base.js
2.27 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
var util = require('util.js')
var uri=require('uri.js')
module.exports = {
onShareAppMessage:function() {
var token=util.cache(uri.CACHE__TOKEN);
if(!token) {
wx.navigateTo({
url:"/pages/login/index"
});
}else{
console.log("this.data.share_xcx_url",this.data.share_xcx_url)
this.sharecallback();
return {
title: this.data.share_xcx_name?this.data.share_xcx_name:(this.data.share_xcx_title?this.data.share_xcx_title:'纳极,最懂你的店铺管家'),
desc: this.data.share_xcx_desc?this.data.share_xcx_desc:'',
path: this.data.share_xcx_url?this.data.share_xcx_url:'/pages/index/index',
}
}
},
sharecallback:function(){
util.post(uri.CGI__ASYN_TOURIST_OPRRATION,{provider_id:this.data.provider_id,type:this.data.sharetype},uri.CGI__ASYN_TOURIST_OPRRATION__CODE);
},
onRefresh:function(){
this.setData({
refreshpage:true
})
var pageinfo=getCurrentPages();
var pagelength=pageinfo.length;
var n_pageinfo=pageinfo[pagelength-1];
var turnpage='/'+n_pageinfo.route;
if(JSON.stringify(n_pageinfo.options)!='{}'){
turnpage+='?';
for(var opt in n_pageinfo.options){
turnpage+=opt+'='+n_pageinfo.options[opt]+'&';
}
}
wx.redirectTo({
url: turnpage,
})
},
restartLogin:function(){
console.log('hahah');
var pages = getCurrentPages();
var num = pages.length;
console.log('hahah');
wx.openSetting({
success: (res) => {
console.log('openSetting',res);
res.authSetting = {
"scope.userInfo": true,
"scope.userLocation": true
}
/*wx.redirectTo({
url:'/pages/index/s_index',
})*/
wx.redirectTo({
url:'../index/s_index',
})
},
fail:(res) => {
console.log('failsetting');
wx.redirectTo({
url:'../me/s_index',
})
}
})
},
};