import { pick } from 'lodash'; import request from '../../utils/request'; // Generated by https://quicktype.io /** * 程序类型 */ export type SubApplicationType = 'TINYAPP_NORMAL' | 'TINYAPP_PLUGIN' | 'TINYAPP_TEMPLATE'; export interface MiniAppList { /** * 小程序appId */ appId: string; /** * 小程序名称 */ appName: string; /** * 小程序logo */ logoUrl: string; /** * 程序类型 */ subApplicationType: SubApplicationType; } /** * 获取可以开发的小程序列表 */ export default async function miniAppList(): Promise { try { let list = await request({ method: 'GET', host: 'ide', path: '/cli/miniapp/appList.json', needSign: true, }); if (!list) list = []; return list.map((item) => { return pick(item, ['appId', 'appName', 'logoUrl', 'subApplicationType']); }); } catch (e) { console.log('获取小程序列表失败', e); return []; } }