You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
//const mode = 'devOnline'; //devLocal: 本地测试、devOnline: 线上测试、production: 生产环境
import Vue from 'vue'
let ROOTPATH = 'http://assets.langye.net' ; //域名
let DBNAME = 'gongguan' ; //sqlite数据库名称
let DBPATH = '_doc/gongguan.db' ; //sqlite路径
function setRootpath ( value ) {
ROOTPATH = value ? ? 'http://assets.langye.net'
uni . setStorageSync ( 'ROOTPATH' , ROOTPATH )
setTimeout ( ( ) => {
Vue . prototype . $u . http . setConfig ( {
baseUrl : ROOTPATH ,
showLoading : true , // 是否显示请求中的loading
loadingMask : true , // 展示loading的时候, 是否给一个透明的蒙层, 防止触摸穿透
loadingText : '加载中' , // 请求loading中的文字提示
loadingTime : 5000 ,
originalData : true , // 是否在拦截器中返回服务端的原始数据
// 设置自定义头部content-type
header : {
'content-type' : 'application/json;charset=UTF-8'
}
} )
} , 50 )
}
function getRootpath ( ) {
return uni . getStorageSync ( 'ROOTPATH' )
}
setRootpath ( getRootpath ( ) )
// switch (mode) {
// case 'devLocal':
// ROOTPATH = "http://assets.langye.net"
// break;
// case 'devOnline':
// ROOTPATH = "http://assets.langye.net"
// break;
// case 'production':
// ROOTPATH = "https://xxxxx.cn"
// break;
// default:
// throw new Error('未配置环境');
// console.log(`未配置环境`);
// }
export {
ROOTPATH ,
DBNAME ,
DBPATH ,
setRootpath ,
getRootpath
}