bt-lcyd/pages/center/center.js
dong_bo0602 4458f60375 0614
2022-06-14 10:56:41 +08:00

135 lines
2.4 KiB
JavaScript

// pages/center/center.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
userInfo: {
avatarUrl: '',
nickName: ''
},
requestIp: '',
passtype: ''
},
goRegister: function () {
if (this.data.userInfo.nickName == '' && this.data.userInfo.avatarUrl == ''){
wx.showToast({
title: '请先登录!',
icon: 'none'
})
}else{
wx.navigateTo({
url: '../venueRegister/venueRegister',
})
}
1 },
goOrder: function () {
if (this.data.userInfo.nickName == '' && this.data.userInfo.avatarUrl == '') {
wx.showToast({
title: '请先登录!',
icon: 'none'
})
} else {
wx.navigateTo({
url: '../order/order',
})
}
},
getUserInfo: function (e) {
console.log(e)
app.globalData.userInfo = e.detail.userInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
console.log(this.data.userInfo)
},
getToken: function () {
var self = this
wx.getStorage({
key: 'token',
success: function(res) {
self.setData({
token: res.data
})
self.getRegisterInfo()
},
})
},
getRegisterInfo: function () {
var self = this
wx.request({
url: self.data.requestIp + 'wxminiapp/register/getregisterinfo',
header: {
'token': self.data.token
},
success: function (res) {
console.log(res.data)
self.setData({
passtype: res.data.data.passType
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
requestIp: app.globalData.requestIp
})
this.getToken()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})