From b041fdf28a8935137c2efa7024cf3451d4375351 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期一, 15 十二月 2025 13:08:32 +0800
Subject: [PATCH] 检查更新
---
pages/storeManagement/CancelMaterialRequisition/index.vue | 3
common/http.api.js | 5 +
pages/sys/user/index.vue | 217 +++++++++++++++++++++++++++++++++++++++++++----------
3 files changed, 179 insertions(+), 46 deletions(-)
diff --git a/common/http.api.js b/common/http.api.js
index 4359fce..328b598 100644
--- a/common/http.api.js
+++ b/common/http.api.js
@@ -15,7 +15,10 @@
'&code=' + params.code + '&grant_type=mobile', {}, header),
sendCode: (params = {}, header = {}) => vm.$u.get('/admin/mobile/' + params.mobile, {}, header),
logout: (params = {}) => vm.$u.delete('/auth/token/logout', params),
-
+ // 妫�鏌ユ洿鏂�
+ checkUpdate: (params = {}) => vm.$u.get('/mes/downloadPda/check?currentVersion=' + params.currentVersion),
+ // 涓嬭浇鏈�鏂板畨瑁呭寘
+ downloadPda: (params = {}) => vm.$u.get('/mes/downloadPda', params),
// 瀛楀吀
dictData: (params = {}) => vm.$u.get('/admin/dict/type/' + params.dictType),
diff --git a/pages/storeManagement/CancelMaterialRequisition/index.vue b/pages/storeManagement/CancelMaterialRequisition/index.vue
index 3a9717d..8fa3e53 100644
--- a/pages/storeManagement/CancelMaterialRequisition/index.vue
+++ b/pages/storeManagement/CancelMaterialRequisition/index.vue
@@ -159,7 +159,7 @@
this.detailedList = val;
this.showModal = true;
},
- confirm() {
+ confirm() {
// 澶勭悊纭閫昏緫
this.$u.api.cancelMaterialRequisition
.cancelMaterialRequisition({
@@ -167,7 +167,6 @@
})
.then((res) => {
this.hasScanSnList.push(this.detailedList);
- console.log("璁板綍", this.hasScanSnList);
this.$u.toast("鍙栨秷棰嗘枡鎴愬姛");
})
.catch((err) => {
diff --git a/pages/sys/user/index.vue b/pages/sys/user/index.vue
index 6d2d23f..afd8564 100644
--- a/pages/sys/user/index.vue
+++ b/pages/sys/user/index.vue
@@ -1,25 +1,57 @@
<template>
<view class="my">
<view class="my-head">
- <u-navbar title="鎴戠殑" :border-bottom="false" :background="background" :title-bold="true" title-color="#fff"
- :is-back="false" />
+ <u-navbar
+ title="鎴戠殑"
+ :border-bottom="false"
+ :background="background"
+ :title-bold="true"
+ title-color="#fff"
+ :is-back="false"
+ />
<view class="my-head-content" @click="navTo('info')">
<u-avatar :src="image" size="240"></u-avatar>
- <p style="font-weight: bold;
-font-size: 34rpx;
-color: #333333;margin-bottom: 12rpx;">{{
- vuex_username || $t("login.noLogin")
- }}</p>
+ <p
+ style="
+ font-weight: bold;
+ font-size: 34rpx;
+ color: #333333;
+ margin-bottom: 12rpx;
+ "
+ >
+ {{ vuex_username || $t("login.noLogin") }}
+ </p>
<!-- TODO 瀵规帴閮ㄩ棬 -->
- <p style="font-weight: 500;
-font-size: 28rpx;
-color: #666666;">鐢熶骇閮ㄩ棬涓�</p>
+ <p style="font-weight: 500; font-size: 28rpx; color: #666666">
+ 鐢熶骇閮ㄩ棬涓�
+ </p>
</view>
</view>
- <u-button type="primary" style="margin: 30rpx;" :loading="loading" @click="logout" :custom-style="{
- backgroundColor: '#214DED',
- height: '80rpx'
- }" class="btn">{{ $t("login.logoutButton") }}</u-button>
+ <u-button
+ type="primary"
+ style="margin: 30rpx"
+ :loading="loading"
+ @click="logout"
+ :custom-style="{
+ backgroundColor: '#214DED',
+ height: '80rpx',
+ }"
+ class="btn"
+ >{{ $t("login.logoutButton") }}</u-button
+ >
+ <u-button
+ type="primary"
+ style="margin: 30rpx"
+ :loading="refreshLoading"
+ @click="refresh"
+ :custom-style="{
+ backgroundColor: '#214DED',
+ height: '80rpx',
+ }"
+ class="btn1"
+ >妫�鏌ユ洿鏂�</u-button
+ >
+ <view class="currentVersion">鐗堟湰鍙凤細{{ currentVersion }}</view>
</view>
</template>
@@ -29,58 +61,144 @@
data() {
return {
background: {
- background: 'transparent'
+ background: "transparent",
},
loading: false,
+ refreshLoading: false,
image: undefined,
- }
+ currentVersion: "1.0.0",
+ };
},
onLoad() {
this.image = config.baseUrl + this.vuex_user.avatar;
},
methods: {
- logout() {
- this.$u.api.logout().then((res) => {
- this.$u.toast(res.message);
+ refresh() {
+ this.refreshLoading = true;
+ uni.showToast({
+ title: "妫�鏌ユ洿鏂颁腑...",
+ icon: "loading",
+ });
+ this.$u.api
+ .checkUpdate({
+ currentVersion: this.currentVersion,
+ })
+ .then((res) => {
+ console.log("checkUpdate", res);
+ if (!res.hasUpdate) {
+ uni.showToast({
+ title: "褰撳墠鐗堟湰涓烘渶鏂扮増鏈�",
+ icon: "success",
+ });
+ } else {
+ let that = this;
+ uni.showModal({
+ title: "鎻愮ず",
+ content: "鍙戠幇鏂扮増鏈紝鏄惁涓嬭浇锛�",
+ success: function (t) {
+ if (t.confirm) {
+ that.downloadApk(res.downloadUrl);
+ } else if (t.cancel) {
+ return;
+ }
+ },
+ });
+ }
+ this.refreshLoading = false;
+ });
+ },
+ // downloadPda() {
+ // this.$u.api
+ // .downloadPda({
+ // // currentVersion: this.currentVersion,
+ // })
+ // .then((res) => {
+ // this.downloadApk(res.url, res.fileSize);
+ // });
+ // },
+ downloadApk(url) {
+ uni.showLoading({ title: "涓嬭浇涓�,璇峰嬁鎿嶄綔" });
+ console.log("downloadApk", url);
+ uni.downloadFile({
+ url: url,
+ success: (res) => {
+ // if (res.statusCode === 200) {
+ const tempPath = res.tempFilePath;
- //娓呯┖瀛樺偍淇℃伅
- this.$u.vuex("vuex_token", "");
- this.$u.vuex("vuex_refresh_token", "");
- this.$u.vuex("vuex_username", "");
- this.$u.vuex("vuex_userId", "");
- this.$u.vuex("vuex_client_id", "");
- this.$u.vuex("vuex_user", {});
-
- setTimeout(() => {
- uni.reLaunch({
- url: "/pages/sys/login/index",
+ // 璋冪敤璁惧 API 杩涜鏈湴瀹夎
+ plus.runtime.install(
+ tempPath,
+ {},
+ () => {
+ // uni.hideLoading();
+ uni.showToast({
+ title: "瀹夎鎴愬姛",
+ });
+ },
+ (err) => {
+ // uni.hideLoading();
+ uni.showToast({
+ title: "瀹夎澶辫触锛�" + err.message,
+ });
+ }
+ );
+ // } else {
+ // uni.hideLoading();
+ // uni.showToast({
+ // title: '涓嬭浇澶辫触'
+ // });
+ // }
+ },
+ fail: (err) => {
+ console.error(err);
+ uni.hideLoading();
+ uni.showToast({
+ title: "涓嬭浇鍑洪敊",
});
- }, 500);
- })
- .catch((err) => {
- this.$u.api.workReporting
- .getWorkshopOrder({})
- .then((res) => {
- });
- })
+ },
+ });
+ },
+ logout() {
+ this.$u.api
+ .logout()
+ .then((res) => {
+ this.$u.toast(res.message);
+
+ //娓呯┖瀛樺偍淇℃伅
+ this.$u.vuex("vuex_token", "");
+ this.$u.vuex("vuex_refresh_token", "");
+ this.$u.vuex("vuex_username", "");
+ this.$u.vuex("vuex_userId", "");
+ this.$u.vuex("vuex_client_id", "");
+ this.$u.vuex("vuex_user", {});
+
+ setTimeout(() => {
+ uni.reLaunch({
+ url: "/pages/sys/login/index",
+ });
+ }, 500);
+ })
+ .catch((err) => {
+ this.$u.api.workReporting.getWorkshopOrder({}).then((res) => {});
+ });
},
navTo(url) {
// uni.navigateTo({
// url: url,
// });
},
- }
-}
+ },
+};
</script>
<style lang="scss" scoped>
.my {
height: 100%;
- background: linear-gradient(to bottom, #E5F0FF, #F6F9FF);
+ background: linear-gradient(to bottom, #e5f0ff, #f6f9ff);
.my-head {
height: 320rpx;
- background-image: url('~@/static/custom/user/bg2.png');
+ background-image: url("~@/static/custom/user/bg2.png");
background-size: 100% auto;
background-repeat: no-repeat;
position: relative;
@@ -99,7 +217,20 @@
.btn {
position: fixed;
- bottom: 160rpx;
+ bottom: 320rpx;
+ width: calc(100% - 60rpx);
+ }
+ .btn1 {
+ position: fixed;
+ bottom: 200rpx;
+ width: calc(100% - 60rpx);
+ }
+ .currentVersion {
+ position: fixed;
+ color: #010101;
+ font-size: 32rpx;
+ text-align: center;
+ bottom: 150rpx;
width: calc(100% - 60rpx);
}
}
--
Gitblit v1.9.3