Pre Merge pull request !174 from wuKong/feat(promotion)-添加DIY模板类型功能支持
commit
eaf71cef17
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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 = '';
|
||||||
|
|
@ -54,7 +57,7 @@ platform = 'miniProgram';
|
||||||
provider = 'wechat';
|
provider = 'wechat';
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
name = 'alipayMiniProgram';
|
name = 'alipayMiniProgram';
|
||||||
platform = 'alipayMiniProgram';
|
platform = 'alipayMiniProgram';
|
||||||
provider = 'alipay';
|
provider = 'alipay';
|
||||||
|
|
@ -177,6 +180,7 @@ const _platform = {
|
||||||
os,
|
os,
|
||||||
provider,
|
provider,
|
||||||
platform,
|
platform,
|
||||||
|
uniPlatform,
|
||||||
useProvider,
|
useProvider,
|
||||||
checkUpdate,
|
checkUpdate,
|
||||||
checkNetwork,
|
checkNetwork,
|
||||||
|
|
|
||||||
|
|
@ -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');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue