main.js
2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import '@u/util'
import Vant from 'vant'
import 'vant/lib/index.css'
import VueWechatTitle from 'vue-wechat-title'
import '@a/scss/common.scss'
import store from "./store"
import axios from 'axios'
Vue.use(VueWechatTitle)
import { Lazyload } from 'vant';
Vue.use(Lazyload);
Vue.use(Vant)
import preview from 'vue-photo-preview'
import 'vue-photo-preview/dist/skin.css'
Vue.use(preview)
Vue.config.productionTip = false
Vue.prototype.isMiniprogram = window.__wxjs_environment === 'miniprogram'
Vue.prototype.track = track;
if (!localStorage['sessionId'] || !localStorage['expirationTime'] || (localStorage['sessionId'] && (new Date().getTime() - localStorage['expirationTime']) > 60 * 60 * 1000)) {
const ua = navigator.userAgent.toLowerCase();
let terminal;
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
terminal = 'h5'
} else {
if (Vue.prototype.checkPhoneType() == 'ios') {
terminal = 'ios'
} else {
terminal = 'android'
}
}
let project_id = process.env.VUE_APP_PROJECR_VERSION;
let secret = process.env.VUE_APP_PROJECR_SECRET;
let client_id = '';
let user_id = '';
track.setCommonConfig({ project_id, secret, client_id, user_id })
let user = JSON.stringify({
"user_id": user_id,
"client_ip": returnCitySN.cip,
"client_id": localStorage['client_id'],
"wx_open_id": '',
"loc_city": returnCitySN.name,
"loc_province": returnCitySN.name,
"loc_country": '',
"network_carrier": '',
"device_model": '',
"brand": Vue.prototype.getDetect().brand,
"resolution": window.screen.width + '*' + window.screen.height,
"browser_version": window.navigator.appVersion,
"browser": Vue.prototype.getDetect().userAgent,
"os_name": Vue.prototype.getDetect().os_name,
"os_version": Vue.prototype.getDetect().version,
"network_type": window.navigator.connection ? window.navigator.connection.effectiveType : '',
"terminal": terminal
})
track.getSessionId('/collectdata/login', user, function () {
axios({
baseURL: process.env.VUE_APP_REPO + '/scrm-equity-mobile-config',
method: 'get'
}).then(({
data: config
}) => {
window.$baseConfig = config
window.vm = new Vue({
router,
store,
render: h => {
return h(App)
}
}).$mount('#app')
})
})
} else {
axios({
baseURL: process.env.VUE_APP_REPO + '/scrm-equity-mobile-config',
method: 'get'
}).then(({
data: config
}) => {
window.$baseConfig = config
window.vm = new Vue({
router,
store,
render: h => {
return h(App)
}
}).$mount('#app')
})
}