makeServerUrl(...) 统一使用 servXxx 变量,在配置文件中根据环境来设置 servXxx,不再使用 servXxxDev 变量

This commit is contained in:
陆柯 2022-06-05 13:31:44 +08:00
parent 241798d443
commit a325868e08

View File

@ -70,8 +70,7 @@ export default {
})
// #ifdef H5
document.title =
windowTitle || wo?.envar?.Sys_Brand_Name?.[mylang] || pagesJson?.appInfo?.i18nText?.[mylang] || pagesJson?.globalStyle?.navigationBarTitleText // 必须放在 setNavigationBarTitle 之后,否则会被其覆盖掉。
document.title = windowTitle || wo?.envar?.callname?.[mylang] || pagesJson?.appInfo?.i18nText?.[mylang] || pagesJson?.globalStyle?.navigationBarTitleText // 必须放在 setNavigationBarTitle 之后,否则会被其覆盖掉。
// #endif
// 必须要在有 tab 的页面里 setTabBarItem 才有效果
@ -119,26 +118,18 @@ export default {
return route
}
let protocol, hostname, port
if (process.env.NODE_ENV === 'production') {
protocol = envar.servProtocol || 'https'
hostname = envar.servHostname
port = envar.servPort
} else {
protocol = envar.servProtocolDev || 'http'
hostname =
envar.servHostnameDev ||
const protocol = envar.servProtocol || (process.env.NODE_ENV === 'production' ? 'https' : 'http')
let hostname = envar.servHostname
let port = envar.servPort
// #ifdef H5
window.location.hostname
// #endif
port =
envar.servPortDev ||
envar.servPort ||
// #ifdef H5
window.location.port.replace(':', '')
// #endif
if (!hostname) {
hostname = window?.location?.hostname
}
if (!port) {
port = window?.location?.port?.replace(':', '')
}
// #endif
return `${protocol}://${hostname}:${port}/${route.replace(/^\//, '')}`
},