把配置参数名改成 Xxx_Yyy 格式,和变量的 xxxYyy 和 常量的 XXX_YYY 区分开。

This commit is contained in:
陆柯 2022-04-03 10:26:19 +08:00
parent 94f3587199
commit c4728babfb

View File

@ -96,18 +96,18 @@ export default {
// #ifdef H5 // #ifdef H5
if (uni.getSystemInfoSync().model==='PC') { if (uni.getSystemInfoSync().model==='PC') {
const envi = this.envi || wo?.envi || {} const envi = this.envi || wo?.envi || {}
if (envi.ResponsiveTabbar==='AUTOHIDE') { if (envi.Responsive_Tabbar==='AUTOHIDE') {
if (window.screen.width > (envi.ResponsiveTabbarAutohideWidthThreshold || this.RESPONSIVE_TABBAR_AUTOHIDE_WIDTH_THRESHOLD_DEFAULT)) { if (window.screen.width > (envi.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.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() uni.hideTabBar()
}else{ }else{
uni.showTabBar() uni.showTabBar()
} }
}) })
}else if (envi.ResponsiveTabbar==='ALWAYSHIDE') { }else if (envi.Responsive_Tabbar==='ALWAYSHIDE') {
uni.hideTabBar() uni.hideTabBar()
} }
} }
@ -116,32 +116,29 @@ export default {
makeServerUrl(route = '') { makeServerUrl(route = '') {
const envi = this.envi || wo?.envi || {} 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('\\', '/') route = route.replace('\\', '/')
if (/^https?:\/\//.test(route)) { if (/^https?:\/\//.test(route)) {
return route return route
} }
let port = envi.ServerPort let protocol, hostname, port
// #ifdef H5
|| window.location.port
// #endif
let hostname
let protocol
if (process.env.NODE_ENV === 'production') { 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 // #ifdef H5
|| window.location.hostname || window.location.hostname
// #endif // #endif
protocol = envi.ServerProtocol || 'https' port = envi.Server_Port_Dev || envi.Server_Port
} else {
hostname =
envi.ServerHostnameDev // 在本机的手机模拟器里可以在虚拟机的浏览器里也可以但是运行到连接的iPhone里就无法连接不知为何
// #ifdef H5 // #ifdef H5
|| window.location.hostname || window.location.port.replace(':','')
// #endif // #endif
protocol = envi.ServerProtocolDev || 'http'
} }
return `${protocol}://${hostname}:${port}/${route.replace(/^\//, '')}` return `${protocol}://${hostname}:${port}/${route.replace(/^\//, '')}`
}, },
@ -154,17 +151,17 @@ export default {
}, },
relaunchForAll ({envi=this.envi || wo?.envi || {}} = {}) { 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 || {}} = {}) { relaunchForOnline ({envi=this.envi || wo?.envi || {}} = {}) {
process.env.NODE_ENV === 'production' && process.env.NODE_ENV === 'production' &&
wo.ss.User.onlineUser.uuid && wo.ss.User.onlineUser.uuid &&
uni.reLaunch({ url: envi?.StartPageForOnline }) uni.reLaunch({ url: envi?.Start_Page_For_Online })
}, },
relaunchForOffline ({envi=this.envi || wo?.envi || {}} ={}) { relaunchForOffline ({envi=this.envi || wo?.envi || {}} ={}) {
process.env.NODE_ENV === 'production' && process.env.NODE_ENV === 'production' &&
! wo.ss.User.onlineUser.uuid && ! wo.ss.User.onlineUser.uuid &&
uni.reLaunch({ url: envi?.StartPageForOffline }) uni.reLaunch({ url: envi?.Start_Page_For_Offline })
}, },
/** uni.request uniCloud.callFunction /** uni.request uniCloud.callFunction
@ -174,7 +171,7 @@ export default {
* - CLINET_BACKEND_EXCEPTION: 前端发现后台异常 * - CLINET_BACKEND_EXCEPTION: 前端发现后台异常
**/ **/
async callBackend({ 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', httpMethod = 'POST',
apiVersion = 'api', apiWho, apiTodo, apiWhat = {} apiVersion = 'api', apiWho, apiTodo, apiWhat = {}
}) { }) {
@ -364,7 +361,7 @@ export default {
}, },
async pickupFile({ 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, mediaType = 'image', count = 1, sizeType = ['original', 'compressed'], sourceType = ['album', 'camera'], maxDuration,
url, header = {}, formData = {}, name = 'file', url, header = {}, formData = {}, name = 'file',
}) { }) {