// pages/common-setting/common-setting.js import { baseurl } from '../../config' const app = getApp() Page({ /** * 页面的初始数据 */ data: { version: '', cancellation: false, userAgreement: encodeURIComponent(baseurl + '/uploadfile/userAgreement.html'), privacyPolicy: encodeURIComponent(baseurl + '/uploadfile/privacyPolicy.html') }, showCancellation() { this.setData({ cancellation: !this.data.cancellation }) }, cancellation() { wx.clearStorage({ success: res => { this.setData({ cancellation: false }) wx.$emit('is_login', false, () => { wx.navigateBack({ delta: 2 }) }) } }) }, logout() { wx.clearStorage({ success: res => { wx.reLaunch({ url: '/pages/index/index', }) } }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if (wx.getAccountInfoSync) { const info = wx.getAccountInfoSync() this.setData({ version: info.miniProgram.version || app.globalData.version }) } else { this.setData({ version: app.globalData.version }) } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })