From 9291687b04fc4b8fb58f6e75fd616e1e013ec0b1 Mon Sep 17 00:00:00 2001 From: wuKong Date: Tue, 30 Dec 2025 10:56:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor(platform):=20=E4=BF=AE=E6=94=B9=20DiyA?= =?UTF-8?q?pi.getUsedDiyTemplate=20=E6=96=B9=E6=B3=95=E5=8F=82=E6=95=B0?= =?UTF-8?q?=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');