// 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 devtools from '@vue/devtools' //引入js桥 //import './util/isc-common/isc-bridge-ext.js' import "babel-polyfill"; import Vue from 'vue' // 重置elementui import './styles/elementui-reset.less' //重置css import 'minireset.css' import App from './App' //导入对BopRule的扩展 import "./BopRuleEx" import 'quill/dist/quill.core.css' // import styles import 'quill/dist/quill.snow.css' // for snow theme import '@wangeditor/editor/dist/css/style.css' //引入路由 import router from './router' import '@/util/dialogDrag' //日期对象格式化方法 import '@/util/date/Date.Format.js' //引入无限滚动组件 import { InfiniteScroll } from 'element-ui'; Vue.use(InfiniteScroll) import Print from "./common/print" Vue.use(Print) import RewriteNotify from "./rewriteNotify" //引入vuex import store from './vuex/store' // 含有size属性的组件统一设置为small Vue.prototype.$ELEMENT = { size: 'small', zIndex: 3000 }; import ElementUI, { Loading, MessageBox, Message, Button, ButtonGroup } from 'element-ui' //重复点击某个按钮,message消息始终只提示一次 let messageInstance = null; const resetMessage = (options) => { if(messageInstance) { messageInstance.close() } messageInstance = Message(options) } ['error','success','info','warning'].forEach(type => { resetMessage[type] = options => { options = { message:options, type:type } return resetMessage(options) } }) const message = resetMessage // plugins Vue.prototype.$loading = Loading.service; Vue.prototype.$msgbox = MessageBox; Vue.prototype.$alert = MessageBox.alert; Vue.prototype.$confirm = MessageBox.confirm; Vue.prototype.$prompt = MessageBox.prompt; // Vue.prototype.$notify = Notification; Vue.prototype.$message = message Vue.use(Button); Vue.use(ButtonGroup); // 内部非全局遮罩 Vue.use(Loading.directive); //es6-promise的兼容性搭配 var Promise = require('es6-promise').Promise; Promise.polyfill() //多语言编辑器 import VueCodeMirror from 'vue-codemirror' import 'codemirror/lib/codemirror.css' Vue.use(VueCodeMirror) import CodeEditor from 'bin-code-editor'; Vue.use(CodeEditor); Vue.config.debug = false; // 如果在开发时需要使用vue-devtools来调试,请将下面的devtools配置为true Vue.config.devtools = true; Vue.config.productionTip = false; //配置信息 import baseData from "./config/isc-baseData.js" router.beforeEach((to, from, next) => { if (to.path && to.path.indexOf("/index.html") > -1) { next({ name: 'login',//这里就是进入子应用的第一页面的路由 query: to.query }) } else { // 开发环境不做验证 if (process.env.NODE_ENV === 'production') { if (to.matched.some(r => r.meta && ((typeof r.meta.auth === 'boolean' && r.meta.auth) || r.meta.auth === 'true'))) { // 请根据自身业务需要修改 const hasLogin = sessionStorage.getItem("system_param_login"); if ('true' == hasLogin) { // 开发模式改好了,这里也需要改 next() } else { // 没有登录的时候跳转到登录界面 // 携带上登陆成功之后需要跳转的页面完整路径 next({ name: 'login', query: { redirect: to.path, query: to.query }, params: { params: to.params } }) } } else { next(); } } else { // 不需要身份校验 直接通过 // next() if (to.matched.some(r => r.meta && ((typeof r.meta.auth === 'boolean' && r.meta.auth) || r.meta.auth === 'true'))) { // 请根据自身业务需要修改 const hasLogin = sessionStorage.getItem("system_param_login"); if ('true' == hasLogin) { // 开发模式改好了,这里也需要改 next() } else { // 没有登录的时候跳转到登录界面 // 携带上登陆成功之后需要跳转的页面完整路径 next({ name: 'login', query: { redirect: to.path, query: to.query }, params: { params: to.params } }) } } else { next(); } } } }); router.afterEach(to => { // 更改标题 let title = 'POIN'; if (to.meta && to.meta.title) { title = typeof to.meta.title === 'function' ? to.meta.title(to) : to.meta.title } else if (to.name) { title = to.name } store.commit('SET_BROWSER_TITLE',title); // 根据菜单判断当前页面是否需要禁用复制、打印、另存功能。 let printStyle = document.getElementById("controlPrint"); let isShowContextMenu = true, displayType = "block"; if(baseData.isOpenDisabledCopy == "false") { // 所有页面不开启禁用 isShowContextMenu = true; displayType = "block"; }else if(baseData.isOpenDisabledCopy == "true") { // 禁用所有页面 isShowContextMenu = false; displayType = "none"; }else if(baseData.isOpenDisabledCopy == "routerConfig") { // 通过路由配置禁用部分页面 if(to.meta && to.meta.isDisablePageOpt == true) { isShowContextMenu = false; displayType = "none"; }else { isShowContextMenu = true; displayType = "block"; } }else if(baseData.isOpenDisabledCopy == "menuConfig") { // 通过菜单配置禁用部分页面 const menu = JSON.parse(sessionStorage.getItem("menu_data")); if(menu && menu.length != 0) { // 查找当前页面对应的菜单信息 let currentPageMenu; to.matched.some(match => { // 循环matched中的path,以解决为通过菜单配置的子路由无法实现禁用的问题,如果父级路由是禁用状态,那么他的子路由也应该是禁用状态 currentPageMenu = menu.find(item => match.path == item.authorityscript); return currentPageMenu }) const isDisablePageOperation = currentPageMenu?currentPageMenu.isDisablePageOpt: false // 若菜单信息中禁用标识为1,则禁用相关功能;若为0,则不禁用。 if(isDisablePageOperation) { isShowContextMenu = false; displayType = "none"; }else { isShowContextMenu = true; displayType = "block"; } } } document.body.onselectstart = document.body.oncontextmenu = function() { return isShowContextMenu; }; printStyle.innerHTML = `@media print { body { display: ${displayType} } }` }); // 国结适配 import "~/assets/css/common.css"; import i18n from "./lang"; import CustomComponent from "./components/business"; import vuefunc from "~/utils/vuefunc"; import EventService,{LOGIN,LOGOUT} from "~/service/EventService"; import ButtonControlService from "~/common/ButtonControlService.js"; Vue.prototype.$buttonControlService = ButtonControlService; window.SUCCESS = "AAAAAA"; window.PageSize = 10; window.validMsg={ title:'失败', message:'请检查必输项!' } window.cancelMsg="点击“返回”后录入的信息将丢失,确定要返回吗?" Vue.use(ElementUI, { size: "small", i18n: (key, value) => i18n.t(key, value) }); Vue.use(CustomComponent); Vue.use(vuefunc); function resetCache(){ window.GLOBAL_CACHE = {PAGEID_CACHE:new Set()}; } //初始化cache resetCache(); //登录后重置 EventService.on(LOGIN,()=>{ resetCache(); }); //退出后重置 EventService.on(LOGOUT,()=>{ resetCache(); }); RewriteNotify() /* eslint-disable no-new */ new Vue({ el: '#app', router, store, i18n, template: '<App/>', components: { App } })