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'; import request from '@/sheep/request';
const DiyApi = { const DiyApi = {
getUsedDiyTemplate: () => { getUsedDiyTemplate: (platform) => {
return request({ return request({
url: '/promotion/diy-template/used', url: '/promotion/diy-template/used',
method: 'GET', method: 'GET',
params: {
platform
},
custom: { custom: {
showError: false, showError: false,
showLoading: false, showLoading: false,

View File

@ -23,6 +23,9 @@ const device = uni.getWindowInfo();
const os = uni.getDeviceInfo().platform; const os = uni.getDeviceInfo().platform;
const uniSystemInfo= uni.getSystemInfoSync();
const uniPlatform = uniSystemInfo?.uniPlatform ?? '';
let name = ''; let name = '';
let provider = ''; let provider = '';
let platform = ''; let platform = '';
@ -177,6 +180,7 @@ const _platform = {
os, os,
provider, provider,
platform, platform,
uniPlatform,
useProvider, useProvider,
checkUpdate, checkUpdate,
checkNetwork, checkNetwork,

View File

@ -182,10 +182,15 @@ const adaptTenant = async () => {
/** 初始化装修模版 */ /** 初始化装修模版 */
const adaptTemplate = async (appTemplate, templateId) => { const adaptTemplate = async (appTemplate, templateId) => {
let platform = $platform.uniPlatform;
// 如果需要其他自定义业务场景
// #ifdef MP
// platform = 'mp';
// #endif
const { data: diyTemplate } = templateId const { data: diyTemplate } = templateId
? // 查询指定模板,一般是预览时使用 ? // 查询指定模板,一般是预览时使用
await DiyApi.getDiyTemplate(templateId) await DiyApi.getDiyTemplate(templateId)
: await DiyApi.getUsedDiyTemplate(); : await DiyApi.getUsedDiyTemplate(platform);
// 模板不存在 // 模板不存在
if (!diyTemplate) { if (!diyTemplate) {
$router.error('TemplateError'); $router.error('TemplateError');