Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
x-training-new
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
x-training-new
Commits
117258ba
提交
117258ba
authored
9月 22, 2021
作者:
lihuihui
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://gitlab.ezijing.com/webapp/x-training-new
# Conflicts: # src/components/base/AppMenu.vue
上级
cfb0a727
58468e85
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
138 行增加
和
50 行删除
+138
-50
base.js
src/api/base.js
+5
-0
AppMenu.vue
src/components/base/AppMenu.vue
+28
-15
Header.vue
src/components/layout/Header.vue
+1
-1
Index.vue
src/modules/home/views/Index.vue
+9
-5
Echart.vue
src/modules/test/views/Echart.vue
+0
-0
EchartBar.vue
src/modules/user-study/components/EchartBar.vue
+6
-1
ScoreSvg.vue
src/modules/user-study/components/ScoreSvg.vue
+0
-0
UserTable.vue
src/modules/user-study/components/UserTable.vue
+33
-7
Index.vue
src/modules/user-study/views/Index.vue
+6
-2
api.js
src/modules/works-show/api.js
+0
-7
Index.vue
src/modules/works-show/views/Index.vue
+6
-4
index.js
src/router/index.js
+16
-3
index.js
src/store/index.js
+22
-5
beforeEnter.js
src/utils/beforeEnter.js
+6
-0
没有找到文件。
src/api/base.js
浏览文件 @
117258ba
...
@@ -37,3 +37,8 @@ export function getSelectCase() {
...
@@ -37,3 +37,8 @@ export function getSelectCase() {
export
function
getSelectRole
()
{
export
function
getSelectRole
()
{
return
httpRequest
.
get
(
'/api/xtraining/api/v1/role'
)
return
httpRequest
.
get
(
'/api/xtraining/api/v1/role'
)
}
}
/** 获取作品完成状态 */
export
function
getWorkStatus
()
{
return
httpRequest
.
get
(
'/api/xtraining/api/v1/show/analysis-status'
)
}
src/components/base/AppMenu.vue
浏览文件 @
117258ba
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
{
getWorkStatus
}
from
'@/api/base.js'
export
default
{
export
default
{
name
:
'AppMenu'
,
name
:
'AppMenu'
,
data
()
{
data
()
{
...
@@ -16,9 +17,9 @@ export default {
...
@@ -16,9 +17,9 @@ export default {
menuList
:
[
menuList
:
[
{
label
:
'首页'
,
path
:
'/home'
,
disabled
:
[]
},
{
label
:
'首页'
,
path
:
'/home'
,
disabled
:
[]
},
{
label
:
'产品分析'
,
path
:
'/product-analysis'
,
disabled
:
[
0
,
2
,
3
]
},
{
label
:
'产品分析'
,
path
:
'/product-analysis'
,
disabled
:
[
0
,
2
,
3
]
},
{
label
:
'用户
研究
'
,
path
:
'/user-study'
,
disabled
:
[
0
,
1
,
3
]
},
{
label
:
'用户
分析
'
,
path
:
'/user-study'
,
disabled
:
[
0
,
1
,
3
]
},
{
label
:
'营销工具使用'
,
path
:
'/market-tools'
,
disabled
:
[
0
,
1
,
2
]
},
{
label
:
'营销工具使用'
,
path
:
'/market-tools'
,
disabled
:
[
0
,
1
,
2
]
},
{
label
:
'作品展示'
,
path
:
'/works-show'
,
disabled
:
[]
}
{
label
:
'作品展示'
,
path
:
'/works-show'
,
disabled
:
[
0
]
}
]
]
}
}
},
},
...
@@ -31,11 +32,23 @@ export default {
...
@@ -31,11 +32,23 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
menuSelect
(
item
)
{
async
menuSelect
(
item
)
{
if
(
item
.
disabled
.
includes
(
this
.
role
))
{
if
(
this
.
role
===
0
)
{
this
.
$message
.
error
(
'请选择角色'
)
}
else
if
(
item
.
disabled
.
includes
(
this
.
role
))
{
this
.
$message
.
error
(
'您当前的角色禁止访问该页面'
)
this
.
$message
.
error
(
'您当前的角色禁止访问该页面'
)
}
else
{
}
else
{
if
([
'/user-study'
,
'/market-tools'
].
includes
(
item
.
path
))
{
const
flag
=
await
this
.
fetchWorkStatus
()
console
.
log
(
flag
)
if
(
flag
)
{
this
.
$router
.
push
(
item
.
path
)
this
.
$router
.
push
(
item
.
path
)
}
else
{
this
.
$message
.
error
(
'请先完成产品分析报告,再进行'
+
item
.
label
)
}
}
else
{
this
.
$router
.
push
(
item
.
path
)
}
}
}
},
},
selectProducts
()
{
selectProducts
()
{
...
@@ -46,17 +59,17 @@ export default {
...
@@ -46,17 +59,17 @@ export default {
}).
then
(()
=>
{
}).
then
(()
=>
{
this
.
$router
.
push
({
path
:
'/product-analysis'
})
this
.
$router
.
push
({
path
:
'/product-analysis'
})
})
})
// if (this.$route.path === '/product-analysis/report') {
},
// this.$confirm('切换案例,当前填写的内容不会保存', '提示',
{
fetchWorkStatus
()
{
// confirmButtonText: '确定',
return
new
Promise
((
resolve
)
=>
{
// cancelButtonText: '取消',
getWorkStatus
().
then
(
res
=>
{
// type: 'warning'
if
(
res
.
code
===
0
&&
res
.
data
&&
res
.
data
.
case_status
)
{
// }).then(() => {
resolve
(
true
)
// this.$router.push({ path: '/product-analysis' })
}
else
{
// }
)
resolve
(
false
)
// } else {
}
// this.$router.push({ path: '/product-analysis' }
)
}).
catch
(()
=>
resolve
(
false
)
)
// }
})
}
}
}
}
}
}
...
...
src/components/layout/Header.vue
浏览文件 @
117258ba
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
import
AppMenu
from
'../base/AppMenu.vue'
import
AppMenu
from
'../base/AppMenu.vue'
export
default
{
export
default
{
name
:
'AppHeader'
,
name
:
'AppHeader'
,
components
:
{
AppMenu
}
components
:
{
AppMenu
}
}
}
</
script
>
</
script
>
...
...
src/modules/home/views/Index.vue
浏览文件 @
117258ba
<
template
>
<
template
>
<div
class=
"home"
>
<div
class=
"home"
>
<div
class=
"top"
>
<div
class=
"top"
>
<el-button
style=
"margin-left:10px;"
type=
"primary"
size=
"medium"
plain
round
@
click=
"handleLogout"
>
退出系统
</el-button>
<el-button
type=
"primary"
size=
"medium"
plain
round
@
click=
"visible = true"
>
切换角色
</el-button>
<el-button
type=
"primary"
size=
"medium"
plain
round
@
click=
"visible = true"
>
切换角色
</el-button>
</div>
</div>
<div
class=
"inner"
>
<div
class=
"inner"
>
...
@@ -8,8 +9,6 @@
...
@@ -8,8 +9,6 @@
<div
class=
"logo"
>
金融
</div>
<div
class=
"logo"
>
金融
</div>
<app-menu
/>
<app-menu
/>
</div>
</div>
<el-button
type=
"primary"
disabled
>
1111
</el-button>
<!--
<btn
:attrs=
"
{ title: '用户分析', left: '360px', top: '134px' }" @click.native="handleClick('/user-study')" disabled/> -->
<btn
v-for=
"(item, index) in btnList"
:key=
"index"
:attrs=
"
{ title: item.label, left: item.left, top: item.top }" @click.native="handleClick(item)" :disabled="item.disabled.includes(role)"/>
<btn
v-for=
"(item, index) in btnList"
:key=
"index"
:attrs=
"
{ title: item.label, left: item.left, top: item.top }" @click.native="handleClick(item)" :disabled="item.disabled.includes(role)"/>
</div>
</div>
<role-select
:visible=
"visible"
@
roleSelect=
"fetchSelectRole"
/>
<role-select
:visible=
"visible"
@
roleSelect=
"fetchSelectRole"
/>
...
@@ -29,8 +28,8 @@ export default {
...
@@ -29,8 +28,8 @@ export default {
btnList
:
[
btnList
:
[
{
label
:
'产品分析'
,
path
:
'/product-analysis'
,
disabled
:
[
0
,
2
,
3
],
left
:
'960px'
,
top
:
'134px'
},
{
label
:
'产品分析'
,
path
:
'/product-analysis'
,
disabled
:
[
0
,
2
,
3
],
left
:
'960px'
,
top
:
'134px'
},
{
label
:
'用户分析'
,
path
:
'/user-study'
,
disabled
:
[
0
,
1
,
3
],
left
:
'340px'
,
top
:
'134px'
},
{
label
:
'用户分析'
,
path
:
'/user-study'
,
disabled
:
[
0
,
1
,
3
],
left
:
'340px'
,
top
:
'134px'
},
{
label
:
'营销工具使用'
,
path
:
'/market-tools'
,
disabled
:
[
0
,
1
,
2
],
left
:
'65
0px'
,
top
:
'344
px'
},
{
label
:
'营销工具使用'
,
path
:
'/market-tools'
,
disabled
:
[
0
,
1
,
2
],
left
:
'65
2px'
,
top
:
'343
px'
},
{
label
:
'作品展示'
,
path
:
'/works-show'
,
disabled
:
[
],
left
:
'320px'
,
top
:
'344
px'
}
{
label
:
'作品展示'
,
path
:
'/works-show'
,
disabled
:
[
0
],
left
:
'320px'
,
top
:
'343
px'
}
],
],
menuMap
:
{}
menuMap
:
{}
}
}
...
@@ -60,6 +59,11 @@ export default {
...
@@ -60,6 +59,11 @@ export default {
menuSelect
(
item
)
{
menuSelect
(
item
)
{
this
.
$router
.
push
(
item
.
path
)
this
.
$router
.
push
(
item
.
path
)
},
},
handleLogout
()
{
this
.
$store
.
dispatch
(
'logout'
).
then
(()
=>
{
window
.
location
.
href
=
`
${
import
.
meta
.
env
.
VITE_LOGIN_URL
}
?rd=
${
encodeURIComponent
(
window
.
location
.
href
)}
`
})
},
fetchSelectRole
(
role
)
{
fetchSelectRole
(
role
)
{
selectRole
({
role
}).
then
(
res
=>
{
selectRole
({
role
}).
then
(
res
=>
{
if
(
res
.
code
===
0
&&
res
.
data
&&
res
.
data
.
status
)
{
if
(
res
.
code
===
0
&&
res
.
data
&&
res
.
data
.
status
)
{
...
@@ -80,10 +84,10 @@ export default {
...
@@ -80,10 +84,10 @@ export default {
<
style
scoped
>
<
style
scoped
>
.top
{
.top
{
height
:
80px
;
height
:
80px
;
padding
:
20px
50px
0
0
;
}
}
.top
.el-button
{
.top
.el-button
{
float
:
right
;
float
:
right
;
margin
:
20px
50px
0
0
;
}
}
.inner
{
.inner
{
background
:
url('@/assets/images/home.png')
no-repeat
left
center
;
background
:
url('@/assets/images/home.png')
no-repeat
left
center
;
...
...
src/modules/test/views/Echart.vue
浏览文件 @
117258ba
src/modules/user-study/components/EchartBar.vue
浏览文件 @
117258ba
...
@@ -17,7 +17,12 @@ export default {
...
@@ -17,7 +17,12 @@ export default {
return
{
return
{
options
:
{
options
:
{
title
:
{
text
:
'年龄分布'
},
title
:
{
text
:
'年龄分布'
},
tooltip
:
{},
tooltip
:
{
trigger
:
'item'
,
formatter
:
function
(
data
)
{
return
data
.
name
+
'<br/>'
+
data
.
seriesName
+
':'
+
data
.
value
+
'%'
// 将小数转化为百分数显示
}
},
// legend: {
// legend: {
// data: ['基金', '全网分布', '平均温度']
// data: ['基金', '全网分布', '平均温度']
// },
// },
...
...
src/modules/user-study/components/ScoreSvg.vue
浏览文件 @
117258ba
src/modules/user-study/components/UserTable.vue
浏览文件 @
117258ba
<
template
>
<
template
>
<div
class=
"user-table"
>
<div
class=
"user-table"
>
<el-table
:data=
"tableData"
stripe
size=
"medium"
height=
"calc(100% - 26px)"
style=
"width: 100%"
:header-row-style=
"
{background:'#ededed',color:'#4d4d4d'}" :header-cell-style="{background: 'transparent'}">
<el-table
:data=
"tableData"
stripe
size=
"medium"
height=
"calc(100% - 26px)"
style=
"width: 100%"
:header-row-style=
"
{background:'#ededed',color:'#4d4d4d'}" :header-cell-style="{background: 'transparent'}">
<el-table-column
prop=
"name"
label=
"客户姓名"
min-width=
"1
2
0"
/>
<el-table-column
prop=
"name"
label=
"客户姓名"
min-width=
"1
0
0"
/>
<el-table-column
prop=
"
id"
label=
"客户编号"
min-width=
"12
0"
/>
<el-table-column
prop=
"
no"
label=
"客户编号"
min-width=
"15
0"
/>
<el-table-column
prop=
"age"
label=
"年龄"
min-width=
"
10
0"
/>
<el-table-column
prop=
"age"
label=
"年龄"
min-width=
"
8
0"
/>
<el-table-column
prop=
"sex"
label=
"性别"
min-width=
"
10
0"
>
<el-table-column
prop=
"sex"
label=
"性别"
min-width=
"
8
0"
>
<template
slot-scope=
"scope"
>
{{
scope
.
row
.
sex
===
1
?
'男'
:
'女'
}}
</
template
>
<template
slot-scope=
"scope"
>
{{
scope
.
row
.
sex
===
1
?
'男'
:
'女'
}}
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
prop=
"property"
label=
"可支配资产"
min-width=
"120"
>
<el-table-column
prop=
"property"
label=
"可支配资产"
min-width=
"120"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
disposable_assets
}}
万
</
template
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
disposable_assets
|
propertyFilter
}}
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"理财经验"
min-width=
"
12
0"
>
<el-table-column
label=
"理财经验"
min-width=
"
8
0"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
financial_experience
}}
年
</
template
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
financial_experience
|
experienceFilter
}}
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
<div
class=
"pagination"
>
<div
class=
"pagination"
>
...
@@ -21,6 +21,21 @@
...
@@ -21,6 +21,21 @@
</template>
</template>
<
script
>
<
script
>
import
{
getUserList
}
from
'../api'
import
{
getUserList
}
from
'../api'
const
propertyMap
=
{
1
:
'10万以下'
,
2
:
'10万-20万'
,
3
:
'20-50万'
,
4
:
'50-80万'
,
5
:
'80-100万'
,
6
:
'100万-300万'
,
7
:
'300万以上'
}
const
experienceMap
=
{
1
:
'没有经验'
,
2
:
'1-3年'
,
3
:
'3-5年'
,
4
:
'5年以上'
}
export
default
{
export
default
{
props
:
{
props
:
{
params
:
{
params
:
{
...
@@ -38,6 +53,14 @@ export default {
...
@@ -38,6 +53,14 @@ export default {
limit
:
10
limit
:
10
}
}
},
},
filters
:
{
propertyFilter
(
val
)
{
return
propertyMap
[
val
]
},
experienceFilter
(
val
)
{
return
experienceMap
[
val
]
}
},
watch
:
{
watch
:
{
params
:
{
params
:
{
handler
(
v
)
{
handler
(
v
)
{
...
@@ -65,6 +88,9 @@ export default {
...
@@ -65,6 +88,9 @@ export default {
box-sizing
:
border-box
;
box-sizing
:
border-box
;
height
:
484px
;
height
:
484px
;
}
}
.user-table
::v-deep
.el-table
.el-table__cell.gutter
{
background
:
#ededed
;
}
.pagination
{
.pagination
{
padding-top
:
7px
;
padding-top
:
7px
;
text-align
:
right
;
text-align
:
right
;
...
...
src/modules/user-study/views/Index.vue
浏览文件 @
117258ba
...
@@ -98,6 +98,10 @@ export default {
...
@@ -98,6 +98,10 @@ export default {
}
}
},
},
created
()
{
created
()
{
if
(
!
[
2
,
4
].
includes
(
this
.
$store
.
state
.
role
))
{
this
.
$router
.
push
(
'/home'
)
return
}
this
.
init
()
this
.
init
()
this
.
status
=
this
.
$route
.
query
.
type
||
'0'
this
.
status
=
this
.
$route
.
query
.
type
||
'0'
},
},
...
@@ -117,13 +121,13 @@ export default {
...
@@ -117,13 +121,13 @@ export default {
}
}
this
.
initQuestions
(
questions
,
selection
)
this
.
initQuestions
(
questions
,
selection
)
this
.
handleChoiceSelect
()
this
.
handleChoiceSelect
()
}).
catch
(
err
=>
{
}).
catch
(
()
=>
{
if
(
!
(
this
.
$store
.
state
.
case
&&
this
.
$store
.
state
.
case
.
id
))
{
if
(
!
(
this
.
$store
.
state
.
case
&&
this
.
$store
.
state
.
case
.
id
))
{
this
.
$alert
(
'请先选择完成产品分析案例选择,再进行用户分析'
,
{
this
.
$alert
(
'请先选择完成产品分析案例选择,再进行用户分析'
,
{
confirmButtonText
:
'回到首页'
,
confirmButtonText
:
'回到首页'
,
showClose
:
false
,
showClose
:
false
,
callback
:
action
=>
{
callback
:
action
=>
{
this
.
$route
.
push
(
'/home'
)
this
.
$route
r
.
push
(
'/home'
)
}
}
})
})
}
}
...
...
src/modules/works-show/api.js
deleted
100644 → 0
浏览文件 @
cfb0a727
import
httpRequest
from
'@/utils/axios'
/** 获取作品完成状态 */
export
function
getWorkStatus
()
{
return
httpRequest
.
get
(
'/api/xtraining/api/v1/show/analysis-status'
)
}
\ No newline at end of file
src/modules/works-show/views/Index.vue
浏览文件 @
117258ba
...
@@ -30,13 +30,13 @@
...
@@ -30,13 +30,13 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
getWorkStatus
}
from
'
../api
'
import
{
getWorkStatus
}
from
'
@/api/base
'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
case_status
:
tru
e
,
case_status
:
fals
e
,
marketing_status
:
tru
e
,
marketing_status
:
fals
e
,
user_analysis_status
:
tru
e
,
user_analysis_status
:
fals
e
,
navMap
:
{
navMap
:
{
1
:
'/product-analysis/report'
,
1
:
'/product-analysis/report'
,
2
:
'/product-analysis/result'
,
2
:
'/product-analysis/result'
,
...
@@ -65,6 +65,8 @@ export default {
...
@@ -65,6 +65,8 @@ export default {
this
.
marketing_status
=
res
.
data
.
marketing_status
this
.
marketing_status
=
res
.
data
.
marketing_status
this
.
user_analysis_status
=
res
.
data
.
user_analysis_status
this
.
user_analysis_status
=
res
.
data
.
user_analysis_status
}
}
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
})
}
}
}
}
...
...
src/router/index.js
浏览文件 @
117258ba
import
Vue
from
'vue'
import
Vue
from
'vue'
import
Vue
Router
from
'vue-router'
import
Router
from
'vue-router'
Vue
.
use
(
VueRouter
)
Vue
.
use
(
Router
)
const
originalPush
=
Router
.
prototype
.
push
const
originalReplace
=
Router
.
prototype
.
replace
// push
Router
.
prototype
.
push
=
function
push
(
location
,
onResolve
,
onReject
)
{
if
(
onResolve
||
onReject
)
return
originalPush
.
call
(
this
,
location
,
onResolve
,
onReject
)
return
originalPush
.
call
(
this
,
location
).
catch
(
err
=>
err
)
}
// replace
Router
.
prototype
.
replace
=
function
push
(
location
,
onResolve
,
onReject
)
{
if
(
onResolve
||
onReject
)
return
originalReplace
.
call
(
this
,
location
,
onResolve
,
onReject
)
return
originalReplace
.
call
(
this
,
location
).
catch
(
err
=>
err
)
}
const
routes
=
[
const
routes
=
[
{
path
:
'*'
,
redirect
:
'/home'
},
{
path
:
'*'
,
redirect
:
'/home'
},
{
path
:
'/'
,
redirect
:
'/home'
}
{
path
:
'/'
,
redirect
:
'/home'
}
]
]
const
router
=
new
Vue
Router
({
const
router
=
new
Router
({
mode
:
'history'
,
mode
:
'history'
,
routes
routes
})
})
...
...
src/store/index.js
浏览文件 @
117258ba
import
Vue
from
'vue'
import
Vue
from
'vue'
import
Vuex
,
{
Store
}
from
'vuex'
import
Vuex
from
'vuex'
import
{
getUser
,
logout
,
getSelectCase
,
getSelectRole
}
from
'@/api/base'
import
{
getUser
,
logout
,
getSelectCase
,
getSelectRole
}
from
'@/api/base'
Vue
.
use
(
Vuex
)
Vue
.
use
(
Vuex
)
...
@@ -8,7 +8,7 @@ export default new Vuex.Store({
...
@@ -8,7 +8,7 @@ export default new Vuex.Store({
state
:
{
state
:
{
user
:
{},
user
:
{},
case
:
{},
case
:
{},
role
:
0
role
:
null
},
},
mutations
:
{
mutations
:
{
setUser
(
state
,
user
)
{
setUser
(
state
,
user
)
{
...
@@ -45,9 +45,9 @@ export default new Vuex.Store({
...
@@ -45,9 +45,9 @@ export default new Vuex.Store({
commit
(
'setCase'
,
response
.
data
.
case
)
commit
(
'setCase'
,
response
.
data
.
case
)
})
})
// 获取用户选中的角色
// 获取用户选中的角色
getSelectRole
().
then
(
res
=>
{
//
getSelectRole().then(res => {
commit
(
'setRole'
,
res
.
data
.
role
)
//
commit('setRole', res.data.role)
})
//
})
return
true
return
true
}
else
{
}
else
{
commit
(
'setUser'
,
{})
commit
(
'setUser'
,
{})
...
@@ -59,6 +59,23 @@ export default new Vuex.Store({
...
@@ -59,6 +59,23 @@ export default new Vuex.Store({
return
false
return
false
})
})
return
isLogin
return
isLogin
},
async
checkRole
({
commit
})
{
const
hasRole
=
await
getSelectRole
()
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
commit
(
'setRole'
,
res
.
data
.
role
)
return
true
}
else
{
commit
(
'setRole'
,
null
)
return
false
}
})
.
catch
(()
=>
{
commit
(
'setRole'
,
null
)
return
false
})
return
hasRole
}
}
}
}
})
})
src/utils/beforeEnter.js
浏览文件 @
117258ba
import
store
from
'@/store'
import
store
from
'@/store'
import
router
from
'@/router'
const
UA
=
navigator
.
userAgent
const
UA
=
navigator
.
userAgent
const
isMobile
=
/iphone/i
.
test
(
UA
)
||
(
/android/i
.
test
(
UA
)
&&
/mobile/i
.
test
(
UA
))
const
isMobile
=
/iphone/i
.
test
(
UA
)
||
(
/android/i
.
test
(
UA
)
&&
/mobile/i
.
test
(
UA
))
...
@@ -29,6 +30,11 @@ export default async function (to, from, next) {
...
@@ -29,6 +30,11 @@ export default async function (to, from, next) {
if
(
!
isLogin
)
{
if
(
!
isLogin
)
{
window
.
location
.
href
=
`
${
import
.
meta
.
env
.
VITE_LOGIN_URL
}
?rd=
${
encodeURIComponent
(
window
.
location
.
href
)}
`
window
.
location
.
href
=
`
${
import
.
meta
.
env
.
VITE_LOGIN_URL
}
?rd=
${
encodeURIComponent
(
window
.
location
.
href
)}
`
return
return
}
else
{
const
hasRole
=
typeof
store
.
state
.
role
===
'number'
||
(
await
store
.
dispatch
(
'checkRole'
))
if
(
hasRole
&&
store
.
state
.
role
===
0
&&
to
.
path
!==
'/home'
)
{
router
.
push
(
'/home'
)
}
}
}
next
()
next
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论