setting.js 1.02 KB
// pages/home/setting/setting.js
import wx from '../../../utils/wx';
import Yas from '../../../common/yas';
let app = getApp();
let yas;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    disabled: false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    yas = new Yas(app); // 实例化埋点
    yas.pageOpenReport();
  },
  outLogin: function () {
    let that = this
    return wx.showModal({
      title: '',
      content: '是否确认退出当前账号?',
      confirmText: '退出',
      confirmColor: '#000'
    }).then(res1 => {
      if (res1.confirm) {
        app.clearUserSession();
        app._setSync('disableAutoLogin', true);
        that.setData({
          disabled: true
        })
        wx.showToast({
          title: '已退出登录'
        }).then((res2)=> {
          setTimeout(()=> {
            wx.switchTab({
              url: '/pages/home/index'
            });
          },2000)
          
        })
      
        
      }
    });
  },
 
})