rename envi to envar

This commit is contained in:
陆柯 2022-04-03 16:22:06 +08:00
parent 2a7d106b88
commit 46dce4a28e

View File

@ -95,19 +95,19 @@ export default {
// #ifdef H5 // #ifdef H5
if (uni.getSystemInfoSync().model==='PC') { if (uni.getSystemInfoSync().model==='PC') {
const envi = this.envi || wo?.envi || {} const envar = this.envar || wo?.envar || {}
if (envi.Responsive_Tabbar==='AUTOHIDE') { if (envar.Responsive_Tabbar==='AUTOHIDE') {
if (window.screen.width > (envi.Responsive_Tabbar_Autohide_Width_Threshold || this.RESPONSIVE_TABBAR_AUTOHIDE_WIDTH_THRESHOLD_DEFAULT)) { if (window.screen.width > (envar.Responsive_Tabbar_Autohide_Width_Threshold || this.RESPONSIVE_TABBAR_AUTOHIDE_WIDTH_THRESHOLD_DEFAULT)) {
uni.hideTabBar() uni.hideTabBar()
} }
uni.onWindowResize(({size})=>{ uni.onWindowResize(({size})=>{
if (size.windowWidth > (envi.Responsive_Tabbar_Autohide_Width_Threshold || this.RESPONSIVE_TABBAR_AUTOHIDE_WIDTH_THRESHOLD_DEFAULT)) { if (size.windowWidth > (envar.Responsive_Tabbar_Autohide_Width_Threshold || this.RESPONSIVE_TABBAR_AUTOHIDE_WIDTH_THRESHOLD_DEFAULT)) {
uni.hideTabBar() uni.hideTabBar()
}else{ }else{
uni.showTabBar() uni.showTabBar()
} }
}) })
}else if (envi.Responsive_Tabbar==='ALWAYSHIDE') { }else if (envar.Responsive_Tabbar==='ALWAYSHIDE') {
uni.hideTabBar() uni.hideTabBar()
} }
} }
@ -115,7 +115,7 @@ export default {
}, },
makeServerUrl(route = '') { makeServerUrl(route = '') {
const envi = this.envi || wo?.envi || {} const envar = this.envar || wo?.envar || {}
if (typeof route !== 'string') route = '' // 防止 route 为 null, undefined 等由于后台数据库默认值而造成的异常。 if (typeof route !== 'string') route = '' // 防止 route 为 null, undefined 等由于后台数据库默认值而造成的异常。
route = route.replace('\\', '/') route = route.replace('\\', '/')
@ -126,16 +126,16 @@ export default {
let protocol, hostname, port let protocol, hostname, port
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
protocol = envi.Base_Protocol || 'https' protocol = envar.Base_Protocol || 'https'
hostname = envi.Base_Hostname hostname = envar.Base_Hostname
port = envi.Base_Port port = envar.Base_Port
}else{ }else{
protocol = envi.Base_Protocol_Dev || 'http' protocol = envar.Base_Protocol_Dev || 'http'
hostname = envi.Base_Hostname_Dev hostname = envar.Base_Hostname_Dev
// #ifdef H5 // #ifdef H5
|| window.location.hostname || window.location.hostname
// #endif // #endif
port = envi.Base_Port_Dev || envi.Base_Port port = envar.Base_Port_Dev || envar.Base_Port
// #ifdef H5 // #ifdef H5
|| window.location.port.replace(':','') || window.location.port.replace(':','')
// #endif // #endif
@ -150,18 +150,18 @@ export default {
return '' return ''
}, },
relaunchForAll ({envi=this.envi || wo?.envi || {}} = {}) { relaunchForAll ({envar=this.envar || wo?.envar || {}} = {}) {
uni.reLaunch({ url: envi?.Start_Page_For_All }) uni.reLaunch({ url: envar?.Start_Page_For_All })
}, },
relaunchForOnline ({envi=this.envi || wo?.envi || {}} = {}) { relaunchForOnline ({envar=this.envar || wo?.envar || {}} = {}) {
process.env.NODE_ENV === 'production' && process.env.NODE_ENV === 'production' &&
wo.ss.User.onlineUser.uuid && wo.ss.User.onlineUser.uuid &&
uni.reLaunch({ url: envi?.Start_Page_For_Online }) uni.reLaunch({ url: envar?.Start_Page_For_Online })
}, },
relaunchForOffline ({envi=this.envi || wo?.envi || {}} ={}) { relaunchForOffline ({envar=this.envar || wo?.envar || {}} ={}) {
process.env.NODE_ENV === 'production' && process.env.NODE_ENV === 'production' &&
! wo.ss.User.onlineUser.uuid && ! wo.ss.User.onlineUser.uuid &&
uni.reLaunch({ url: envi?.Start_Page_For_Offline }) uni.reLaunch({ url: envar?.Start_Page_For_Offline })
}, },
/** uni.request uniCloud.callFunction /** uni.request uniCloud.callFunction
@ -171,7 +171,7 @@ export default {
* - CLINET_BACKEND_EXCEPTION: 前端发现后台异常 * - CLINET_BACKEND_EXCEPTION: 前端发现后台异常
**/ **/
async callBackend({ async callBackend({
backend = this.envi?.Backend_Default || wo?.envi?.Backend_Default || this.BACKEND_DEFAULT, backend = this.envar?.Backend_Default || wo?.envar?.Backend_Default || this.BACKEND_DEFAULT,
httpMethod = 'POST', httpMethod = 'POST',
apiVersion = 'api', apiWho, apiTodo, apiWhat = {} apiVersion = 'api', apiWho, apiTodo, apiWhat = {}
}) { }) {
@ -361,7 +361,7 @@ export default {
}, },
async pickupFile({ async pickupFile({
backend = this.envi?.Backend_Default || wo?.envi?.Backend_Default || this.BACKEND_DEFAULT, backend = this.envar?.Backend_Default || wo?.envar?.Backend_Default || this.BACKEND_DEFAULT,
mediaType = 'image', count = 1, sizeType = ['original', 'compressed'], sourceType = ['album', 'camera'], maxDuration, mediaType = 'image', count = 1, sizeType = ['original', 'compressed'], sourceType = ['album', 'camera'], maxDuration,
url, header = {}, formData = {}, name = 'file', url, header = {}, formData = {}, name = 'file',
}) { }) {