把配置参数名改成 Xxx_Yyy 格式,和变量的 xxxYyy 和 常量的 XXX_YYY 区分开。
This commit is contained in:
parent
94f3587199
commit
c4728babfb
43
usertool.js
43
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',
|
||||
}) {
|
||||
|
Loading…
Reference in New Issue
Block a user