profile.vue
2.66 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<template>
<view>
<headerComp :title="titleStr"></headerComp>
<view class="prefix-elem"></view>
<view class="profile-item" @tap="switchConnect">
<span class="texts">切换服务器地址</span>
<img class="arrows" :src="rArrow" alt=""/>
</view>
<!-- <view class="profile-item">
<span class="texts">修改密码</span>
<img class="arrows" :src="rArrow" alt=""/>
</view> -->
<view class="logout">
<button type="primary" class="primary logout-btn" @tap="logoutHandle">退出登录</button>
</view>
</view>
</template>
<script>
import headerComp from '../../components/header'
import backArrow from '../../static/header/backArrow.png'
import rArrow from "../../static/analysis/rArrow.png"
export default {
onLoad(option) {
console.log(option)
},
components: {
headerComp
},
data() {
return {
titleStr: '我的',
backArrow: backArrow,
rArrow: rArrow
}
},
methods: {
switchConnect() {
let that = this;
that.$message.confirm('<div class="dialog-content" style="color: #333; font-size: 17px;text-align: center;">确认切换该服务器地址?</div>', function(res, body) {
}, [{
className: 'dialog-btn',
label: '取消',
callback: function(res, $body) {
return true;
}
}, {
className: 'dialog-btn',
label: '确定',
callback: function(res, $body) {
that.clearCache(true);
model.switchConnectType() // 调用swift 无参
}
}], '提示');
},
logoutHandle() {
this.clearCache();
uni.reLaunch({
url: '../login/login',
});
},
clearCache(isAllClear) {
Object.keys(window.localStorage).forEach(item => {
if(isAllClear) {
uni.removeStorage({
key: item,
success: function (res) {
}
});
} else {
if(item!='user'&&item!='pwd'&&item!='statusBarH'){
uni.removeStorage({
key: item,
success: function (res) {
}
});
}
}
})
}
},
}
</script>
<style>
.prefix-elem {
height: 25.36upx;
}
.profile-item {
background: #FFFFFF;
position: relative;
}
.texts {
display: block;
height: 90.57upx;
line-height: 90.57upx;
margin-left: 23.55upx;
font-size: 28.98upx;
color: #333;
border-bottom: 1.81upx solid rgba(151, 151, 151, .2);
box-sizing: border-box;
}
.profile-item:last-of-type .texts {
border-bottom: none;
}
.arrows {
width: 14.49upx;
height: 25.36upx;
position: absolute;
right: 23.55upx;
top: 32.6upx;
}
.logout {
margin-top: 255.43upx;
padding: 0 41.66upx;
}
.logout-btn {
background-color: transparent;
border: 1px solid #0069FF;
color: #0069FF;
border-radius: 41.66upx;
}
</style>