|
@@ -35,7 +35,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getDate } from "@/api/asEditor/index";
|
|
|
+import { getData } from "@/api/asEditor/index";
|
|
|
import headerTop1 from '../../components/headerTop1'
|
|
|
import collect from '../../components/collect'
|
|
|
import {
|
|
@@ -95,17 +95,17 @@ export default {
|
|
|
},
|
|
|
async created() {
|
|
|
// 是否是iframe使用
|
|
|
- if (this.$route.query.type === 'iframe') {
|
|
|
- window.addEventListener('message', e => {
|
|
|
- console.log(e.data, '-------------message')
|
|
|
- let datas = e.data
|
|
|
- this.pageComponents = JSON.parse(datas.component)
|
|
|
- this.pageSetup = JSON.parse(datas.templateJson)
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
+ // if (this.$route.query.type === 'iframe') {
|
|
|
+ // window.addEventListener('message', e => {
|
|
|
+ // console.log(e.data, '-------------message')
|
|
|
+ // let datas = e.data
|
|
|
+ // this.pageComponents = JSON.parse(datas.component)
|
|
|
+ // this.pageSetup = JSON.parse(datas.templateJson)
|
|
|
+ // })
|
|
|
+ // return
|
|
|
+ // }
|
|
|
|
|
|
- await this.loadShopData()
|
|
|
+ // await this.loadShopData()
|
|
|
let miniprogram = window.localStorage.getItem('miniprogram')
|
|
|
console.log(miniprogram, '-------------------miniprogram')
|
|
|
},
|
|
@@ -114,12 +114,14 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
initData(){
|
|
|
- getDate().then(response=>{
|
|
|
+ getData().then(response=>{
|
|
|
if(response.code==200){
|
|
|
console.log(response.data);
|
|
|
this.getJSONList = response.data;
|
|
|
console.log(this.getJSONList);
|
|
|
console.log(this.getJSONList.component);
|
|
|
+ this.pageComponents=JSON.parse(this.getJSONList.component)
|
|
|
+ this.pageSetup=JSON.parse(this.getJSONList.templateJson)
|
|
|
}else{
|
|
|
this.$message.error("获取数据失败")
|
|
|
}
|
|
@@ -147,23 +149,7 @@ export default {
|
|
|
})
|
|
|
this.orgid = false
|
|
|
// 模板数据替换 shopTemplateData.data.shopTemplate 此处可替换成接口
|
|
|
- let shopTemplateData = this.getJSONList.map(item => (
|
|
|
- {
|
|
|
- code: 0,
|
|
|
- success: true,
|
|
|
- error: false ,
|
|
|
- data:{
|
|
|
- shopTemplate: {
|
|
|
- id: item.id,
|
|
|
- name: item.name,
|
|
|
- // templateJson: item.templateJson,
|
|
|
- // component: item.component,
|
|
|
- }
|
|
|
- },
|
|
|
- msg: '成功'
|
|
|
- }
|
|
|
- ));
|
|
|
- /* {
|
|
|
+ /* let shopTemplateData = {
|
|
|
code: 0,
|
|
|
success: true,
|
|
|
error: false ,
|
|
@@ -177,10 +163,10 @@ export default {
|
|
|
},
|
|
|
msg: '成功'
|
|
|
} */
|
|
|
- console.log(shopTemplateData, '----------shopTemplateData')
|
|
|
- if (shopTemplateData.code !== 0) {
|
|
|
- return this.$toast(shopTemplateData.msg)
|
|
|
- }
|
|
|
+ // console.log(shopTemplateData, '----------shopTemplateData')
|
|
|
+ // if (shopTemplateData.code !== 0) {
|
|
|
+ // return this.$toast(shopTemplateData.msg)
|
|
|
+ // }
|
|
|
let datas = shopTemplateData.data.shopTemplate
|
|
|
if (!datas) return this.tota?.clear()
|
|
|
this.pageComponents = JSON.parse(datas.component)
|