import Vue from 'vue'
import App from './App'

import store from './store'
import uView from "uview-ui"
Vue.use(uView)
Vue.config.productionTip = false

let vuexStore = require("@/store/$u.mixin.js")
Vue.mixin(vuexStore)

App.mpType = 'mini'

/**
 * 权限检查
 */
Vue.prototype.$hasPermissions = function (value) {
 let isExist = false;
 // 没有登录 或 是游客
 if(!store.state.hasLogin || store.state.vuex_userInfo.sysUserFlag == '0'){
 	 return true
 }
 let permissionsStr = uni.getStorageSync('permCodes');
 if (permissionsStr == undefined || permissionsStr == null || !permissionsStr) {
  return false;
 }
 let has = permissionsStr.find(item => {
   return item == value
 })
 if (has) {
  isExist = true;
 }
 return isExist;
}

/*
* 打电话
*/ 
Vue.prototype.callPhone = function (phone) {
	uni.makePhoneCall({
		phoneNumber: phone
	});
} 
const app = new Vue({
    store,
    ...App
})
app.$mount()
