From c4728babfb9af61c27606c230fdc66b575c74422 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Sun, 3 Apr 2022 10:26:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8A=E9=85=8D=E7=BD=AE=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=90=8D=E6=94=B9=E6=88=90=20Xxx=5FYyy=20=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E5=92=8C=E5=8F=98=E9=87=8F=E7=9A=84=20xxxYyy=20?= =?UTF-8?q?=E5=92=8C=20=E5=B8=B8=E9=87=8F=E7=9A=84=20XXX=5FYYY=20=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E5=BC=80=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usertool.js | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/usertool.js b/usertool.js index 6aacc95..47d2541 100644 --- a/usertool.js +++ b/usertool.js @@ -96,18 +96,18 @@ export default { // #ifdef H5 if (uni.getSystemInfoSync().model==='PC') { const envi = this.envi || wo?.envi || {} - if (envi.ResponsiveTabbar==='AUTOHIDE') { - if (window.screen.width > (envi.ResponsiveTabbarAutohideWidthThreshold || this.RESPONSIVE_TABBAR_AUTOHIDE_WIDTH_THRESHOLD_DEFAULT)) { + if (envi.Responsive_Tabbar==='AUTOHIDE') { + if (window.screen.width > (envi.Responsive_Tabbar_Autohide_Width_Threshold || this.RESPONSIVE_TABBAR_AUTOHIDE_WIDTH_THRESHOLD_DEFAULT)) { uni.hideTabBar() } uni.onWindowResize(({size})=>{ - if (size.windowWidth > (envi.ResponsiveTabbarAutohideWidthThreshold || this.RESPONSIVE_TABBAR_AUTOHIDE_WIDTH_THRESHOLD_DEFAULT)) { + if (size.windowWidth > (envi.Responsive_Tabbar_Autohide_Width_Threshold || this.RESPONSIVE_TABBAR_AUTOHIDE_WIDTH_THRESHOLD_DEFAULT)) { uni.hideTabBar() }else{ uni.showTabBar() } }) - }else if (envi.ResponsiveTabbar==='ALWAYSHIDE') { + }else if (envi.Responsive_Tabbar==='ALWAYSHIDE') { uni.hideTabBar() } } @@ -116,32 +116,29 @@ export default { makeServerUrl(route = '') { const envi = this.envi || wo?.envi || {} - if (typeof route !== 'string') route = '' // 防止 route 为 null, undefined 等由于后台数据库默认值而造成的异常。 + if (typeof route !== 'string') route = '' // 防止 route 为 null, undefined 等由于后台数据库默认值而造成的异常。 route = route.replace('\\', '/') if (/^https?:\/\//.test(route)) { return route } - let port = envi.ServerPort - // #ifdef H5 - || window.location.port - // #endif - let hostname - let protocol + let protocol, hostname, port + if (process.env.NODE_ENV === 'production') { - hostname = envi.ServerHostname + protocol = envi.Server_Protocol || 'https' + hostname = envi.Server_Hostname + port = envi.Server_Port + }else{ + protocol = envi.Server_Protocol_Dev || 'http' + hostname = envi.Server_Hostname_Dev // #ifdef H5 || window.location.hostname // #endif - protocol = envi.ServerProtocol || 'https' - } else { - hostname = - envi.ServerHostnameDev // 在本机的手机模拟器里可以,在虚拟机的浏览器里也可以,但是运行到连接的iPhone里就无法连接,不知为何 + port = envi.Server_Port_Dev || envi.Server_Port // #ifdef H5 - || window.location.hostname + || window.location.port.replace(':','') // #endif - protocol = envi.ServerProtocolDev || 'http' } return `${protocol}://${hostname}:${port}/${route.replace(/^\//, '')}` }, @@ -154,17 +151,17 @@ export default { }, relaunchForAll ({envi=this.envi || wo?.envi || {}} = {}) { - uni.reLaunch({ url: envi?.StartPageForAll }) + uni.reLaunch({ url: envi?.Start_Page_For_All }) }, relaunchForOnline ({envi=this.envi || wo?.envi || {}} = {}) { process.env.NODE_ENV === 'production' && wo.ss.User.onlineUser.uuid && - uni.reLaunch({ url: envi?.StartPageForOnline }) + uni.reLaunch({ url: envi?.Start_Page_For_Online }) }, relaunchForOffline ({envi=this.envi || wo?.envi || {}} ={}) { process.env.NODE_ENV === 'production' && ! wo.ss.User.onlineUser.uuid && - uni.reLaunch({ url: envi?.StartPageForOffline }) + uni.reLaunch({ url: envi?.Start_Page_For_Offline }) }, /** 统一 uni.request 和 uniCloud.callFunction 的调用方法,提供统一、透明的后台调用 @@ -174,7 +171,7 @@ export default { * - CLINET_BACKEND_EXCEPTION: 前端发现后台异常 **/ async callBackend({ - backend = this.envi?.Backend || wo?.envi?.Backend || this.BACKEND_DEFAULT, + backend = this.envi?.Backend_Default || wo?.envi?.Backend_Default || this.BACKEND_DEFAULT, httpMethod = 'POST', apiVersion = 'api', apiWho, apiTodo, apiWhat = {} }) { @@ -364,7 +361,7 @@ export default { }, async pickupFile({ - backend = this.envi?.Backend || wo?.envi?.Backend || this.BACKEND_DEFAULT, + backend = this.envi?.Backend_Default || wo?.envi?.Backend_Default || this.BACKEND_DEFAULT, mediaType = 'image', count = 1, sizeType = ['original', 'compressed'], sourceType = ['album', 'camera'], maxDuration, url, header = {}, formData = {}, name = 'file', }) {