index.vue
5.83 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<template>
<div class="setting_container">
<NafmHeader navClass="nafmii-head-bg3" :title="$t('title.setting')" />
<div class="setting_list">
<!--
<van-cell :title="$t('setting.newMsgTip')" center value-class="right_content">
<template #default>
<van-switch v-model="msgChecked" @click="changeMsgStatus" size="20px" />
</template>
</van-cell>
-->
<van-cell :title="$t('setting.language')" center is-link @click="controllZhEn(true)" value-class="right_content">
<template #default>
{{$t("lang")}}
</template>
</van-cell>
<van-cell :title="$t('setting.bindWechat')" center is-link @click="jumpMessagePage('wechat')" value-class="right_content">
<template #default>
含笑一过
</template>
</van-cell>
<van-cell :title="$t('setting.resetPassword')" center is-link @click="jumpMessagePage('reset')" value-class="right_content" />
<!--
<van-cell title="指纹ID解锁" center value-class="right_content">
<template #default>
<van-switch v-model="fingerprintChecked" @click="changeFingerprintStatus" size="20px" />
</template>
</van-cell>
<van-cell title="面容ID解锁" center value-class="right_content">
<template #default>
<van-switch v-model="faceIdChecked" @click="changeFaceIdStatus" size="20px" />
</template>
</van-cell>
-->
<van-cell title="系统字体设置" center is-link @click="showSysFont=true" value-class="right_content">
<template #default>
<span>{{sysFontText}}</span>
</template>
</van-cell>
</div>
<div class="agreement_list">
<van-cell :title="$t('setting.privacyPolicy')" center is-link @click="jumpPrivacyPage" value-class="right_content" />
<van-cell :title="$t('setting.serviceAgreement')" center is-link @click="jumpServicePage" value-class="right_content" />
</div>
<van-button type="primary" plain color="#a4a4a4" class="logout_btn" @click="handleLogout">{{$t('button.logout')}}</van-button>
<van-action-sheet v-model="showZhEn" :actions="actions" :cancel-text="$t('button.cancel')" close-on-click-action @cancel="controllZhEn(false)" @select="changeLang" />
<van-popup v-model="showSysFont" position="bottom">
<van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="showSysFont = false" />
</van-popup>
</div>
</template>
<script>
import { setLocalStorage, getLocalStorage, removeLocalStorage } from '@/utils/LocalStorage'
import { NativeApi } from '@/api/NativeApis';
export default {
name: 'Setting',
data() {
return {
msgChecked: false, //新消息提醒
showZhEn: false, // 弹出中英文设置
fingerprintChecked: false, // 指纹ID解锁状态
faceIdChecked: false, // 面容ID解锁状态
showSysFont: false,
sysFontText: '标准',
columns: [{ text: '较小', value: 98 }, { text: '标准', value: 100 }, { text: '较大', value: 110 }, { text: '超大', value: 120 }],
}
},
mounted() {
this.msgChecked = true
},
computed: {
// 中英文切换 切换 tab
actions() {
return [{ name: '中文', key: 'zh' }, { name: 'English', key: 'en' }] // 中英文切换选项
}
},
methods: {
// 切换消息操作
changeMsgStatus() {
this.msgChecked = !this.msgChecked
},
// 弹出/关闭 设置中英文框
controllZhEn(value) {
this.showZhEn = value
},
// 切换语言
changeLang(value) {
setLocalStorage('lang', value.key)
this.$i18n.locale = value.key
},
// 解绑微信/重置密码
jumpMessagePage(type) {
const phone = getLocalStorage('phone') || '18311098924'; //todo
if (type == 'wechat') {
// 解绑微信
Dialog.confirm({
title: this.$t('toast.tip'),
message: this.$t('toast.tipMessage'),
cancelButtonText: this.$t('button.clickWrong'),
cancelButtonColor: '#206CB3',
confirmButtonText: this.$t('button.okUnbinding'),
confirmButtonColor: '#999999'
})
.then(() => {
this.$router.push({
name: 'SendVerification',
query: {
phone,
type
}
})
})
.catch(() => {
});
} else {
// 重置密码
this.$router.push({
name: 'SendVerification',
query: {
phone,
type
}
})
}
},
// 更改 指纹ID状态
changeFingerprintStatus() {
this.fingerprintChecked = !this.fingerprintChecked
},
// 触发下啦刷新
refreshInit() {
console.log('__', this.fingerprintChecked);
},
// 更改 面容ID状态
changeFaceIdStatus() {
this.faceIdChecked = !this.faceIdChecked
},
// 跳转到隐私协议页面
jumpPrivacyPage() {
this.$router.push({
path: '/user/privacy'
})
},
// 跳转到服务协议页面
jumpServicePage() {
this.$router.push({
path: '/user/service'
})
},
// 退出登录
handleLogout() {
// 清空用户信息
removeLocalStorage('user')
this.$router.push({
path: '/user/center'
})
},
// 切换字体大小
onConfirm(opt) {
this.sysFontText = opt.text
const size = opt.value
NativeApi.nativeTextZoom({
value: size
})
this.showSysFont = false
}
}
}
</script>
<style lang="less" scoped>
.setting_container {
background-color: #efefef;
height: 100vh;
}
.van-cell:not(:last-child)::after {
right: 16px;
}
.right_content {
display: flex;
justify-content: flex-end;
align-items: center;
}
.agreement_list {
margin-top: 10px;
}
.logout_btn {
margin-top: 200px;
width: 100%;
border: 0;
}
</style>