|
@@ -29,6 +29,7 @@
|
29
|
29
|
</view>
|
30
|
30
|
<view class="changeDept">
|
31
|
31
|
<button type="primary" @click="showDeptModel">切换科室</button>
|
|
32
|
+ <button type="primary" @click="checkUpdate">检测更新</button>
|
32
|
33
|
<button type="primary" @click="changePwd">修改密码</button>
|
33
|
34
|
<button type="primary" @click="logout">退出登录</button>
|
34
|
35
|
</view>
|
|
@@ -42,6 +43,7 @@
|
42
|
43
|
</template>
|
43
|
44
|
|
44
|
45
|
<script>
|
|
46
|
+ import config from "../../request/config.js";
|
45
|
47
|
import {
|
46
|
48
|
mapState,
|
47
|
49
|
mapMutations
|
|
@@ -49,6 +51,7 @@
|
49
|
51
|
import {
|
50
|
52
|
reqLogout2,
|
51
|
53
|
reqUppwd,
|
|
54
|
+ reqFetchDataList,
|
52
|
55
|
} from "../../request/api.js";
|
53
|
56
|
export default {
|
54
|
57
|
data() {
|
|
@@ -220,6 +223,99 @@
|
220
|
223
|
}, ],
|
221
|
224
|
})
|
222
|
225
|
},
|
|
226
|
+ // 检测更新
|
|
227
|
+ checkUpdate() {
|
|
228
|
+ uni.showLoading({
|
|
229
|
+ mask: true,
|
|
230
|
+ title: '加载中'
|
|
231
|
+ })
|
|
232
|
+ let postData = {
|
|
233
|
+ "idx": 0,
|
|
234
|
+ "sum": 1,
|
|
235
|
+ "systemConfiguration": {
|
|
236
|
+ "keyconfig": "pdaVersion"
|
|
237
|
+ }
|
|
238
|
+ };
|
|
239
|
+ reqFetchDataList('simple/data', 'systemConfiguration', postData)
|
|
240
|
+ .then((data) => {
|
|
241
|
+ uni.hideLoading();
|
|
242
|
+ if (data.status == 200) {
|
|
243
|
+ const version = data.list[0].valueconfig;
|
|
244
|
+ // #ifdef APP-PLUS
|
|
245
|
+ plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
|
|
246
|
+ console.log(wgtinfo.version); //应用版本号
|
|
247
|
+ if (wgtinfo.version === version) {
|
|
248
|
+ this.$refs.seiminModel.show({
|
|
249
|
+ skin: "toast",
|
|
250
|
+ icon: "success",
|
|
251
|
+ content: "您所使用的已是最新版本",
|
|
252
|
+ });
|
|
253
|
+ } else {
|
|
254
|
+ this.$refs.seiminModel.show({
|
|
255
|
+ icon: 'warn',
|
|
256
|
+ content: `发现新版本Version ${version}`,
|
|
257
|
+ btns: [{},
|
|
258
|
+ {
|
|
259
|
+ name: '立即下载更新',
|
|
260
|
+ click: () => {
|
|
261
|
+ this.downloadUrl(`${config.pdaDownloadUrl}/pda-v${version}.apk`);
|
|
262
|
+ }
|
|
263
|
+ }
|
|
264
|
+ ]
|
|
265
|
+ });
|
|
266
|
+ }
|
|
267
|
+ })
|
|
268
|
+ // #endif
|
|
269
|
+ // #ifndef APP-PLUS
|
|
270
|
+ this.$refs.seiminModel.show({
|
|
271
|
+ skin: "toast",
|
|
272
|
+ icon: "error",
|
|
273
|
+ content: "当前不是APP端",
|
|
274
|
+ });
|
|
275
|
+ // #endif
|
|
276
|
+ } else {
|
|
277
|
+ this.$refs.seiminModel.show({
|
|
278
|
+ skin: "toast",
|
|
279
|
+ icon: "error",
|
|
280
|
+ content: data.error || "获取版本失败",
|
|
281
|
+ });
|
|
282
|
+ }
|
|
283
|
+ });
|
|
284
|
+ },
|
|
285
|
+ // 下载更新
|
|
286
|
+ downloadUrl(Url = '') {
|
|
287
|
+ uni.showLoading({
|
|
288
|
+ title: '更新中……',
|
|
289
|
+ mask: true,
|
|
290
|
+ })
|
|
291
|
+ const downloadTask = uni.downloadFile({ //执行下载
|
|
292
|
+ url: Url, //下载地址
|
|
293
|
+ timeout: 1000 * 30, //30秒超时时间
|
|
294
|
+ success: downloadResult => { //下载成功
|
|
295
|
+ console.log(downloadResult)
|
|
296
|
+ uni.hideLoading();
|
|
297
|
+ if (downloadResult.statusCode == 200) {
|
|
298
|
+ plus.runtime.install( //安装软件
|
|
299
|
+ downloadResult.tempFilePath, {
|
|
300
|
+ force: true
|
|
301
|
+ },
|
|
302
|
+ function(res) {
|
|
303
|
+ plus.runtime.restart();
|
|
304
|
+ }
|
|
305
|
+ );
|
|
306
|
+ }
|
|
307
|
+ },
|
|
308
|
+ fail: err => {
|
|
309
|
+ uni.hideLoading();
|
|
310
|
+ this.$refs.seiminModel.show({
|
|
311
|
+ skin: "toast",
|
|
312
|
+ icon: "error",
|
|
313
|
+ content: "更新失败",
|
|
314
|
+ });
|
|
315
|
+ console.log(err)
|
|
316
|
+ },
|
|
317
|
+ });
|
|
318
|
+ },
|
223
|
319
|
}
|
224
|
320
|
}
|
225
|
321
|
</script>
|