2023-12-20 15:01:16 +00:00
|
|
|
|
<!-- 首页,支持店铺装修 -->
|
2022-11-22 07:45:36 +00:00
|
|
|
|
<template>
|
2023-10-31 09:41:57 +00:00
|
|
|
|
<view v-if="template">
|
2023-11-03 01:18:03 +00:00
|
|
|
|
<s-layout title="首页" navbar="custom" tabbar="/pages/index/index" :bgStyle="template.page"
|
2024-03-13 14:46:46 +00:00
|
|
|
|
:navbarStyle="template.navigationBar" onShareAppMessage>
|
2023-11-04 14:06:40 +00:00
|
|
|
|
<s-block v-for="(item, index) in template.components" :key="index" :styles="item.property.style">
|
2023-11-03 01:18:03 +00:00
|
|
|
|
<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
|
2023-10-31 09:41:57 +00:00
|
|
|
|
</s-block>
|
|
|
|
|
</s-layout>
|
|
|
|
|
</view>
|
2022-11-22 07:45:36 +00:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2023-10-31 09:41:57 +00:00
|
|
|
|
import {
|
|
|
|
|
computed
|
|
|
|
|
} from 'vue';
|
|
|
|
|
import {
|
|
|
|
|
onLoad,
|
|
|
|
|
onPageScroll,
|
|
|
|
|
onPullDownRefresh
|
|
|
|
|
} from '@dcloudio/uni-app';
|
|
|
|
|
import sheep from '@/sheep';
|
|
|
|
|
import $share from '@/sheep/platform/share';
|
|
|
|
|
// 隐藏原生tabBar
|
|
|
|
|
uni.hideTabBar();
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
2023-10-31 09:41:57 +00:00
|
|
|
|
const template = computed(() => sheep.$store('app').template?.home);
|
2023-11-07 09:49:02 +00:00
|
|
|
|
// 在此处拦截改变一下首页轮播图 此处先写死后期复活 放到启动函数里
|
2023-12-07 13:25:24 +00:00
|
|
|
|
// (async function() {
|
|
|
|
|
// console.log('原代码首页定制化数据',template)
|
|
|
|
|
// let {
|
|
|
|
|
// data
|
|
|
|
|
// } = await index2Api.decorate();
|
|
|
|
|
// console.log('首页导航配置化过高无法兼容',JSON.parse(data[1].value))
|
2023-11-07 09:49:02 +00:00
|
|
|
|
// 改变首页底部数据 但是没有通过数组id获取商品数据接口
|
|
|
|
|
// let {
|
|
|
|
|
// data: datas
|
|
|
|
|
// } = await index2Api.spids();
|
|
|
|
|
// template.value.data[9].data.goodsIds = datas.list.map(item => item.id);
|
2023-12-07 13:25:24 +00:00
|
|
|
|
// 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"
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// }())
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
|
|
|
|
|
2023-10-31 09:41:57 +00:00
|
|
|
|
onLoad((options) => {
|
|
|
|
|
// #ifdef MP
|
|
|
|
|
// 小程序识别二维码
|
|
|
|
|
if (options.scene) {
|
|
|
|
|
const sceneParams = decodeURIComponent(options.scene).split('=');
|
2024-05-14 15:23:31 +00:00
|
|
|
|
console.log("sceneParams=>",sceneParams);
|
2023-10-31 09:41:57 +00:00
|
|
|
|
options[sceneParams[0]] = sceneParams[1];
|
|
|
|
|
}
|
|
|
|
|
// #endif
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
2023-10-31 09:41:57 +00:00
|
|
|
|
// 预览模板
|
|
|
|
|
if (options.templateId) {
|
|
|
|
|
sheep.$store('app').init(options.templateId);
|
|
|
|
|
}
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
2023-10-31 09:41:57 +00:00
|
|
|
|
// 解析分享信息
|
|
|
|
|
if (options.spm) {
|
|
|
|
|
$share.decryptSpm(options.spm);
|
|
|
|
|
}
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
2023-10-31 09:41:57 +00:00
|
|
|
|
// 进入指定页面(完整页面路径)
|
|
|
|
|
if (options.page) {
|
|
|
|
|
sheep.$router.go(decodeURIComponent(options.page));
|
|
|
|
|
}
|
|
|
|
|
});
|
2023-10-29 14:01:20 +00:00
|
|
|
|
|
2023-10-31 09:41:57 +00:00
|
|
|
|
// 下拉刷新
|
|
|
|
|
onPullDownRefresh(() => {
|
|
|
|
|
sheep.$store('app').init();
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
uni.stopPullDownRefresh();
|
|
|
|
|
}, 800);
|
|
|
|
|
});
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
2023-10-31 09:41:57 +00:00
|
|
|
|
onPageScroll(() => {});
|
2022-11-22 07:45:36 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
2023-12-09 07:37:24 +00:00
|
|
|
|
<style></style>
|