diff --git a/manifest.json b/manifest.json index ee098e2..a5ec375 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "海亮铜箔", "appid" : "__UNI__22404A1", "description" : "海亮铜箔手持系统", - "versionName" : "1.0.2", - "versionCode" : 102, + "versionName" : "1.0.0", + "versionCode" : 100, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { diff --git a/pages.json b/pages.json index 9b6e893..7adc4f4 100644 --- a/pages.json +++ b/pages.json @@ -18,6 +18,12 @@ "navigationStyle": "custom" } } + ,{ + "path" : "pages/login/upgrade", + "style": { + "navigationStyle": "custom" + } + } ,{ "path" : "pages/ProductManage/SboProdProgress", "style": { @@ -138,21 +144,6 @@ "navigationStyle": "custom" } } - ,{ - "path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup", - "style": { - "app-plus": { - "animationDuration": 200, - "animationType": "fade-in", - "background": "transparent", - "backgroundColorTop": "transparent", - "popGesture": "none", - "scrollIndicator": false, - "titleNView": false - }, - "disableScroll": true - } -} ,{ "path" : "pages/ProductManage/EmptyPipeOutStore", "style" : diff --git a/pages/login/login.vue b/pages/login/login.vue index fe0fe56..55e67ff 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -15,6 +15,7 @@ 记住用户名 设置 + 升级版本 @@ -25,132 +26,23 @@ import {getCLodop, getPrinterList} from "@/utils/CLodopfuncs.js" import { RSAencrypt } from '@/utils/jsencrypt.js' import {handLogin} from '@/utils/getData2.js' - import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update' - export default { + export default { data() { return { user: this.$store.getters.loginName ? this.$store.getters.loginName : '', password: '', showPassword: false, saveUser: this.$store.getters.loginName ? true : false, - disabled: false, - version: '', - versionCode: '' + disabled: false } }, created () { - //#ifdef APP-PLUS - // 获取本地应用资源版本号 - plus.runtime.getProperty(plus.runtime.appid, (info) => { - this.version = info.version; - this.versionCode = info.versionCode ; - if (Number(this.versionCode) < 103) { - checkUpdate(); - } - }) - //#endif }, methods: { - // 检测版本更新 - async checkUpdates() { - // #ifdef APP-PLUS - //调用接口获取后台版本信息,检查是否需要更新 - let versionInfo = await this.$api.login.getAppInfo(); - console.log('获取后台版本信息', versionInfo); - // 待更新版本 - const currentVersion = versionInfo.versionName; - console.log('后台需要更新版本', currentVersion); - // 更新地址 - let androidUrl = versionInfo.url; - // 是否强制更新 isMust 0.否 1.强制更新 - let showCancel = versionInfo.isMust ? true : false; - // 比较版本是否不同 当前版本:plus.runtime.version - const localVersion = plus.runtime.version.split('.'); - let current = currentVersion.split('.'); - // 默认是同一个版本,不需要更新 - let flag = false; - current.forEach((item, i) => { - if (item !== localVersion[i]) { - // 检测到版本不同,需要更新 - flag = true; - } - }); - - if (flag) { - uni.showModal({ - // 更新提醒 - title: '发现新版本,是否更新', - content: '待更新版本号:' + currentVersion , - // showCancel: showCancel, - success: res => { - if (res.confirm) { - this.doUpData(androidUrl); - this.showdownLine = true; - // plus.runtime.openURL(androidUrl) - } else if (res.cancel) { - // 不更新强制退出app - if (showCancel) { - console.log('不更新强制退出app'); - plus.runtime.quit(); - } - } - } - }); - } else { - this.$myToast('无更新', 'none'); - } - // #endif - }, - doUpData(Url) { - uni.showLoading({ - title: '更新中……' - }); - const downloadTask = uni.downloadFile({ - //执行下载 - url: Url, //下载地址 - timeout: 1000 * 30, //30秒超时时间 - success: downloadResult => { - //下载成功 - console.log(downloadResult); - this.showdownLine = false; - uni.hideLoading(); - if (downloadResult.statusCode == 200) { - plus.runtime.install( - //安装软件 - downloadResult.tempFilePath, - { - force: true - }, - function(res) { - plus.runtime.restart(); - } - ); - } - }, - fail: err => { - uni.hideLoading(); - this.showdownLine = false; - this.$u.toast(err.errMsg); - console.log(err); - }, - complete: com => { - console.log(com); - } - }); - - // 下载进度 - downloadTask.onProgressUpdate(res => { - // this.$u.toast(res.progress) - this.downloadNum = res.progress; - // console.log('下载进度' + res.progress); - // console.log('已经下载的数据长度' + res.totalBytesWritten); - // console.log('预期需要下载的数据总长度' + res.totalBytesExpectedToWrite); - - // 满足测试条件,取消下载任务。 - // if (res.progress > 50) { - // downloadTask.abort(); - // } - }); + isUpdate () { + uni.navigateTo({ + url: `/pages/login/upgrade` + }) }, test() { let LODOP = getCLodop(); @@ -239,13 +131,15 @@ margin: 25rpx 0 70rpx 0 height: 34rpx .radio-wrap - _fj() + _fj(flex-start) height: 34rpx + flex: 2 .radio-label _font(28rpx, 28rpx,#333) padding-left: 10rpx .setup-text _font(28rpx, 28rpx,$red,,right) + padding-left 25rpx .bg background-color: #fff; _bis('../../static/image/login_bg.png', 100%,,bottom) diff --git a/pages/login/upgrade.vue b/pages/login/upgrade.vue new file mode 100644 index 0000000..f6e019c --- /dev/null +++ b/pages/login/upgrade.vue @@ -0,0 +1,226 @@ + + + + + diff --git a/static/image/app_update_close.png b/static/image/app_update_close.png new file mode 100644 index 0000000..8b2ffe6 Binary files /dev/null and b/static/image/app_update_close.png differ diff --git a/static/image/bg_top.png b/static/image/bg_top.png new file mode 100644 index 0000000..015f698 Binary files /dev/null and b/static/image/bg_top.png differ diff --git a/utils/getData2.js b/utils/getData2.js index 378f15b..bea3de0 100644 --- a/utils/getData2.js +++ b/utils/getData2.js @@ -1,5 +1,14 @@ import request from './request.js' +// 版本更新测试 +// export const getAppInfo = () => { +// let res = { +// versionName: '1.0.2', +// url: '' +// } +// return res +// } + // 登录 export const handLogin = (user, password) => request({ url:'mobile/auth/login',