| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 | <!-- 店铺首页,支持店铺装修 --><template>	<view v-if="template">		<s-layout title="xxx店" navbar="normal" tabbar="/pages/index/index" :bgStyle="template.page"			:navbarStyle="template.style?.navbar" onShareAppMessage >			<s-block v-for="(item, index) in template.components" :key="index" :styles="item.property.style">				<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />			</s-block>		</s-layout>	</view></template><script setup>	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();	const template = {	"page": {		"description": "",		"backgroundColor": "#f5f5f5",		"backgroundImage": ""	},	"navigationBar": {		"title": "页面标题",		"description": "",		"navBarHeight": 35,		"backgroundColor": "#fff",		"backgroundImage": "",		"styleType": "default",		"alwaysShow": true,		"showGoBack": true	},	"components": [{		"id": "SearchBar",		"property": {			"height": 28,			"showScan": false,			"borderRadius": 0,			"placeholder": "搜索商品",			"placeholderPosition": "left",			"backgroundColor": "rgb(238, 238, 238)",			"textColor": "rgb(150, 151, 153)",			"hotKeywords": [],			"style": {				"bgType": "color",				"bgColor": "#fff",				"marginBottom": 8,				"paddingTop": 8,				"paddingRight": 8,				"paddingBottom": 8,				"paddingLeft": 8			}		}	}, {		"id": "UserCard",		"property": {			"style": {				"bgType": "color",				"bgColor": "",				"marginBottom": 8			}		}	}]}	// 在此处拦截改变一下首页轮播图 此处先写死后期复活 放到启动函数里	// (async function() {		// console.log('原代码首页定制化数据',template)		// let {		// 	data		// } = await index2Api.decorate();		// console.log('首页导航配置化过高无法兼容',JSON.parse(data[1].value))		// 改变首页底部数据 但是没有通过数组id获取商品数据接口		// let {		// 	data: datas		// } = await index2Api.spids();		// template.value.data[9].data.goodsIds = datas.list.map(item => item.id);		// 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		// 小程序识别二维码		if (options.scene) {			const sceneParams = decodeURIComponent(options.scene).split('=');			options[sceneParams[0]] = sceneParams[1];		}		// #endif		// 预览模板		if (options.templateId) {			sheep.$store('app').init(options.templateId);		}		// 解析分享信息		if (options.spm) {			$share.decryptSpm(options.spm);		}		// 进入指定页面(完整页面路径)		if (options.page) {			sheep.$router.go(decodeURIComponent(options.page));		}	});	onPageScroll(() => {});</script><style></style>
 |