From 9fcbad1f8e9d6aad598b4028628dfa35554a6597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Tue, 4 Nov 2025 14:27:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E8=B7=AF=E5=BE=84=E5=92=8C=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor: 移除调试日志和冗余代码 style: 格式化代码和修复条件判断逻辑 feat: 重新启用401错误处理并优化表单重置逻辑 --- .../components/panels/code/merge.vue | 2 +- .../components/panels/code/typing.vue | 73 +++++++++---------- apps/hand-factory/manifest.json | 2 +- apps/hand-factory/pages/index.vue | 36 +-------- apps/hand-factory/pages/login.vue | 2 +- apps/hand-factory/store/modules/user.js | 1 - apps/hand-factory/utils/request.js | 14 ++-- 7 files changed, 50 insertions(+), 80 deletions(-) diff --git a/apps/hand-factory/components/panels/code/merge.vue b/apps/hand-factory/components/panels/code/merge.vue index 8113900..de21374 100644 --- a/apps/hand-factory/components/panels/code/merge.vue +++ b/apps/hand-factory/components/panels/code/merge.vue @@ -762,7 +762,7 @@ export default { itemType: this.itemType || this.scannedCoils[0].itemType, // 优先使用选择的itemType itemId: this.itemId || this.scannedCoils[0].itemId, // 优先使用选择的itemId warehouseId: this.warehouseId || this.scannedCoils[0].warehouseId, // 使用选择的库区或第一个钢卷的库区 - actualWarehouseId: this.actualWarehouseId || this.scannedCoils[0].actualWarehouseId + actualWarehouseId: this.actualWarehouseId || this.scannedCoils[0].actualWarehouseId, grossWeight: this.grossWeight ? Number(this.grossWeight) : null, netWeight: this.netWeight ? Number(this.netWeight) : null, newCoils: this.scannedCoils.map(coil => ({ diff --git a/apps/hand-factory/components/panels/code/typing.vue b/apps/hand-factory/components/panels/code/typing.vue index 7367517..44c190f 100644 --- a/apps/hand-factory/components/panels/code/typing.vue +++ b/apps/hand-factory/components/panels/code/typing.vue @@ -76,11 +76,11 @@ - + 真实库区 - + @@ -612,41 +612,43 @@ closeWarehouseList() { this.showWarehouseList = false; }, - + handleReScan() { uni.showModal({ title: '确认重新扫码', content: '是否要清空当前数据并重新扫码?', success: (res) => { - this.handleReset() + if (res.confirm) { + this.handleReset() + } + } }); }, // 重新扫码 handleReset() { - if (res.confirm) { - this.form = { - coilId: undefined, - itemType: '', - itemId: undefined, - team: '', - currentCoilNo: '', - warehouseId: undefined, - actualWarehouseId: undefined, - warehouseName: '', - grossWeight: '', - netWeight: '' - }; - this.coilDetail = {}; - this.materialDetail = null; - this.bomItemList = []; - this.warehouseKeyword = ''; - this.currentWarehouseName = ''; - this.selectedProductName = ''; - this.filteredWarehouses = this.warehouses; - this.qrcodeStatus = 1; // 重置二维码状态 - } + + this.form = { + coilId: undefined, + itemType: '', + itemId: undefined, + team: '', + currentCoilNo: '', + warehouseId: undefined, + actualWarehouseId: undefined, + warehouseName: '', + grossWeight: '', + netWeight: '' + }; + this.coilDetail = {}; + this.materialDetail = null; + this.bomItemList = []; + this.warehouseKeyword = ''; + this.currentWarehouseName = ''; + this.selectedProductName = ''; + this.filteredWarehouses = this.warehouses; + this.qrcodeStatus = 1; // 重置二维码状态 }, // 提交 @@ -693,16 +695,13 @@ updateMaterialCoil(submitData).then(res => { if (res.code === 200) { - // uni.showToast({ - // title: '保存成功', - // icon: 'success' - // }); - // setTimeout(() => { - this.handleReset(); - // }, 1500); - uni.navigateTo({ - url: '/pages/scansuccess/scansuccess' - }) + uni.showToast({ + title: '保存成功', + icon: 'success' + }); + setTimeout(() => { + this.handleReset(); + }, 1500); } else { uni.showToast({ title: res.msg || '保存失败', diff --git a/apps/hand-factory/manifest.json b/apps/hand-factory/manifest.json index c40791d..2fa4627 100644 --- a/apps/hand-factory/manifest.json +++ b/apps/hand-factory/manifest.json @@ -2,7 +2,7 @@ "name" : "科伦普", "appid" : "__UNI__E781B49", "description" : "", - "versionName" : "3.5", + "versionName" : "1.3.7", "versionCode" : 1, "transformPx" : false, "app-plus" : { diff --git a/apps/hand-factory/pages/index.vue b/apps/hand-factory/pages/index.vue index 207e16a..a727b55 100644 --- a/apps/hand-factory/pages/index.vue +++ b/apps/hand-factory/pages/index.vue @@ -14,17 +14,14 @@ export default { if (this.hasJumped) return; // 显示加载状态,提升用户感知 - uni.showLoading({ - title: '验证身份中...', - mask: true // 防止用户重复操作 - }); + // uni.showLoading({ + // title: '验证身份中...', + // mask: true // 防止用户重复操作 + // }); // 检查用户角色 this.$store.dispatch('GetInfo') .then(res => { - uni.hideLoading(); // 关闭加载提示 - - console.log('获取身份信息内容', res.data, ) // 验证返回数据格式 if (!res || !res.data || !Array.isArray(res.data.roles)) { throw new Error('用户角色信息格式错误'); @@ -97,31 +94,6 @@ export default { uni.reLaunch({ url: '/pages/login' }) - // uni.hideLoading(); // 关闭加载提示 - // console.error('用户信息获取失败:', err); - - // // 区分错误类型,给出更精准提示 - // const errorMsg = err.message || '网络异常,请检查网络后重试'; - // uni.showToast({ - // title: errorMsg, - // icon: 'none', - // duration: 3000 - // }); - - // // 提供重试入口 - // setTimeout(() => { - // uni.showModal({ - // title: '加载失败', - // content: '是否重新登录?', - // success: (res) => { - // if (res.confirm) { - // uni.reLaunch({ - // url: '/pages/login' - // }) - // } - // } - // }); - // }, 3000); }); } } diff --git a/apps/hand-factory/pages/login.vue b/apps/hand-factory/pages/login.vue index 772a0e3..ba3b7ff 100644 --- a/apps/hand-factory/pages/login.vue +++ b/apps/hand-factory/pages/login.vue @@ -122,7 +122,7 @@ loginSuccess(result) { // 设置用户信息 this.$store.dispatch('GetInfo').then(res => { - this.$tab.reLaunch('/pages/easycode/easycode') + this.$tab.reLaunch('/pages/index') }) } } diff --git a/apps/hand-factory/store/modules/user.js b/apps/hand-factory/store/modules/user.js index c960f7c..7ddc10b 100644 --- a/apps/hand-factory/store/modules/user.js +++ b/apps/hand-factory/store/modules/user.js @@ -83,7 +83,6 @@ const user = { }) { return new Promise((resolve, reject) => { getInfo().then(res => { - console.log('个人信息', res) const user = res.data.user let avatar = user.avatar || "" if (!isHttp(avatar)) { diff --git a/apps/hand-factory/utils/request.js b/apps/hand-factory/utils/request.js index 63c80a9..672c52f 100644 --- a/apps/hand-factory/utils/request.js +++ b/apps/hand-factory/utils/request.js @@ -41,13 +41,13 @@ const request = config => { const code = res.data.code || 200 const msg = errorCode[code] || res.data.msg || errorCode['default'] if (code === 401) { - // showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => { - // if (res.confirm) { - // store.dispatch('LogOut').then(res => { - // uni.reLaunch({ url: '/pages/login' }) - // }) - // } - // }) + showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => { + if (res.confirm) { + store.dispatch('LogOut').then(res => { + uni.reLaunch({ url: '/pages/login' }) + }) + } + }) reject('无效的会话,或者会话已过期,请重新登录。') } else if (code === 500) { toast(msg)