From 2903972e557cd9664850a5e5cf5446cd7db2cf9e Mon Sep 17 00:00:00 2001
From: xuan <1359774872@qq.com>
Date: Fri, 30 Oct 2026 10:41:17 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=9D=E5=AD=98=E6=94=B9=E4=BA=BA?=
=?UTF-8?q?=E5=A3=B0=E5=B9=B6=E9=BB=98=E8=AE=A4=E6=AD=A3=E5=BC=8F=E7=8E=AF?=
=?UTF-8?q?=E5=A2=83=E5=9C=B0=E5=9D=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.zhoushang | 4 +--
src/common/config.js | 4 +--
src/common/util.js | 28 +++++++++++++++++--
.../storeFabricBusinessOutMixin.js | 6 ++--
.../storegoods/storeGoodsProcessInMixin.js | 6 ++--
.../storegoods/storeGoodsProcessOutMixin.js | 6 ++--
.../storeGoodsProcessReturnInMixin.js | 6 ++--
.../storegoods/storeGoodsPurchaseInMixin.js | 6 ++--
src/pages/sys/login/index.vue | 16 +++++++----
src/store/index.js | 4 +--
10 files changed, 55 insertions(+), 31 deletions(-)
diff --git a/.env.zhoushang b/.env.zhoushang
index 1c97cdb..cf32d57 100644
--- a/.env.zhoushang
+++ b/.env.zhoushang
@@ -1,5 +1,5 @@
NODE_ENV = production
VUE_APP_ENV_NAME = zhoushang环境
VUE_APP_UPGRADE_NAME = erp_pda_zhoushang
-VUE_APP_PRODUCTION_API_URL = https://hcscmtest.zzfzyc.com/hcscm_weave/pda/v1
-VUE_APP_DEV_API_URL = https://hcscmtest.zzfzyc.com/hcscm_weave/pda/v1
+VUE_APP_PRODUCTION_API_URL = https://zsfz.yushangfangzhi.com/server/pda/v1
+VUE_APP_DEV_API_URL = https://zsfz.yushangfangzhi.com/server/pda/v1
diff --git a/src/common/config.js b/src/common/config.js
index ca2af73..2217b90 100644
--- a/src/common/config.js
+++ b/src/common/config.js
@@ -21,14 +21,14 @@ const config = {
isDevelopment: isDevelopment,
// 生产环境API URL(服务名段 hcscm)
- productionApiUrl: process.env.VUE_APP_PRODUCTION_API_URL || 'https://www.haotopai.com/hcscm/pda/v1',
+ productionApiUrl: process.env.VUE_APP_PRODUCTION_API_URL,
// 开发环境API URL选项(服务名段 hcscm)
devApiUrlOptions: [
{ label: '测试环境', value: 'https://hcscmtest.zzfzyc.com/hcscm/pda/v1' },
{ label: '本地环境', value: 'http://192.168.1.66:7010/hcscm/pda/v1' },
{ label: '本地穿透', value: 'https://2yd52gx88533.vicp.fun/hcscm/pda/v1' },
- { label: '正式环境', value: process.env.VUE_APP_DEV_API_URL || 'https://www.haotopai.com/hcscm/pda/v1' },
+ { label: '正式环境', value: process.env.VUE_APP_PRODUCTION_API_URL },
{ label: '自定义', value: 'custom' }
]
diff --git a/src/common/util.js b/src/common/util.js
index 25865c3..6a64a6a 100644
--- a/src/common/util.js
+++ b/src/common/util.js
@@ -346,20 +346,42 @@ function statusSuccessVoice(action) {
/** 成功/失败提示音约 0.9 秒,播完再朗读,避免提示音抢走语音 */
let speakFeedbackTimer = null;
-function speakFeedback(text, fallback) {
+function voiceContent(text, fallback) {
let content = String(text == null ? '' : text)
.replace(/[\r\n\t]/g, '')
.replace(/[!!。..??;;,,、]/g, '')
.trim();
if (!content || content.length > 32) content = fallback;
- if (speakFeedbackTimer) clearTimeout(speakFeedbackTimer);
+ return content;
+}
+
+function clearSpeakFeedbackTimer() {
+ if (!speakFeedbackTimer) return;
+ clearTimeout(speakFeedbackTimer);
+ speakFeedbackTimer = null;
+}
+
+function speakFeedback(text, fallback) {
+ const content = voiceContent(text, fallback);
+ clearSpeakFeedbackTimer();
speakFeedbackTimer = setTimeout(() => {
speakFeedbackTimer = null;
speak(content);
}, 1100);
}
-function playSuccessAudio(text) {
+/** 只播人声,不播提示音 */
+function speakNow(text, fallback) {
+ clearSpeakFeedbackTimer();
+ if (successAudio) successAudio.stop();
+ speak(voiceContent(text, fallback));
+}
+
+function playSuccessAudio(text, options) {
+ if (options && options.voiceOnly) {
+ speakNow(text, '成功');
+ return;
+ }
speakFeedback(text, '成功');
if (!successAudio) {
//console.log("create success");
diff --git a/src/pages/storefabric/storeFabricBusinessOutMixin.js b/src/pages/storefabric/storeFabricBusinessOutMixin.js
index 46b0858..6c3f11c 100644
--- a/src/pages/storefabric/storeFabricBusinessOutMixin.js
+++ b/src/pages/storefabric/storeFabricBusinessOutMixin.js
@@ -248,7 +248,7 @@ export default {
this.applyOrder(order);
this.headerSaved = true;
this.syncCanScanFromStatus(order.audit_status);
- this.showSuccess('保存成功,可以扫码', '提交成功');
+ this.showSuccess('保存成功,可以扫码', '保存成功', { voiceOnly: true });
this.registerOrderScanBroadcast();
})
.catch((e) => {
@@ -398,8 +398,8 @@ export default {
if (!options.skipErrorAudio) util.playErrorAudio(message);
uni.showModal({ title: '提示', content: message, showCancel: false });
},
- showSuccess(message, voiceText) {
- util.playSuccessAudio(voiceText || message);
+ showSuccess(message, voiceText, options) {
+ util.playSuccessAudio(voiceText || message, options);
uni.showToast({ title: message, icon: 'success' });
},
getBillTypeName() {
diff --git a/src/pages/storegoods/storeGoodsProcessInMixin.js b/src/pages/storegoods/storeGoodsProcessInMixin.js
index 9a755b4..cc7d63d 100644
--- a/src/pages/storegoods/storeGoodsProcessInMixin.js
+++ b/src/pages/storegoods/storeGoodsProcessInMixin.js
@@ -496,7 +496,7 @@ export default {
this.headerSaved = true;
this.clearWarehouseBin();
this.syncCanScanFromStatus(order.audit_status);
- this.showSuccess('保存成功,请先扫描仓位', '提交成功');
+ this.showSuccess('保存成功,请先扫描仓位', '保存成功', { voiceOnly: true });
this.registerOrderScanBroadcast();
})
.catch((e) => {
@@ -645,8 +645,8 @@ export default {
util.playErrorAudio(message);
uni.showModal({ title: '提示', content: message, showCancel: false });
},
- showSuccess(message, voiceText) {
- util.playSuccessAudio(voiceText || message);
+ showSuccess(message, voiceText, options) {
+ util.playSuccessAudio(voiceText || message, options);
uni.showToast({ title: message, icon: 'success' });
},
},
diff --git a/src/pages/storegoods/storeGoodsProcessOutMixin.js b/src/pages/storegoods/storeGoodsProcessOutMixin.js
index 88c9d6a..264aa1a 100644
--- a/src/pages/storegoods/storeGoodsProcessOutMixin.js
+++ b/src/pages/storegoods/storeGoodsProcessOutMixin.js
@@ -367,7 +367,7 @@ export default {
this.applyOrder(order);
this.headerSaved = true;
this.syncCanScanFromStatus(order.audit_status);
- this.showSuccess('保存成功,请开始扫码', '提交成功');
+ this.showSuccess('保存成功,请开始扫码', '保存成功', { voiceOnly: true });
this.registerOrderScanBroadcast();
})
.catch((e) => {
@@ -488,8 +488,8 @@ export default {
util.playErrorAudio(message);
uni.showModal({ title: '提示', content: message, showCancel: false });
},
- showSuccess(message, voiceText) {
- util.playSuccessAudio(voiceText || message);
+ showSuccess(message, voiceText, options) {
+ util.playSuccessAudio(voiceText || message, options);
uni.showToast({ title: message, icon: 'success' });
},
},
diff --git a/src/pages/storegoods/storeGoodsProcessReturnInMixin.js b/src/pages/storegoods/storeGoodsProcessReturnInMixin.js
index 7dfd1b4..aef07d6 100644
--- a/src/pages/storegoods/storeGoodsProcessReturnInMixin.js
+++ b/src/pages/storegoods/storeGoodsProcessReturnInMixin.js
@@ -419,7 +419,7 @@ export default {
this.headerSaved = true;
this.clearWarehouseBin();
this.syncCanScanFromStatus(order.audit_status);
- this.showSuccess('保存成功,请先扫描仓位', '提交成功');
+ this.showSuccess('保存成功,请先扫描仓位', '保存成功', { voiceOnly: true });
this.registerOrderScanBroadcast();
})
.catch((e) => {
@@ -545,8 +545,8 @@ export default {
util.playErrorAudio(message);
uni.showModal({ title: '提示', content: message, showCancel: false });
},
- showSuccess(message, voiceText) {
- util.playSuccessAudio(voiceText || message);
+ showSuccess(message, voiceText, options) {
+ util.playSuccessAudio(voiceText || message, options);
uni.showToast({ title: message, icon: 'success' });
},
},
diff --git a/src/pages/storegoods/storeGoodsPurchaseInMixin.js b/src/pages/storegoods/storeGoodsPurchaseInMixin.js
index 8824f83..6152992 100644
--- a/src/pages/storegoods/storeGoodsPurchaseInMixin.js
+++ b/src/pages/storegoods/storeGoodsPurchaseInMixin.js
@@ -501,7 +501,7 @@ export default {
this.headerSaved = true;
this.clearWarehouseBin();
this.syncCanScanFromStatus(order.audit_status);
- this.showSuccess('保存成功,请先扫描仓位', '提交成功');
+ this.showSuccess('保存成功,请先扫描仓位', '保存成功', { voiceOnly: true });
this.registerOrderScanBroadcast();
})
.catch((e) => {
@@ -650,8 +650,8 @@ export default {
util.playErrorAudio(message);
uni.showModal({ title: '提示', content: message, showCancel: false });
},
- showSuccess(message, voiceText) {
- util.playSuccessAudio(voiceText || message);
+ showSuccess(message, voiceText, options) {
+ util.playSuccessAudio(voiceText || message, options);
uni.showToast({ title: message, icon: 'success' });
},
},
diff --git a/src/pages/sys/login/index.vue b/src/pages/sys/login/index.vue
index e9bc680..8725a39 100644
--- a/src/pages/sys/login/index.vue
+++ b/src/pages/sys/login/index.vue
@@ -104,8 +104,8 @@
-
+
版本: {{ appVersion }}
@@ -136,10 +136,8 @@ export default {
password: ""
},
showApiUrlPicker: false,
- // 暂时在打包后也展示服务器选项;生产包默认正式环境
- selectedApiUrl: config.isDevelopment
- ? config.devApiUrlOptions[0].value
- : ((config.devApiUrlOptions.find(item => item.label === '正式环境') || {}).value || config.productionApiUrl),
+ // 登录默认正式环境,本地已选过的地址仍会在 onShow 里恢复
+ selectedApiUrl: (config.devApiUrlOptions.find(item => item.label === '正式环境') || {}).value || config.productionApiUrl,
customApiUrl: 'http://192.168.1.66:50002/hcscm/pda/v1',
apiUrlList: config.devApiUrlOptions,
phoneNo: '',
@@ -169,6 +167,12 @@ export default {
},
envName() {
return process.env.VUE_APP_ENV_NAME || '';
+ },
+ apiUrlDefaultIndex() {
+ const list = this.apiUrlList || [];
+ let index = list.findIndex(item => item.value === this.selectedApiUrl);
+ if (index < 0) index = list.findIndex(item => item.label === '正式环境');
+ return [index >= 0 ? index : 0];
}
},
diff --git a/src/store/index.js b/src/store/index.js
index 5dd4f7d..07ac109 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -26,9 +26,7 @@ function normalizeApiUrl(url) {
// 初始化API URL
function initApiUrl() {
- const fallbackUrl = config.isDevelopment
- ? config.devApiUrlOptions[0].value
- : ((config.devApiUrlOptions.find(item => item.label === '正式环境') || {}).value || config.productionApiUrl);
+ const fallbackUrl = (config.devApiUrlOptions.find(item => item.label === '正式环境') || {}).value || config.productionApiUrl;
try {
const savedApiUrl = uni.getStorageSync('ApiUrl');
const url = normalizeApiUrl(savedApiUrl || fallbackUrl);