From d44f9a90be53b45070a33583cc257d5e40dcac88 Mon Sep 17 00:00:00 2001 From: guoshuang Date: Wed, 19 Jan 2022 16:26:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E8=87=AA=E5=8A=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=EF=BC=8C=E6=95=B0=E9=87=8F=E8=BE=93=E5=85=A5=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/lang/cn.ts | 2 + src/i18n/lang/en.ts | 2 + src/pages/login/login/index.vue | 117 ++++++++++++++---- .../outbound/stoOutbound/DN-delivergoods.vue | 4 +- .../warehouse/wholeLnventory/index.vue | 2 +- src/pages/raw/commission/entrant/index.vue | 4 +- src/pages/raw/handover/feeding/Location.vue | 4 +- src/pages/raw/handover/picking/ByOrder.vue | 2 +- src/pages/raw/handover/picking/BySummary.vue | 2 +- src/pages/raw/handover/returning/index.vue | 2 +- src/pages/raw/ingoods/dnReceipt/ImportDN.vue | 2 +- .../raw/ingoods/dnReceipt/dnReceiving.vue | 11 +- src/pages/raw/warehouse/rowCollect/index.vue | 2 +- .../raw/warehouse/rowInventory/index.vue | 1 + src/pages/raw/warehouse/rowScrap/index.vue | 2 +- src/pages/raw/warehouse/rowTransfer/index.vue | 2 +- 16 files changed, 117 insertions(+), 44 deletions(-) diff --git a/src/i18n/lang/cn.ts b/src/i18n/lang/cn.ts index ea77d66..23a2496 100644 --- a/src/i18n/lang/cn.ts +++ b/src/i18n/lang/cn.ts @@ -27,6 +27,8 @@ export default { //版本更新 updatePrompt: '更新提示', Tip1: '检测到有新版本,是否更新?', + restart: '重启', + Tip2: '更新成功,是否重启?', //服务器设置 ServerSetting: '服务器设置', PleaseInputIPAddress: '请输入IP地址', diff --git a/src/i18n/lang/en.ts b/src/i18n/lang/en.ts index 7442075..a25273a 100644 --- a/src/i18n/lang/en.ts +++ b/src/i18n/lang/en.ts @@ -30,6 +30,8 @@ export default { //版本更新 updatePrompt: 'Update tips', Tip1: 'New version detected, update?', + restart: 'restart', + Tip2: 'Update succeeded. Are you sure to restart?', //服务器设置 ServerSetting: 'Server Setting', PleaseInputIPAddress: 'Please input IP address', diff --git a/src/pages/login/login/index.vue b/src/pages/login/login/index.vue index a7f0d9e..6036d29 100644 --- a/src/pages/login/login/index.vue +++ b/src/pages/login/login/index.vue @@ -86,6 +86,7 @@ import { BasePage } from '@/components/base/page'; import { VForm } from 'vue/types/form'; import { Lang } from '@/i18n'; import { url } from '@/utils/url'; +import { path } from 'lodash/fp'; // import { any } from 'lodash/fp'; @Component({ @@ -143,10 +144,8 @@ export default class LoginPage extends BasePage { async update() { await session.QueryVersion(); if (this.Version != session.Version) { - //alert('版本更新啦!'); // 版本更新提示 uni.showModal({ - //title: this.$t('message.updatePrompt') as string, content: this.$t('message.Tip1') as string, confirmText: this.$t('message.workArea_Confirm') as string, cancelText: this.$t('message.Cancel') as string, @@ -154,38 +153,104 @@ export default class LoginPage extends BasePage { if (res.confirm) { //确定执行下载 let downloadApkUrl = session.url; - // uni.downloadFile({ - // url: downloadApkUrl, - // }); - var dtask = plus.downloader.createDownload(downloadApkUrl, {}, function (d, status) { - if (status == 200) { - console.log('Download success: ' + d.filename); - uni.showToast({ - icon: 'none', - title: d.filename, - }); - } else { - console.log('Download failed: ' + status); - } + ////////////////uni下载方法, + uni.downloadFile({ + url: downloadApkUrl, + success: (downloadResult) => { + //uni.hideLoading(); + if (downloadResult.statusCode == 200) { + //安装更新 + plus.runtime.install(downloadResult.tempFilePath, { force: true }, function (res) { + //uni.showToast('更新成功,重启'); + plus.runtime.restart(); + }); + // uni.showModal({ + // //content: '更新更新', + // content: this.$t('message.Tip2') as string, + // confirmText: this.$t('message.restart') as string, + // cancelText: this.$t('message.Cancel') as string, + // success: function (res) { + // if (res.confirm == true) { + // plus.runtime.install(downloadResult.tempFilePath, { force: true }, function (res) { + // //uni.showToast('更新成功,重启'); + // plus.runtime.restart(); + // }); + // } + // }, + // }); + } + }, }); - dtask.start(); + ///////////////////// plus方法 + // plus.downloader + // .createDownload(downloadApkUrl, {}, function (d, status) { + // uni.showModal({ + // content: status, + // }); + // if (status == 200) { + // uni.showModal({ + // title: '', + // content: this.$t('message.Tip2') as string, + // confirmText: this.$t('message.restart') as string, + // cancelText: this.$t('message.Cancel') as string, + // success: function (res) { + // if (res.confirm == true) { + // plus.runtime.install(plus.io.convertLocalFileSystemURL(d.filename), { force: true }, function (res) { + // //uni.showToast('更新成功,重启'); + // plus.runtime.restart(); + // }); + // } + // }, + // }); + // } else { + // console.log('Download failed: ' + status); + // } + // }) + // .start(); + // dtask.start(); + /////////////////plus 方法 } else if (res.cancel) { //console.log('用户点击取消'); } }, }); - - //dtask.addEventListener("statechanged", onStateChanged, false); - // await uni.downloadFile({ - // url: session.url, - // success: (res) => { - // console.log('res.statusCode', res.statusCode); - // console.log('res.tempFilePath', res.tempFilePath); - // console.log("url,url,url",session.url); - // }, - // }); } } + /////////////////无用代码无用代码 + // 更新应用资源 + async installApk(path) { + plus.runtime.install( + path, + {}, + function () { + console.log('安装文件成功!'); + + plus.runtime.restart(); + }, + function (e) { + uni.hideLoading(); + console.log(JSON.stringify(e)); //这里!e一直为null,path路径为_downloads/apk/10.apk + uni.showToast({ + title: '安装失败', + mask: false, + duration: 1500, + }); + }, + ); + } + /* 安装失败 */ + failed() { + uni.showToast({ + icon: 'none', + mask: true, + title: '更新失败!请退出重试或向工作人员反映', + duration: 1500, + }); + setTimeout(function () { + plus.runtime.quit(); + }, 1500); + } + //////////////////////////// login(): void { this.$form.validate(async (valid: boolean) => { if (valid) { diff --git a/src/pages/product/outbound/stoOutbound/DN-delivergoods.vue b/src/pages/product/outbound/stoOutbound/DN-delivergoods.vue index fcaf892..7f2d082 100644 --- a/src/pages/product/outbound/stoOutbound/DN-delivergoods.vue +++ b/src/pages/product/outbound/stoOutbound/DN-delivergoods.vue @@ -14,7 +14,7 @@ - + @@ -38,7 +38,7 @@ - + diff --git a/src/pages/product/warehouse/wholeLnventory/index.vue b/src/pages/product/warehouse/wholeLnventory/index.vue index fd8c3b3..54b9cf3 100644 --- a/src/pages/product/warehouse/wholeLnventory/index.vue +++ b/src/pages/product/warehouse/wholeLnventory/index.vue @@ -31,7 +31,7 @@ - + diff --git a/src/pages/raw/commission/entrant/index.vue b/src/pages/raw/commission/entrant/index.vue index ed4ec6c..b4fdf26 100644 --- a/src/pages/raw/commission/entrant/index.vue +++ b/src/pages/raw/commission/entrant/index.vue @@ -47,11 +47,11 @@ {{ $t('message.CommissionedLocation') }} - + {{ $t('message.CommissionedThisNumber') }} - + diff --git a/src/pages/raw/handover/feeding/Location.vue b/src/pages/raw/handover/feeding/Location.vue index d503c91..f4a2b7e 100644 --- a/src/pages/raw/handover/feeding/Location.vue +++ b/src/pages/raw/handover/feeding/Location.vue @@ -26,11 +26,11 @@ {{ $t('message.CommissionedLocation') }} - + {{ $t('message.CommissionedThisNumber') }} - + diff --git a/src/pages/raw/handover/picking/ByOrder.vue b/src/pages/raw/handover/picking/ByOrder.vue index 4ea5057..b15b119 100644 --- a/src/pages/raw/handover/picking/ByOrder.vue +++ b/src/pages/raw/handover/picking/ByOrder.vue @@ -29,7 +29,7 @@ {{ $t('message.CommissionedThisNumber') }}: - + diff --git a/src/pages/raw/handover/picking/BySummary.vue b/src/pages/raw/handover/picking/BySummary.vue index ae3413b..d4ff2c6 100644 --- a/src/pages/raw/handover/picking/BySummary.vue +++ b/src/pages/raw/handover/picking/BySummary.vue @@ -30,7 +30,7 @@ {{ $t('message.CommissionedThisNumber') }}: - + diff --git a/src/pages/raw/handover/returning/index.vue b/src/pages/raw/handover/returning/index.vue index 7b737ef..13fe7d4 100644 --- a/src/pages/raw/handover/returning/index.vue +++ b/src/pages/raw/handover/returning/index.vue @@ -54,7 +54,7 @@ - + diff --git a/src/pages/raw/ingoods/dnReceipt/ImportDN.vue b/src/pages/raw/ingoods/dnReceipt/ImportDN.vue index 17489e3..05d79b8 100644 --- a/src/pages/raw/ingoods/dnReceipt/ImportDN.vue +++ b/src/pages/raw/ingoods/dnReceipt/ImportDN.vue @@ -59,7 +59,7 @@ {{ $t('message.CommissionedThisNumber') }} - + diff --git a/src/pages/raw/ingoods/dnReceipt/dnReceiving.vue b/src/pages/raw/ingoods/dnReceipt/dnReceiving.vue index 119d3e8..634624a 100644 --- a/src/pages/raw/ingoods/dnReceipt/dnReceiving.vue +++ b/src/pages/raw/ingoods/dnReceipt/dnReceiving.vue @@ -44,11 +44,11 @@ {{ $t('message.DemandQuantity') }} - + {{ $t('message.Cumulative') }} - + @@ -59,7 +59,7 @@ {{ $t('message.CommissionedThisNumber') }} - + @@ -138,10 +138,13 @@ export default class dnReceiptDom extends BasePage { poNo: any = null; // 需求数量 requestAmount: number = null; - + //receiptAmount = (this.receiptAmount.match(/\d+(.\d{0,2})?/) || [''])[0]; async onReady() { //this.initLocation(); } + input() { + this.receiptAmount = (this.receiptAmount.match(/\d+(.\d{0,2})?/) || [''])[0]; + } // 页面初始化 // 页面需要清空仓库,因此需要复用该方法 async initLocation(condition): Promise { diff --git a/src/pages/raw/warehouse/rowCollect/index.vue b/src/pages/raw/warehouse/rowCollect/index.vue index 270f797..1f12565 100644 --- a/src/pages/raw/warehouse/rowCollect/index.vue +++ b/src/pages/raw/warehouse/rowCollect/index.vue @@ -28,7 +28,7 @@ - + diff --git a/src/pages/raw/warehouse/rowInventory/index.vue b/src/pages/raw/warehouse/rowInventory/index.vue index c563e67..2821d63 100644 --- a/src/pages/raw/warehouse/rowInventory/index.vue +++ b/src/pages/raw/warehouse/rowInventory/index.vue @@ -47,6 +47,7 @@ diff --git a/src/pages/raw/warehouse/rowScrap/index.vue b/src/pages/raw/warehouse/rowScrap/index.vue index f7b5d41..eee8e86 100644 --- a/src/pages/raw/warehouse/rowScrap/index.vue +++ b/src/pages/raw/warehouse/rowScrap/index.vue @@ -28,7 +28,7 @@ - + diff --git a/src/pages/raw/warehouse/rowTransfer/index.vue b/src/pages/raw/warehouse/rowTransfer/index.vue index 46bedf4..88a94af 100644 --- a/src/pages/raw/warehouse/rowTransfer/index.vue +++ b/src/pages/raw/warehouse/rowTransfer/index.vue @@ -35,7 +35,7 @@ - +