| | |
| | | <view class="example-body"> |
| | | <uni-grid :column="col" :showBorder="true"> |
| | | <uni-grid-item v-for="(item, index) in userMenu" :index="index" :key="index"> |
| | | <navigator navigateTo class="grid-item-box" hover-class="none" |
| | | :url="`../${item.path}`"> |
| | | <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" |
| | |
| | | if (isShowMask) uni.hideLoading(); |
| | | } |
| | | }); |
| | | }, |
| | | getIsMsg() { |
| | | this.$post({ |
| | | url: "/MessageCenter/IsShow", |
| | | data: { |
| | | createBy: this.$loginInfo.account, |
| | | isShow: 1, |
| | | }, |
| | | }).then(res => { |
| | | if (res.data.tbBillList > 0) { |
| | | this.msg = "您有新的异常待处理/您有新的异常待处理"; |
| | | //展示图标 |
| | | uni.showTabBarRedDot({ |
| | | index: 1 |
| | | }); |
| | | } else { |
| | | this.msg = "宁波广深科技有限公司"; |
| | | //展示图标 |
| | | uni.hideTabBarRedDot({ |
| | | index: 1 |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | 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); |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | |
| | | |
| | | downloadNewApk(apkUrl) { |
| | | uni.showToast({ |
| | | title: "开始下载更新...", |
| | | icon: "none", |
| | | duration: 2000 |
| | | }); |
| | | |
| | | uni.downloadFile({ |
| | | url: apkUrl, |
| | | success: (res) => { |
| | | if (res.statusCode === 200) { |
| | | plus.runtime.install(res.tempFilePath, { |
| | | force: true |
| | | }, function() { |
| | | console.log("安装成功,重启应用"); |
| | | //plus.runtime.restart(); |
| | | //plus.runtime.quit(); |
| | | // uni.navigateBack() |
| | | }, function(e) { |
| | | console.error("安装失败:", e); |
| | | }); |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | console.error("下载失败:", err); |
| | | uni.showToast({ |
| | | title: "下载失败,请检查网络", |
| | | icon: "none", |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }, |
| | | onLoad() { |
| | | if (!this.loginInfo.hasLogin) { |
| | |
| | | if (this.loginInfo.hasLogin) |
| | | this.getMenu(true); |
| | | }, |
| | | |
| | | } |
| | | </script> |
| | | |