refactor(platform): 修改 DiyApi.getUsedDiyTemplate 方法参数名从 type 为 platform
- 修改 DiyApi.getUsedDiyTemplate 方法参数名从 type 为 platform - 调整 uniPlatform 默认值从 'default' 为空字符串 - 在 adaptTemplate 方法中添加平台标识符处理逻辑 - 增加小程序平台特殊标识符处理分支 - 修复装修模板初始化时的平台参数传递问题pull/174/head
parent
0475d53d56
commit
9291687b04
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 = '';
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in New Issue