| | |
| | | <navigator navigateTo class="grid-item-box" hover-class="none" :url="`../${item.path}`"> |
| | | <image v-if="item.icoimg" class="imgMenu" :src="`${item.icoimg}`"></image> |
| | | <image v-else class="imgMenu" src="/static/img/imgMenu/APP01.png"></image> |
| | | <uni-notice-bar v-if="item.pagE_VIEW.length>6" :speed="30" |
| | | <uni-notice-bar v-if="item.pagE_VIEW && item.pagE_VIEW.length>6" :speed="30" |
| | | style="padding:0;margin-bottom:0;font-weight: 900;" textSize="13px" |
| | | background-color="#ffffff" color="#000000" :scrollable="item.pagE_VIEW.length>6" |
| | | :single="true" :text="item.pagE_VIEW" /> |
| | | <text v-else class="text">{{ item.pagE_VIEW }}</text> |
| | | background-color="#ffffff" color="#000000" :scrollable="item.pagE_VIEW && item.pagE_VIEW.length>6" |
| | | :single="true" :text="item.pagE_VIEW || ''" /> |
| | | <text v-else class="text">{{ item.pagE_VIEW || '' }}</text> |
| | | </navigator> |
| | | </uni-grid-item> |
| | | </uni-grid> |
| | |
| | | "../../static/img/SN-GG1.png" |
| | | ], |
| | | col: 4, //菜单列数 |
| | | updateChecked: false, |
| | | msg: "", |
| | | }; |
| | | }, |
| | | methods: { |
| | |
| | | }) |
| | | }, |
| | | checkForUpdate() { |
| | | this.$post({ |
| | | url: "/Login/getAppUpgradeInfo", |
| | | data: {} |
| | | }).then(res => { |
| | | |
| | | let newVersion = res.data.version; |
| | | let currentVersion = uni.getSystemInfoSync(); // 获取当前 APK 版本号 |
| | | |
| | | if (newVersion > currentVersion.appVersion) { |
| | | uni.showModal({ |
| | | title: "发现新版本", |
| | | content: "是否下载最新版本?", |
| | | success: (modalRes) => { |
| | | if (modalRes.confirm) { |
| | | this.downloadNewApk(res.data.apkUrl); |
| | | } |
| | | } |
| | | }); |
| | | //this.downloadNewApk(res.data.apkUrl); |
| | | this.updateChecked = true; // 标记更新已检查过 |
| | | // // 如果有新版本,开始下载 |
| | | //download(res.data.apkUrl); |
| | | if (this.updateChecked) return; |
| | | if (!this.$post || typeof this.$post !== 'function') return; |
| | | this.$post({ |
| | | url: "/Login/getAppUpgradeInfo", |
| | | data: {} |
| | | }).then(res => { |
| | | const newVersion = res && res.data ? res.data.version : null; |
| | | const sysInfo = uni.getSystemInfoSync(); |
| | | const currentVersion = sysInfo && sysInfo.appVersion ? sysInfo.appVersion : null; |
| | | if (!newVersion || !currentVersion) { |
| | | this.updateChecked = true; |
| | | return; // 非 APP 端或缺少版本信息时跳过 |
| | | } |
| | | // 简单比较,不处理复杂语义版本 |
| | | if (String(newVersion) !== String(currentVersion)) { |
| | | uni.showModal({ |
| | | title: "发现新版本", |
| | | content: "是否下载最新版本?", |
| | | success: (modalRes) => { |
| | | if (modalRes.confirm) { |
| | | this.downloadNewApk(res.data.apkUrl); |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | } |
| | | }); |
| | | this.updateChecked = true; |
| | | } |
| | | }).catch(err => { |
| | | console.error('getAppUpgradeInfo error:', err); |
| | | this.updateChecked = true; |
| | | }) |
| | | }, |
| | | |
| | | |
| | | downloadNewApk(apkUrl) { |
| | | if (typeof plus === "undefined" || !plus.runtime) { |
| | | uni.showToast({ |
| | | title: "仅支持在APP内更新", |
| | | icon: "none", |
| | | duration: 2000 |
| | | }); |
| | | return; |
| | | } |
| | | uni.showToast({ |
| | | title: "开始下载更新...", |
| | | icon: "none", |
| | |
| | | }); |
| | | } else { |
| | | this.getMenu(true); |
| | | // 检查应用更新 |
| | | this.checkForUpdate(); |
| | | // 检查应用更新(仅 APP 端) |
| | | if (typeof plus !== "undefined") { |
| | | this.checkForUpdate(); |
| | | } |
| | | } |
| | | |
| | | }, |
| | | onPullDownRefresh() { |
| | | if (this.loginInfo.hasLogin) { |
| | | this.getMenu(true); |
| | | // 下拉刷新时也检查更新 |
| | | this.checkForUpdate(); |
| | | // 下拉刷新时也检查更新(仅 APP 端) |
| | | if (typeof plus !== "undefined") { |
| | | this.checkForUpdate(); |
| | | } |
| | | } |
| | | }, |
| | | |