2023-03-06 17:57:39 +08:00

92 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Pages/index/index.js
const app = getApp()
Page({
data: {
loading: true
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({
tabBarShow:false, //true/false
})
}
this.setData({ loading: false });
},
goCheck(e){
console.log(e);
let usertype = e.currentTarget.dataset.usertype;
let url = e.currentTarget.dataset.url;
wx.setStorageSync('usertype', usertype);
wx.setStorageSync('next_url', url);
let user_uuid = wx.getStorageSync('user_id');
console.log(user_uuid);
if(user_uuid){
wx.switchTab({
url: url
})
}else{
app.go(app.globalData.login_url);
}
},
bindGetUserInfo(){
wx.getUserInfo({
success: function(res) {
var userInfo = res.userInfo
var nickName = userInfo.nickName
var avatarUrl = userInfo.avatarUrl
var gender = userInfo.gender //性别 0未知、1男、2
var province = userInfo.province
var city = userInfo.city
var country = userInfo.country
console.log(res.userInfo)
}
})
},
shenfang(){
wx.requestSubscribeMessage({
tmplIds: [
"5Tl-xmaWXrKP5BB8E6b3oTdPHbHa7WYWbmvZiuz4TLs",
"kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40"
],
success(res){
console.log(res)
},
fail(res){
console.log(res)
},
complete(res){
console.log(res)
}
})
},
yici(){
wx.requestSubscribeMessage({
tmplIds: [
"jhYUf91ULCTX_f69hazqAYwImdFf8ELasRAwB6X-MTM",
"JMPmlYGh1HcUSuEfJCVQUIsZv4H5ar3QvXZfrNYNFuc"
],
success(res){
console.log(res)
},
fail(res){
console.log(res)
},
complete(res){
console.log(res)
}
})
},
check(){
wx.getSetting({
withSubscriptions: true,
success (res) {
console.log(res.authSetting)
console.log(res.subscriptionsSetting)
}
})
}
})