feat(promotion): 添加装修模板类型参数支持
- 为 getUsedDiyTemplate 方法添加 type 参数 - 在平台模块中新增 uniPlatform 属性获取 - 重构装修模板适配逻辑以支持平台类型区分 - 更新请求参数传递方式以包含平台类型信息pull/174/head
parent
a5aae8480b
commit
db95ed1a90
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in New Issue