Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
binhai-people
Project
Project
Details
Activity
Releases
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
binhai-jiaoguan
binhai-people
Commits
02367be7
Commit
02367be7
authored
Nov 23, 2023
by
盖献康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调查问卷 - 查看详情前的限制
parent
d56bc14d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
13 deletions
+50
-13
.env.production
.env.production
+1
-1
question.js
src/api/question/question.js
+8
-0
index.vue
src/views/questionnaire/index.vue
+41
-12
No files found.
.env.production
View file @
02367be7
...
...
@@ -5,7 +5,7 @@ VUE_APP_TITLE = 新区交通综合信息服务系统
ENV = 'production'
# 若依管理系统/生产环境
VUE_APP_BASE_API = 'http://
49.232.167.247:22000
'
VUE_APP_BASE_API = 'http://
10.10.10.105:8082/trip-prod-api
'
# 百度地图api
# https://api.map.baidu.com/
...
...
src/api/question/question.js
View file @
02367be7
...
...
@@ -31,3 +31,11 @@ export function addQuestionDetail(data) {
data
:
data
})
}
// 在登录的前提下,获取当前用户对于某一问卷的答题次数
export
function
getQuestionAnswerCountByUserId
(
id
)
{
return
request
({
url
:
'/answer/count/'
+
id
,
method
:
'get'
})
}
src/views/questionnaire/index.vue
View file @
02367be7
...
...
@@ -64,12 +64,12 @@ border: 1px solid #CCCCCC;border-radius:0.3rem;padding: 0.25rem 1rem 0.25rem 1re
<
script
>
import
{
parseTime
}
from
'@/utils'
import
{
listQuestion
}
from
'@/api/question/question'
import
{
getQuestionAnswerCountByUserId
,
listQuestion
}
from
'@/api/question/question'
import
NavList
from
'@/views/Home/components/NavList/index.vue'
import
store
from
"@/store"
;
import
{
MessageBox
}
from
"element-ui"
;
import
{
removeToken
}
from
"@/utils/auth"
;
import
router
from
"@/router"
;
import
store
from
'@/store'
import
{
MessageBox
}
from
'element-ui'
import
{
removeToken
}
from
'@/utils/auth'
import
router
from
'@/router'
export
default
{
name
:
'Questionnaire'
,
...
...
@@ -112,6 +112,10 @@ export default {
},
// 跳转详情页方法
changeInfo
(
row
)
{
// 跳转前需要有几个判断
// 1. 先判断当前用户所在IP是否可以答题
// 2. 判断当前问卷是否可以免登录答题
// 3. 判断当前用户答题数是否超过此问卷最大答题数
console
.
log
(
'row111'
,
row
)
// 获取当前IP
let
num
=
0
...
...
@@ -133,7 +137,7 @@ export default {
// 判断此问卷是否需要登录权限
if
(
row
.
loginFlag
===
'1'
)
{
// 当前token为空,不许登录
if
(
store
.
state
.
user
.
token
===
undefined
)
{
if
(
store
.
state
.
user
.
token
===
undefined
||
store
.
state
.
user
.
token
===
null
)
{
MessageBox
.
confirm
(
'您的身份认证已失效,请重新登录'
,
'认证失效'
,
{
confirmButtonText
:
'前往登录'
,
cancelButtonText
:
'暂不登录'
,
...
...
@@ -157,19 +161,44 @@ export default {
console
.
log
(
'numnnnn'
,
num
)
if
(
num
===
0
)
{
// 如果答题次数已经超过规定答题数,则不能点击进入详情页
if
(
row
.
answerNum
>
row
.
submitNum
)
{
// 登录状态
if
(
store
.
state
.
user
.
token
!==
undefined
&&
store
.
state
.
user
.
token
!==
null
)
{
getQuestionAnswerCountByUserId
(
row
.
Id
).
then
(
response
=>
{
if
(
row
.
answerNum
>
response
.
data
)
{
this
.
$router
.
push
({
path
:
'/questionnaire/questionnaire-detail'
,
query
:
{
id
:
row
.
Id
}
})
}
else
{
this
.
$message
({
message
:
'此问卷已达到最大提交次数'
,
type
:
'warning'
})
}
})
}
else
{
this
.
$router
.
push
({
path
:
'/questionnaire/questionnaire-detail'
,
query
:
{
id
:
row
.
Id
}
})
}
else
{
this
.
$message
({
message
:
'此问卷已达到最大提交次数'
,
type
:
'warning'
})
}
// if (row.answerNum > row.submitNum) {
// this.$router.push({
// path: '/questionnaire/questionnaire-detail',
// query: {
// id: row.Id
// }
// })
// } else {
// this.$message({
// message: '此问卷已达到最大提交次数',
// type: 'warning'
// })
// }
}
})
},
...
...
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