|
|
@@ -2,6 +2,13 @@ import axios from 'axios'
|
|
|
import plus from '@/utils/h5plus'
|
|
|
|
|
|
export default new (class {
|
|
|
+ systemInfo = {
|
|
|
+ version: '1.0.0',
|
|
|
+ versionCode: '100000',
|
|
|
+ apiUrl: 'http://localhost',
|
|
|
+ shwoRegister: true
|
|
|
+ }
|
|
|
+
|
|
|
/** 服务配置信息 */
|
|
|
config = {
|
|
|
commSearchUrl: '',
|
|
|
@@ -40,7 +47,7 @@ export default new (class {
|
|
|
private isPending = false
|
|
|
|
|
|
/**
|
|
|
- * 自动初始化,若断网或其它原因导致初始化失败,需手动初始化
|
|
|
+ * 自动初始化,若断网或其它原因导致初始化失败,需重新初始化
|
|
|
* IOS上架审核可能会遇到网络权限的情况,应用可能会在未授权网络权限的情况下发起请求,导致请求等待时间过长,最终审核被拒
|
|
|
*/
|
|
|
//private onload = this.init()
|
|
|
@@ -92,8 +99,12 @@ export default new (class {
|
|
|
}
|
|
|
}
|
|
|
getAppConfig().then((res) => {
|
|
|
+ this.systemInfo = {
|
|
|
+ ...this.systemInfo,
|
|
|
+ ...res
|
|
|
+ }
|
|
|
// 获取服务接口地址
|
|
|
- axios(res.apiUrl).then((res) => {
|
|
|
+ axios(this.systemInfo.apiUrl).then((res) => {
|
|
|
this.config = res.data.data
|
|
|
this.isReady = true
|
|
|
resolve(this.config)
|
|
|
@@ -126,4 +137,13 @@ export default new (class {
|
|
|
getConfig<K extends keyof typeof this.config>(key: K) {
|
|
|
return this.config[key]
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取系统信息
|
|
|
+ * @param key
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ getSystemInfo<K extends keyof typeof this.systemInfo>(key: K) {
|
|
|
+ return this.systemInfo[key]
|
|
|
+ }
|
|
|
})
|