setting.js
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// 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)
})
}
});
},
})