// pages/mycenter/index.js const app = getApp() const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0' Page({ /** * 页面的初始数据 */ data: { show: false, avatarUrl: defaultAvatarUrl, hasUserInfo: false, canIUseGetUserProfile: false, theme: wx.getSystemInfoSync().theme, actions: [ { name: '微信头像', subname: wx.canIUse('open-data.type.userAvatarUrl') , openType: 'share', }, { name: '从相册选择', }, { name: '拍照', }, ] }, onChooseAvatar(e) { const { avatarUrl } = e.detail this.setData({ avatarUrl, }) }, onChooseAvatars(){ var that =this console.log(111) that.setData({ show:true }) }, onClose() { this.setData({ show: false }); }, // onSelect(event) { // var that =this // console.log(111) // console.log(event.detail); // }, //退出登录 LoginOut(){ wx.removeStorage({ key: 'xiaoxi_token', success (res) { wx.removeStorage({ key: 'sqlid', success (res) { wx.reLaunch({ url: "../login/login", }) } }) } }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that =this; let sqlids = wx.getStorageSync('sqlid') || 0 if (sqlids == 1) { that.setData({ DBname: "uts_zongqing" }) } else { that.setData({ DBname: "uts_johao" }) } wx.onThemeChange((result) => { this.setData({ theme: result.theme }) }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.setData({ userInfo: app.globalData.userinfo, autho: app.globalData.autho }) }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })