import App from './App'
import store from './store';

// #ifndef VUE3
import Vue from 'vue'
// main.js
import uView from "uview-ui";
import share from '@/common/share.js'
import {setGuestMode} from "@/common/utils/auth";
Vue.mixin(share)
Vue.use(uView);

//防抖函数
import common from './common/common.js'
Vue.prototype.$noMultipleClicks = common.noMultipleClicks;

const token = uni.getStorageSync('token');
const userInfo = uni.getStorageSync('userinfo');
if (!token || !userInfo) {
	console.log('未登录')
	setGuestMode();
}
//时间戳的处理
Vue.filter("formatDate", function(value) {
	var date = new Date(value * 1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
	var year = date.getFullYear();
	var month = ("0" + (date.getMonth() + 1)).slice(-2);
	var sdate = ("0" + date.getDate()).slice(-2);
	var hour = ("0" + date.getHours()).slice(-2);
	var minute = ("0" + date.getMinutes()).slice(-2);
	var second = ("0" + date.getSeconds()).slice(-2);
	// 拼接
	var time = year + "-" + month + "-" + sdate + ' ' + hour + ':' + minute + ':' + second
	return time;
})


Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	store,
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif