settings.vue
4.8 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
196
197
198
199
200
201
<template>
<view style="background-color: #F5F7FC; padding-top: 15rpx; height: 100vh; ">
<view class="qh-list-c" @click="onLogout()">
<view style="display: flex;">
<text class="list-text">账号注销</text>
</view>
<image src="@/static/mine_icons/arrow_right.png"
style="width: 50rpx; height: 50rpx; margin-right: 30rpx;" />
</view>
<view class="qh-list-c" @click="onUserAgreement()">
<view style="display: flex;">
<text class="list-text">用户协议</text>
</view>
<image src="@/static/mine_icons/arrow_right.png"
style="width: 50rpx; height: 50rpx; margin-right: 30rpx;" />
</view>
<view class="qh-list-c" @click="onPrivacyPolicy()">
<view style="display: flex;">
<text class="list-text">隐私政策</text>
</view>
<image src="@/static/mine_icons/arrow_right.png"
style="width: 50rpx; height: 50rpx; margin-right: 30rpx;" />
</view>
<view class="qh-list-c" @click="showUpdateVersion()">
<text class="update_text">{{this.versionName}}</text>
<view style="display: flex; " >
<text style="font-size: 27rpx;">{{this.updateInfoStr}}</text>
<image src="@/static/mine_icons/arrow_right.png"
style="width: 50rpx; height: 50rpx; margin-right: 30rpx;" />
</view>
</view>
<button style="background-color: white; margin: 35rpx; color: #469bf4;" @click="bindLogout()">
{{ this.hasLogin ? "退出登录" : '登陆/注册' }}</button>
</view>
</template>
<script>
import {
default as http
} from "@/utils/http.js";
import {
updateUseModal,
compare
} from '@/utils/check_update.js';
import {
default as app_config
} from '@/utils/app.js';
import loginHelper from "../../utils/loginHelper.js"
export default {
data() {
return {
app_config,
hasLogin : false,
updateInfoStr : "已是最新版本",
versionData : null,
versionName : app_config.app_info.AppName,
}
},
onShow() {
this.hasLogin = loginHelper.hasLogin()
console.log("onShow");
this.updateVersion();
},
methods: {
bindLogout() {
{
loginHelper.logout();
uni.reLaunch({
url: '/pages/mine/mine'
})
}
},
onLogout() {
if (!loginHelper.hasLogin()) {
uni.navigateTo({
url: '/pages/login_pwd/login_pwd',
});
} else {
uni.navigateTo({
url: "/pages/logout/logout",
});
}
},
onUserAgreement() {
let tempData = {
url: app_config.ppolicy_user,
title: "用户协议"
}
uni.navigateTo({
url: `/pages/normal_webview/normal_webview?info=${encodeURIComponent(JSON.stringify(tempData))}`
})
},
onPrivacyPolicy() {
let tempData = {
url: app_config.ppolicy_app,
title: "隐私政策"
}
uni.navigateTo({
url: `/pages/normal_webview/normal_webview?info=${encodeURIComponent(JSON.stringify(tempData))}`
})
},
showUpdateVersion() {
if(this.versionData) {
updateUseModal({
title: "更新",
contents: this.versionData.Version_Content || '',
is_mandatory: false,
url: this.versionData.Package_Url,
platform: 'android',
type: "pkg" // 安装包类型
});
}
},
async updateVersion() {
let appInfo = app_config.app_info;
// #ifdef APP-PLUS
let query_data = `query{
update_app_version(App_Code:${JSON.stringify(appInfo.Version)}) {
App_Code
App_Name
Sys_Code
Sys_Name
Version_Code
Version_Type
Version_Content
Package_Url
Package_Weight
Version_Num
Update_Way
Download_Way
Update_Time
Publish_Time
Sys_Version
Promoter_Id
}
}`;
console.info(query_data);
let result = await http.gql({
query: query_data
})
console.info(result);
//处理返回请求
if (result && result.data && result.data.update_app_version) {
if (result.data.update_app_version.Error) {
uni.showToast({
icon: "none",
title: result.data.update_app_version.Error,
});
} else {
this.versionData = result.data.update_app_version;
if (this.versionData && this.versionData.Package_Url) {
this.updateInfoStr = "更新版本";
} else {
this.updateInfoStr = "已是最新版本";
}
}
}
// #endif
// #ifdef MP-WEIXIN
this.versionName = app_config.app_info.AppName
this.updateInfoStr = appInfo.Version
// #endif
}
}
}
</script>
<style>
button::after {
border: none
}
.qh-list-c {
margin-top: 4rpx;
background-color: white;
display: flex;
height: 100rpx;
font-weight: bold;
justify-content: space-between;
align-items: center;
}
.update_text {
font-size: 33rpx;
color: black; font-weight: bold;
margin-left: 35rpx;
}
.list-text {
margin-left: 35rpx;
font-size: 32rpx;
font-weight: 400;
color: black;
}
</style>