feat: 更新正式环境API地址并默认选用

This commit is contained in:
2026-10-30 11:59:10 +08:00
parent a4dbcbe504
commit b1404fdd89
7 changed files with 46 additions and 36 deletions
+6 -6
View File
@@ -21,21 +21,21 @@ const config = {
isDevelopment: isDevelopment,
// 生产环境API URL(服务名段 hcscm_weave)
productionApiUrl: process.env.VUE_APP_PRODUCTION_API_URL || 'https://www.haotopai.com/hcscm_weave/mes/server/pda/v1',
productionApiUrl: process.env.VUE_APP_PRODUCTION_API_URL,
// 开发环境API URL选项(仅替换 //域名/ 后第一个路径段 hcscm → hcscm_weave,不改域名)
devApiUrlOptions: [
{ label: '测试环境', value: 'https://hcscmtest.zzfzyc.com/hcscm_weave/pda/v1' },
{ label: '正式环境', value: process.env.VUE_APP_DEV_API_URL || process.env.VUE_APP_PRODUCTION_API_URL || 'https://www.haotopai.com/hcscm_weave/mes/server/pda/v1' },
{ label: '本地环境', value: 'http://192.168.1.66:7010/hcscm_weave/pda/v1' },
{ label: '正式环境', value: process.env.VUE_APP_PRODUCTION_API_URL },
// { label: '本地环境', value: 'http://192.168.1.66:7010/hcscm_weave/pda/v1' },
{ label: '自定义', value: 'custom' }
]
}
export function getTestApiUrl() {
const test = config.devApiUrlOptions.find(item => item.label === '测试环境');
return (test && test.value) || 'https://hcscmtest.zzfzyc.com/hcscm_weave/pda/v1';
export function getDefaultApiUrl() {
const prod = config.devApiUrlOptions.find(item => item.label === '正式环境');
return (prod && prod.value) || config.productionApiUrl || 'https://zszc.yushangfangzhi.com/server/hcscm_weave/pda/v1';
}
export default config;
+2 -2
View File
@@ -2,8 +2,8 @@
"name" : "浩拓织厂",
"appid" : "__UNI__F79F300",
"description" : "周尚-浩拓织厂",
"versionName" : "1.1.13",
"versionCode" : 113,
"versionName" : "1.1.14",
"versionCode" : 114,
"transformPx" : false,
"app-plus" : {
"optimization" : {
+5 -5
View File
@@ -117,7 +117,7 @@
/**
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
*/
import config, { getTestApiUrl } from '@/common/config.js';
import config, { getDefaultApiUrl } from '@/common/config.js';
import base64 from '@/common/base64.js';
import util from '@/common/util.js';
import md5 from '@/common/md5.js';
@@ -135,7 +135,7 @@ export default {
password: ""
},
showApiUrlPicker: false,
selectedApiUrl: getTestApiUrl(),
selectedApiUrl: getDefaultApiUrl(),
customApiUrl: 'http://192.168.1.66:50002/hcscm_weave/pda/v1',
apiUrlList: config.devApiUrlOptions,
phoneNo: '',
@@ -169,9 +169,9 @@ export default {
},
onShow() {
const testUrl = getTestApiUrl();
util.updateApiUrl(testUrl);
this.selectedApiUrl = testUrl;
const defaultUrl = getDefaultApiUrl();
util.updateApiUrl(defaultUrl);
this.selectedApiUrl = defaultUrl;
uni.getStorage({
key: 'UserInfo',
+6 -6
View File
@@ -1,7 +1,7 @@
/**
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
*/
import config, { getTestApiUrl } from '@/common/config.js';
import config, { getDefaultApiUrl } from '@/common/config.js';
import util from '@/common/util.js';
import Vue from 'vue'
import Vuex from 'vuex'
@@ -19,15 +19,15 @@ try{
}
// 初始化API URL
// 初始化API URL(默认正式环境)
function initApiUrl() {
const testUrl = getTestApiUrl();
const defaultUrl = getDefaultApiUrl();
try {
uni.setStorageSync('ApiUrl', testUrl);
uni.setStorageSync('ApiUrl', defaultUrl);
} catch (e) {
console.log('写入测试环境地址失败', e);
console.log('写入正式环境地址失败', e);
}
return testUrl;
return defaultUrl;
}
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名