| | |
| | | import crudCommon from '@/mixins/crud'; |
| | | // 业务组件 |
| | | import tenantPackage from './views/system/tenantpackage'; |
| | | |
| | | |
| | | import Cookies from 'js-cookie' |
| | | // 携带token跳转页面设置 |
| | | |
| | | const tokenLength = window.location.href.indexOf('='); |
| | | if(tokenLength>0){ |
| | | //取“=”之后的token |
| | | let z = window.location.href.substring(tokenLength + 1) |
| | | // 把token存进B系统 |
| | | let obj = { |
| | | dataType: typeof (z), |
| | | content: z, |
| | | datetime: new Date().getTime() |
| | | } |
| | | window.localStorage.setItem('saber-token', JSON.stringify(obj)); |
| | | Cookies.set('saber-access-token', z) |
| | | } |
| | | |
| | | // 注册全局crud驱动 |
| | | window.$crudCommon = crudCommon; |
| | |
| | | NProgress.configure({showSpinner: false}); |
| | | const lockPage = store.getters.website.lockPage; //锁屏页 |
| | | router.beforeEach((to, from, next) => { |
| | | var tag = false; |
| | | if (to.fullPath.indexOf("token") > 0) { |
| | | tag = true; |
| | | } |
| | | const meta = to.meta || {}; |
| | | const isMenu = meta.menu === undefined ? to.query.menu : meta.menu; |
| | | store.commit('SET_IS_MENU', isMenu === undefined); |
| | |
| | | next({path: '/'}) |
| | | } else { |
| | | //如果用户信息为空则获取用户信息,获取用户信息失败,跳转到登录页 |
| | | if (store.getters.token.length === 0) { |
| | | if (store.getters.token.length === 0 && tag==false) { |
| | | store.dispatch('FedLogOut').then(() => { |
| | | next({path: '/login'}) |
| | | }) |
| | |
| | | const i18n = to.query.i18n; |
| | | if (to.query.target) { |
| | | window.open(value) |
| | | } else if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) { |
| | | } else if (meta.isTab !== false && !validatenull(value) && !validatenull(label) && tag==false) { |
| | | store.commit('ADD_TAG', { |
| | | label: label, |
| | | value: value, |
| | |
| | | } else if (obj.dataType == 'object') { |
| | | content = obj.content; |
| | | } |
| | | console.log(content,9999) |
| | | return content; |
| | | } |
| | | /** |
| | |
| | | return ids.join(","); |
| | | } |
| | | }, |
| | | created(){ |
| | | const tokenLength = window.location.href.indexOf('='); |
| | | if(tokenLength>0){ |
| | | //取“=”之后的token |
| | | let z = window.location.href.substring(tokenLength + 1) |
| | | this.$store.commit('SET_TOKEN', z); |
| | | } |
| | | }, |
| | | methods: { |
| | | rowSave(row, done, loading) { |
| | | add(row).then(() => { |