diff --git a/usertool.js b/usertool.js index 55d8b98..a196611 100644 --- a/usertool.js +++ b/usertool.js @@ -95,19 +95,19 @@ export default { // #ifdef H5 if (uni.getSystemInfoSync().model==='PC') { - const envi = this.envi || wo?.envi || {} - if (envi.Responsive_Tabbar==='AUTOHIDE') { - if (window.screen.width > (envi.Responsive_Tabbar_Autohide_Width_Threshold || this.RESPONSIVE_TABBAR_AUTOHIDE_WIDTH_THRESHOLD_DEFAULT)) { + const envar = this.envar || wo?.envar || {} + if (envar.Responsive_Tabbar==='AUTOHIDE') { + if (window.screen.width > (envar.Responsive_Tabbar_Autohide_Width_Threshold || this.RESPONSIVE_TABBAR_AUTOHIDE_WIDTH_THRESHOLD_DEFAULT)) { uni.hideTabBar() } 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() }else{ uni.showTabBar() } }) - }else if (envi.Responsive_Tabbar==='ALWAYSHIDE') { + }else if (envar.Responsive_Tabbar==='ALWAYSHIDE') { uni.hideTabBar() } } @@ -115,7 +115,7 @@ export default { }, makeServerUrl(route = '') { - const envi = this.envi || wo?.envi || {} + const envar = this.envar || wo?.envar || {} if (typeof route !== 'string') route = '' // 防止 route 为 null, undefined 等由于后台数据库默认值而造成的异常。 route = route.replace('\\', '/') @@ -126,16 +126,16 @@ export default { let protocol, hostname, port if (process.env.NODE_ENV === 'production') { - protocol = envi.Base_Protocol || 'https' - hostname = envi.Base_Hostname - port = envi.Base_Port + protocol = envar.Base_Protocol || 'https' + hostname = envar.Base_Hostname + port = envar.Base_Port }else{ - protocol = envi.Base_Protocol_Dev || 'http' - hostname = envi.Base_Hostname_Dev + protocol = envar.Base_Protocol_Dev || 'http' + hostname = envar.Base_Hostname_Dev // #ifdef H5 || window.location.hostname // #endif - port = envi.Base_Port_Dev || envi.Base_Port + port = envar.Base_Port_Dev || envar.Base_Port // #ifdef H5 || window.location.port.replace(':','') // #endif @@ -150,18 +150,18 @@ export default { return '' }, - relaunchForAll ({envi=this.envi || wo?.envi || {}} = {}) { - uni.reLaunch({ url: envi?.Start_Page_For_All }) + relaunchForAll ({envar=this.envar || wo?.envar || {}} = {}) { + 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' && 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' && ! 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 的调用方法,提供统一、透明的后台调用 @@ -171,7 +171,7 @@ export default { * - CLINET_BACKEND_EXCEPTION: 前端发现后台异常 **/ 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', apiVersion = 'api', apiWho, apiTodo, apiWhat = {} }) { @@ -361,7 +361,7 @@ export default { }, 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, url, header = {}, formData = {}, name = 'file', }) {