var t = getApp(), a = t.request, os = t.globalData.setting, ut = require("../../utils/util.js"), com = require("../../utils/common.js"); var regeneratorRuntime = require('../../utils/runtime.js'); var api = require('../../api/api.js'); var appd = getApp().globalData; Page({ data: { url: os.imghost, temp_id:0, }, onLoad: function(e) { var th = this; this.data.temp_id=e.scene; if(!this.data.temp_id) this.data.temp_id=e.sence; if(!this.data.temp_id) wx.showModal({ title:"未读取到模板ID" ,}) }, async onShow() { var th = this; await this.init_load(); //如果是自定义模板 if (this.data.isTemplate) { } }, //当隐藏的时候就关闭计时器 onHide: function() { }, //同步初始加载 async init_load() { var th = this; //因为营销版本的功能包含了自定义模板的功能,是同时的 //读取全局是否有弄自定义模板 await getApp().request.promiseGet("/api/weshop/store_module/get/"+th.data.temp_id+"/4",{1:1} ).then(res => { var data = res.data.data; if (data) { var temp_data = data; wx.setNavigationBarTitle({ title: temp_data.page_title, }); var t_arr = JSON.parse(temp_data.json_str); th.setData({ template_arr: t_arr, isTemplate: 1, bgcolor_t: temp_data.bkcolor }); //---如果有设定顶部的颜色的时候-- if(temp_data.top_color && temp_data.top_color!='null' ){ wx.setNavigationBarColor({ frontColor: '#ffffff', // 必写项 backgroundColor: temp_data.top_color, // 必写项 }) } } }) }, onPullDownRefresh: function(e) { }, onUnload: function() { }, setCountTime: function(e) { }, onPageScroll: function(e) { }, onShareAppMessage: function(e) { }, });