import Vue from 'vue'
import App from './App'
//store
import store from '@/store';
let vuexStore = require("@/store/$u.mixin.js");
Vue.mixin(vuexStore);

//uView
import uView from "uview-ui";
Vue.use(uView);

//mescroll
import MescrollBody from "@/components/mescroll-body/mescroll-body.vue"
Vue.component('MescrollBody', MescrollBody)

//封装api
import { api } from 'assets/http/api.js' 
Vue.prototype.$api = api

//缓存
import simpleCache from "@/utils/cache.js"
Vue.prototype.$cache = simpleCache

//封装日期时间工具类
import dateTime from 'utils/dateTime.js'
Vue.prototype.$dateTime = dateTime

//封装提示工具
import dialog from 'utils/dialog.js'
Vue.prototype.$dialog = dialog

//数字处理
import digital from './utils/digital.js'
Vue.prototype.$digital = digital

// 全局注入
import Mixin from './utils/mixin'
Vue.mixin(Mixin)

// 微信函数封装
import Mpi from './utils/mpi'
Vue.prototype.$mpi = Mpi

//引入工具类
import util from 'utils/util.js'
Vue.prototype.$util = util

//校验文件
import verify from 'utils/verify.js'
Vue.prototype.$verify = verify

//全局变量
import global from './assets/http/global.js'
Vue.prototype.$global = global

//判断是不是微信浏览器
Vue.prototype.$isWxBrowser = () => {
	let flag=false
	try{
		let na = navigator.userAgent.toLowerCase();
		flag=na.indexOf('micromessenger') !== -1
	}catch(e){
		flag=false
	}
	return flag;
}


//跳转
Vue.prototype.$jump=function(url,events){
	uni.navigateTo({
		url,
		events
	})
}
Vue.prototype.$back=function(){
	uni.navigateBack({
		delta:1
	})
}
//判空函数
Vue.prototype.$isEmpty=function(value){
	switch (typeof value) {
		case 'undefined':
			return true;
		case 'string':
			if(value=='undefined') return true
			if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
			break;
		case 'boolean':
			if (!value) return true;
			break;
		case 'number':
			if (0 === value || isNaN(value)) return true;
			break;
		case 'object':
			if (null === value || value.length === 0) return true;
			for (var i in value) {
				return false;
			}
			return true;
	}
	return false;
}

Vue.prototype.$isNotEmpty=function(value){
	switch (typeof value) {
		case 'undefined':
			return false;
		case 'string':
			if(value=='undefined') return false
			if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return false;
			break;
		case 'boolean':
			if (!value) return false;
			break;
		case 'number':
			if (0 === value || isNaN(value)) return false;
			break;
		case 'object':
			if (null === value || value.length === 0) return false;
			for (var i in value) {
				return true;
			}
			return false;
	}
	return true;
}
Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
	store,
    ...App
})

app.$mount()
