diff --git a/sheep/api/promotion/diy.js b/sheep/api/promotion/diy.js index e524f69b..9a26ffb2 100644 --- a/sheep/api/promotion/diy.js +++ b/sheep/api/promotion/diy.js @@ -1,10 +1,13 @@ import request from '@/sheep/request'; const DiyApi = { - getUsedDiyTemplate: () => { + getUsedDiyTemplate: (platform) => { return request({ url: '/promotion/diy-template/used', method: 'GET', + params: { + platform + }, custom: { showError: false, showLoading: false, diff --git a/sheep/platform/index.js b/sheep/platform/index.js index bae2b68e..079b6d0d 100644 --- a/sheep/platform/index.js +++ b/sheep/platform/index.js @@ -23,6 +23,9 @@ const device = uni.getWindowInfo(); const os = uni.getDeviceInfo().platform; +const uniSystemInfo= uni.getSystemInfoSync(); +const uniPlatform = uniSystemInfo?.uniPlatform ?? ''; + let name = ''; let provider = ''; let platform = ''; @@ -54,7 +57,7 @@ platform = 'miniProgram'; provider = 'wechat'; // #endif -// #ifdef MP-ALIPAY +// #ifdef MP-ALIPAY name = 'alipayMiniProgram'; platform = 'alipayMiniProgram'; provider = 'alipay'; @@ -177,6 +180,7 @@ const _platform = { os, provider, platform, + uniPlatform, useProvider, checkUpdate, checkNetwork, diff --git a/sheep/store/app.js b/sheep/store/app.js index 262adde9..8998c57c 100644 --- a/sheep/store/app.js +++ b/sheep/store/app.js @@ -182,10 +182,15 @@ const adaptTenant = async () => { /** 初始化装修模版 */ const adaptTemplate = async (appTemplate, templateId) => { + let platform = $platform.uniPlatform; + // 如果需要其他自定义业务场景 + // #ifdef MP + // platform = 'mp'; + // #endif const { data: diyTemplate } = templateId ? // 查询指定模板,一般是预览时使用 await DiyApi.getDiyTemplate(templateId) - : await DiyApi.getUsedDiyTemplate(); + : await DiyApi.getUsedDiyTemplate(platform); // 模板不存在 if (!diyTemplate) { $router.error('TemplateError');