This commit is contained in:
aihe 2024-06-16 11:54:33 +08:00
parent f908645a56
commit 8c59a8bdcd
4 changed files with 31 additions and 13 deletions

View File

@ -59,4 +59,11 @@ export const getStaffQRCodePng = (data = {})=> {
return coreRequest(url.getStaffQRCodePng, data, {}, "GET")
}
// 获取app最新版本
export const getLastAppVersion = (data = {})=> {
return coreRequest(url.getLastAppVersion, data, {})
}

View File

@ -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`,// 获取用户基本信息

View File

@ -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
}

View File

@ -75,7 +75,9 @@
<u-text margin="0 0 0 30rpx" text="设备Id" size="28" color="#333"></u-text>
</u-row>
<u-row custom-style="flex: 1;">
<view class="font-28 mr-10">{{curDeviceId}}</view>
<view style="text-align: right;flex: 1;">
<tpx-text-dic :value="curDeviceId"></tpx-text-dic>
</view>
<u-icon name="arrow-right" size="32" color="#333"></u-icon>
</u-row>
</u-row>
@ -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