// app.js,
|
|
App({
|
|
globalData: {
|
|
userInfo: {},
|
|
hasUserInfo: false,
|
|
canIUse: wx.canIUse('button.open-type.getUserInfo'),
|
|
canIUseGetUserProfile: false,
|
|
canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName'), // 如需尝试获取用户信息可改为false,
|
|
flag_value: 0
|
|
},
|
|
onLaunch: function () {
|
|
if (!wx.cloud) {
|
|
console.error('请使用 2.2.3 或以上的基础库以使用云能力');
|
|
} else {
|
|
wx.cloud.init({
|
|
env: 'prod-2g058voqbea31ecb',
|
|
traceUser: true,
|
|
});
|
|
}
|
|
wx.cloud.callContainer({
|
|
"config": {
|
|
"env": "prod-2g058voqbea31ecb"
|
|
},
|
|
"path": "general/openid/",
|
|
"header": {
|
|
"X-WX-SERVICE": "django-5198",
|
|
"content-type": "application/json"
|
|
},
|
|
"method": "GET",
|
|
data: {},
|
|
success(res){
|
|
console.log(res.data)
|
|
}
|
|
})
|
|
|
|
|
|
this.globalData = {};
|
|
},
|
|
parse_json(res){
|
|
let arr = res.data.result
|
|
if(arr.toString().indexOf("|")!=-1){
|
|
arr = arr.split('| ')
|
|
arr = arr.map((item,index,arr)=>{
|
|
item = JSON.parse(item);
|
|
return item
|
|
})
|
|
}
|
|
else if(arr){
|
|
arr = [JSON.parse(arr)]
|
|
}
|
|
return arr
|
|
},
|
|
});
|