refactor(platform): 修改 DiyApi.getUsedDiyTemplate 方法参数名从 type 为 platform

- 修改 DiyApi.getUsedDiyTemplate 方法参数名从 type 为 platform
- 调整 uniPlatform 默认值从 'default' 为空字符串
- 在 adaptTemplate 方法中添加平台标识符处理逻辑
- 增加小程序平台特殊标识符处理分支
- 修复装修模板初始化时的平台参数传递问题
pull/174/head
wuKong 2025-12-30 10:56:55 +08:00
parent 0475d53d56
commit 9291687b04
3 changed files with 9 additions and 4 deletions

View File

@ -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,

View File

@ -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 = '';

View File

@ -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');