123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- 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 { 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 } from 'vant'
- 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()
- // true为APP打包,false为M端打包
- Vue.prototype.$isApp = true
- Vue.use(VueScroller)
- Vue.component('icon', icon)
- Vue.component('noData', noData)
- Vue.component('userImage', userImage)
- 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)
- 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: '<App/>'
- })
|