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.
64 lines
1.3 KiB
64 lines
1.3 KiB
import Vue from 'vue';
|
|
import moment from 'moment';
|
|
import { http } from 'plugins/request/index';
|
|
import App from './App';
|
|
import store from './store';
|
|
import axios from 'axios'
|
|
Vue.prototype.$axios = axios
|
|
|
|
import Fingerprint from 'fingerprintjs'
|
|
|
|
// 白名单页面
|
|
const whitePathList = [
|
|
'basic-info',
|
|
'statistics',
|
|
'user-code',
|
|
'sign',
|
|
'my-signs',
|
|
'my-code',
|
|
'my-trips',
|
|
];
|
|
/**
|
|
* 检查url是否在是否在白名单内
|
|
* @param {string} url path+query
|
|
*/
|
|
const checkWhitePath = url => {
|
|
let str = url.slice(7).split('/')[0];
|
|
return whitePathList.includes(str);
|
|
};
|
|
|
|
// var fingerprint = new Fingerprint().get();
|
|
// store.state.user.fingerprint = fingerprint
|
|
// console.log(store.state.user.fingerprint)
|
|
|
|
|
|
Vue.config.productionTip = false;
|
|
Vue.prototype.$http = http;
|
|
Vue.prototype.$moment = moment;
|
|
|
|
moment.locale('zh-cn');
|
|
|
|
Vue.prototype.goHome = () => {
|
|
uni.reLaunch({
|
|
url: '/pages/index/index',
|
|
});
|
|
};
|
|
|
|
Vue.prototype.openPage = function(path, query = '') {
|
|
let url = query ? `${path}?${query}` : path;
|
|
store.commit('user/setPagePath', url);
|
|
const isWhite = checkWhitePath(url);
|
|
if ((!store.state.user.userInfo || !store.state.user.userInfo.id) && !isWhite) {
|
|
url = '/pages/basic-info/basic-info';
|
|
}
|
|
|
|
uni.navigateTo({ url });
|
|
};
|
|
|
|
App.mpType = 'app';
|
|
|
|
const app = new Vue({
|
|
store,
|
|
...App,
|
|
});
|
|
app.$mount();
|
|
|