index.js
2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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() {
getApp().check_can_share();
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({
share_title:temp_data.page_title,
template_arr: t_arr,
isTemplate: 1,
bgcolor_t: temp_data.bkcolor
});
//---如果有设定顶部的颜色的时候--
if(temp_data.top_color && temp_data.top_color!='null' ){
var top_w_color="#ffffff";
if(temp_data.top_word_color && temp_data.top_word_color=='black'){
top_w_color="#000000";
}
wx.setNavigationBarColor({
frontColor: top_w_color, // 必写项
backgroundColor: temp_data.top_color, // 必写项
})
}
}
})
},
onPullDownRefresh: function(e) {
},
onUnload: function() {
},
setCountTime: function(e) {
},
onPageScroll: function(e) {
},
onShareAppMessage: function(e) {
getApp().globalData.no_clear=1;
},
/**
* 用户分享朋友圈
*/
async onShareTimeline(){
getApp().getConfig(await function(e){
this.setData({
store_config:e
})
}.bind(this))
var {share_title,temp_id,store_config} = this.data;
// var url= `pages/template/index?sence=${temp_id}`;
var ob = {
title:share_title,
// path: url,
query:`sence=${temp_id}`,
imageUrl:this.data.url+store_config.store_logo,
};
console.log(ob);
return ob;
},
//---加载更多是靠这个函数----
onReachBottom: function() {
if(getApp().globalData.func_list)
{
for(let i in getApp().globalData.func_list){
let item=getApp().globalData.func_list[i];
item.re_show();
}
}
},
});