You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
181 lines
3.1 KiB
181 lines
3.1 KiB
// pages/about/about.js
|
|
var request = require('../../utils/http')
|
|
var login = require('../../utils/login')
|
|
var app = getApp();
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
username: '立即登录',
|
|
isLogin: false, //是否登录
|
|
},
|
|
|
|
//绑定微信
|
|
bindWx() {
|
|
var isBindWx = ''
|
|
var content = ''
|
|
if (app.globalData.bindvx) {
|
|
//解绑
|
|
isBindWx = '解除绑定'
|
|
content = '平台账号已经与您微信账号绑定,是否进行解绑定?'
|
|
} else {
|
|
//绑定
|
|
isBindWx = '立刻绑定'
|
|
content = '平台账号将与您微信账号绑定,是否进行绑定?'
|
|
}
|
|
|
|
|
|
wx.showModal({
|
|
title: '绑定微信',
|
|
content: content,
|
|
confirmText: isBindWx,
|
|
complete: (res) => {
|
|
if (res.confirm) {
|
|
login.bindWechat({
|
|
openid: app.globalData.openid
|
|
}).then(res1 => {
|
|
this.onLoad()
|
|
})
|
|
}
|
|
if (res.cancel) {
|
|
|
|
}
|
|
}
|
|
})
|
|
|
|
},
|
|
|
|
//查询跳转
|
|
goSelNav(e) {
|
|
var tag = e.currentTarget.dataset.id
|
|
var url
|
|
//自建物流查询
|
|
if (tag == 'goQueryme') {
|
|
url = '../queryme/queryme'
|
|
}
|
|
|
|
//第三方物流查询
|
|
if (tag == 'goQuerythree') {
|
|
url = '../querythree/querythree'
|
|
}
|
|
|
|
//货运物流查询
|
|
if (tag == 'goQueryfrei') {
|
|
url = '../queryfrei/queryfrei'
|
|
}
|
|
|
|
wx.navigateTo({
|
|
url: url,
|
|
})
|
|
},
|
|
|
|
//意见反馈
|
|
goFeekback() {
|
|
wx.navigateTo({
|
|
url: '../feedback/feedback',
|
|
})
|
|
},
|
|
|
|
//登录
|
|
goLogin() {
|
|
wx.navigateTo({
|
|
url: '../login/login',
|
|
})
|
|
},
|
|
|
|
//退出登录
|
|
outLogin() {
|
|
wx.showModal({
|
|
title: '提示',
|
|
content: '是否确定退出?',
|
|
complete: (res) => {
|
|
if (res.cancel) {
|
|
|
|
}
|
|
|
|
if (res.confirm) {
|
|
app.globalData.token = ''
|
|
app.globalData.userInfo = {}
|
|
|
|
this.setData({
|
|
isLogin: false,
|
|
username: '立即登录'
|
|
})
|
|
this.onLoad()
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
|
|
request.post('/sso/checkBind/' + app.globalData.openid).then(res2 => {
|
|
console.log('检查是否绑定=' + JSON.stringify(res2.data.data));
|
|
app.globalData.bindvx = res2.data.data
|
|
})
|
|
|
|
var userInfo = app.globalData.userInfo
|
|
|
|
if (userInfo != undefined && JSON.stringify(userInfo) != '{}') {
|
|
this.setData({
|
|
username: userInfo.nickname,
|
|
isLogin: true
|
|
})
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
}) |