|
@@ -2,84 +2,56 @@
|
|
|
import configpath from 'config/setting.config.js';
|
|
|
import api from 'api/index.js'
|
|
|
import Vue from 'vue'
|
|
|
+
|
|
|
const inforeq = (cb) => {
|
|
|
- fetch('/static/.config.json')
|
|
|
- .then((res) => res.json())
|
|
|
- .then(async (res) => {
|
|
|
- let obj = {
|
|
|
- ...res,
|
|
|
- img_local_host:
|
|
|
- (process.env.NODE_ENV === 'production'
|
|
|
- ? res.prodIp || configpath.prodIp
|
|
|
- : process.env.NODE_ENV === 'test'
|
|
|
- ? res.testIp || configpath.testIp
|
|
|
- : res.devIp || configpath.devIp) + '/file/',
|
|
|
- // 请求 地址
|
|
|
- baseURL:
|
|
|
- (process.env.NODE_ENV === 'production'
|
|
|
- ? res.prodIp || configpath.prodIp
|
|
|
- : process.env.NODE_ENV === 'test'
|
|
|
- ? res.testIp || configpath.testIp
|
|
|
- : res.devIp || configpath.devIp) + '/api/h5',
|
|
|
- }
|
|
|
- cb&&cb(obj)
|
|
|
- })
|
|
|
+ fetch('/static/.config.json')
|
|
|
+ .then((res) => res.json())
|
|
|
+ .then(async (res) => {
|
|
|
+ let obj = {
|
|
|
+ ...res,
|
|
|
+ img_local_host: (process.env.NODE_ENV === 'production' ?
|
|
|
+ res.prodIp || configpath.prodIp :
|
|
|
+ process.env.NODE_ENV === 'test' ?
|
|
|
+ res.testIp || configpath.testIp :
|
|
|
+ res.devIp || configpath.devIp) + '/file/',
|
|
|
+ // 请求 地址
|
|
|
+ baseURL: (process.env.NODE_ENV === 'production' ?
|
|
|
+ res.prodIp || configpath.prodIp :
|
|
|
+ process.env.NODE_ENV === 'test' ?
|
|
|
+ res.testIp || configpath.testIp :
|
|
|
+ res.devIp || configpath.devIp) + '/api/h5',
|
|
|
+ }
|
|
|
+ cb && cb(obj)
|
|
|
+ })
|
|
|
}
|
|
|
export default {
|
|
|
globalData: {
|
|
|
SET_STATUS_BAR: 0,
|
|
|
SET_CUSTOM_BAR: 0,
|
|
|
SET_SYSTEM_INFO: {},
|
|
|
- configData:{},
|
|
|
- $api:{...api}
|
|
|
+ configData: {},
|
|
|
+ token:''
|
|
|
},
|
|
|
onLaunch: function(option) {
|
|
|
+ let token = window.location.search.split('token=')[1]
|
|
|
console.log('App Launch')
|
|
|
- let t = this
|
|
|
- let query = option.query || option
|
|
|
- uni.setStorageSync('query', query)
|
|
|
+ console.log(token)
|
|
|
+
|
|
|
+ let t = this;
|
|
|
inforeq((res)=>{
|
|
|
t.globalData.configData=res
|
|
|
- })
|
|
|
- uni.getSystemInfo({
|
|
|
- success: (e) => {
|
|
|
- let statusBar = 0
|
|
|
- let customBar = 0
|
|
|
-
|
|
|
- // #ifdef MP
|
|
|
- statusBar = e.statusBarHeight
|
|
|
- customBar = e.statusBarHeight + 45
|
|
|
- if (e.platform === 'android') {
|
|
|
- customBar = e.statusBarHeight + 50
|
|
|
- }
|
|
|
- // #endif
|
|
|
-
|
|
|
- // #ifdef MP-WEIXIN
|
|
|
- statusBar = e.statusBarHeight
|
|
|
- const custom = wx.getMenuButtonBoundingClientRect()
|
|
|
- customBar = custom.bottom + custom.top - e.statusBarHeight
|
|
|
- // #endif
|
|
|
-
|
|
|
- // #ifdef MP-ALIPAY
|
|
|
- statusBar = e.statusBarHeight
|
|
|
- customBar = e.statusBarHeight + e.titleBarHeight
|
|
|
- // #endif
|
|
|
-
|
|
|
- // #ifdef APP-PLUS
|
|
|
- console.log('app-plus', e)
|
|
|
- statusBar = e.statusBarHeight
|
|
|
- customBar = e.statusBarHeight + 45
|
|
|
- // #endif
|
|
|
-
|
|
|
- // #ifdef H5
|
|
|
- statusBar = 0
|
|
|
- customBar = e.statusBarHeight + 45
|
|
|
- // #endif
|
|
|
-
|
|
|
- this.globalData.SET_SYSTEM_INFO = e
|
|
|
- this.globalData.SET_CUSTOM_BAR = customBar
|
|
|
- this.globalData.SET_STATUS_BAR = statusBar
|
|
|
+ if(token&&token.length>0){
|
|
|
+ console.log(token)
|
|
|
+ uni.setStorage({
|
|
|
+ key: 'token',
|
|
|
+ data: token,
|
|
|
+ success: function () {
|
|
|
+ console.log('success');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ t.globalData.token = token
|
|
|
}
|
|
|
+
|
|
|
})
|
|
|
},
|
|
|
onShow: function() {
|
|
@@ -87,9 +59,49 @@
|
|
|
},
|
|
|
onHide: function() {
|
|
|
console.log('App Hide')
|
|
|
- }
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
+uni.getSystemInfo({
|
|
|
+success: (e) => {
|
|
|
+let statusBar = 0
|
|
|
+let customBar = 0
|
|
|
+
|
|
|
+// #ifdef MP
|
|
|
+statusBar = e.statusBarHeight
|
|
|
+customBar = e.statusBarHeight + 45
|
|
|
+if (e.platform === 'android') {
|
|
|
+customBar = e.statusBarHeight + 50
|
|
|
+}
|
|
|
+// #endif
|
|
|
+
|
|
|
+// #ifdef MP-WEIXIN
|
|
|
+statusBar = e.statusBarHeight
|
|
|
+const custom = wx.getMenuButtonBoundingClientRect()
|
|
|
+customBar = custom.bottom + custom.top - e.statusBarHeight
|
|
|
+// #endif
|
|
|
+
|
|
|
+// #ifdef MP-ALIPAY
|
|
|
+statusBar = e.statusBarHeight
|
|
|
+customBar = e.statusBarHeight + e.titleBarHeight
|
|
|
+// #endif
|
|
|
+
|
|
|
+// #ifdef APP-PLUS
|
|
|
+console.log('app-plus', e)
|
|
|
+statusBar = e.statusBarHeight
|
|
|
+customBar = e.statusBarHeight + 45
|
|
|
+// #endif
|
|
|
+
|
|
|
+// #ifdef H5
|
|
|
+statusBar = 0
|
|
|
+customBar = e.statusBarHeight + 45
|
|
|
+// #endif
|
|
|
+
|
|
|
+this.globalData.SET_SYSTEM_INFO = e
|
|
|
+this.globalData.SET_CUSTOM_BAR = customBar
|
|
|
+this.globalData.SET_STATUS_BAR = statusBar
|
|
|
+}
|
|
|
+})
|
|
|
|
|
|
<style>
|
|
|
/*每个页面公共css */
|