You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
147 lines
3.0 KiB
JavaScript
147 lines
3.0 KiB
JavaScript
|
2 years ago
|
// pages/myInfo/index.js
|
||
|
|
const app = getApp();
|
||
|
|
Page({
|
||
|
|
/**
|
||
|
|
* 页面的初始数据
|
||
|
|
*/
|
||
|
|
data: {
|
||
|
|
user: {},
|
||
|
|
isLogin: false,
|
||
|
|
topTips: false
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面加载
|
||
|
|
*/
|
||
|
|
onLoad: function (options) {
|
||
|
|
|
||
|
|
if (wx.getUserProfile) {
|
||
|
|
console.log(true);
|
||
|
|
} else {
|
||
|
|
console.log(false);
|
||
|
|
}
|
||
|
|
|
||
|
|
},
|
||
|
|
toLogin: function () {
|
||
|
|
wx.navigateTo({
|
||
|
|
url: "/pages/login/index",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
getUserInfoBtn () {
|
||
|
|
app.getUserInfoBtn(this);
|
||
|
|
},
|
||
|
|
goShowID: function (e) {
|
||
|
|
let name1 = e.currentTarget.dataset.name;
|
||
|
|
wx.navigateTo({
|
||
|
|
url: "/pages/justShowID/index?name=" + name1,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
goAuth: function () {
|
||
|
|
if (!app.globalData.isLogin) {
|
||
|
|
wx.navigateTo({
|
||
|
|
url: "/pages/login/index",
|
||
|
|
});
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
wx.navigateTo({
|
||
|
|
url: "/pages/makeInfo/index",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
|
*/
|
||
|
|
onReady: function () { },
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面显示
|
||
|
|
*/
|
||
|
|
onShow: function () {
|
||
|
|
console.log("是否登录 我的" + app.globalData.isLogin)
|
||
|
|
console.log(app.globalData.user);
|
||
|
|
console.log(app.globalData.hasAva);
|
||
|
|
if (app.globalData.hasAva) {
|
||
|
|
this.setData({
|
||
|
|
topTips: false
|
||
|
|
})
|
||
|
|
} else {
|
||
|
|
this.setData({
|
||
|
|
topTips: true
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
console.log(app.globalData.isLogin);
|
||
|
|
|
||
|
|
if (!app.globalData.isLogin) {
|
||
|
|
wx.redirectTo({
|
||
|
|
url: "/pages/login/index?path=" + 'mine',
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
this.setData({
|
||
|
|
isLogin: app.globalData.isLogin,
|
||
|
|
hasUserInfo: app.globalData.hasUserInfo,
|
||
|
|
agencyStatus: app.globalData.agencyStatus,
|
||
|
|
user: app.globalData.user,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
},
|
||
|
|
loginOut: function () {
|
||
|
|
wx.showModal({
|
||
|
|
title: '退出登录',
|
||
|
|
content: '确定要退出登录吗?',
|
||
|
|
success (res) {
|
||
|
|
if (res.confirm) {
|
||
|
|
console.log('用户点击确定');
|
||
|
|
app.logout().then(() => {
|
||
|
|
// app.globalData.tgIndexPage.setData({isShow: true});
|
||
|
|
wx.reLaunch({
|
||
|
|
url: '/pages/mine/index',
|
||
|
|
})
|
||
|
|
});
|
||
|
|
|
||
|
|
// wx.navigateBack({
|
||
|
|
// delta: 1
|
||
|
|
// })
|
||
|
|
|
||
|
|
} else if (res.cancel) {
|
||
|
|
console.log('用户点击取消')
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
// 触摸开始事件
|
||
|
|
// filterTouchStart: function (event) {
|
||
|
|
// app.filterTouchStart(event)
|
||
|
|
// },
|
||
|
|
// filterTouchMove (event) {
|
||
|
|
// app.filterTouchMove(event,'single-right','/pages/mobile/index')
|
||
|
|
// },
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面隐藏
|
||
|
|
*/
|
||
|
|
onHide: function () { },
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面卸载
|
||
|
|
*/
|
||
|
|
onUnload: function () { },
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
|
*/
|
||
|
|
onPullDownRefresh: function () { },
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面上拉触底事件的处理函数
|
||
|
|
*/
|
||
|
|
onReachBottom: function () { },
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 用户点击右上角分享
|
||
|
|
*/
|
||
|
|
// onShareAppMessage: function () {
|
||
|
|
|
||
|
|
// }
|
||
|
|
});
|