Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-cr20g
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
dsk-cr20g
Commits
8c29d7e1
Commit
8c29d7e1
authored
Apr 24, 2024
by
chenyuefang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
5f80792d
3f6f203d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
16 deletions
+34
-16
.env.production
dsk-operate-ui/.env.production
+1
-1
.env.test
dsk-operate-ui/.env.test
+1
-1
permission.js
dsk-operate-ui/src/permission.js
+15
-3
user.js
dsk-operate-ui/src/store/modules/user.js
+0
-1
auth.js
dsk-operate-ui/src/utils/auth.js
+16
-4
vue.config.js
dsk-operate-ui/vue.config.js
+1
-6
No files found.
dsk-operate-ui/.env.production
View file @
8c29d7e1
...
...
@@ -5,7 +5,7 @@ VUE_APP_TITLE = 数字化经营履约全生命链路管理系统
ENV = 'production'
# 数字化经营履约全生命链路管理系统/生产环境
VUE_APP_BASE_API = '
http://123.60.218.188:9099
/prod-api'
VUE_APP_BASE_API = '/prod-api'
# 子系统地址
VUE_APP_SUB_SYSTEM_ADDRESS = "https://plug.jiansheku.com"
...
...
dsk-operate-ui/.env.test
View file @
8c29d7e1
...
...
@@ -9,7 +9,7 @@ ENV = 'test'
# 数字化经营履约全生命链路管理系统/测试环境
VUE_APP_BASE_API
=
'
http://123.60.218.188:9099
/prod-api'
VUE_APP_BASE_API
=
'/prod-api'
# 子系统地址
VUE_APP_SUB_SYSTEM_ADDRESS
=
"https://pre-plug.jiansheku.com"
...
...
dsk-operate-ui/src/permission.js
View file @
8c29d7e1
...
...
@@ -3,18 +3,27 @@ import store from './store';
import
{
Message
}
from
'element-ui'
;
import
NProgress
from
'nprogress'
;
import
'nprogress/nprogress.css'
;
import
{
getToken
,
getThirdPlatform
}
from
'@/utils/auth'
;
import
{
getToken
,
getThirdPlatform
,
checkThirdPlatformChange
,
removeThirdPlatform
,
setThirdPlatform
}
from
'@/utils/auth'
;
import
{
isRelogin
}
from
'@/utils/request'
;
NProgress
.
configure
({
showSpinner
:
false
});
const
whiteList
=
[
'/login'
,
"/404"
,
"/401"
];
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
// 存在platFormkey但是 已经更换 或本地session不存在 已经存在其它token 重写拉取所有信息
const
onlyUrlKey
=
getThirdPlatform
(
true
);
if
(
onlyUrlKey
&&
checkThirdPlatformChange
(
onlyUrlKey
))
{
// 前端退出登录
await
store
.
dispatch
(
"FedLogOut"
);
removeThirdPlatform
();
setThirdPlatform
(
onlyUrlKey
);
}
// 默认跳转路径 本系统跳转首页,第三方跳转宏观市场
const
platFormKey
=
getThirdPlatform
();
let
defaultRedirectPath
=
platFormKey
?
"/macro/nationalEconomies"
:
"/"
;
NProgress
.
start
();
// 正常登录 不带第三方
if
(
getToken
())
{
// tab页签title
const
{
tabTitle
,
url
}
=
to
.
query
;
...
...
@@ -29,7 +38,10 @@ router.beforeEach((to, from, next) => {
if
(
!
store
.
state
?.
user
?.
userId
&&
!
store
.
state
?.
user
?.
roles
?.
length
)
{
isRelogin
.
show
=
true
;
// 判断当前用户是否已拉取完user_info信息
store
.
dispatch
(
'GetInfo'
).
then
(()
=>
{
store
.
dispatch
(
'GetInfo'
).
then
(
async
(
res
)
=>
{
if
(
res
?.
data
?.
isThirdPlatformLogin
&&
!
platFormKey
)
{
throw
new
Error
(
"第三方登录重置,请重新使用platFormKey进入"
);
}
isRelogin
.
show
=
false
;
store
.
dispatch
(
'GenerateRoutes'
).
then
(
accessRoutes
=>
{
// 根据roles权限生成可访问的路由表
...
...
dsk-operate-ui/src/store/modules/user.js
View file @
8c29d7e1
...
...
@@ -115,7 +115,6 @@ const user = {
try
{
if
(
!
payload
)
throw
new
Error
(
"缺少platFormKey"
);
const
tokenInfo
=
await
thirdPlatformLoginApi
(
payload
);
console
.
log
(
tokenInfo
);
if
(
tokenInfo
.
code
==
200
)
{
setToken
(
tokenInfo
.
data
.
token
);
commit
(
'SET_TOKEN'
,
tokenInfo
.
data
.
token
);
...
...
dsk-operate-ui/src/utils/auth.js
View file @
8c29d7e1
...
...
@@ -34,20 +34,32 @@ export function setBiAuth(token) {
/**
* 获取第三方app key
* @param {*} onlyUrl 是否仅从url获取
* @returns
*/
export
function
getThirdPlatform
()
{
const
platForm
=
sessionStorage
.
getItem
(
"PLAT_FORM"
);
if
(
platForm
)
return
platForm
;
export
function
getThirdPlatform
(
onlyUrl
=
false
)
{
if
(
!
onlyUrl
)
{
const
platForm
=
sessionStorage
.
getItem
(
"PLAT_FORM"
);
if
(
platForm
)
return
platForm
;
}
// sessiongStorage 未获取到appkey 寻找url上的参数
const
{
platFormKey
}
=
getUrlSearchQuery
();
if
(
platFormKey
)
{
return
setThirdPlatform
(
platFormKey
)
?
platFormKey
:
""
;
return
platFormKey
;
}
else
{
return
""
;
};
}
/**
* 检测 appkey是否存在变动
* @param {*} appkey
*/
export
function
checkThirdPlatformChange
(
appkey
)
{
const
platForm
=
sessionStorage
.
getItem
(
"PLAT_FORM"
);
return
platForm
!==
appkey
;
}
/**
* 储存第三方app key
* @param {*} appkey
...
...
dsk-operate-ui/vue.config.js
View file @
8c29d7e1
...
...
@@ -35,12 +35,7 @@ module.exports = {
proxy
:
{
// detail: https://cli.vuejs.org/config/#devserver-proxy
[
process
.
env
.
VUE_APP_BASE_API
]:
{
target
:
`http://120.46.64.239:9099/prod-api`
,
//测试
// target: `https://szhapi.jiansheku.com`,//线上
// target: `http://122.9.160.122:9011`, //线上
// target: `http://192.168.0.165:9098`,//施-无线
// target: `http://192.168.60.46:9098`,//施-有线
// target: `http://192.168.60.6:9098`,//谭
target
:
`http://123.60.218.188:9099/prod-api`
,
//测试
changeOrigin
:
true
,
pathRewrite
:
{
[
'^'
+
process
.
env
.
VUE_APP_BASE_API
]:
''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment