refactor(登录): 重写登录模块,接入oauth2.0(pc)、welink(mobile)
This commit is contained in:
+9
-3
@@ -34,7 +34,7 @@
|
||||
<div class="user-box">
|
||||
<img :src="userAvator" v-if="$store.getters.userInfo.avator">
|
||||
<span class="iconfont" v-else style="color: #000;"></span>
|
||||
<span style="color: #000;">{{ $store.getters.userInfo.uName }}</span>
|
||||
<span style="color: #000;" v-if="uName">{{ uName }}</span>
|
||||
<i style="color: #000;" class="el-icon-arrow-down"/>
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
@@ -70,7 +70,7 @@
|
||||
<div class="user-box">
|
||||
<img :src="userAvator" v-if="$store.getters.userInfo.avator">
|
||||
<span class="iconfont" v-else style="color: #000;"></span>
|
||||
<span style="color: #000;">{{ $store.getters.userInfo.uName }}</span>
|
||||
<span style="color: #000;" v-if="uName">{{ uName }}</span>
|
||||
<i style="color: #000;" class="el-icon-arrow-down"/>
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
@@ -97,9 +97,9 @@
|
||||
|
||||
<script>
|
||||
import {mapGetters, mapState} from 'vuex'
|
||||
import {webLoginType, ssoLogoutUrlDev} from '@/sysConfig'
|
||||
import customerService from "@/components/customerService";
|
||||
import isMobile from "./store/isMobile";
|
||||
import { loginOut } from '@/utils/login'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
@@ -152,6 +152,8 @@
|
||||
confirmButtonClass: 'common-button-primary',
|
||||
roundButton: false
|
||||
}).then(() => {
|
||||
loginOut()
|
||||
/*
|
||||
if (webLoginType != null && webLoginType === 'idm') {
|
||||
this.$store.dispatch('logout')
|
||||
window.location.href = ssoLogoutUrlDev
|
||||
@@ -168,6 +170,7 @@
|
||||
}, e => {
|
||||
})
|
||||
}
|
||||
*/
|
||||
// this.$http.post('/logout', {}, res => {
|
||||
// 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'
|
||||
// })
|
||||
@@ -243,6 +246,9 @@
|
||||
userAvator() {
|
||||
return this.$store.getters.userInfo.avator || require('@/assets/images/avator_default.png')
|
||||
},
|
||||
uName () {
|
||||
return this.$store.getters.userInfo.uName || this.$store.getters.userInfo.uname
|
||||
},
|
||||
customerServiceShow () {
|
||||
return !isMobile()
|
||||
},
|
||||
|
||||
@@ -9,6 +9,7 @@ import store from '@/store'
|
||||
import {Message} from 'element-ui'
|
||||
import { baseUrl,webLoginType,ssoLoginUrlDev } from '@/sysConfig'
|
||||
import isMobile from "../../store/isMobile";
|
||||
import { loginAgain } from '@/utils/login'
|
||||
|
||||
import domMessage from '../messageOnce/messageOnce'
|
||||
|
||||
@@ -69,6 +70,7 @@ _axios.interceptors.response.use(
|
||||
}
|
||||
}
|
||||
if(res.data && res.data.respCode && res.data.respCode === 'LE505'){
|
||||
/*
|
||||
if (isMobile()) {
|
||||
localStorage.removeItem('token')
|
||||
return router.push('/phoneIndex')
|
||||
@@ -84,6 +86,12 @@ _axios.interceptors.response.use(
|
||||
}else if(webLoginType != null && webLoginType === 'dev'){
|
||||
return router.push('/login')
|
||||
}
|
||||
*/
|
||||
messageOnce.warning({
|
||||
message: '登录超时,请重新登录',
|
||||
type: 'warning'
|
||||
})
|
||||
loginAgain()
|
||||
}
|
||||
return res
|
||||
},
|
||||
|
||||
@@ -4,6 +4,7 @@ import store from '@/store'
|
||||
import {Message} from 'element-ui'
|
||||
import { baseUrl,webLoginType,ssoLoginUrlDev } from '@/sysConfig'
|
||||
import isMobile from "../../store/isMobile";
|
||||
import { loginAgain } from '@/utils/login'
|
||||
|
||||
import domMessage from '../messageOnce/messageOnce'
|
||||
|
||||
@@ -64,6 +65,7 @@ service.interceptors.response.use(
|
||||
}
|
||||
}
|
||||
if(res.data && res.data.respCode !== undefined && res.data.respCode === 'LE505'){
|
||||
/*
|
||||
if (isMobile()) {
|
||||
localStorage.removeItem('token')
|
||||
return router.push('/phoneIndex')
|
||||
@@ -80,6 +82,12 @@ service.interceptors.response.use(
|
||||
return router.push('/login')
|
||||
}
|
||||
}
|
||||
*/
|
||||
messageOnce.warning({
|
||||
message: '登录超时,请重新登录',
|
||||
type: 'warning'
|
||||
})
|
||||
loginAgain()
|
||||
}
|
||||
return res.data
|
||||
},
|
||||
|
||||
@@ -0,0 +1,562 @@
|
||||
import '@babel/polyfill'
|
||||
require('es6-promise').polyfill();
|
||||
require('es6-promise/auto');
|
||||
import Vue from 'vue'
|
||||
import App from './App'
|
||||
import ElementUI from 'element-ui'
|
||||
import 'element-ui/lib/theme-chalk/index.css'
|
||||
// jQuery
|
||||
import $ from 'jquery'
|
||||
// vuex
|
||||
import store from './store'
|
||||
import Axios from 'axios'
|
||||
// 复制
|
||||
import VueClipboard from 'vue-clipboard2'
|
||||
// 全局样式文件
|
||||
import '@/assets/styles/common.less'
|
||||
// 样式重置
|
||||
import '@/assets/styles/reset.css'
|
||||
// iconfont字体库
|
||||
import '@/assets/styles/iconfont.css'
|
||||
import '@/assets/styles/shangqi-iconfont/iconfont.css'
|
||||
import '@/assets/styles/shangqi-iconfont-replace/iconfont.css' // 可直接替换此文件夹
|
||||
import '@/assets/styles/shangqi-iconfont-2021/iconfont.css'
|
||||
// axios
|
||||
import axios from 'axios'
|
||||
import $axios from '@/common/axios'
|
||||
// 自定义全局组件
|
||||
import components from '@/components'
|
||||
// 自定义插件
|
||||
import common from '@/common'
|
||||
import dragDialogWidth from '@/common/dragDialogWidth'
|
||||
// 自定义按钮显示指令
|
||||
import btnPermission from '@/common/btnPermission' // eslint-disable-line
|
||||
import VueI18n from 'vue-i18n' // 国际化
|
||||
// import * as echarts from 'echarts'
|
||||
import { simpleUploadPath } from '@/sysConfig'
|
||||
// 时间转换
|
||||
import moment from 'moment'
|
||||
moment.suppressDeprecationWarnings = true;
|
||||
// 右键菜单
|
||||
import Contextmenu from 'vue-contextmenujs'
|
||||
|
||||
// vant
|
||||
import vant from 'vant';
|
||||
import 'vant/lib/index.css';
|
||||
//vant
|
||||
|
||||
import animate from 'animate.css'
|
||||
import tool from './utils/tool'
|
||||
Vue.use(tool)
|
||||
// 引入路由器
|
||||
import router from './router'
|
||||
// 路由解析器
|
||||
import Re from 'path-to-regexp'
|
||||
|
||||
import { get_verify_by_instance,loginIdm,getMenu,loginMobile } from 'api/process'
|
||||
import hwh5 from 'api/hwh5-cloudonline.js';
|
||||
|
||||
import { ssoLoginUrlDev,ssoLoginUrl,webLoginType,devWebUrl } from '@/sysConfig'
|
||||
|
||||
import { mapMutations, mapActions } from 'vuex'
|
||||
import VConsole from 'vuex'
|
||||
|
||||
|
||||
import isMobile from "./store/isMobile";
|
||||
import { Loading } from 'element-ui';
|
||||
|
||||
// 路由拦截
|
||||
router.beforeEach(function (to, from, next) {
|
||||
closeLoading()
|
||||
if (isMobile()){
|
||||
var loading = Loading.service({
|
||||
text: '加载中...',
|
||||
background: '#fff'
|
||||
});
|
||||
}
|
||||
function closeLoading(){
|
||||
if (loading) {
|
||||
setTimeout(() => {
|
||||
loading.close()
|
||||
loading = null
|
||||
}, 3000)
|
||||
}
|
||||
}
|
||||
let fromName = from.name
|
||||
if(fromName === undefined || fromName === null){
|
||||
window.sessionStorage.clear()
|
||||
}
|
||||
let toName = to.name
|
||||
if (toName === 'CheckPage' || toName === 'loginStandDetails' || toName === 'error'
|
||||
|| toName === 'LoginVerifyPhone') {
|
||||
next()
|
||||
closeLoading()
|
||||
return
|
||||
}
|
||||
|
||||
if(webLoginType === 'idm' && toName === 'Login'){
|
||||
window.location.href = ssoLoginUrlDev
|
||||
}
|
||||
|
||||
let token = store.state.token
|
||||
let path = to.path;
|
||||
let userName = ""
|
||||
/*
|
||||
if((fromName === undefined || fromName === null) && (path.indexOf("/standardSearch/All&userName=") !== -1 || (path.indexOf("/standardSearch/All") !== -1 && to.query.userName !== undefined))){
|
||||
if((path.indexOf("/standardSearch/All") !== -1 && to.query.userName !== undefined)){
|
||||
userName = to.query.userName
|
||||
}else {
|
||||
userName = path.split("&")[1].split("=")[1]
|
||||
}
|
||||
window.sessionStorage.clear()
|
||||
}else {
|
||||
*/
|
||||
if(fromName === 'Home2'){
|
||||
localStorage.removeItem("external")
|
||||
}
|
||||
/*
|
||||
}
|
||||
*/
|
||||
let requireAuth = to.meta.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 routerType = to.query.routerType;
|
||||
let unShowReceipt = to.query.unShowReceipt;
|
||||
let param = "taskIds=" + taskId + "&prcId=" + prcId
|
||||
+ "&prcNum=" + prcNum + "&prcName=" + prcName + "&prcType=" + prcType;
|
||||
if (unShowReceipt) {
|
||||
param += "&unShowReceipt=" + unShowReceipt
|
||||
}
|
||||
let param4 = {
|
||||
path: path,
|
||||
token: token,
|
||||
taskId: taskId,
|
||||
prcId: prcId,
|
||||
prcNum: prcNum,
|
||||
prcName: prcName,
|
||||
prcType: prcType,
|
||||
toName: toName
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
function extractedLocalStorage(url,param,param4) {
|
||||
localStorage.removeItem("external")
|
||||
localStorage.removeItem("routerUrl")
|
||||
localStorage.setItem('routerUrl', url)
|
||||
localStorage.removeItem("routerParam")
|
||||
localStorage.setItem('routerParam', param)
|
||||
}
|
||||
// 返回值为登录状态
|
||||
// 单点登录
|
||||
/** 判断是不是在手机端操作 */
|
||||
if (isMobile()) {
|
||||
if(toName === 'phoneHome' && (token === undefined || token === null || token === '')){
|
||||
localStorage.removeItem('token')
|
||||
token = localStorage.getItem("token")
|
||||
window.sessionStorage.clear()
|
||||
localStorage.setItem("routerName","phoneHome")
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else if(toName === 'phoneHome' && token != null && (fromName === undefined || fromName === null)){
|
||||
localStorage.removeItem('token')
|
||||
token = localStorage.getItem("token")
|
||||
window.sessionStorage.clear()
|
||||
next()
|
||||
closeLoading()
|
||||
}else if(toName === 'phoneHome' && token != null){
|
||||
next()
|
||||
closeLoading()
|
||||
} else if(toName === 'processCenter'){
|
||||
// hwh5.close();
|
||||
//关闭当前窗口
|
||||
let userAgent = navigator.userAgent;
|
||||
if (userAgent.indexOf("Firefox") !== -1 || userAgent.indexOf("Chrome") !==-1) {
|
||||
window.location.href="about:blank";
|
||||
}else if(userAgent.indexOf('Android') > -1 || userAgent.indexOf('Linux') > -1){
|
||||
window.opener=null;window.open('about:blank','_self','').close();
|
||||
}else {
|
||||
window.opener = null;
|
||||
window.open("about:blank", "_self");
|
||||
window.close();
|
||||
}
|
||||
//如果是微信打开,关闭当前微信窗口
|
||||
weixinClosePage()
|
||||
}else {
|
||||
|
||||
if ((token === null || token === '' ) && toName !== 'Login') {
|
||||
if(toName !== 'phoneIndex'){
|
||||
if(toName === 'phoneHome'){
|
||||
// 手机端 首页 首次进入系统 清除 缓存, 防止 跳转 oa 的页面, 问题追溯 #55852
|
||||
localStorage.removeItem('token')
|
||||
token = localStorage.getItem("token")
|
||||
window.sessionStorage.clear()
|
||||
localStorage.setItem("routerName","phoneHome")
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else if(toName === 'databaseSearch' || toName === 'standDynamics' ||
|
||||
toName === 'domesticStand' || toName === 'domesticDetails' || toName === 'zlzxDetails'){
|
||||
localStorage.setItem("routerName",toName)
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else {
|
||||
if(fromName === 'phoneHome'){
|
||||
next()
|
||||
closeLoading()
|
||||
}else {
|
||||
localStorage.removeItem("param");
|
||||
localStorage.setItem('param',JSON.stringify(param4))
|
||||
next('/phoneIndex')
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
}else {
|
||||
// 区分手机端首页 单独逻辑处理 token 为空 跳回验证页面重新验证
|
||||
if(fromName === 'databaseSearch' || fromName === 'standDynamics' ||
|
||||
fromName === 'domesticStand' || fromName === 'domesticDetails' || toName === 'zlzxDetails'){
|
||||
localStorage.setItem("routerName",toName)
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(toName === 'databaseSearch' || toName === 'standDynamics' || toName === 'zlzxDetails' ||
|
||||
toName === 'domesticStand' || toName === 'domesticDetails'){
|
||||
next()
|
||||
closeLoading()
|
||||
}else if (toName.slice(0,5) !== 'phone') {
|
||||
if(toName === 'LoginVerify'){
|
||||
if(toName === 'phoneHome'){
|
||||
// 手机端 首页 首次进入系统 清除 缓存, 防止 跳转 oa 的页面, 问题追溯 #55852
|
||||
localStorage.removeItem('token')
|
||||
token = localStorage.getItem("token")
|
||||
window.sessionStorage.clear()
|
||||
localStorage.setItem("routerName","phoneHome")
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else{
|
||||
next('/blankPage')
|
||||
closeLoading()
|
||||
}
|
||||
}else {
|
||||
if(toName === 'blankPage' || toName === 'processedPage') {
|
||||
next()
|
||||
closeLoading()
|
||||
}else {
|
||||
|
||||
console.log('-pc端-')
|
||||
extractedVerify()
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if(toName !== 'blankPage'){
|
||||
if(to.matched.length === 0){
|
||||
if(toName === 'phoneHome'){
|
||||
// 手机端 首页 首次进入系统 清除 缓存, 防止 跳转 oa 的页面, 问题追溯 #55852
|
||||
localStorage.removeItem('token')
|
||||
token = localStorage.getItem("token")
|
||||
window.sessionStorage.clear()
|
||||
localStorage.setItem("routerName","phoneHome")
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else{
|
||||
next('/blankPage')
|
||||
closeLoading()
|
||||
}
|
||||
}else {
|
||||
console.log('-phone端-')
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
localStorage.removeItem("routerUrl")
|
||||
localStorage.setItem('routerUrl', 'home2')
|
||||
localStorage.removeItem("routerParam")
|
||||
localStorage.setItem('routerParam', '')
|
||||
if ((token === null || token === '' ) && toName === 'OtherStandardDetails') {
|
||||
if (document.cookie) {
|
||||
next()
|
||||
closeLoading()
|
||||
return
|
||||
}
|
||||
}
|
||||
if ((token === null || token === '' ) && toName !== 'Login') {
|
||||
if(webLoginType != null && webLoginType === 'idm' ){
|
||||
if(code){
|
||||
next()
|
||||
closeLoading()
|
||||
}else {
|
||||
if (taskId !== undefined && taskId !== null && prcId !== undefined && prcId !== null) {
|
||||
extractedVerify(token)
|
||||
}else {
|
||||
/*
|
||||
if((fromName === undefined || fromName === null) && (path.indexOf("/standardSearch/All&userName") !== -1 || (path.indexOf("/standardSearch/All") !== -1 && userName !== undefined))){
|
||||
extractedLocalStorage("standardSearch/All",userName)
|
||||
localStorage.setItem('external', "external")
|
||||
next('/LoginVerifyNoEncryption')
|
||||
closeLoading()
|
||||
}else {
|
||||
*/
|
||||
if (toName === 'LoginVerifyNoEncryption') {
|
||||
next()
|
||||
closeLoading()
|
||||
}else {
|
||||
/*
|
||||
if(path === '/standardSearch/All'){
|
||||
extractedLocalStorage('standardSearch/All','');
|
||||
}else {
|
||||
*/
|
||||
extractedLocalStorage('home2','');
|
||||
/*
|
||||
}
|
||||
*/
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
}
|
||||
/*
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}else if(webLoginType != null && webLoginType === 'dev'){
|
||||
if (isMobile()) {
|
||||
extractedVerify(token)
|
||||
} else {
|
||||
next('/Login')
|
||||
closeLoading()
|
||||
}
|
||||
|
||||
}
|
||||
}else {
|
||||
extractedVerify(token)
|
||||
}
|
||||
}
|
||||
function weixinClosePage() {
|
||||
if (typeof WeixinJSBridge == "undefined") {
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener('WeixinJSBridgeReady', weixin_ClosePage, false);
|
||||
} else if (document.attachEvent) {
|
||||
document.attachEvent('WeixinJSBridgeReady', weixin_ClosePage);
|
||||
document.attachEvent('onWeixinJSBridgeReady', weixin_ClosePage);
|
||||
}
|
||||
} else {
|
||||
weixin_ClosePage();
|
||||
}
|
||||
}
|
||||
function weixin_ClosePage() {
|
||||
WeixinJSBridge.call('closeWindow');
|
||||
}
|
||||
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)) { // 业务系统 当前节点已完成
|
||||
if(isMobile()){
|
||||
next('/processedPage')
|
||||
closeLoading()
|
||||
}else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
} else { // 业务系统 当前节点未完成
|
||||
// commitStatus 大于0 表示当前节点存在未完成干活流程
|
||||
// isNotFinished OA 系统显示接受任务 已置为已办
|
||||
if (routerType && routerType === 'oa' &&isNotFinished && isNotFinished > 0 && commitStatus && commitStatus > 0) {
|
||||
if(isMobile()) {
|
||||
extractedIphone()
|
||||
}else if (prcType === '3') {
|
||||
//标准征求意见 接受节点 未完成 oa已办 跳转详情页面
|
||||
if (path === '/bzzqyjStep3') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}else if (prcType === '5') {
|
||||
if (path === '/xmpgStep4') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}else if (prcType === '2') {
|
||||
if (path === '/bzdyStep3') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}else if (prcType === '9') {
|
||||
if (path === '/bzjdStep3') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}else if (prcType === '6') {
|
||||
if (path === '/xmpg2Step6') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}else if (prcType === '10') {
|
||||
if (path === '/xmqdqrStep2') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}else if (prcType === '8') {
|
||||
if (path === '/wfhxzgStep4') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(isMobile()) {
|
||||
extractedIphone()
|
||||
}else{
|
||||
extracted3()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function extracted(routerPath) {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(routerPath,param);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next({path: routerPath + '?' +param})
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
|
||||
function extracted3() {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(toName,param);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
|
||||
function extractedIphone() {
|
||||
let paramPhone = 'taskIds=' + taskId + '&prcId=' + prcId + '&prcNum=' + prcNum +
|
||||
'&taskAssignee=' + toName + '&prcName=' + prcName + '&prcType=' + prcType
|
||||
let phoneRouter = 'phone' + toName.charAt(0).toUpperCase() + toName.slice(1)
|
||||
console.log(phoneRouter);
|
||||
next({path: phoneRouter + '?' + paramPhone})
|
||||
closeLoading()
|
||||
}
|
||||
function extracted2(routerPath,param2) {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(routerPath,param2);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next({path: routerPath + '?' + param2})
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
function extracted4(routerPath,param4) {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(routerPath,param4);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next({path: routerPath + '?' + param4})
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
if(path === '/loginVerify'){
|
||||
if(webLoginType != null && webLoginType === 'dev'){
|
||||
next('/Login')
|
||||
closeLoading()
|
||||
}else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}else {
|
||||
/*
|
||||
if((fromName === undefined || fromName === null) && (path.indexOf("/standardSearch/All&userName") !== -1 || (path.indexOf("/standardSearch/All") !== -1 && userName !== undefined))) {
|
||||
extractedLocalStorage("standardSearch/All",userName)
|
||||
localStorage.setItem('external', "external")
|
||||
next('/LoginVerifyNoEncryption')
|
||||
closeLoading()
|
||||
}else {
|
||||
*/
|
||||
next()
|
||||
closeLoading()
|
||||
/*
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// 设置用户信息
|
||||
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
|
||||
Vue.prototype.$ = $
|
||||
Vue.use(ElementUI)
|
||||
Vue.use(common)
|
||||
Vue.use(dragDialogWidth)
|
||||
Vue.use(components)
|
||||
Vue.use(VueI18n)
|
||||
Vue.use(VueClipboard)
|
||||
Vue.use(Contextmenu)
|
||||
Vue.use(animate)
|
||||
Vue.use(vant)
|
||||
|
||||
// Vue.prototype.$echarts = echarts
|
||||
// 原生axios
|
||||
Vue.prototype.axios = axios
|
||||
// 封装后的axios
|
||||
Vue.prototype.$http = $axios
|
||||
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')
|
||||
}
|
||||
})
|
||||
/* eslint-disable no-new */
|
||||
window.vm = new Vue({
|
||||
VConsole,
|
||||
router,
|
||||
store,
|
||||
i18n,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
||||
+46
-452
@@ -9,7 +9,6 @@ import 'element-ui/lib/theme-chalk/index.css'
|
||||
import $ from 'jquery'
|
||||
// vuex
|
||||
import store from './store'
|
||||
import Axios from 'axios'
|
||||
// 复制
|
||||
import VueClipboard from 'vue-clipboard2'
|
||||
// 全局样式文件
|
||||
@@ -32,7 +31,6 @@ import dragDialogWidth from '@/common/dragDialogWidth'
|
||||
// 自定义按钮显示指令
|
||||
import btnPermission from '@/common/btnPermission' // eslint-disable-line
|
||||
import VueI18n from 'vue-i18n' // 国际化
|
||||
// import * as echarts from 'echarts'
|
||||
import { simpleUploadPath } from '@/sysConfig'
|
||||
// 时间转换
|
||||
import moment from 'moment'
|
||||
@@ -50,480 +48,76 @@ import tool from './utils/tool'
|
||||
Vue.use(tool)
|
||||
// 引入路由器
|
||||
import router from './router'
|
||||
// 路由解析器
|
||||
import Re from 'path-to-regexp'
|
||||
|
||||
import { get_verify_by_instance,loginIdm,getMenu,loginMobile } from 'api/process'
|
||||
import hwh5 from 'api/hwh5-cloudonline.js';
|
||||
import { webLoginType } from '@/sysConfig'
|
||||
|
||||
import { ssoLoginUrlDev,ssoLoginUrl,webLoginType,devWebUrl } from '@/sysConfig'
|
||||
|
||||
import { mapMutations, mapActions } from 'vuex'
|
||||
import VConsole from 'vuex'
|
||||
|
||||
|
||||
import isMobile from "./store/isMobile";
|
||||
import { Loading } from 'element-ui';
|
||||
import { getCode, toIdmLoginPage, loginInIdm, loginInPhone, close } from '@/utils/login'
|
||||
|
||||
// 路由拦截
|
||||
router.beforeEach(function (to, from, next) {
|
||||
closeLoading()
|
||||
if (isMobile()){
|
||||
var loading = Loading.service({
|
||||
text: '加载中...',
|
||||
background: '#fff'
|
||||
});
|
||||
}
|
||||
function closeLoading(){
|
||||
if (loading) {
|
||||
setTimeout(() => {
|
||||
loading.close()
|
||||
loading = null
|
||||
}, 3000)
|
||||
}
|
||||
}
|
||||
let fromName = from.name
|
||||
if(fromName === undefined || fromName === null){
|
||||
window.sessionStorage.clear()
|
||||
}
|
||||
let toName = to.name
|
||||
if (toName === 'CheckPage' || toName === 'loginStandDetails' || toName === 'error'
|
||||
|| toName === 'LoginVerifyPhone') {
|
||||
next()
|
||||
closeLoading()
|
||||
return
|
||||
}
|
||||
|
||||
if(webLoginType === 'idm' && toName === 'Login'){
|
||||
window.location.href = ssoLoginUrlDev
|
||||
}
|
||||
|
||||
let token = store.state.token
|
||||
let path = to.path;
|
||||
let userName = ""
|
||||
/*
|
||||
if((fromName === undefined || fromName === null) && (path.indexOf("/standardSearch/All&userName=") !== -1 || (path.indexOf("/standardSearch/All") !== -1 && to.query.userName !== undefined))){
|
||||
if((path.indexOf("/standardSearch/All") !== -1 && to.query.userName !== undefined)){
|
||||
userName = to.query.userName
|
||||
}else {
|
||||
userName = path.split("&")[1].split("=")[1]
|
||||
}
|
||||
window.sessionStorage.clear()
|
||||
}else {
|
||||
*/
|
||||
if(fromName === 'Home2'){
|
||||
localStorage.removeItem("external")
|
||||
}
|
||||
/*
|
||||
}
|
||||
*/
|
||||
let requireAuth = to.meta.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 routerType = to.query.routerType;
|
||||
let unShowReceipt = to.query.unShowReceipt;
|
||||
let param = "taskIds=" + taskId + "&prcId=" + prcId
|
||||
+ "&prcNum=" + prcNum + "&prcName=" + prcName + "&prcType=" + prcType;
|
||||
if (unShowReceipt) {
|
||||
param += "&unShowReceipt=" + unShowReceipt
|
||||
}
|
||||
let param4 = {
|
||||
path: path,
|
||||
token: token,
|
||||
taskId: taskId,
|
||||
prcId: prcId,
|
||||
prcNum: prcNum,
|
||||
prcName: prcName,
|
||||
prcType: prcType,
|
||||
toName: toName
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
function extractedLocalStorage(url,param,param4) {
|
||||
localStorage.removeItem("external")
|
||||
localStorage.removeItem("routerUrl")
|
||||
localStorage.setItem('routerUrl', url)
|
||||
localStorage.removeItem("routerParam")
|
||||
localStorage.setItem('routerParam', param)
|
||||
}
|
||||
// 返回值为登录状态
|
||||
// 单点登录
|
||||
/** 判断是不是在手机端操作 */
|
||||
if (isMobile()) {
|
||||
if(toName === 'phoneHome' && (token === undefined || token === null || token === '')){
|
||||
localStorage.removeItem('token')
|
||||
token = localStorage.getItem("token")
|
||||
window.sessionStorage.clear()
|
||||
localStorage.setItem("routerName","phoneHome")
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else if(toName === 'phoneHome' && token != null && (fromName === undefined || fromName === null)){
|
||||
localStorage.removeItem('token')
|
||||
token = localStorage.getItem("token")
|
||||
window.sessionStorage.clear()
|
||||
next()
|
||||
closeLoading()
|
||||
}else if(toName === 'phoneHome' && token != null){
|
||||
next()
|
||||
closeLoading()
|
||||
} else if(toName === 'processCenter'){
|
||||
// hwh5.close();
|
||||
//关闭当前窗口
|
||||
let userAgent = navigator.userAgent;
|
||||
if (userAgent.indexOf("Firefox") !== -1 || userAgent.indexOf("Chrome") !==-1) {
|
||||
window.location.href="about:blank";
|
||||
}else if(userAgent.indexOf('Android') > -1 || userAgent.indexOf('Linux') > -1){
|
||||
window.opener=null;window.open('about:blank','_self','').close();
|
||||
}else {
|
||||
window.opener = null;
|
||||
window.open("about:blank", "_self");
|
||||
window.close();
|
||||
router.beforeEach((to, from, next) => {
|
||||
const token = store.state.token
|
||||
if (to.query.taskIds && to.query.taskIds !== '' && to.query.prcId && to.query.prcId !== '') {
|
||||
const fullPath = to.fullPath.slice(1)
|
||||
if (isMobile()) {
|
||||
if (fullPath.indexOf('phone') !== 0) {
|
||||
let path = fullPath.replace(fullPath.charAt(0), fullPath.charAt(0).toUpperCase())
|
||||
path = '/phone' + path
|
||||
next({ path: path })
|
||||
}
|
||||
//如果是微信打开,关闭当前微信窗口
|
||||
weixinClosePage()
|
||||
}else {
|
||||
if (!to.name) { // 不存在路由
|
||||
next('/blankPage')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((token === null || token === '' ) && toName !== 'Login') {
|
||||
if(toName !== 'phoneIndex'){
|
||||
if(toName === 'phoneHome'){
|
||||
// 手机端 首页 首次进入系统 清除 缓存, 防止 跳转 oa 的页面, 问题追溯 #55852
|
||||
localStorage.removeItem('token')
|
||||
token = localStorage.getItem("token")
|
||||
window.sessionStorage.clear()
|
||||
localStorage.setItem("routerName","phoneHome")
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else if(toName === 'databaseSearch' || toName === 'standDynamics' ||
|
||||
toName === 'domesticStand' || toName === 'domesticDetails' || toName === 'zlzxDetails'){
|
||||
localStorage.setItem("routerName",toName)
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else {
|
||||
if(fromName === 'phoneHome'){
|
||||
next()
|
||||
closeLoading()
|
||||
}else {
|
||||
localStorage.removeItem("param");
|
||||
localStorage.setItem('param',JSON.stringify(param4))
|
||||
next('/phoneIndex')
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
}else {
|
||||
// 区分手机端首页 单独逻辑处理 token 为空 跳回验证页面重新验证
|
||||
if(fromName === 'databaseSearch' || fromName === 'standDynamics' ||
|
||||
fromName === 'domesticStand' || fromName === 'domesticDetails' || toName === 'zlzxDetails'){
|
||||
localStorage.setItem("routerName",toName)
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
if (token && token !== '') {
|
||||
if (to.path === '/') {
|
||||
if (isMobile()) {
|
||||
next('/phoneHome')
|
||||
} else {
|
||||
if(toName === 'databaseSearch' || toName === 'standDynamics' || toName === 'zlzxDetails' ||
|
||||
toName === 'domesticStand' || toName === 'domesticDetails'){
|
||||
next()
|
||||
closeLoading()
|
||||
}else if (toName.slice(0,5) !== 'phone') {
|
||||
if(toName === 'LoginVerify'){
|
||||
if(toName === 'phoneHome'){
|
||||
// 手机端 首页 首次进入系统 清除 缓存, 防止 跳转 oa 的页面, 问题追溯 #55852
|
||||
localStorage.removeItem('token')
|
||||
token = localStorage.getItem("token")
|
||||
window.sessionStorage.clear()
|
||||
localStorage.setItem("routerName","phoneHome")
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else{
|
||||
next('/blankPage')
|
||||
closeLoading()
|
||||
}
|
||||
}else {
|
||||
if(toName === 'blankPage' || toName === 'processedPage') {
|
||||
next()
|
||||
closeLoading()
|
||||
}else {
|
||||
|
||||
console.log('-pc端-')
|
||||
extractedVerify()
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if(toName !== 'blankPage'){
|
||||
if(to.matched.length === 0){
|
||||
if(toName === 'phoneHome'){
|
||||
// 手机端 首页 首次进入系统 清除 缓存, 防止 跳转 oa 的页面, 问题追溯 #55852
|
||||
localStorage.removeItem('token')
|
||||
token = localStorage.getItem("token")
|
||||
window.sessionStorage.clear()
|
||||
localStorage.setItem("routerName","phoneHome")
|
||||
next('/loginVerifyPhone')
|
||||
closeLoading()
|
||||
}else{
|
||||
next('/blankPage')
|
||||
closeLoading()
|
||||
}
|
||||
}else {
|
||||
console.log('-phone端-')
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
next('/home2')
|
||||
}
|
||||
}
|
||||
next()
|
||||
} else {
|
||||
localStorage.removeItem("routerUrl")
|
||||
localStorage.setItem('routerUrl', 'home2')
|
||||
localStorage.removeItem("routerParam")
|
||||
localStorage.setItem('routerParam', '')
|
||||
if ((token === null || token === '' ) && toName === 'OtherStandardDetails') {
|
||||
if (document.cookie) {
|
||||
if (to.path === '/login') {
|
||||
if (webLoginType === 'idm') { // webLoginType === "idm"时不会进入login路由
|
||||
// let href = window.location.href.replace('code=' + getCode(), '')
|
||||
// toIdmLoginPage(href)
|
||||
}
|
||||
if (webLoginType === 'dev') {
|
||||
next()
|
||||
closeLoading()
|
||||
return
|
||||
}
|
||||
}
|
||||
if ((token === null || token === '' ) && toName !== 'Login') {
|
||||
if(webLoginType != null && webLoginType === 'idm' ){
|
||||
if(code){
|
||||
next()
|
||||
closeLoading()
|
||||
}else {
|
||||
if (taskId !== undefined && taskId !== null && prcId !== undefined && prcId !== null) {
|
||||
extractedVerify(token)
|
||||
}else {
|
||||
/*
|
||||
if((fromName === undefined || fromName === null) && (path.indexOf("/standardSearch/All&userName") !== -1 || (path.indexOf("/standardSearch/All") !== -1 && userName !== undefined))){
|
||||
extractedLocalStorage("standardSearch/All",userName)
|
||||
localStorage.setItem('external', "external")
|
||||
next('/LoginVerifyNoEncryption')
|
||||
closeLoading()
|
||||
}else {
|
||||
*/
|
||||
if (toName === 'LoginVerifyNoEncryption') {
|
||||
next()
|
||||
closeLoading()
|
||||
}else {
|
||||
/*
|
||||
if(path === '/standardSearch/All'){
|
||||
extractedLocalStorage('standardSearch/All','');
|
||||
}else {
|
||||
*/
|
||||
extractedLocalStorage('home2','');
|
||||
/*
|
||||
}
|
||||
*/
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
}
|
||||
/*
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}else if(webLoginType != null && webLoginType === 'dev'){
|
||||
if (isMobile()) {
|
||||
extractedVerify(token)
|
||||
} else {
|
||||
next('/Login')
|
||||
closeLoading()
|
||||
}
|
||||
|
||||
}
|
||||
}else {
|
||||
extractedVerify(token)
|
||||
}
|
||||
}
|
||||
function weixinClosePage() {
|
||||
if (typeof WeixinJSBridge == "undefined") {
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener('WeixinJSBridgeReady', weixin_ClosePage, false);
|
||||
} else if (document.attachEvent) {
|
||||
document.attachEvent('WeixinJSBridgeReady', weixin_ClosePage);
|
||||
document.attachEvent('onWeixinJSBridgeReady', weixin_ClosePage);
|
||||
}
|
||||
} else {
|
||||
weixin_ClosePage();
|
||||
}
|
||||
}
|
||||
function weixin_ClosePage() {
|
||||
WeixinJSBridge.call('closeWindow');
|
||||
}
|
||||
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)) { // 业务系统 当前节点已完成
|
||||
if(isMobile()){
|
||||
next('/processedPage')
|
||||
closeLoading()
|
||||
}else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
} else { // 业务系统 当前节点未完成
|
||||
// commitStatus 大于0 表示当前节点存在未完成干活流程
|
||||
// isNotFinished OA 系统显示接受任务 已置为已办
|
||||
if (routerType && routerType === 'oa' &&isNotFinished && isNotFinished > 0 && commitStatus && commitStatus > 0) {
|
||||
if(isMobile()) {
|
||||
extractedIphone()
|
||||
}else if (prcType === '3') {
|
||||
//标准征求意见 接受节点 未完成 oa已办 跳转详情页面
|
||||
if (path === '/bzzqyjStep3') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}else if (prcType === '5') {
|
||||
if (path === '/xmpgStep4') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}else if (prcType === '2') {
|
||||
if (path === '/bzdyStep3') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}else if (prcType === '9') {
|
||||
if (path === '/bzjdStep3') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}else if (prcType === '6') {
|
||||
if (path === '/xmpg2Step6') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}else if (prcType === '10') {
|
||||
if (path === '/xmqdqrStep2') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}else if (prcType === '8') {
|
||||
if (path === '/wfhxzgStep4') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(isMobile()) {
|
||||
extractedIphone()
|
||||
}else{
|
||||
extracted3()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function extracted(routerPath) {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(routerPath,param);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next({path: routerPath + '?' +param})
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
|
||||
function extracted3() {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(toName,param);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
if (webLoginType === 'idm') {
|
||||
if (isMobile()) {
|
||||
loginInPhone().then(() => {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
|
||||
function extractedIphone() {
|
||||
let paramPhone = 'taskIds=' + taskId + '&prcId=' + prcId + '&prcNum=' + prcNum +
|
||||
'&taskAssignee=' + toName + '&prcName=' + prcName + '&prcType=' + prcType
|
||||
let phoneRouter = 'phone' + toName.charAt(0).toUpperCase() + toName.slice(1)
|
||||
console.log(phoneRouter);
|
||||
next({path: phoneRouter + '?' + paramPhone})
|
||||
closeLoading()
|
||||
}
|
||||
function extracted2(routerPath,param2) {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(routerPath,param2);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
})
|
||||
} else {
|
||||
if (getCode()) {
|
||||
loginInIdm(getCode()).then(() => {
|
||||
let path = to.fullPath.replace('code=' + getCode(), '')
|
||||
next({ path })
|
||||
})
|
||||
} else {
|
||||
next({path: routerPath + '?' + param2})
|
||||
closeLoading()
|
||||
toIdmLoginPage(window.location.href)
|
||||
}
|
||||
}
|
||||
function extracted4(routerPath,param4) {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(routerPath,param4);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next({path: routerPath + '?' + param4})
|
||||
closeLoading()
|
||||
}
|
||||
}
|
||||
if (webLoginType === 'dev') {
|
||||
if (isMobile()) {
|
||||
next('/login')
|
||||
} else {
|
||||
next('/login')
|
||||
}
|
||||
})
|
||||
}
|
||||
if(path === '/loginVerify'){
|
||||
if(webLoginType != null && webLoginType === 'dev'){
|
||||
next('/Login')
|
||||
closeLoading()
|
||||
}else {
|
||||
next()
|
||||
closeLoading()
|
||||
}
|
||||
}else {
|
||||
/*
|
||||
if((fromName === undefined || fromName === null) && (path.indexOf("/standardSearch/All&userName") !== -1 || (path.indexOf("/standardSearch/All") !== -1 && userName !== undefined))) {
|
||||
extractedLocalStorage("standardSearch/All",userName)
|
||||
localStorage.setItem('external', "external")
|
||||
next('/LoginVerifyNoEncryption')
|
||||
closeLoading()
|
||||
}else {
|
||||
*/
|
||||
next()
|
||||
closeLoading()
|
||||
/*
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// 设置用户信息
|
||||
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
|
||||
Vue.prototype.$ = $
|
||||
@@ -537,7 +131,7 @@ Vue.use(Contextmenu)
|
||||
Vue.use(animate)
|
||||
Vue.use(vant)
|
||||
|
||||
// Vue.prototype.$echarts = echarts
|
||||
Vue.prototype.$close = close
|
||||
// 原生axios
|
||||
Vue.prototype.axios = axios
|
||||
// 封装后的axios
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
import { mapMutations, mapActions } from 'vuex'
|
||||
import axios from 'axios'
|
||||
import util from 'util'
|
||||
import isMobile from "../../store/isMobile";
|
||||
export default {
|
||||
name: 'Login',
|
||||
data () {
|
||||
@@ -187,6 +188,10 @@
|
||||
if (this.showIETips) {//判断是否IE浏览器
|
||||
alert('为了最佳显示效果 请使用google chrome')
|
||||
}
|
||||
if (isMobile()) {
|
||||
this.$router.push('/phoneHome')
|
||||
return;
|
||||
}
|
||||
this.$router.push('/home2')
|
||||
}, e => {
|
||||
this.$message.warning('未获取到菜单')
|
||||
|
||||
@@ -68,10 +68,12 @@ const routes = [
|
||||
title: '手机提示页面',
|
||||
}
|
||||
},
|
||||
/*
|
||||
{
|
||||
path: '*',
|
||||
redirect: '/loginVerify'
|
||||
},
|
||||
*/
|
||||
// 单点登录跳转页面
|
||||
{
|
||||
path: '/checkPage',
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
const devIp = 'localhost'
|
||||
// const devIp = '10.0.10.115'
|
||||
const devInterfacePORT = '10086'
|
||||
// const devInterfacePORT = '4202'
|
||||
// 配置 idm 认证
|
||||
const ssoLogin = 'http://sso.foton.com.cn/oauth2.0/authorize?client_id=app_slrs&response_type=code&redirect_uri='
|
||||
// 配置 前端服务
|
||||
// const devWebUrl = 'http://62.234.136.153:8038/#/'
|
||||
const devWebUrl = 'http://localhost:9090/#/'
|
||||
// webLoginType : idm (线上统一登录) 、 webLoginType: dev (测试环境登录)
|
||||
const webLoginType = 'dev'
|
||||
|
||||
// const kkFileViewUrl = 'https://srms.foton.com.cn/preview'
|
||||
const kkFileViewUrl = 'http://127.0.0.1:8012'
|
||||
// 配置onlyOffice 前端服务
|
||||
const onlyOfficeUrl = 'http://127.0.0.1:8080'
|
||||
// const onlyOfficeUrl = 'http://10.10.10.46:8889'
|
||||
|
||||
// 云端端口号
|
||||
const DEV_CLOUD_RES_INTERFACE_PORT = '7777'
|
||||
const simpleFilePath = 'att/attFile/upload'
|
||||
const multipleFilePath = 'att/attFile/uploadFiles'
|
||||
const staticFilePath = '192.168.10.140:10010'
|
||||
// const staticFilePath = '106.2.13.189:8888'
|
||||
const staticPDFPath = '192.168.7.140'
|
||||
const webSocket = '192.168.7.178'
|
||||
// const enterprise = ''
|
||||
const enterprise = 'SJZX'
|
||||
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
|
||||
|
||||
*****************************************************************/
|
||||
// 生产环境配置
|
||||
// const prodIp = '39.98.140.126'
|
||||
// const prodInterfacePORT = '4201'
|
||||
const prodIp = '10.10.10.46'
|
||||
const prodInterfacePORT = '4202'
|
||||
// const prodIp = 'slrs.foton.com.cn'
|
||||
// const prodInterfacePORT = ''
|
||||
|
||||
// 判断环境
|
||||
const serverIP = process.env.NODE_ENV === 'production' ? prodIp : devIp
|
||||
const interfacePORT = process.env.NODE_ENV === 'production' ? prodInterfacePORT : devInterfacePORT
|
||||
const CLOUD_RES_INTERFACE_PORT = process.env.NODE_ENV === 'production' ? DEV_CLOUD_RES_INTERFACE_PORT : DEV_CLOUD_RES_INTERFACE_PORT
|
||||
|
||||
module.exports = {
|
||||
baseUrl: 'http://' + serverIP + ':' + interfacePORT,
|
||||
webLoginType: webLoginType,
|
||||
ssoLoginUrlDev: ssoLogin + devWebUrl,
|
||||
ssoLoginUrl: ssoLogin,
|
||||
kkFileViewUrl,
|
||||
onlyOfficeUrl: onlyOfficeUrl,
|
||||
devWebUrl: devWebUrl,
|
||||
serverUrl: 'http://' + serverIP, // 服务器IP地址
|
||||
interfaceUrl: 'http://' + serverIP + ':' + interfacePORT + '/api/', // 服务器端接口访问地址,
|
||||
cloudResInterFaceUrl: 'http://' + serverIP + ':' + interfacePORT + '/busApi/', // 云端资源库服务器端接口访问地址,
|
||||
simpleUploadPath: 'api/' + simpleFilePath, // 单文件上传地址
|
||||
multipleUploadPath: 'api/' + multipleFilePath, // 多文件上传地址
|
||||
staticFilePath: 'http://' + staticFilePath,
|
||||
staticPDFPath: 'http://' + staticPDFPath,
|
||||
webSocket: webSocket + ':' + devInterfacePORT + '/websocket/socketServer', // webSocket连接
|
||||
enterprise: enterprise, // GQ广汽 SJZX数据中心
|
||||
theme: theme, // 主题
|
||||
processInterfaceURL: `http://${serverIP}:${processPort}/bat-wkflow`
|
||||
}
|
||||
+63
-68
@@ -1,81 +1,76 @@
|
||||
/*** 前端本地配置文件:
|
||||
@description: 通用配置
|
||||
* @author: chenxiaoxi
|
||||
* @date: 2018-09-04 17:47:46
|
||||
*/
|
||||
// 服务器地址
|
||||
// const devIp = '39.98.140.126'
|
||||
// const devInterfacePORT = '4202'
|
||||
// const devIp = '192.168.1.42'
|
||||
// const devInterfacePORT = '9999'
|
||||
// const devIp = '10.10.10.46'
|
||||
// const devInterfacePORT = '4202'
|
||||
// // const devIp = '10.0.3.10'
|
||||
const devIp = '10.0.3.11'
|
||||
const devInterfacePORT = '10086'
|
||||
// const devIp = '62.234.136.153'
|
||||
// const devInterfacePORT = '8033'
|
||||
// 配置 idm 认证
|
||||
const ssoLogin = 'http://localhost:9090/#/'
|
||||
// 配置 前端服务
|
||||
const devWebUrl = 'http://localhost:9090/#/'
|
||||
// webLoginType : idm (线上统一登录) 、 webLoginType: dev (测试环境登录)
|
||||
const webLoginType = 'dev'
|
||||
|
||||
// 配置onlyOffice 前端服务
|
||||
const onlyOfficeUrl = 'http://127.0.0.1:8080'
|
||||
// const onlyOfficeUrl = 'http://10.10.10.46:8889'
|
||||
|
||||
// 云端端口号
|
||||
const DEV_CLOUD_RES_INTERFACE_PORT = '7777'
|
||||
const simpleFilePath = 'att/attFile/upload'
|
||||
const multipleFilePath = 'att/attFile/uploadFiles'
|
||||
const staticFilePath = '192.168.10.140:10010'
|
||||
// const staticFilePath = '106.2.13.189:8888'
|
||||
const staticPDFPath = '192.168.7.140'
|
||||
const webSocket = '192.168.7.178'
|
||||
// const enterprise = ''
|
||||
const enterprise = 'SJZX'
|
||||
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
|
||||
|
||||
*****************************************************************/
|
||||
// 生产环境配置
|
||||
|
||||
const simpleUploadPath = 'api/att/attFile/upload'
|
||||
const multipleUploadPath = 'api/att/attFile/uploadFiles'
|
||||
|
||||
const ssoLoginProd = 'http://sso.foton.com.cn/oauth2.0/authorize?client_id=app_slrs&response_type=code&redirect_uri='
|
||||
const ssoLoginDev = 'http://testsso1.foton.com.cn/oauth2.0/authorize?client_id=app_slrs&response_type=code&redirect_uri='
|
||||
|
||||
const ssoLogoutProd = 'http://sso.foton.com.cn/logout?service='
|
||||
const ssoLogoutDev = 'http://testsso1.foton.com.cn/logout?service='
|
||||
|
||||
// webLoginType : idm (线上统一登录) 、 webLoginType: dev (测试环境登录、本地环境登录)
|
||||
// const webLoginType = 'idm' // (线上统一登录)
|
||||
const webLoginType = 'dev' // (后门登录、测试环境登录、本地环境登录)
|
||||
|
||||
// 配置kkFileView
|
||||
const kkFileViewUrlDev = 'http://127.0.0.1:8012'
|
||||
const kkFileViewUrlProd = 'https://srms.foton.com.cn/preview'
|
||||
|
||||
// 配置onlyOffice
|
||||
const onlyOfficeUrlDev = 'http://127.0.0.1:8080'
|
||||
const onlyOfficeUrlProd = 'http://10.100.5.116:8088'
|
||||
|
||||
// 本地环境
|
||||
const devIp = 'localhost'
|
||||
const devPORT = '10086'
|
||||
|
||||
// 测试环境
|
||||
// const prodIp = '39.98.140.126'
|
||||
// const prodInterfacePORT = '4201'
|
||||
const prodIp = '10.10.10.46'
|
||||
const prodInterfacePORT = '4202'
|
||||
// const prodIp = 'slrs.foton.com.cn'
|
||||
// const prodInterfacePORT = ''
|
||||
// const prodPORT = '4201'
|
||||
// const prodPORT = '4202'
|
||||
|
||||
// 后门
|
||||
// const prodIp = '172.24.7.197'
|
||||
// const prodPORT = '4202'
|
||||
// const prodIp = '10.19.11.243'
|
||||
// const prodPORT = '4204'
|
||||
|
||||
// 生产环境配置
|
||||
const prodIp = 'srms.foton.com.cn'
|
||||
const prodPORT = ''
|
||||
|
||||
// 判断环境
|
||||
const serverIP = process.env.NODE_ENV === 'production' ? prodIp : devIp
|
||||
const interfacePORT = process.env.NODE_ENV === 'production' ? prodInterfacePORT : devInterfacePORT
|
||||
const CLOUD_RES_INTERFACE_PORT = process.env.NODE_ENV === 'production' ? DEV_CLOUD_RES_INTERFACE_PORT : DEV_CLOUD_RES_INTERFACE_PORT
|
||||
const IP = process.env.NODE_ENV === 'production' ? prodIp : devIp
|
||||
const PORT = process.env.NODE_ENV === 'production' ? prodPORT : devPORT
|
||||
const kkFileViewUrl = process.env.NODE_ENV === 'production' ? kkFileViewUrlProd : kkFileViewUrlDev
|
||||
const onlyOfficeUrl = process.env.NODE_ENV === 'production' ? onlyOfficeUrlProd : onlyOfficeUrlDev
|
||||
const protocol = process.env.NODE_ENV === 'production' ? 'https://' : 'http://'
|
||||
|
||||
// 配置 idm 认证
|
||||
const ssoLogin = process.env.NODE_ENV === 'production' ? ssoLoginProd : ssoLoginDev
|
||||
const ssoLogout = process.env.NODE_ENV === 'production' ? ssoLogoutProd : ssoLogoutDev
|
||||
|
||||
const baseUrl = protocol + IP + ':' + PORT
|
||||
const interfaceUrl = protocol + IP + ':' + PORT + '/api/' // 服务器端接口访问地址,
|
||||
|
||||
module.exports = {
|
||||
baseUrl: 'http://' + serverIP + ':' + interfacePORT,
|
||||
webLoginType: webLoginType,
|
||||
ssoLoginUrlDev: ssoLogin + devWebUrl,
|
||||
ssoLoginUrl: ssoLogin,
|
||||
onlyOfficeUrl: onlyOfficeUrl,
|
||||
devWebUrl: devWebUrl,
|
||||
serverUrl: 'http://' + serverIP, // 服务器IP地址
|
||||
interfaceUrl: 'http://' + serverIP + ':' + interfacePORT + '/api/', // 服务器端接口访问地址,
|
||||
cloudResInterFaceUrl: 'http://' + serverIP + ':' + interfacePORT + '/busApi/', // 云端资源库服务器端接口访问地址,
|
||||
simpleUploadPath: 'api/' + simpleFilePath, // 单文件上传地址
|
||||
multipleUploadPath: 'api/' + multipleFilePath, // 多文件上传地址
|
||||
staticFilePath: 'http://' + staticFilePath,
|
||||
staticPDFPath: 'http://' + staticPDFPath,
|
||||
webSocket: webSocket + ':' + devInterfacePORT + '/websocket/socketServer', // webSocket连接
|
||||
enterprise: enterprise, // GQ广汽 SJZX数据中心
|
||||
theme: theme, // 主题
|
||||
processInterfaceURL: `http://${serverIP}:${processPort}/bat-wkflow`
|
||||
baseUrl,
|
||||
interfaceUrl, // 服务器端接口访问地址,
|
||||
simpleUploadPath, // 单文件上传地址
|
||||
multipleUploadPath, // 多文件上传地址
|
||||
|
||||
webLoginType,
|
||||
ssoLogin,
|
||||
ssoLogout,
|
||||
|
||||
kkFileViewUrl,
|
||||
onlyOfficeUrl,
|
||||
theme, // 主题
|
||||
}
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
import { webLoginType, ssoLogin, ssoLogout } from '@/sysConfig'
|
||||
import { getMenu, loginIdm } from "@/api/process";
|
||||
import { getTokenToWeLink } from "@/api/phoneWeLink";
|
||||
import isMobile from "@/store/isMobile";
|
||||
import store from "@/store";
|
||||
import router from '@/router'
|
||||
import hwh5 from '@/api/hwh5-cloudonline.js'
|
||||
import { Message, MessageBox, Loading } from "element-ui";
|
||||
import { Dialog } from 'vant';
|
||||
|
||||
function getCode () {
|
||||
let url = window.location.href
|
||||
if (url && url !== '') {
|
||||
if (url.split('code=').length > 1) {
|
||||
return url.split('code=')[1]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toIdmLoginPage (url) {
|
||||
if (webLoginType === 'idm') {
|
||||
let href = url
|
||||
if (href.indexOf('localhost:9090' > -1)) {
|
||||
href = href.replace('localhost:9090', '39.98.140.126:9090') // 开发环境
|
||||
}
|
||||
console.log(ssoLogin + encodeURIComponent(href))
|
||||
window.location.href = ssoLogin + encodeURIComponent(href)
|
||||
}
|
||||
}
|
||||
|
||||
// 重新登录
|
||||
function loginAgain () {
|
||||
store.dispatch('logout').then(() => {
|
||||
if (webLoginType === 'idm') {
|
||||
if (isMobile()) {
|
||||
loginInPhone().then(() => {
|
||||
router.go(0)
|
||||
})
|
||||
} else {
|
||||
window.location.href = ssoLogout + encodeURIComponent(window.location.href)
|
||||
}
|
||||
}
|
||||
if (webLoginType === 'dev') {
|
||||
router.push('/login')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 退出登录
|
||||
function loginOut () {
|
||||
store.dispatch('logout').then(() => {
|
||||
if (webLoginType === 'idm') {
|
||||
window.location.href = ssoLogout + encodeURIComponent(window.location.origin)
|
||||
}
|
||||
if (webLoginType === 'dev') {
|
||||
router.push('/login')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// idm登录
|
||||
function loginInIdm(code) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let loading = Loading.service({
|
||||
lock: true,
|
||||
text: '登录中...',
|
||||
spinner: 'el-icon-loading',
|
||||
})
|
||||
let _formData = new FormData()
|
||||
_formData.append('code', code)
|
||||
// 获取用户信息
|
||||
loginIdm(_formData).then(res => {
|
||||
if (res.ok) {
|
||||
loginNew(res).then(() => {
|
||||
resolve()
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
})
|
||||
} else {
|
||||
if(res.respCode && res.respCode === 'r0011'){
|
||||
quit()
|
||||
loading.close()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// welink登录
|
||||
function loginInPhone () {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let loading = Loading.service({
|
||||
lock: true,
|
||||
text: '登录中...',
|
||||
spinner: 'el-icon-loading',
|
||||
})
|
||||
hwh5.getAuthCode().then(data => {
|
||||
console.log("获取到了welinkCode", data)
|
||||
if (data) {
|
||||
let code = data.code
|
||||
getTokenToWeLink({
|
||||
code: code,
|
||||
name: encodeURIComponent("standards"+"-"+"regulations"),
|
||||
type:"",
|
||||
corpCode:"",
|
||||
}).then(res => {
|
||||
if (res.ok) {
|
||||
loginNew(res).then(() => {
|
||||
resolve()
|
||||
}).finally(() => {
|
||||
loading.close()
|
||||
})
|
||||
} else {
|
||||
if(res.respCode && res.respCode === 'r0011'){
|
||||
quit()
|
||||
loading.close()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}).catch(e => {
|
||||
Message.warning(e)
|
||||
})
|
||||
}
|
||||
|
||||
function loginNew (res) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (res.data.orgId === null || res.data.orgId === '') {
|
||||
Message.warning('未分配组织机构,请联系管理员分配后重新登录')
|
||||
return
|
||||
}
|
||||
let Base64 = require('js-base64').Base64
|
||||
// 解析用户信息
|
||||
let userInfoStr = Base64.decode(res.data)
|
||||
let userInfoJSON = decodeURIComponent(userInfoStr)
|
||||
let userInfo = JSON.parse(userInfoJSON)
|
||||
userInfo.userId = userInfo.usid
|
||||
store.commit('setToken', userInfo.token)
|
||||
store.commit('setUserInfo', JSON.stringify(userInfo))
|
||||
getMenu({ userId: store.getters.userInfo.userId }).then(menuRes => {
|
||||
if (menuRes.ok) {
|
||||
let hasHomeMenu = false
|
||||
const menuList = menuRes.data
|
||||
menuList.forEach(menu => {
|
||||
if (menu.id === 'asdfadf') {
|
||||
hasHomeMenu = true
|
||||
}
|
||||
})
|
||||
if (hasHomeMenu) {
|
||||
store.dispatch('setMenu', JSON.stringify(menuList)).then(() => {
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
} else {
|
||||
reject(menuRes)
|
||||
}
|
||||
}).catch(e => {
|
||||
reject(e)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function quit () {
|
||||
Message.warning('系统无权限访问')
|
||||
if(isMobile()) {
|
||||
Dialog.confirm({
|
||||
message: '您没有系统访问权限,请联系管理员进行授权',
|
||||
}).then(() => {
|
||||
store.dispatch('logout').then(() => {
|
||||
close()
|
||||
})
|
||||
});
|
||||
} else {
|
||||
MessageBox.confirm('您没有系统访问权限,请联系管理员进行授权', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'warning',
|
||||
showClose: false,
|
||||
showCancelButton: false,
|
||||
}).then(() => {
|
||||
store.dispatch('logout').then(() => {
|
||||
window.location.href = ssoLogout + encodeURIComponent(window.location.origin)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function close () {
|
||||
if (isMobile()) {
|
||||
hwh5.close()
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
toIdmLoginPage,
|
||||
getCode,
|
||||
loginInIdm,
|
||||
loginInPhone,
|
||||
loginAgain,
|
||||
loginOut,
|
||||
close
|
||||
}
|
||||
Reference in New Issue
Block a user