From 8c59a8bdcdf443f4e67dd27d3c39680c8721654a Mon Sep 17 00:00:00 2001
From: aihe <961836564@qq.com>
Date: Sun, 16 Jun 2024 11:54:33 +0800
Subject: [PATCH] uu
---
common/api/common.js | 7 +++++++
common/api/url.js | 1 +
common/appUpdate/index.js | 23 +++++++++++++++--------
pages/tabBar/mine/mine.vue | 13 ++++++++-----
4 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/common/api/common.js b/common/api/common.js
index 84b0ce8..2200896 100644
--- a/common/api/common.js
+++ b/common/api/common.js
@@ -59,4 +59,11 @@ export const getStaffQRCodePng = (data = {})=> {
return coreRequest(url.getStaffQRCodePng, data, {}, "GET")
}
+// 获取app最新版本
+export const getLastAppVersion = (data = {})=> {
+ return coreRequest(url.getLastAppVersion, data, {})
+}
+
+
+
diff --git a/common/api/url.js b/common/api/url.js
index 4998bdf..7c6ab11 100644
--- a/common/api/url.js
+++ b/common/api/url.js
@@ -3,6 +3,7 @@ import { curEnvConf } from "../env"
export const host = curEnvConf.apiHost
export default {
+ getLastAppVersion: `/emis/common/getLastAppVersion`, // 获取app最新版本
uploadFile: '/common/ossUpload',
loginByApp: `/loginByApp`, // 登录
getInfoByApp: `/getInfoByApp`,// 获取用户基本信息
diff --git a/common/appUpdate/index.js b/common/appUpdate/index.js
index 74e54bc..bc3fe91 100644
--- a/common/appUpdate/index.js
+++ b/common/appUpdate/index.js
@@ -1,4 +1,5 @@
import { confirmModal, showLoading, hideLoading, showToast } from "@/common/untool"
+import * as apiService from "@/common/api"
export const getSystemInfo = ()=> {
let info = uni.getSystemInfoSync()
@@ -63,14 +64,19 @@ const installNewApk = (url)=> {
}
const getLastAppInfo = async (curAppInfo)=> {
- return {
- version: '1.0.1',
- versionCode: 101,
- apkUrl: 'http://192.168.1.7:5173/static/t.apk',
- // apkUrl: 'http://oss-emis.tanex56.com/sapp/sdg/hdbg.png',
- wgtUrl: 'http://192.168.1.7:5173/static/t.wgt?t.wgt',
- // whiteDeviceIds: ['F9E778C90D0E9A8DA9D95AA97B00A3FB'],
- }
+ let { version, versionCode } = curAppInfo
+ let { deviceId } = getSystemInfo()
+ let res = await apiService.getLastAppVersion({ version, versionCode, deviceId })
+ console.log("getLastAppInfo res====", res)
+ // res.data = {
+ // version: '1.0.0',
+ // versionCode: 100,
+ // apkUrl: 'http://192.168.1.7:5173/static/t.apk',
+ // wgtUrl: 'http://192.168.1.7:5173/static/t.wgt',
+ // whiteDeviceIds: ['F9E778C90D0E9A8DA9D95AA97B00A3FB'],
+ // remark: '',
+ // }
+ return res.data
}
const compareInfo = (curAppInfo, lastAppInfo)=> {
@@ -110,4 +116,5 @@ export const checkUpdate = async ()=> {
await installNewApk(cmpRes.url)
}
}
+ return cmpRes
}
\ No newline at end of file
diff --git a/pages/tabBar/mine/mine.vue b/pages/tabBar/mine/mine.vue
index f0fec6d..272982e 100644
--- a/pages/tabBar/mine/mine.vue
+++ b/pages/tabBar/mine/mine.vue
@@ -75,7 +75,9 @@
- {{curDeviceId}}
+
+
+
@@ -128,7 +130,7 @@
import { dealBtnMap } from "@/common/enum"
import * as apiService from "@/common/api"
import { getAuthList, authCodeEnum } from "@/common/authCode"
- import { getCurrentAppInfo, getSystemInfo } from "@/common/appUpdate"
+ import { getCurrentAppInfo, getSystemInfo, checkUpdate } from "@/common/appUpdate"
export default {
computed: {
@@ -183,9 +185,9 @@
methods: {
async initData(){
this.getAppHomeStatData()
+ this.curDeviceId = getSystemInfo()?.deviceId
let appRes = await getCurrentAppInfo()
this.curAppVersion = appRes._appVersion
- this.curDeviceId = getSystemInfo()?.deviceId
},
async getAppHomeStatData(){
let res = await apiService.getAppHomeStatData()
@@ -195,8 +197,9 @@
await this.$store.dispatch(USERKEY.LOGOUT)
this.goto(`login/login`, 2)
},
- handleCheckAppVersion() {
- // TODO
+ async handleCheckAppVersion() {
+ let res = await checkUpdate()
+ this.showToast('已经是最新版本,无需更新')
},
handleClearCache() {
// TODO