| | |
| | | }) |
| | | } |
| | | |
| | | export function LoginMenuCloud(data) { |
| | | return request({ |
| | | url: 'http://182.61.13.206/prod-api/enterprise/user/getModulesByEnterpriseUserName', |
| | | method: 'get', |
| | | params: data |
| | | }) |
| | | } |
| | | |
| | | export function getInfo(token) { |
| | | return request({ |
| | | url: '/vue-admin-template/user/info', |
| | |
| | | // 打印 |
| | | // import Print from 'vue-print-nb' |
| | | import Print from './components/Print/vue-print-nb' |
| | | |
| | | Vue.use(Print) |
| | | |
| | | // 水印 |
| | | import watermark from './utils/watermark.js' |
| | | |
| | | Vue.prototype.$watermark = watermark |
| | | |
| | | import clearTabIndex from './utils/clearTabIndex.js' // 删除el-tooltip tabindex |
| | | clearTabIndex.install(Vue) |
| | | |
| | | import vGanttChart from './lib/v-gantt-chart/index' // 引用修改过的gantt |
| | | import vGanttChart from './lib/v-gantt-chart/index' |
| | | // 引用修改过的gantt |
| | | Vue.use(vGanttChart) |
| | | |
| | | import { setCookie } from '@/utils/auth' // 引用修改过的gantt |
| | | // 判断是否走原平台过来 |
| | | if (window.location.hash.indexOf('guid') !== -1) { |
| | | setCookie('cloud', true)// 走云平台 |
| | | |
| | | const url = window.location.hash.split('?')[1] |
| | | const arr = url.split('&') |
| | | setCookie('guid', arr[0].split('=')[1]) |
| | | setCookie('userid', arr[1].split('=')[1]) |
| | | setCookie('admin', arr[2].split('=')[1]) |
| | | setCookie('navTabId', arr[2].split('=')[1]) |
| | | setCookie('username', decodeURIComponent(arr[3].split('=')[1])) |
| | | setCookie('password', arr[4].split('=')[1]) |
| | | setCookie('usertype', arr[5].split('=')[1]) |
| | | setCookie('rediskey', arr[6].split('=')[1]) |
| | | } |
| | | |
| | | new Vue({ |
| | | el: '#app', |
| | | router, |
| | |
| | | path: '/otherErp', |
| | | component: Layout, |
| | | redirect: '/otherErp/InventoryList', |
| | | name: '其它ERP集成', |
| | | name: '其他产品ERP集成', |
| | | code: '2018', |
| | | meta: { code: '2018', title: '其它ERP集成', icon: 'erpjc' }, |
| | | meta: { code: '2018', title: '其他产品ERP集成', icon: 'erpjc' }, |
| | | alwaysShow: true, |
| | | children: [ |
| | | { |
| | |
| | | import { asyncRoutes, commonRoutes } from '@/router' |
| | | import Layout from '@/layout' |
| | | import { getCookie } from '@/utils/auth' |
| | | |
| | | // 判断是否有权限 |
| | | function hasPermission(roles, route) { |
| | |
| | | const actions = { |
| | | generateRoutes({ commit }, menu) { |
| | | return new Promise(resolve => { |
| | | // console.log(menu, 'menu') |
| | | // const newRoutes = getAsyncRoutes(asyncRoutes, menu) |
| | | // const arr = ['1001', '1002', '1004'] |
| | | // const newRoutes = asyncRoutes.filter(i => { |
| | | // if (arr.includes(i.code)) { |
| | | // return i |
| | | // } |
| | | // }) |
| | | |
| | | const newRoutes = asyncRoutes |
| | | |
| | | let newRoutes |
| | | if (getCookie('cloud')) { |
| | | const arr = menu.map(i => i.code) |
| | | newRoutes = asyncRoutes.filter(i => { |
| | | if (arr.includes(i.code)) { |
| | | return i |
| | | } |
| | | }) |
| | | } else { |
| | | newRoutes = getAsyncRoutes(asyncRoutes, menu) |
| | | } |
| | | commit('SET_ROUTES', newRoutes) |
| | | resolve(newRoutes) |
| | | }) |
| | |
| | | import { login, logout, getInfo, LoginMenu } from '@/api/user' |
| | | import { login, logout, getInfo, LoginMenu, LoginMenuCloud } from '@/api/user' |
| | | import { getToken, setToken, removeToken, setCookie, removeCookie, getCookie } from '@/utils/auth' |
| | | import { resetRouter } from '@/router' |
| | | |
| | |
| | | // get user menu |
| | | getMenu({ commit, state }) { |
| | | return new Promise((resolve, reject) => { |
| | | LoginMenu({ usertype: 'PC', usercode: getCookie('admin') }).then(res => { |
| | | if (res.code === '200') { |
| | | commit('SET_NAME', res.Message) |
| | | commit('SET_MENU', res.data) |
| | | resolve(res.data) |
| | | } |
| | | }).catch(error => { |
| | | reject(error) |
| | | }) |
| | | console.log('进来了11111') |
| | | if (getCookie('cloud')) { // 走云 |
| | | LoginMenuCloud({ enterpriseUserName: getCookie('admin') }).then(res => { |
| | | if (res.code === 200) { |
| | | commit('SET_NAME', res.msg) |
| | | commit('SET_MENU', res.data) |
| | | resolve(res.data) |
| | | } |
| | | }).catch(error => { |
| | | reject(error) |
| | | }) |
| | | } else { |
| | | LoginMenu({ usertype: 'PC', usercode: getCookie('admin') }).then(res => { |
| | | if (res.code === '200') { |
| | | commit('SET_NAME', res.Message) |
| | | commit('SET_MENU', res.data) |
| | | resolve(res.data) |
| | | } |
| | | }).catch(error => { |
| | | reject(error) |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | |
| | | // reset visited views and cached views |
| | | dispatch('tagsView/delAllViews', null, { root: true }) |
| | | sessionStorage.removeItem('tabViews') |
| | | |
| | | if (getCookie('cloud')) { |
| | | removeCookie('cloud') |
| | | window.location.href = 'http://182.61.13.206/choose' |
| | | } |
| | | commit('RESET_STATE') |
| | | |
| | | resolve() |
| | |
| | | removeCookie('rediskey') |
| | | removeCookie('code') |
| | | removeCookie('guid') |
| | | setTimeout(() => { |
| | | sessionStorage.removeItem('tabViews') |
| | | window.location.reload() |
| | | }, 1000 * 2) |
| | | |
| | | if (getCookie('cloud')) { |
| | | removeCookie('cloud') |
| | | setTimeout(() => { |
| | | sessionStorage.removeItem('tabViews') |
| | | window.location.href = 'http://182.61.13.206/choose' |
| | | }, 1000 * 2) |
| | | } else { |
| | | setTimeout(() => { |
| | | sessionStorage.removeItem('tabViews') |
| | | window.location.reload() |
| | | }, 1000 * 2) |
| | | } |
| | | } |
| | | // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; |
| | | // if (res.code === 50008 || res.code === 50012 || res.code === 50014) { |