| | |
| | | <template> |
| | | <uni-base-page :footer="false"> |
| | | <view slot="page"> |
| | | <view v-if="loginInfo.hasLogin"> |
| | | <!-- 教学视频、公司内部宣传图片等 --> |
| | | <!-- <swiper indicator-dots="true" :autoplay="true" :interval="3000">--> |
| | | <!-- <swiper-item v-for="(img,key) in imgUrls" :key="key">--> |
| | | <!-- <image :src="img"/>--> |
| | | <!-- </swiper-item>--> |
| | | <!-- </swiper>--> |
| | | <!-- 通报批评、消息预警、公告、报告 --> |
| | | <uni-notice-bar :show-icon="true" :scrollable="true" :speed="30" :single="true" |
| | | :text="msg"/> |
| | | <!-- 用户系统菜单模块 --> |
| | | <view class="example-body"> |
| | | <uni-grid :column="col" :showBorder="false"> |
| | | <uni-grid-item v-for="(item, index) in userMenu" :index="index" :key="index" class="grid-item"> |
| | | <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/WARBAAHtml.png"></image> |
| | | <!-- <uni-notice-bar v-if="item.pagE_VIEW.length>6" :speed="30" |
| | | <uni-base-page :footer="false"> |
| | | <view slot="page"> |
| | | <view v-if="loginInfo.hasLogin"> |
| | | <!-- 教学视频、公司内部宣传图片等 --> |
| | | <!-- <swiper indicator-dots="true" :autoplay="true" :interval="3000">--> |
| | | <!-- <swiper-item v-for="(img,key) in imgUrls" :key="key">--> |
| | | <!-- <image :src="img"/>--> |
| | | <!-- </swiper-item>--> |
| | | <!-- </swiper>--> |
| | | <!-- 通报批评、消息预警、公告、报告 --> |
| | | <uni-notice-bar :show-icon="true" :scrollable="true" :speed="30" :single="true" :text="msg" /> |
| | | <!-- 用户系统菜单模块 --> |
| | | <view class="example-body"> |
| | | <uni-grid :column="col" :showBorder="false"> |
| | | <uni-grid-item v-for="(item, index) in userMenu" :index="index" :key="index" class="grid-item"> |
| | | <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/WARBAAHtml.png"></image> |
| | | <!-- <uni-notice-bar v-if="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 class="text" style="text-align: center;padding:5px 0px 5px 0px">{{ item.pagE_VIEW }}</text> |
| | | </navigator> |
| | | </uni-grid-item> |
| | | </uni-grid> |
| | | </view> |
| | | </view> |
| | | <view v-if="!loginInfo.hasLogin"> |
| | | <view class="title"> |
| | | 您好 游客。 |
| | | </view> |
| | | <view class="ul"> |
| | | <view>这是 XXMES 首页。</view> |
| | | <view>在 “我的” 中点击 “登录” 可以 “登录您的账户”</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </uni-base-page> |
| | | <text class="text" |
| | | style="text-align: center;padding:5px 0px 5px 0px">{{ item.pagE_VIEW }}</text> |
| | | </navigator> |
| | | </uni-grid-item> |
| | | </uni-grid> |
| | | </view> |
| | | </view> |
| | | <view v-if="!loginInfo.hasLogin"> |
| | | <view class="title"> |
| | | 您好 游客。 |
| | | </view> |
| | | <view class="ul"> |
| | | <view>这是 XXMES 首页。</view> |
| | | <view>在 “我的” 中点击 “登录” 可以 “登录您的账户”</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </uni-base-page> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | loginInfo: this.$loginInfo, |
| | | color: this.$defaultColor, |
| | | userMenu: [], |
| | | imgUrls: [ |
| | | "../../static/img/SN-GG.png", |
| | | "../../static/img/SN-GG1.png" |
| | | ], |
| | | col: 4, //菜单列数 |
| | | msg: "宁波广深科技有限公司" |
| | | }; |
| | | }, |
| | | methods: { |
| | | getMenu(isShowMask) { |
| | | if (isShowMask) uni.showLoading({ |
| | | mask: true, |
| | | title: "加载中..." |
| | | }); |
| | | this.$getUserMenu({ |
| | | type: 'sys', |
| | | programId: this.loginInfo.sysNumber, |
| | | success: (res) => { |
| | | this.userMenu = res; |
| | | uni.stopPullDownRefresh(); |
| | | }, |
| | | fail: (err) => { |
| | | export default { |
| | | data() { |
| | | return { |
| | | loginInfo: this.$loginInfo, |
| | | color: this.$defaultColor, |
| | | userMenu: [], |
| | | imgUrls: [ |
| | | "../../static/img/SN-GG.png", |
| | | "../../static/img/SN-GG1.png" |
| | | ], |
| | | col: 4, //菜单列数 |
| | | msg: "宁波广深科技有限公司", |
| | | updateChecked: false |
| | | |
| | | }, |
| | | complete() { |
| | | 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 |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | onLoad() { |
| | | if (!this.loginInfo.hasLogin) { |
| | | uni.showModal({ |
| | | title: '未登录', |
| | | content: '您未登录,需要登录后才能继续', |
| | | /** |
| | | * 如果需要强制登录,不显示取消按钮 |
| | | */ |
| | | showCancel: !this.loginInfo.forcedLogin, |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | /** |
| | | * 如果需要强制登录,使用reLaunch方式 |
| | | */ |
| | | if (this.loginInfo.forcedLogin) { |
| | | uni.reLaunch({ |
| | | url: 'login' |
| | | }); |
| | | } else { |
| | | uni.navigateTo({ |
| | | url: 'login' |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | this.getMenu(true); |
| | | } |
| | | }; |
| | | }, |
| | | methods: { |
| | | getMenu(isShowMask) { |
| | | if (isShowMask) uni.showLoading({ |
| | | mask: true, |
| | | title: "加载中..." |
| | | }); |
| | | this.$getUserMenu({ |
| | | type: 'sys', |
| | | programId: this.loginInfo.sysNumber, |
| | | success: (res) => { |
| | | this.userMenu = res; |
| | | uni.stopPullDownRefresh(); |
| | | |
| | | }, |
| | | fail: (err) => { |
| | | |
| | | }, |
| | | complete() { |
| | | 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); |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | |
| | | |
| | | }, |
| | | onShow() { |
| | | // this.getIsMsg(); |
| | | }, |
| | | onPullDownRefresh() { |
| | | if (this.loginInfo.hasLogin) |
| | | this.getMenu(true); |
| | | }, |
| | | } |
| | | 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) { |
| | | uni.showModal({ |
| | | title: '未登录', |
| | | content: '您未登录,需要登录后才能继续', |
| | | /** |
| | | * 如果需要强制登录,不显示取消按钮 |
| | | */ |
| | | showCancel: !this.loginInfo.forcedLogin, |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | /** |
| | | * 如果需要强制登录,使用reLaunch方式 |
| | | */ |
| | | if (this.loginInfo.forcedLogin) { |
| | | uni.reLaunch({ |
| | | url: 'login' |
| | | }); |
| | | } else { |
| | | uni.navigateTo({ |
| | | url: 'login' |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | |
| | | this.getMenu(true); |
| | | this.checkForUpdate(); |
| | | } |
| | | |
| | | |
| | | }, |
| | | onShow() { |
| | | // this.getIsMsg(); |
| | | }, |
| | | onPullDownRefresh() { |
| | | if (this.loginInfo.hasLogin) |
| | | this.getMenu(true); |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | .text { |
| | | /* color: #ffffff; */ |
| | | /* font-size: 15px; */ |
| | | font-weight: 900; |
| | | } |
| | | |
| | | .example-body { |
| | | flex-direction: row; |
| | | flex-wrap: wrap; |
| | | justify-content: center; |
| | | padding: 0; |
| | | font-size: 14px; |
| | | /* background-color: #ffffff; */ |
| | | } |
| | | .grid-item { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | height: 100% !important; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: stretch; /* 保证垂直拉伸以适应内容 */ |
| | | .text { |
| | | /* color: #ffffff; */ |
| | | /* font-size: 15px; */ |
| | | font-weight: 900; |
| | | } |
| | | .grid-item-box { |
| | | flex: 1; |
| | | /* position: relative;*/ |
| | | /* #ifndef APP-NVUE */ |
| | | display: flex; |
| | | /* #endif */ |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | padding: 5px; |
| | | } |
| | | |
| | | .imgMenu { |
| | | width: 100rpx; |
| | | height: 100rpx; |
| | | } |
| | | .example-body { |
| | | flex-direction: row; |
| | | flex-wrap: wrap; |
| | | justify-content: center; |
| | | padding: 0; |
| | | font-size: 14px; |
| | | /* background-color: #ffffff; */ |
| | | } |
| | | |
| | | image, |
| | | swiper, |
| | | .img-view { |
| | | width: 100%; |
| | | height: 350rpx; |
| | | margin-bottom: 10rpx; |
| | | } |
| | | .grid-item { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | height: 100% !important; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: stretch; |
| | | /* 保证垂直拉伸以适应内容 */ |
| | | } |
| | | |
| | | .example-body { |
| | | flex-direction: row; |
| | | justify-content: flex-start; |
| | | } |
| | | .grid-item-box { |
| | | flex: 1; |
| | | /* position: relative;*/ |
| | | /* #ifndef APP-NVUE */ |
| | | display: flex; |
| | | /* #endif */ |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | padding: 5px; |
| | | } |
| | | |
| | | .imgMenu { |
| | | width: 100rpx; |
| | | height: 100rpx; |
| | | } |
| | | |
| | | image, |
| | | swiper, |
| | | .img-view { |
| | | width: 100%; |
| | | height: 350rpx; |
| | | margin-bottom: 10rpx; |
| | | } |
| | | |
| | | .example-body { |
| | | flex-direction: row; |
| | | justify-content: flex-start; |
| | | } |
| | | </style> |