From 08e8cae713a22fdcf84bec9fab938aad68bc892c Mon Sep 17 00:00:00 2001 From: hou <1601990943@qq.com> Date: Tue, 14 Dec 2021 15:22:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/login/login/index.vue | 15 ++++++++++++++- src/store/modules/session.ts | 9 +++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/pages/login/login/index.vue b/src/pages/login/login/index.vue index 0f01089..59220b7 100644 --- a/src/pages/login/login/index.vue +++ b/src/pages/login/login/index.vue @@ -173,8 +173,21 @@ export default class LoginPage extends BasePage { this.$form.setRules(this.rules); console.log("image", this.image); } - + Version: string = "1.0.0"; + async update() { + await session.QueryVersion(); + if (this.Version != session.Version) { + await uni.downloadFile({ + url: "http://106.13.174.133:5210/HaierWMS.apk", + success: (res) => { + console.log("res.statusCode", res.statusCode); + console.log("res.tempFilePath", res.tempFilePath); + }, + }); + } + } login(): void { + // this.update(); this.$form.validate(async (valid: boolean) => { if (valid) { if (!server.isServerAddressSet) { diff --git a/src/store/modules/session.ts b/src/store/modules/session.ts index 74f4ab1..fdcd992 100644 --- a/src/store/modules/session.ts +++ b/src/store/modules/session.ts @@ -4,6 +4,7 @@ import { Module, Mutation, VuexModule, + MutationAction, } from "vuex-module-decorators"; import { Area } from "@/pages/login/area/model"; import { Lang } from "@/i18n"; @@ -37,6 +38,7 @@ class SessionService extends VuexModule { * 当前登录用户 */ user: User | null = null; + Version: string = ""; /** * 当前工作区 @@ -170,6 +172,13 @@ class SessionService extends VuexModule { setArea(area: Area): void { this.area = area; } + //查询版本号 + @MutationAction + async QueryVersion() { + let res: any = await request.get("http://106.13.174.133:5210/setup.json"); + let Version = res.version; + return { Version }; + } } export const session = getModule(SessionService);