Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
activities
/
web-questionnaire
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2abefc36
authored
Sep 13, 2022
by
Lays-lzq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 用户作答问卷时就进行登录态的判断
parent
ccd6aa87
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletions
+31
-1
components/Questionnaire/QuestionFormItem.vue
+10
-1
store/questionnaire.js
+21
-0
No files found.
components/Questionnaire/QuestionFormItem.vue
View file @
2abefc36
...
...
@@ -9,7 +9,7 @@
<div
class=
"question-form-item__title"
>
{{
info
.
title
}}
</div>
<div
class=
"question-form-item__type"
>
{{
info
.
component
|
showType
}}
</div>
</div>
<div
class=
"question-form-item__content"
>
<div
class=
"question-form-item__content"
@
click=
"isLogin()"
>
<slot></slot>
</div>
</div>
...
...
@@ -17,6 +17,7 @@
</
template
>
<
script
>
import
{
mapActions
}
from
'vuex'
import
{
QUESTION_TYPE
}
from
'~/utils/constant'
export
default
{
...
...
@@ -52,6 +53,14 @@ export default {
return
!
this
.
info
?.
rule
?.
required
},
},
methods
:
{
...
mapActions
({
loginState
:
'questionnaire/loginState'
,
}),
isLogin
()
{
this
.
loginState
()
}
}
}
</
script
>
...
...
store/questionnaire.js
View file @
2abefc36
...
...
@@ -163,6 +163,27 @@ export const actions = {
}
})
},
// 验证是否登录
loginState
({
state
,
dispatch
,
rootState
})
{
if
(
!
rootState
.
users
.
isLogin
)
{
if
(
isIframe
)
{
Toast
({
message
:
'请先登录'
,
duration
:
1500
,
})
}
else
{
Toast
({
message
:
'请先登录'
,
duration
:
1500
,
onClose
:
()
=>
{
dispatch
(
'users/jumpToLogin'
,
''
,
{
root
:
true
})
},
})
}
return
0
}
return
0
},
}
export
const
getters
=
{
questionnaireInfo
:
(
state
)
=>
state
.
questionnaireInfo
,
...
...
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