123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- // The Vue build version to load with the `import` command
- // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
- import Vue from 'vue';
- import ElementUI from 'element-ui';
- // import Viewer from 'v-viewer'
- // import 'viewerjs/dist/viewer.css'
- import 'element-ui/lib/theme-chalk/index.css';
- import store from './store';
- import axios from 'axios';
- import VueBus from 'vue-bus'
- import config from './common/config.js'
- import dataSource from './common/data.source.js'
- import formTags from './common/form.tags.js'
- import formAction from './common/form.action.js'
- import './assets/icon/iconfont.css'
- import { postUserLogin } from '@/api/sysUser';
- import QRCode from 'qrcode'
- import ElTreeGrid from 'element-tree-grid'
- import importComponents from './importComponents';
- import ADialog from '@/components/common/a-dialog'
- import App from './App';
- import router from './router';
- Vue.component('a-dialog', ADialog);
- Vue.component(ElTreeGrid.name,ElTreeGrid)
- Vue.use(QRCode);
- Vue.use(VueBus);
- Vue.use(dataSource);
- Vue.use(formAction);
- Vue.prototype.$axios = axios;
- Vue.prototype.config = config;
- Vue.prototype.$eventBus = new Vue();
- importComponents(Vue)
- // Vue.use(Viewer)
- // Vue.use(Viewer, {
- // defaultOptions: {
- // zIndex: 9999,
- // title: false
- // }
- // })
- Vue.config.productionTip = false;
- Vue.use(ElementUI);
- Vue.use(require('vue-moment'));
- router.beforeEach((to, from, next) => {
- let userInfo = JSON.parse(localStorage.getItem('loginInfo'))
- if(userInfo) {
- if(userInfo.erp) { //ERP报表跳转DUP
- postUserLogin(
- {
- LoginCode: userInfo.LoginCode,
- PassWord: userInfo.PassWord,
- response: '0697056754B0C13C745662D33E1AC555',
- os: 'erp'
- },
- (response) => {
- sessionStorage.setItem('sysUserInfo', JSON.stringify(response));
- localStorage.removeItem('loginInfo')
- // next()
- next({ path: '/welcome' })
- },
- (error) => {
- next({ path: '/login' });
- },
- (exception) => {
- next({ path: '/login' });
- })
- return
- }
- }
- if(to.query.erp) { //ERP报表跳转DUP
- postUserLogin(
- {
- LoginCode: to.query.LoginCode,
- PassWord: to.query.PassWord,
- response: '0697056754B0C13C745662D33E1AC555',
- os: 'erp'
- },
- (response) => {
- sessionStorage.setItem('sysUserInfo', JSON.stringify(response));
- // next()
- next({ path: to.path })
- },
- (error) => {
- next({ path: '/login' });
- },
- (exception) => {
- next({ path: '/login' });
- })
- return
- }
- const sysUserInfo = JSON.parse(sessionStorage.getItem('sysUserInfo'));
- if(to.name == 'login') {
- if(sysUserInfo != {} && sysUserInfo != undefined && sysUserInfo != null){
- next({ path: '/welcome' });
- }else{
- sessionStorage.setItem('tongyitype', '1');
- next()
- }
- } else {
- if(sysUserInfo == null){
- // next(false)
- let tongyi=sessionStorage.getItem('tongyitype')
- if(tongyi){
- window.sessionStorage.removeItem('tongyitype');
- next()
- }else{
- next({ path: '/login' });
- }
- } else{
- next()
- }
- }
- })
- Vue.directive('right',{
- update:function (el,binding) {
- let key = binding.value.btnKey
- const sysUserInfo = JSON.parse(sessionStorage.getItem('sysUserInfo'));
- let showStatus = false
- sysUserInfo.userFunctions.forEach(item => {
- if(item.code === key) {
- showStatus = item.enable
- return
- }
- })
- if(!showStatus){
- if(el.parentNode) {
- el.parentNode.removeChild(el)
- }
- }
- }
- })
- /* eslint-disable no-new */
- new Vue({
- el: '#app',
- router,
- store,
- template: '<App/>',
-
- components: { App },
- });
|