feat: 保存改人声并默认正式环境地址
This commit is contained in:
+2
-2
@@ -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
|
||||
|
||||
@@ -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' }
|
||||
]
|
||||
|
||||
|
||||
+25
-3
@@ -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");
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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' });
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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' });
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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' });
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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' });
|
||||
},
|
||||
},
|
||||
|
||||
@@ -104,8 +104,8 @@
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </div>-->
|
||||
<u-select class="login-env-picker" v-model="showApiUrlPicker" :list="apiUrlList" title="选择服务器"
|
||||
@confirm="onApiUrlConfirm" @cancel="showApiUrlPicker = false"></u-select>
|
||||
<u-select class="login-env-picker" v-model="showApiUrlPicker" :list="apiUrlList" :default-value="apiUrlDefaultIndex"
|
||||
title="选择服务器" @confirm="onApiUrlConfirm" @cancel="showApiUrlPicker = false"></u-select>
|
||||
<!-- 版本信息显示 -->
|
||||
<view class="version-info">
|
||||
<text class="version-text">版本: {{ appVersion }}</text>
|
||||
@@ -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];
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
+1
-3
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user