Pre Merge pull request !174 from wuKong/feat(promotion)-添加DIY模板类型功能支持

pull/174/MERGE
wuKong 2026-04-18 05:38:57 +00:00 committed by Gitee
commit eaf71cef17
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 15 additions and 3 deletions

View File

@ -1,10 +1,13 @@
import request from '@/sheep/request';
const DiyApi = {
getUsedDiyTemplate: () => {
getUsedDiyTemplate: (platform) => {
return request({
url: '/promotion/diy-template/used',
method: 'GET',
params: {
platform
},
custom: {
showError: false,
showLoading: false,

View File

@ -23,6 +23,9 @@ const device = uni.getWindowInfo();
const os = uni.getDeviceInfo().platform;
const uniSystemInfo= uni.getSystemInfoSync();
const uniPlatform = uniSystemInfo?.uniPlatform ?? '';
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,

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();
: await DiyApi.getUsedDiyTemplate(platform);
// 模板不存在
if (!diyTemplate) {
$router.error('TemplateError');