feat: 保存改人声并默认正式环境地址

This commit is contained in:
2026-10-30 10:41:17 +08:00
parent 917d028ca0
commit 2903972e55
10 changed files with 55 additions and 31 deletions
+10 -6
View File
@@ -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];
}
},