Merge branch 'develop_idm' into 'develop'
Develop idm See merge request LAWS/laws-system-front-FOTON!174
This commit is contained in:
@@ -431,6 +431,22 @@ export function get_verify_by_instance (data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function getMenu (data) {
|
||||
return axios({
|
||||
url: '/api/sarUser/user/menu',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
export function loginIdm (data) {
|
||||
return axios({
|
||||
url: '/api/loginIdm',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 流程委托接口
|
||||
export function changeAssigneeNew (data) {
|
||||
return axios({
|
||||
|
||||
+46
-25
@@ -7,7 +7,11 @@ import axios from 'axios'
|
||||
import router from '@/router'
|
||||
import store from '@/store'
|
||||
import {Message} from 'element-ui'
|
||||
import { baseUrl } from '@/sysConfig'
|
||||
import { baseUrl,webLoginType,ssoLoginUrlDev } from '@/sysConfig'
|
||||
import domMessage from '../messageOnce/messageOnce'
|
||||
|
||||
const messageOnce = new domMessage()
|
||||
|
||||
export const CancelToken = axios.CancelToken
|
||||
// import 'element-ui/lib/theme-chalk/index.css'
|
||||
const _axios = axios.create({
|
||||
@@ -34,37 +38,54 @@ window._axiosPromiseArr = []
|
||||
* liuyan
|
||||
*/
|
||||
_axios.interceptors.request.use(
|
||||
config => {
|
||||
// 记录接口请求
|
||||
// config.cancelToken = new axios.CancelToken(cancel => {
|
||||
// // window._axiosPromiseArr.push({ cancel })
|
||||
// })
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
return Promise.reject(error.response)
|
||||
})
|
||||
config => {
|
||||
// 记录接口请求
|
||||
let token = store.state.token;
|
||||
if (!config.headers.hasOwnProperty('token') && token != null && token) {
|
||||
config.headers.token = token;
|
||||
}
|
||||
// config.cancelToken = new axios.CancelToken(cancel => {
|
||||
// // window._axiosPromiseArr.push({ cancel })
|
||||
// })
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
return Promise.reject(error.response)
|
||||
})
|
||||
/**
|
||||
* @description: axios响应拦截器
|
||||
* liuyan
|
||||
*/
|
||||
_axios.interceptors.response.use(
|
||||
res => {
|
||||
return res
|
||||
},
|
||||
error => {
|
||||
// 登录超时
|
||||
if (error.response.data.path === '/a/login' && store.state.isTimeOut === false) {
|
||||
for (let key in store.state) {
|
||||
if (key !== 'isTimeOut' && key !== 'laws_urm' && key !== 'laws_prm') {
|
||||
store.state[key] = ''
|
||||
res => {
|
||||
if(res.data && res.data.respCode && res.data.respCode === 'LE505'){
|
||||
window.sessionStorage.clear()
|
||||
messageOnce.warning({
|
||||
message: '登录超时,请重新登录',
|
||||
type: 'warning'
|
||||
})
|
||||
if(webLoginType != null && webLoginType === 'idm' ) {
|
||||
// idm 统一认证登录页面
|
||||
return window.location.href = ssoLoginUrlDev
|
||||
}else if(webLoginType != null && webLoginType === 'dev'){
|
||||
return router.push('/login')
|
||||
}
|
||||
}
|
||||
Message.warning('登录超时,请重新登录')
|
||||
router.push('/login')
|
||||
store.state.isTimeOut = true
|
||||
}
|
||||
})
|
||||
return res
|
||||
},
|
||||
error => {
|
||||
// 登录超时
|
||||
if (error.response.data.path === '/a/login' && store.state.isTimeOut === false) {
|
||||
for (let key in store.state) {
|
||||
if (key !== 'isTimeOut' && key !== 'laws_urm' && key !== 'laws_prm') {
|
||||
store.state[key] = ''
|
||||
}
|
||||
}
|
||||
Message.warning('登录超时,请重新登录')
|
||||
router.push('/login')
|
||||
store.state.isTimeOut = true
|
||||
}
|
||||
})
|
||||
function api () {
|
||||
return store.getters.getTypeFlag === 'CloudRepository' ? '/busApi/' : '/api/'
|
||||
}
|
||||
|
||||
+46
-25
@@ -2,9 +2,13 @@ import axios from 'axios'
|
||||
import router from '@/router'
|
||||
import store from '@/store'
|
||||
import {Message} from 'element-ui'
|
||||
import { baseUrl } from '@/sysConfig'
|
||||
import { baseUrl,webLoginType,ssoLoginUrlDev } from '@/sysConfig'
|
||||
import domMessage from '../messageOnce/messageOnce'
|
||||
|
||||
// import 'element-ui/lib/theme-chalk/index.css'
|
||||
|
||||
const messageOnce = new domMessage()
|
||||
|
||||
/**
|
||||
* @description: FormData
|
||||
* @author: xx
|
||||
@@ -29,35 +33,52 @@ service.defaults.headers['Content-type'] = 'application/json'
|
||||
* liuyan
|
||||
*/
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
if (config.params) {
|
||||
// 解决IE请求不刷新
|
||||
config.params._t = new Date().getTime()
|
||||
}
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
return Promise.reject(error.response)
|
||||
})
|
||||
config => {
|
||||
if (config.params) {
|
||||
// 解决IE请求不刷新
|
||||
config.params._t = new Date().getTime()
|
||||
}
|
||||
let token = store.state.token;
|
||||
if (!config.headers.hasOwnProperty('token') && token != null && token) {
|
||||
config.headers.token = token;
|
||||
}
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
return Promise.reject(error.response)
|
||||
})
|
||||
/**
|
||||
* @description: axios响应拦截器
|
||||
* liuyan
|
||||
*/
|
||||
service.interceptors.response.use(
|
||||
res => {
|
||||
return res.data
|
||||
},
|
||||
error => {
|
||||
// 登录超时
|
||||
if (error.response.data.path === '/a/login' && store.state.isTimeOut === false) {
|
||||
for (let key in store.state) {
|
||||
if (key !== 'isTimeOut' && key !== 'laws_urm' && key !== 'laws_prm') {
|
||||
store.state[key] = ''
|
||||
res => {
|
||||
if(res.data && res.data.respCode != undefined && res.data.respCode === 'LE505'){
|
||||
window.sessionStorage.clear()
|
||||
messageOnce.warning({
|
||||
message: '登录超时,请重新登录',
|
||||
type: 'warning'
|
||||
})
|
||||
if(webLoginType != null && webLoginType === 'idm' ) {
|
||||
// idm 统一认证登录页面
|
||||
return window.location.href = ssoLoginUrlDev
|
||||
}else if(webLoginType != null && webLoginType === 'dev'){
|
||||
return router.push('/login')
|
||||
}
|
||||
}
|
||||
return res.data
|
||||
},
|
||||
error => {
|
||||
// 登录超时
|
||||
if (error.response.data.path === '/a/login' && store.state.isTimeOut === false) {
|
||||
for (let key in store.state) {
|
||||
if (key !== 'isTimeOut' && key !== 'laws_urm' && key !== 'laws_prm') {
|
||||
store.state[key] = ''
|
||||
}
|
||||
}
|
||||
Message.warning('登录超时,请重新登录')
|
||||
router.push('/login')
|
||||
store.state.isTimeOut = true
|
||||
}
|
||||
Message.warning('登录超时,请重新登录')
|
||||
router.push('/login')
|
||||
store.state.isTimeOut = true
|
||||
}
|
||||
})
|
||||
})
|
||||
export default service
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import {Message} from 'element-ui'
|
||||
// 私有属性,只在当前文件可用
|
||||
const showMessage = Symbol('showMessage')
|
||||
export default class domMessage {
|
||||
success (options, single = true) {
|
||||
this[showMessage]('success', options, single)
|
||||
}
|
||||
warning(options, single = true) {
|
||||
this[showMessage]('warning', options, single)
|
||||
}
|
||||
info(options, single = true) {
|
||||
this[showMessage]('info', options, single)
|
||||
}
|
||||
error(options, single = true) {
|
||||
this[showMessage]('error', options, single)
|
||||
}
|
||||
[showMessage] (type, options, single) {
|
||||
if (single) {
|
||||
// 关键代码,判断当前页是否有el-message标签,如果没有则执行弹窗操作
|
||||
if (document.getElementsByClassName('el-message').length === 0) {
|
||||
Message[type](options)
|
||||
}
|
||||
} else {
|
||||
Message[type](options)
|
||||
}
|
||||
}
|
||||
}
|
||||
+185
-82
@@ -46,86 +46,189 @@ import router from './router'
|
||||
// 路由解析器
|
||||
import Re from 'path-to-regexp'
|
||||
|
||||
import { get_verify_by_instance } from 'api/process'
|
||||
import { get_verify_by_instance,loginIdm,getMenu } from 'api/process'
|
||||
|
||||
import { ssoLoginUrlDev,ssoLoginUrl,webLoginType,devWebUrl } from '@/sysConfig'
|
||||
|
||||
import { mapMutations, mapActions } from 'vuex'
|
||||
|
||||
// 路由拦截
|
||||
router.beforeEach(function (to, from, next) {
|
||||
let path = to.path;
|
||||
console.log("auth : to =>", to);
|
||||
console.log("auth : path =>" + path);
|
||||
let taskId = to.query.taskIds;
|
||||
let prcId = to.query.prcId;
|
||||
let prcNum = to.query.prcNum;
|
||||
let prcName = to.query.prcName;
|
||||
let prcType = to.query.prcType;
|
||||
let param = "?taskIds="+taskId+"&prcId="+prcId
|
||||
+"&prcNum="+prcNum+"&prcName="+prcName+"&prcType="+prcType;
|
||||
if(taskId !== undefined && taskId !== null && prcId !== undefined && prcId !== null){
|
||||
get_verify_by_instance({
|
||||
taskId: taskId, // 任务id
|
||||
pId: prcId // 流程实例
|
||||
}).then(res => {
|
||||
let hisCount = res.hisCount === undefined ? 0 : res.hisCount;
|
||||
let commitStatus = res.commitStatus === undefined ? 0 : res.commitStatus;
|
||||
let isNotFinished = res.isNotFinished === undefined ? 0 :res.isNotFinished;
|
||||
|
||||
if(hisCount && hisCount > 0){ // 业务系统 当前节点已完成
|
||||
// 根据type判断跳转具体流程页面
|
||||
if (prcType === '1') {
|
||||
// 标准入库流程数据
|
||||
next({path:"bzrkStep5"+param})
|
||||
}else if(prcType === '4'){
|
||||
//标准清单发布流程数据
|
||||
next({path:"bzqdfbStep1-4"+param})
|
||||
}else if (prcType === '5'){
|
||||
//标准项目合规评估 标准维度
|
||||
if(path === "/xmpgStep2" || path === "/xmpgStep1" || path === "/xmpgStep1-2"){
|
||||
next({path:"xmpgStep1-2"+param})
|
||||
}else {
|
||||
next({path:"xmpgStep1-7"+param})
|
||||
}
|
||||
}else if(prcType === '6'){
|
||||
//标准项目合规评估 项目维度
|
||||
if(path === "/xmpg2Step1" || path === "/xmpg2Step2" || path === "/xmpg2Step1-2"){
|
||||
next({path:"xmpg2Step1-2"+param})
|
||||
}else {
|
||||
next({path:"xmpg2Step1-12"+param})
|
||||
}
|
||||
} else if (prcType === '8') {
|
||||
// 未符合项整改
|
||||
next({path:"wfhxzgStep5-1"+param})
|
||||
} else if(prcType === '9'){
|
||||
next({path:"bzjdStep1-6"+param})
|
||||
//标准调研流程
|
||||
}else if(prcType === '2'){
|
||||
next({path:"bzdyStep1-9"+param})
|
||||
}else if(prcType === '3'){
|
||||
//标准征求意见
|
||||
next({path:"bzzqyjStep1-9"+param})
|
||||
}else if(prcType === '10'){
|
||||
//项目清单确认
|
||||
next({path:"xmqdqrStep1-3"+param})
|
||||
console.log("auth : to =>", to);
|
||||
console.log(webLoginType)
|
||||
let toName = to.name
|
||||
let token = store.state.token
|
||||
let path = to.path;
|
||||
let requireAuth = to.meta.requireAuth;
|
||||
console.log("auth : path =>" + path);
|
||||
console.log("token : token =>" + token);
|
||||
console.log("requireAuth : requireAuth =>" + requireAuth);
|
||||
let taskId = to.query.taskIds;
|
||||
let prcId = to.query.prcId;
|
||||
let prcNum = to.query.prcNum;
|
||||
let prcName = to.query.prcName;
|
||||
let prcType = to.query.prcType;
|
||||
let param = "taskIds=" + taskId + "&prcId=" + prcId
|
||||
+ "&prcNum=" + prcNum + "&prcName=" + prcName + "&prcType=" + prcType;
|
||||
console.log(store)
|
||||
let url = window.location.search
|
||||
let code = "";
|
||||
if(url){
|
||||
url = url.substr(1);
|
||||
url = url.split('&');
|
||||
let info = [];
|
||||
let obj = {};
|
||||
for (let i = 0,len = url.length; i < len; i++) {
|
||||
info = url[i].split('=')
|
||||
obj[info[0]] = decodeURI(info[1]);
|
||||
url[i] = obj;
|
||||
}
|
||||
}else { // 业务系统 当前节点未完成
|
||||
// commitStatus 大于0 表示当前节点存在未完成干活流程
|
||||
if(isNotFinished && isNotFinished > 0 && commitStatus && commitStatus > 0){
|
||||
if(prcType === '3'){
|
||||
//标准征求意见 接受节点 未完成 oa已办 跳转详情页面
|
||||
if(path === '/bzzqyjStep3'){
|
||||
next({path:"processAcceptDetail?prcNum="+prcNum+"&tabsName=AlreadyProcess"})
|
||||
}
|
||||
}
|
||||
}else{
|
||||
next()
|
||||
}
|
||||
}
|
||||
console.log("res : res =>", res);
|
||||
})
|
||||
}
|
||||
next()
|
||||
code = url[0].code
|
||||
}
|
||||
|
||||
function extractedLocalStorage(url,param) {
|
||||
localStorage.removeItem("routerUrl")
|
||||
localStorage.setItem('routerUrl', url)
|
||||
localStorage.removeItem("routerParam")
|
||||
localStorage.setItem('routerParam', param)
|
||||
}
|
||||
// 返回值为登录状态
|
||||
if ((token === null || token === '' ) && toName !== 'Login') {
|
||||
if(webLoginType != null && webLoginType === 'idm' ){
|
||||
if(code){
|
||||
next()
|
||||
}else {
|
||||
if (taskId !== undefined && taskId !== null && prcId !== undefined && prcId !== null) {
|
||||
extractedVerify(token)
|
||||
}else {
|
||||
extractedLocalStorage('home2','');
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
}
|
||||
}
|
||||
}else if(webLoginType != null && webLoginType === 'dev'){
|
||||
next('/Login')
|
||||
}
|
||||
}else {
|
||||
extractedVerify(token)
|
||||
}
|
||||
|
||||
function extractedVerify() {
|
||||
if (taskId !== undefined && taskId !== null && prcId !== undefined && prcId !== null) {
|
||||
get_verify_by_instance({
|
||||
taskId: taskId, // 任务id
|
||||
pId: prcId // 流程实例
|
||||
}).then(res => {
|
||||
let hisCount = res.hisCount === undefined ? 0 : res.hisCount;
|
||||
let commitStatus = res.commitStatus === undefined ? 0 : res.commitStatus;
|
||||
let isNotFinished = res.isNotFinished === undefined ? 0 : res.isNotFinished;
|
||||
|
||||
if (hisCount && hisCount > 0) { // 业务系统 当前节点已完成
|
||||
// 根据type判断跳转具体流程页面
|
||||
if (prcType === '1') {
|
||||
// 标准入库流程数据
|
||||
extracted("bzrkStep5");
|
||||
} else if (prcType === '4') {
|
||||
//标准清单发布流程数据
|
||||
extracted("bzqdfbStep1-4");
|
||||
} else if (prcType === '5') {
|
||||
//标准项目合规评估 标准维度
|
||||
if (path === "/xmpgStep2" || path === "/xmpgStep1" || path === "/xmpgStep1-2") {
|
||||
extracted("xmpgStep1-2");
|
||||
} else {
|
||||
extracted("xmpgStep1-7");
|
||||
}
|
||||
} else if (prcType === '6') {
|
||||
//标准项目合规评估 项目维度
|
||||
if (path === "/xmpg2Step1" || path === "/xmpg2Step2" || path === "/xmpg2Step1-2") {
|
||||
extracted("xmpg2Step1-2");
|
||||
} else {
|
||||
extracted("xmpg2Step1-12");
|
||||
}
|
||||
} else if (prcType === '8') {
|
||||
// 未符合项整改
|
||||
extracted("wfhxzgStep5-1");
|
||||
} else if (prcType === '9') {
|
||||
extracted("bzjdStep1-6");
|
||||
//标准调研流程
|
||||
} else if (prcType === '2') {
|
||||
extracted("bzdyStep1-9");
|
||||
} else if (prcType === '3') {
|
||||
//标准征求意见
|
||||
extracted("bzzqyjStep1-9");
|
||||
} else if (prcType === '10') {
|
||||
//项目清单确认
|
||||
extracted("xmqdqrStep1-3");
|
||||
}
|
||||
} else { // 业务系统 当前节点未完成
|
||||
// commitStatus 大于0 表示当前节点存在未完成干活流程
|
||||
if (isNotFinished && isNotFinished > 0 && commitStatus && commitStatus > 0) {
|
||||
if (prcType === '3') {
|
||||
//标准征求意见 接受节点 未完成 oa已办 跳转详情页面
|
||||
if (path === '/bzzqyjStep3') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// oa 待测 sso
|
||||
extracted3()
|
||||
}
|
||||
}
|
||||
function extracted(routerPath) {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(routerPath,param);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next({path: routerPath + '?' +param})
|
||||
}
|
||||
}
|
||||
|
||||
function extracted3() {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(toName,param);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
function extracted2(routerPath,param2) {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(routerPath,param2);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next({path: routerPath + '?' + param2})
|
||||
}
|
||||
}
|
||||
console.log("res : res =>", res);
|
||||
})
|
||||
}
|
||||
if(path === '/loginVerify'){
|
||||
if(webLoginType != null && webLoginType === 'dev'){
|
||||
next('/Login')
|
||||
}else {
|
||||
next()
|
||||
}
|
||||
}else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// 设置用户信息
|
||||
function setUserInfo (userInfo) {
|
||||
const timeStamp = new Date().getTime().toString()
|
||||
const _USERINFO = JSON.parse(userInfo)
|
||||
_USERINFO.userId = _USERINFO.userId || _USERINFO.usId
|
||||
_USERINFO.userName = _USERINFO.userName || _USERINFO.uName
|
||||
try {
|
||||
localStorage.setItem('userInfo', JSON.stringify(_USERINFO))
|
||||
localStorage.setItem('userInfoModifyTime', timeStamp)
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
|
||||
Vue.config.productionTip = false
|
||||
// jquery
|
||||
@@ -147,16 +250,16 @@ Vue.prototype.simpleUploadPath = simpleUploadPath
|
||||
Vue.prototype.$moment = moment
|
||||
// 国际化
|
||||
const i18n = new VueI18n({
|
||||
locale: store.getters.getLanguage || 'cn', // 定义默认语言为中文
|
||||
messages: {
|
||||
cn: require('@/assets/languages/cn'),
|
||||
en: require('@/assets/languages/en')
|
||||
}
|
||||
locale: store.getters.getLanguage || 'cn', // 定义默认语言为中文
|
||||
messages: {
|
||||
cn: require('@/assets/languages/cn'),
|
||||
en: require('@/assets/languages/en')
|
||||
}
|
||||
})
|
||||
/* eslint-disable no-new */
|
||||
window.vm = new Vue({
|
||||
router,
|
||||
store,
|
||||
i18n,
|
||||
render: h => h(App)
|
||||
router,
|
||||
store,
|
||||
i18n,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
||||
|
||||
+1
-144
@@ -81,150 +81,7 @@
|
||||
prefix: '/foton'
|
||||
}, res => {
|
||||
if (res.ok) {
|
||||
const JSESSIONID = document.cookie
|
||||
this.setJESSCookie(JSESSIONID)
|
||||
if (res.data.orgId === null || res.data.orgId === '') {
|
||||
this.$message.warning('未分配组织机构,请联系管理员分配后重新登录')
|
||||
return
|
||||
}
|
||||
// debugger
|
||||
let Base64 = require('js-base64').Base64
|
||||
let userInfoStr = Base64.decode(res.data)
|
||||
let userInfo2 = decodeURIComponent(userInfoStr)
|
||||
let userInfoObj = JSON.parse(userInfo2)
|
||||
userInfoObj.userId = userInfoObj.usid
|
||||
this.setToken(userInfoObj.usid) // vuex存储token
|
||||
this.getByUserInfoCode(userInfoObj.usid).then((userInfo) => {
|
||||
if (userInfo !== '' && userInfo !== null) {
|
||||
userInfo.workNum = userInfoObj.workNum
|
||||
if (userInfo.userPic !== null) {
|
||||
this.getUserPic(userInfo.userPic).then((userPic) => {
|
||||
// 把图片信息挂到用户信息中
|
||||
userInfo.avator = 'uploadPath' + userPic.filePath + userPic.fileName
|
||||
this.setUserInfo((JSON.stringify(userInfo)))
|
||||
this.resetTime()
|
||||
if (this.isRemember) {
|
||||
this.rememberPwd({
|
||||
username: this.username,
|
||||
password: this.password
|
||||
})
|
||||
} else {
|
||||
this.rememberPwd({
|
||||
username: '',
|
||||
password: ''
|
||||
})
|
||||
}
|
||||
// 获取用户菜单
|
||||
this.getMenu().then((menuList) => {
|
||||
let hasHomeMenu = menuList.some((menuItem) => {
|
||||
// return menuItem.id === 'G72J4WNFM8'
|
||||
return menuItem.id === 'asdfadf'
|
||||
})
|
||||
|
||||
if (hasHomeMenu) {
|
||||
this.setMenu(JSON.stringify(menuList)).then(res => {
|
||||
this.loading = false
|
||||
this.$router.push('/home2')
|
||||
}, e => {
|
||||
this.loading = false
|
||||
this.$message.warning('未获取到菜单')
|
||||
})
|
||||
} else {
|
||||
this.$http.get('/logout', {}, {}, res => {
|
||||
this.loading = false
|
||||
this.$message.warning('无权访问')
|
||||
this.$store.dispatch('logout')
|
||||
}, e => {})
|
||||
}
|
||||
})
|
||||
}, e => {
|
||||
this.loading = false
|
||||
this.$notify.error('用户信息拉取失败')
|
||||
})
|
||||
} else {
|
||||
this.setUserInfo((JSON.stringify(userInfo)))
|
||||
this.resetTime()
|
||||
if (this.isRemember) {
|
||||
this.rememberPwd({
|
||||
username: this.username,
|
||||
password: this.password
|
||||
})
|
||||
} else {
|
||||
this.rememberPwd({
|
||||
username: '',
|
||||
password: ''
|
||||
})
|
||||
}
|
||||
// 获取用户菜单
|
||||
this.getMenu().then((menuList) => {
|
||||
let hasHomeMenu = false
|
||||
menuList.map((menuItem) => {
|
||||
if (menuItem.id === 'asdfadf') {
|
||||
hasHomeMenu = true
|
||||
}
|
||||
})
|
||||
if (hasHomeMenu) {
|
||||
this.setMenu(JSON.stringify(menuList)).then(res => {
|
||||
this.$router.push('/home2')
|
||||
}, e => {
|
||||
this.$message.warning('未获取到菜单')
|
||||
})
|
||||
} else {
|
||||
this.$http.get('/logout', {}, {}, res => {
|
||||
this.$message.warning('无权访问')
|
||||
}, e => {})
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
let userInfo = {}
|
||||
for (let key in userInfoObj) {
|
||||
if (key !== 'uname') {
|
||||
userInfo[key] = userInfoObj[key]
|
||||
} else {
|
||||
userInfo.uName = userInfoObj[key]
|
||||
}
|
||||
}
|
||||
this.setUserInfo(JSON.stringify((userInfo)))
|
||||
this.resetTime()
|
||||
if (this.isRemember) {
|
||||
this.rememberPwd({
|
||||
username: this.username,
|
||||
password: this.password
|
||||
})
|
||||
} else {
|
||||
this.rememberPwd({
|
||||
username: '',
|
||||
password: ''
|
||||
})
|
||||
}
|
||||
// 获取用户菜单
|
||||
this.getMenu().then((menuList) => {
|
||||
let hasHomeMenu = false
|
||||
menuList.map((menuItem) => {
|
||||
if (menuItem.id === 'asdfadf') {
|
||||
hasHomeMenu = true
|
||||
}
|
||||
})
|
||||
if (hasHomeMenu) {
|
||||
this.setMenu(JSON.stringify(menuList)).then(res => {
|
||||
this.$router.push('/home2')
|
||||
}, e => {
|
||||
this.$message.warning('未获取到菜单')
|
||||
})
|
||||
} else {
|
||||
this.$http.get('/logout', {}, {}, res => {
|
||||
console.log('logout')
|
||||
this.$message.warning('无权访问')
|
||||
}, e => {
|
||||
console.log(e)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}, e => {
|
||||
this.$message.warning('获取用户信息失败')
|
||||
})
|
||||
this.loginNew(res)
|
||||
} else if (res.respCode === 'r0012') {
|
||||
this.loading = false
|
||||
this.$message.error(res.message)
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
<!-- 长城项目 登录页 -->
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapMutations, mapActions } from 'vuex'
|
||||
import axios from 'axios'
|
||||
import util from 'util'
|
||||
import { get_verify_by_instance,loginIdm,getMenu } from 'api/process'
|
||||
import { ssoLoginUrlDev,ssoLoginUrl,webLoginType,devWebUrl } from '@/sysConfig'
|
||||
|
||||
export default {
|
||||
name: 'LoginVerify',
|
||||
data () {
|
||||
return {
|
||||
username: this.$store.state.laws_urm || '', // 用户名
|
||||
password: this.$store.state.laws_prm || '', // 密码
|
||||
loading: false,
|
||||
isRemember: false, // 记住密码
|
||||
showIETips: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* @description: 获取菜单logout
|
||||
* @author: chenxiaoxi
|
||||
* @date: 2018/11/11 13:42:14
|
||||
*/
|
||||
getMenu () {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$http.get('sarUser/user/menu', {}, {
|
||||
_this: this,
|
||||
}, res => {
|
||||
if (res.ok) {
|
||||
resolve(res.data)
|
||||
}
|
||||
}, e => {
|
||||
reject(e)
|
||||
})
|
||||
})
|
||||
},
|
||||
loginNew (res) {
|
||||
if (res.data.orgId === null || res.data.orgId === '') {
|
||||
this.$message.warning('未分配组织机构,请联系管理员分配后重新登录')
|
||||
return
|
||||
}
|
||||
let Base64 = require('js-base64').Base64
|
||||
let userInfoStr = Base64.decode(res.data)
|
||||
let userInfo2 = decodeURIComponent(userInfoStr)
|
||||
let userInfoObj = JSON.parse(userInfo2)
|
||||
userInfoObj.userId = userInfoObj.usid
|
||||
window.sessionStorage.setItem('userInfoObj', userInfoObj); // del
|
||||
this.setToken(userInfoObj.token) // vuex存储token
|
||||
let userInfo = {}
|
||||
for (let key in userInfoObj) {
|
||||
if (key !== 'uname') {
|
||||
userInfo[key] = userInfoObj[key]
|
||||
} else {
|
||||
userInfo.uName = userInfoObj[key]
|
||||
}
|
||||
}
|
||||
this.setUserInfo(JSON.stringify((userInfo)))
|
||||
// this.resetTime()
|
||||
// 获取用户菜单
|
||||
window.sessionStorage.setItem('userInfo', userInfo); // del
|
||||
this.getMenu().then((menuList) => {
|
||||
let hasHomeMenu = false
|
||||
menuList.map((menuItem) => {
|
||||
if (menuItem.id === 'asdfadf') {
|
||||
hasHomeMenu = true
|
||||
}
|
||||
})
|
||||
window.sessionStorage.setItem('hasHomeMenu', hasHomeMenu); // del
|
||||
window.sessionStorage.setItem('menuList', menuList); // del
|
||||
if (hasHomeMenu) {
|
||||
this.setMenu(JSON.stringify(menuList)).then(res => {
|
||||
// this.$router.push('/home1')
|
||||
let routerUrl = localStorage.getItem("routerUrl");
|
||||
let routerParam = localStorage.getItem("routerParam");
|
||||
// 路由跳转
|
||||
if(routerParam && routerParam != ''){
|
||||
const param = routerParam.split("&");
|
||||
this.$router.push({
|
||||
name: routerUrl,
|
||||
query: {
|
||||
taskIds: param[0].split("=")[1],
|
||||
prcId: param[1].split("=")[1],
|
||||
prcNum: param[2].split("=")[1],
|
||||
prcName: param[3].split("=")[1],
|
||||
prcType: param[4].split("=")[1]
|
||||
}
|
||||
})
|
||||
}else {
|
||||
this.$router.push('/'+routerUrl)
|
||||
}
|
||||
|
||||
|
||||
}, e => {
|
||||
this.$message.warning('未获取到菜单')
|
||||
})
|
||||
} else {
|
||||
alert('无系统权限')
|
||||
// window.location.href = 'http://testsso1.foton.com.cn/oauth2.0/authorize?client_id=app_slrs&redirect_uri=http://127.0.0.1:9090&response_type=code';
|
||||
}
|
||||
})
|
||||
},
|
||||
...mapMutations(['setToken', 'setUserInfo', 'resetTime', 'rememberPwd', 'setJESSCookie']),
|
||||
...mapActions(['setMenu'])
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
mounted () {
|
||||
let url = window.location.search
|
||||
let code = "";
|
||||
if(url){
|
||||
url = url.substr(1);
|
||||
url = url.split('&');
|
||||
let info = [];
|
||||
let obj = {};
|
||||
for (let i = 0,len = url.length; i < len; i++) {
|
||||
info = url[i].split('=')
|
||||
obj[info[0]] = decodeURI(info[1]);
|
||||
url[i] = obj;
|
||||
}
|
||||
code = url[0].code
|
||||
}
|
||||
let _formData = new FormData()
|
||||
_formData.append('code', code === undefined ? "" : code)
|
||||
loginIdm(_formData).then(res => {
|
||||
if (res.ok) {
|
||||
this.loginNew(res)
|
||||
} else {
|
||||
window.location.href = ssoLoginUrlDev
|
||||
}
|
||||
})
|
||||
|
||||
if (this.$store.state.laws_urm !== '') {
|
||||
this.isRemember = true
|
||||
}
|
||||
const UA = navigator.userAgent.toLocaleLowerCase()
|
||||
if (UA.match(/msie/) != null || UA.match(/trident/) != null) {
|
||||
this.showIETips = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
||||
+16
-30
@@ -6,14 +6,20 @@ Vue.use(Router)
|
||||
const routes = [
|
||||
{
|
||||
path: '*',
|
||||
redirect: '/login'
|
||||
redirect: '/loginVerify'
|
||||
},
|
||||
// 登录页
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
component: () =>
|
||||
import('@/pages/login')
|
||||
import('@/pages/login')
|
||||
},
|
||||
{
|
||||
path: '/loginVerify',
|
||||
name: 'LoginVerify',
|
||||
component: () =>
|
||||
import('@/pages/loginVerify')
|
||||
},
|
||||
// 跳转刷新页面
|
||||
{
|
||||
@@ -2106,33 +2112,13 @@ router.onError((error) => {
|
||||
}
|
||||
})
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
let toName = to.name
|
||||
let token = store.state.token
|
||||
// 返回值为登录状态
|
||||
if ((token === null || token === '') && (toName !== 'Login' && to.meta.requireAuth)) {
|
||||
return next('/Login')
|
||||
}
|
||||
// 流程页面权限判断
|
||||
// const processCenter = to.name === 'ProcessCenter' || (to.meta.parentPath && to.meta.parentPath === '/processCenter')
|
||||
// if (processCenter) {
|
||||
// if (to.meta.process) {
|
||||
// if (store.getters.getHandleInfo.prcType === to.meta.process.prcType &&
|
||||
// (store.getters.getHandleInfo. === to.meta.process.taskInfo ||
|
||||
// (to.meta.process.taskInfo.__proto__.constructor === Array && to.meta.process.taskInfo.includes(store.getters.getHandleInfo.taskInfo)))) {
|
||||
// next()
|
||||
// } else {
|
||||
// Message.error('请正确操作流程')
|
||||
// setTimeout(() => {
|
||||
// router.push({
|
||||
// name: 'ProcessCenter'
|
||||
// })
|
||||
// }, 100)
|
||||
// }
|
||||
// }
|
||||
// next()
|
||||
// }
|
||||
next()
|
||||
})
|
||||
// router.beforeEach((to, from, next) => {
|
||||
// let toName = to.name
|
||||
// let token = store.state.token
|
||||
// // 返回值为登录状态
|
||||
// if ((token === null || token === '') && (toName !== 'Login' && to.meta.requireAuth)) {
|
||||
// return next('/Login')
|
||||
// }
|
||||
// })
|
||||
|
||||
export default router
|
||||
|
||||
+17
-6
@@ -4,10 +4,17 @@
|
||||
* @date: 2018-09-04 17:47:46
|
||||
*/
|
||||
// 服务器地址
|
||||
// const devIp = '39.98.140.126'
|
||||
// const devInterfacePORT = '10005'
|
||||
// const devIp = '192.168.10.248'
|
||||
const devIp = '62.234.136.153'
|
||||
const devInterfacePORT = '8033'
|
||||
// const devIp = '192.168.10.247'
|
||||
// const devInterfacePORT = '9999'
|
||||
// 配置 idm 认证
|
||||
const ssoLogin = 'http://testsso1.foton.com.cn/oauth2.0/authorize?client_id=app_slrs&response_type=code&redirect_uri='
|
||||
// 配置 前端服务
|
||||
const devWebUrl = 'http://127.0.0.1:10088/#/'
|
||||
// webLoginType : idm (线上统一登录) 、 webLoginType: dev (测试环境登录)
|
||||
const webLoginType = 'dev'
|
||||
// 云端端口号
|
||||
const DEV_CLOUD_RES_INTERFACE_PORT = '7777'
|
||||
const simpleFilePath = 'att/attFile/upload'
|
||||
@@ -22,11 +29,11 @@ const theme = 'theme-one' // 主题(theme-one浅蓝色,theme-two深蓝色)
|
||||
const processPort = '17210'
|
||||
/*****************************************************************
|
||||
|
||||
<<<<<<<<< 主题修改 >>>>>>>>>
|
||||
<<<<<<<<< 主题修改 >>>>>>>>>
|
||||
|
||||
1. 主题分为theme-one,theme-two两种
|
||||
2. 修改assets/styles/style.less文件,注释theme-one/theme-two
|
||||
3. 将上方theme改为theme-one/theme-two
|
||||
1. 主题分为theme-one,theme-two两种
|
||||
2. 修改assets/styles/style.less文件,注释theme-one/theme-two
|
||||
3. 将上方theme改为theme-one/theme-two
|
||||
|
||||
*****************************************************************/
|
||||
// 生产环境配置
|
||||
@@ -41,6 +48,10 @@ const CLOUD_RES_INTERFACE_PORT = process.env.NODE_ENV === 'production' ? DEV_CLO
|
||||
|
||||
module.exports = {
|
||||
baseUrl: 'http://' + serverIP + ':' + interfacePORT,
|
||||
webLoginType: webLoginType,
|
||||
ssoLoginUrlDev: ssoLogin + devWebUrl,
|
||||
ssoLoginUrl: ssoLogin,
|
||||
devWebUrl: devWebUrl,
|
||||
serverUrl: 'http://' + serverIP, // 服务器IP地址
|
||||
interfaceUrl: 'http://' + serverIP + ':' + interfacePORT + '/api/', // 服务器端接口访问地址,
|
||||
cloudResInterFaceUrl: 'http://' + serverIP + ':' + interfacePORT + '/busApi/', // 云端资源库服务器端接口访问地址,
|
||||
|
||||
Reference in New Issue
Block a user