2024-08-07 10:31:42 +08:00
|
|
|
|
<!-- 自定义页面:支持装修 -->
|
|
|
|
|
<template>
|
2024-10-11 16:07:43 +08:00
|
|
|
|
<s-layout navbar="normal" :bgStyle="{ color: '#FE832A'}">
|
2024-08-07 10:31:42 +08:00
|
|
|
|
<s-block v-for="(item, index) in state.components" :key="index" :styles="item.property.style">
|
|
|
|
|
<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
|
|
|
|
|
</s-block>
|
|
|
|
|
</s-layout>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { reactive } from 'vue';
|
|
|
|
|
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
|
|
|
|
import DiyApi from '@/sheep/api/promotion/diy';
|
|
|
|
|
|
|
|
|
|
const state = reactive({
|
|
|
|
|
name: '',
|
|
|
|
|
components: [],
|
|
|
|
|
navigationBar: {},
|
|
|
|
|
page: {},
|
|
|
|
|
});
|
|
|
|
|
onLoad(async (options) => {
|
2024-10-08 20:11:54 +08:00
|
|
|
|
let id = options.id
|
2024-08-07 10:31:42 +08:00
|
|
|
|
|
|
|
|
|
// #ifdef MP
|
|
|
|
|
// 小程序预览自定义页面
|
|
|
|
|
if (options.scene) {
|
|
|
|
|
const sceneParams = decodeURIComponent(options.scene).split('=');
|
|
|
|
|
id = sceneParams[1];
|
|
|
|
|
}
|
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
|
const { code, data } = await DiyApi.getDiyPage(id);
|
|
|
|
|
if (code === 0) {
|
|
|
|
|
state.name = data.name;
|
|
|
|
|
state.components = data.property?.components;
|
|
|
|
|
state.navigationBar = data.property?.navigationBar;
|
|
|
|
|
state.page = data.property?.page;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
onPageScroll(() => {});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style></style>
|