

import Vue from 'vue'
import App from './App'
import store from './store'
import Cache from './utils/cache'
import util from 'utils/util'
import configs from './config/app.js'
import socket from './libs/new_chat.js'
import i18n from './utils/lang.js';
Vue.prototype.$util = util;
Vue.prototype.$config = configs;
Vue.prototype.$Cache = Cache;
Vue.prototype.$eventHub = new Vue();
Vue.prototype.$socket = new socket();
Vue.config.productionTip = false
import pageLoading from './components/pageLoading.vue'
import skeleton from './components/skeleton/index.vue'

Vue.component('skeleton', skeleton)
Vue.component('pageLoading',pageLoading) 

/* uni.scss */
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
// console.log(uni.$u.config.v);
// uni.$u.config.unit = 'rpx'
// #ifdef H5


import { parseQuery } from "./utils";
import Auth from './libs/wechat';
import { SPREAD } from './config/cache';
Vue.prototype.$wechat = Auth;



let query = parseQuery(),
	urlSpread = query["spread"]

if (urlSpread !== undefined) {
	var spread = Cache.get(SPREAD);
	urlSpread = parseInt(urlSpread);
	if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
		Cache.set("spread", urlSpread || 0);
	} else if (spread === 0 || typeof spread !== "number") {
		Cache.set("spread", urlSpread || 0);
	}
}
// let snsapiBase = 'snsapi_base';
// Auth.isWeixin() && Auth.oAuth(snsapiBase);


//全局路由前置守卫
// #endif
import Mock from './mock'
Vue.use(Mock)
App.mpType = 'app'


const app = new Vue({
    ...App,
	store,
	Cache,
	i18n,
})
app.$mount();