import Vue from 'vue' import App from './App' import router from './router' import store from './store' import echarts from 'echarts' import moment from 'moment' // 时间库 import '@/permission' import '@/utils/validator' import '@/assets/css/reset.css' import '@/attendanceSet' // 考勤相关 import '@/performanceSet' // 绩效系统相关配置 import icon from 'vue2-svg-icon/Icon' import VueScroller from '@/components/scroller/src' import noData from '@/components/noData' import userImage from '@/components/user_image' import * as socketApi from '@/api/websocket' import * as socketApiTow from '@/api/websocketTow' import axios from '@/utils/axios' import axiosKq from '@/utils/axiosKq' import axiosUser from '@/utils/axiosUser' import axiosKc from '@/utils/axiosKc' import 'shepherd.js/dist/css/shepherd.css'; // import 'vant/lib/index.css'; import { Tabbar, Empty, TabbarItem, ShareSheet, Loading, Divider, Overlay, Grid, GridItem, Form, Field, NavBar, Row, Col, List, Picker, Cell, CellGroup, Toast, Popup, Dialog, RadioGroup, Radio, Notify, Button, Icon, Tab, Tabs, Collapse, CollapseItem } from 'vant' /*element ui*/ import { Tree as ELTree, Button as ELButton, Drawer as ELDrawer, } from 'element-ui' import 'element-ui/lib/theme-chalk/index.css'; import { getWxToken, setWxToken, getIsIdentity, supremeAuthority, getIsWx, getTypes, getTypesName, getUserData, getEmployeeMap, getCache, setCache, removeCache, returnDeptName, getEmployeeMapItem, returnFh } from '@/utils/auth' Vue.prototype.$echarts = echarts Vue.prototype.$moment = moment Vue.prototype.$getTypesName = getTypesName Vue.prototype.$getTypes = getTypes() Vue.prototype.$userInfo = getUserData; Vue.prototype.$getEmployeeMap = getEmployeeMap Vue.prototype.$getEmployeeMapItem = getEmployeeMapItem Vue.prototype.$getCache = getCache Vue.prototype.$setCache = setCache Vue.prototype.$getIsIdentity = getIsIdentity Vue.prototype.$supremeAuthority = supremeAuthority Vue.prototype.$axios = axios Vue.prototype.$axiosUser = axiosUser Vue.prototype.$axiosKq = axiosKq Vue.prototype.$axiosKc = axiosKc Vue.prototype.$removeCache = removeCache Vue.prototype.$returnDeptName = returnDeptName Vue.prototype.$socketApi = socketApi //长连接 Vue.prototype.$socketApiTow = socketApiTow //长连接 Vue.prototype.$returnFh = returnFh Vue.prototype.$isWx = getIsWx() // localStorage.setItem('Wx-Token','eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjE3ODIzNDkxMTYyMzI4OTI0MTcsIm5iZiI6MTcxMzg0MzIzMjY2Niwicm9sZSI6Im1rdF91c2VyIiwicHJ2IjoiMGU1ZWM0NzM3NDk3NmFmY2NlZGJiY2Y1ZGVlNzVmMDE0Y2E1YjliNSIsImV4cCI6LTEsImlhdCI6MTcxMzg0MzIzMjY2NiwianRpIjoieGJ5N3ljbWxqNGduYXcybyJ9.Iv04__mjBDEV75QU8kbrJX2umQIKDZE87-kTD5LG4vg') // localStorage.setItem('wx_user_info',JSON.stringify({"id":"1782349116232892417","name":"雷阳","mobile":"15270803986","statistics":{"teamAmount":0,"saleAmount":0},"imgUrl":"","marketable":1,"utoken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjE3ODIzNDkxMTYyMzI4OTI0MTcsIm5iZiI6MTcxMzg0MzIzMjY2Niwicm9sZSI6Im1rdF91c2VyIiwicHJ2IjoiMGU1ZWM0NzM3NDk3NmFmY2NlZGJiY2Y1ZGVlNzVmMDE0Y2E1YjliNSIsImV4cCI6LTEsImlhdCI6MTcxMzg0MzIzMjY2NiwianRpIjoieGJ5N3ljbWxqNGduYXcybyJ9.Iv04__mjBDEV75QU8kbrJX2umQIKDZE87-kTD5LG4vg"})) // true为APP打包,false为M端打包 Vue.prototype.$isApp = true Vue.use(VueScroller) Vue.component('icon', icon) Vue.component('noData', noData) Vue.component('userImage', userImage) /*element ui 按需引入*/ Vue.use(ELTree).use(ELButton).use(ELDrawer) Vue.use(Button).use(Tabbar).use(TabbarItem).use(ShareSheet).use(Grid).use(Overlay).use(Loading).use(Divider).use( GridItem).use(Picker).use(Form).use(Field).use(List).use(Tabs).use(Tab).use(NavBar).use(Row).use(Col).use(Cell).use( CellGroup).use(Toast).use(Popup).use(Dialog).use(RadioGroup).use(Radio).use(Icon).use(Notify).use(Empty).use(Collapse).use(CollapseItem) Vue.prototype.$route_back = function(setp) { if (typeof(setp) == 'undefined') { setp = -1 } if (window.history.length <= 1 && window.plus) { //先关掉键盘再 document.activeElement.blur() setTimeout(() => { plus.webview.currentWebview().close() }, 100) } else { router.go(-1) } } Vue.directive('isKeyboard', function(el) { let isAndroid = true; if (navigator.userAgent.indexOf('Android') > 0) { isAndroid = true; } else { isAndroid = false; } if (isAndroid) { //获取原窗口的高度 var originalHeight = document.documentElement.clientHeight || document.body.clientHeight; window.onresize = function() { //键盘弹起与隐藏都会引起窗口的高度发生变化 var resizeHeight = document.documentElement.clientHeight || document.body.clientHeight; if (resizeHeight - 0 < originalHeight - 0) { // console.log("键盘收起") el.style['display'] = 'none' } else { // console.log("键盘放下") el.style['display'] = 'block' } }; } else { // ios:focusin和focusout支持冒泡,对应focus和blur, 使用focusin和focusout的原因是focusin和focusout可以冒泡,focus和blur不会冒泡,这样就可以使用事件代理,处理多个输入框存在的情况。 document.body.addEventListener("focusin", () => { //软键盘弹出的事件处理 el.style['display'] = 'none' }); document.body.addEventListener("focusout", () => { //软键盘收起的事件处理 el.style['display'] = 'block' }); } }) Vue.config.productionTip = false window.VueObj = new Vue({ el: '#app', router, store, components: { App }, template: '' })