Commit 02367be7 authored by 盖献康's avatar 盖献康

调查问卷 - 查看详情前的限制

parent d56bc14d
......@@ -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/
......
......@@ -31,3 +31,11 @@ export function addQuestionDetail(data) {
data: data
})
}
// 在登录的前提下,获取当前用户对于某一问卷的答题次数
export function getQuestionAnswerCountByUserId(id) {
return request({
url: '/answer/count/' + id,
method: 'get'
})
}
......@@ -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'
// })
// }
}
})
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment