营销:装修页面适配

pull/10/head
owen 2023-11-03 09:18:03 +08:00
parent 8bd5f9f3cc
commit 614f8bb9fd
5 changed files with 29 additions and 38 deletions

View File

@ -1,9 +1,9 @@
<template>
<view v-if="template">
<s-layout title="首页" navbar="custom" tabbar="/pages/index/index" :bgStyle="template.style?.background"
<s-layout title="首页" navbar="custom" tabbar="/pages/index/index" :bgStyle="template.page"
:navbarStyle="template.style?.navbar" onShareAppMessage>
<s-block v-for="(item, index) in template.data" :key="index" :styles="item.style">
<s-block-item :type="item.type" :data="item.data" :styles="item.style" />
<s-block v-for="(item, index) in template.components" :key="index" :styles="item.style">
<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
</s-block>
<!-- 广告模块 -->
<s-popup-image />
@ -22,25 +22,10 @@
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import $share from '@/sheep/platform/share';
import index2Api from '@/sheep/api/index2';
// tabBar
uni.hideTabBar();
const template = computed(() => sheep.$store('app').template?.home);
//
(async function() {
let {
data
} = await index2Api.decorate();
template.value.data[0].data.list = JSON.parse(data[0].value).map(item => {
return {
src: item.picUrl,
url: item.url,
title: item.name,
type: "image"
}
})
}())
onLoad((options) => {
// #ifdef MP
@ -81,4 +66,4 @@
onPageScroll(() => {});
</script>
<style></style>
<style></style>

View File

@ -5,7 +5,7 @@
<s-video-block v-if="type === 'videoPlayer'" :data="data" :styles="styles" />
<s-image-cube v-if="type === 'imageCube'" :data="data" :styles="styles" />
<s-notice-block v-if="type === 'noticeBlock'" :data="data" />
<s-notice-block v-if="type === 'NoticeBar'" :data="data" />
<s-search-block v-if="type === 'searchBlock'" :data="data" :navbar="false" />
<s-title-block v-if="type === 'titleBlock'" :data="data" :styles="styles" />
<s-line-block v-if="type === 'lineBlock'" :data="data" />

View File

@ -161,8 +161,8 @@
const bgMain = computed(() => {
if (navbarMode.value === 'inner') {
return {
background: `${props.bgStyle.color} url(${sheep.$url.cdn(
props.bgStyle.src,
background: `${props.bgStyle.backgroundColor} url(${sheep.$url.cdn(
props.bgStyle.backgroundImage,
)}) no-repeat top center / 100% auto`,
};
}
@ -173,8 +173,8 @@
const bgBody = computed(() => {
if (navbarMode.value === 'normal') {
return {
background: `${props.bgStyle.color} url(${sheep.$url.cdn(
props.bgStyle.src,
background: `${props.bgStyle.backgroundColor} url(${sheep.$url.cdn(
props.bgStyle.backgroundImage,
)}) no-repeat top center / 100% auto`,
};
}

View File

@ -1,15 +1,16 @@
<template>
<view class="ss-flex ss-col-center notice-wrap">
<image class="icon-img" :src="sheep.$url.cdn(data.src)" mode="heightFix"></image>
<image class="icon-img" :src="sheep.$url.cdn(data.iconUrl)" mode="heightFix"></image>
<!-- todo@owen 暂时只支持一个公告 -->
<su-notice-bar
style="flex: 1"
:showIcon="false"
scrollable
single
:text="data.title.text"
:text="data.contents[0].text"
:speed="50"
:color="data.title.color"
@tap="sheep.$router.go(data.url)"
:color="data.textColor"
@tap="sheep.$router.go(data.contents[0].url)"
></su-notice-bar>
</view>
</template>

View File

@ -72,16 +72,7 @@ const app = defineStore({
}
this.chat = res.data.chat;
const diyTemplate = await diyTemplateApi.getUsedDiyTemplate();
if (diyTemplate?.data?.property) {
const templateProperty = JSON.parse(diyTemplate?.data?.property)
this.template.basic.tabbar = templateProperty.tabBar
if (templateProperty?.tabBar.theme) {
this.template.basic.theme = templateProperty?.tabBar.theme;
}
} else {
$router.error('TemplateError');
}
await adaptTemplate(this.template);
// 加载主题
const sysStore = sys();
@ -108,4 +99,18 @@ const app = defineStore({
},
});
// todo: @owen 先做数据适配,后期重构
const adaptTemplate = async (appTemplate) => {
const diyTemplate = await diyTemplateApi.getUsedDiyTemplate();
const tabBar = diyTemplate?.data?.property?.tabBar;
if (tabBar) {
appTemplate.basic.tabbar = tabBar
if (tabBar?.theme) {
appTemplate.basic.theme = tabBar?.theme;
}
}
appTemplate.home = diyTemplate?.data?.home;
// appTemplate.user = diyTemplate?.data?.user;
}
export default app;