From db95ed1a90a92d88b29eb9c92368b3ca9a446e3f Mon Sep 17 00:00:00 2001 From: wuKong Date: Mon, 29 Dec 2025 18:11:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat(promotion):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=A3=85=E4=BF=AE=E6=A8=A1=E6=9D=BF=E7=B1=BB=E5=9E=8B=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为 getUsedDiyTemplate 方法添加 type 参数 - 在平台模块中新增 uniPlatform 属性获取 - 重构装修模板适配逻辑以支持平台类型区分 - 更新请求参数传递方式以包含平台类型信息 --- sheep/api/promotion/diy.js | 5 ++++- sheep/platform/index.js | 6 +++++- sheep/store/app.js | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sheep/api/promotion/diy.js b/sheep/api/promotion/diy.js index e524f69b..f7dd2f11 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: (type) => { return request({ url: '/promotion/diy-template/used', method: 'GET', + params: { + type + }, custom: { showError: false, showLoading: false, diff --git a/sheep/platform/index.js b/sheep/platform/index.js index bae2b68e..5c01d8fd 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 ?? 'default'; + 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 efd06876..b1a826c0 100644 --- a/sheep/store/app.js +++ b/sheep/store/app.js @@ -182,10 +182,11 @@ const adaptTenant = async () => { /** 初始化装修模版 */ const adaptTemplate = async (appTemplate, templateId) => { + let type = $platform.uniPlatform; const { data: diyTemplate } = templateId ? // 查询指定模板,一般是预览时使用 await DiyApi.getDiyTemplate(templateId) - : await DiyApi.getUsedDiyTemplate(); + : await DiyApi.getUsedDiyTemplate(type); // 模板不存在 if (!diyTemplate) { $router.error('TemplateError'); From 0475d53d56943c9d86b70da017cf798eb385480d Mon Sep 17 00:00:00 2001 From: wuKong Date: Mon, 29 Dec 2025 18:28:32 +0800 Subject: [PATCH 2/3] =?UTF-8?q?refactor(store):=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84=20type=20=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=A3=B0=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除不必要的 type 变量声明 - 直接使用 $platform.uniPlatform 替代变量引用 - 保持代码逻辑不变但提高代码简洁性 --- sheep/store/app.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sheep/store/app.js b/sheep/store/app.js index b1a826c0..f05e9ba7 100644 --- a/sheep/store/app.js +++ b/sheep/store/app.js @@ -182,11 +182,10 @@ const adaptTenant = async () => { /** 初始化装修模版 */ const adaptTemplate = async (appTemplate, templateId) => { - let type = $platform.uniPlatform; const { data: diyTemplate } = templateId ? // 查询指定模板,一般是预览时使用 await DiyApi.getDiyTemplate(templateId) - : await DiyApi.getUsedDiyTemplate(type); + : await DiyApi.getUsedDiyTemplate($platform.uniPlatform); // 模板不存在 if (!diyTemplate) { $router.error('TemplateError'); From 9291687b04fc4b8fb58f6e75fd616e1e013ec0b1 Mon Sep 17 00:00:00 2001 From: wuKong Date: Tue, 30 Dec 2025 10:56:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?refactor(platform):=20=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?DiyApi.getUsedDiyTemplate=20=E6=96=B9=E6=B3=95=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=90=8D=E4=BB=8E=20type=20=E4=B8=BA=20platform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 DiyApi.getUsedDiyTemplate 方法参数名从 type 为 platform - 调整 uniPlatform 默认值从 'default' 为空字符串 - 在 adaptTemplate 方法中添加平台标识符处理逻辑 - 增加小程序平台特殊标识符处理分支 - 修复装修模板初始化时的平台参数传递问题 --- sheep/api/promotion/diy.js | 4 ++-- sheep/platform/index.js | 2 +- sheep/store/app.js | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sheep/api/promotion/diy.js b/sheep/api/promotion/diy.js index f7dd2f11..9a26ffb2 100644 --- a/sheep/api/promotion/diy.js +++ b/sheep/api/promotion/diy.js @@ -1,12 +1,12 @@ import request from '@/sheep/request'; const DiyApi = { - getUsedDiyTemplate: (type) => { + getUsedDiyTemplate: (platform) => { return request({ url: '/promotion/diy-template/used', method: 'GET', params: { - type + platform }, custom: { showError: false, diff --git a/sheep/platform/index.js b/sheep/platform/index.js index 5c01d8fd..079b6d0d 100644 --- a/sheep/platform/index.js +++ b/sheep/platform/index.js @@ -24,7 +24,7 @@ const device = uni.getWindowInfo(); const os = uni.getDeviceInfo().platform; const uniSystemInfo= uni.getSystemInfoSync(); -const uniPlatform = uniSystemInfo?.uniPlatform ?? 'default'; +const uniPlatform = uniSystemInfo?.uniPlatform ?? ''; let name = ''; let provider = ''; diff --git a/sheep/store/app.js b/sheep/store/app.js index f05e9ba7..9e986a8b 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($platform.uniPlatform); + : await DiyApi.getUsedDiyTemplate(platform); // 模板不存在 if (!diyTemplate) { $router.error('TemplateError');