问卷
This commit is contained in:
@@ -79,6 +79,7 @@ public class H5QsvQuizController {
|
|||||||
Integer maxAttempts = activity.getMaxAttempts();
|
Integer maxAttempts = activity.getMaxAttempts();
|
||||||
//题目显示模式
|
//题目显示模式
|
||||||
String displayMode = activity.getDisplayMode();
|
String displayMode = activity.getDisplayMode();
|
||||||
|
|
||||||
// 重复答题,显示提示
|
// 重复答题,显示提示
|
||||||
Boolean repeatTips = false;
|
Boolean repeatTips = false;
|
||||||
|
|
||||||
|
|||||||
@@ -7,18 +7,20 @@ layout("/layouts/platform.html"){
|
|||||||
<search @search="doSearch">
|
<search @search="doSearch">
|
||||||
<search-item label="年度">
|
<search-item label="年度">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
@change="listActivity"
|
@change="listActivity"
|
||||||
placeholder="选择年"
|
placeholder="选择年"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
type="year"
|
type="year"
|
||||||
v-model="pageForm.year"
|
v-model="pageForm.year"
|
||||||
value-format="yyyy"
|
value-format="yyyy"
|
||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</search-item>
|
</search-item>
|
||||||
<search-item label="问卷">
|
<search-item label="问卷">
|
||||||
<el-select filterable placeholder="所属问卷" style="width: 100%" @change="doSearch" v-model="pageForm.activityId">
|
<el-select filterable placeholder="所属问卷" style="width: 100%" @change="doSearch"
|
||||||
<el-option :label="item.title" :value="item.id" :key="item.id" v-for="item in activityOptions"></el-option>
|
v-model="pageForm.activityId">
|
||||||
|
<el-option :label="item.title" :value="item.id" :key="item.id"
|
||||||
|
v-for="item in activityOptions"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</search-item>
|
</search-item>
|
||||||
<search-item label="姓名/工号">
|
<search-item label="姓名/工号">
|
||||||
@@ -36,12 +38,12 @@ layout("/layouts/platform.html"){
|
|||||||
</search-item>
|
</search-item>
|
||||||
<search-item label="答题日期">
|
<search-item label="答题日期">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@change="doSearch"
|
@change="doSearch"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
v-model="pageForm.attemptDate"
|
v-model="pageForm.attemptDate"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
placeholder="选择答题日期"
|
placeholder="选择答题日期"
|
||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</search-item>
|
</search-item>
|
||||||
</search>
|
</search>
|
||||||
@@ -49,7 +51,8 @@ layout("/layouts/platform.html"){
|
|||||||
|
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<table-tool>
|
<table-tool>
|
||||||
<el-button @click="exportXlsx" icon="el-icon-download" size="small" type="primary" class="mr5">导出xlsx</el-button>
|
<el-button @click="exportXlsx" icon="el-icon-download" size="small" type="primary" class="mr5">导出xlsx
|
||||||
|
</el-button>
|
||||||
</table-tool>
|
</table-tool>
|
||||||
<el-table :data="tableData" ref="tableRef" @sort-change="pageOrder">
|
<el-table :data="tableData" ref="tableRef" @sort-change="pageOrder">
|
||||||
<el-table-column label="序号" width="50" type="index" :index="indexMethod"></el-table-column>
|
<el-table-column label="序号" width="50" type="index" :index="indexMethod"></el-table-column>
|
||||||
@@ -59,7 +62,11 @@ layout("/layouts/platform.html"){
|
|||||||
<el-table-column label="单位" prop="unitName" sortable></el-table-column>
|
<el-table-column label="单位" prop="unitName" sortable></el-table-column>
|
||||||
<el-table-column label="分工会" prop="unionName" sortable></el-table-column>
|
<el-table-column label="分工会" prop="unionName" sortable></el-table-column>
|
||||||
<el-table-column label="联系方式" prop="mobile" sortable></el-table-column>
|
<el-table-column label="联系方式" prop="mobile" sortable></el-table-column>
|
||||||
<el-table-column label="答题日期" prop="attemptDate" sortable></el-table-column>
|
<el-table-column label="答题日期" prop="attemptDate" sortable>
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
{{$moment(row.attemptDate).format("YYYY-MM-DD")}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="得分" prop="totalScore" sortable></el-table-column>
|
<el-table-column label="得分" prop="totalScore" sortable></el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!--#include("/layouts/pagination.html"){}#-->
|
<!--#include("/layouts/pagination.html"){}#-->
|
||||||
@@ -79,7 +86,7 @@ layout("/layouts/platform.html"){
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
listActivity() {
|
listActivity() {
|
||||||
this.$axios.post("/platform/qsv/quizRank/listQuiz", { year: this.pageForm.year }).then((res) => {
|
this.$axios.post("/platform/qsv/quizRank/listQuiz", {year: this.pageForm.year}).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.activityOptions = res.data
|
this.activityOptions = res.data
|
||||||
if (this.activityOptions.length > 0) {
|
if (this.activityOptions.length > 0) {
|
||||||
|
|||||||
@@ -76,7 +76,8 @@ layout("/layouts/platform_h5.html"){
|
|||||||
<div class="container" :style="{'padding-bottom': answerRecord.isFinish ? 0 : '84px'}">
|
<div class="container" :style="{'padding-bottom': answerRecord.isFinish ? 0 : '84px'}">
|
||||||
<van-sticky offset-top="46px">
|
<van-sticky offset-top="46px">
|
||||||
<!--开启计时 未完成 活动未结束-->
|
<!--开启计时 未完成 活动未结束-->
|
||||||
<div class="timer" v-if="activity.timeLimit > 0 && !answerRecord.isFinish && !isEnd">⏰{{ remainingTime }}s</div>
|
<div class="timer" v-if="activity.timeLimit > 0 && !answerRecord.isFinish && !isEnd">⏰{{ remainingTime }}s
|
||||||
|
</div>
|
||||||
<h2 class="title">{{ activity.title }}</h2>
|
<h2 class="title">{{ activity.title }}</h2>
|
||||||
</van-sticky>
|
</van-sticky>
|
||||||
|
|
||||||
@@ -92,19 +93,19 @@ layout("/layouts/platform_h5.html"){
|
|||||||
<van-checkbox-group v-model="subject.userSelectOptionIds" :ref="'subject'+subject.id">
|
<van-checkbox-group v-model="subject.userSelectOptionIds" :ref="'subject'+subject.id">
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
<van-cell
|
<van-cell
|
||||||
v-for="(option,index) in subject.options"
|
v-for="(option,index) in subject.options"
|
||||||
clickable
|
clickable
|
||||||
:key="option.id"
|
:key="option.id"
|
||||||
:title="option.text"
|
:title="option.text"
|
||||||
@click="cellToggle(subject,option.id)"
|
@click="cellToggle(subject,option.id)"
|
||||||
>
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<van-checkbox
|
<van-checkbox
|
||||||
:name="option.id"
|
:name="option.id"
|
||||||
:ref="'option'+option.id"
|
:ref="'option'+option.id"
|
||||||
:disabled="answerRecord.isFinish"
|
:disabled="answerRecord.isFinish"
|
||||||
:shape="subject.type==='checkbox' ? 'square' : 'round'"
|
:shape="subject.type==='checkbox' ? 'square' : 'round'"
|
||||||
style="margin-right: 10px"
|
style="margin-right: 10px"
|
||||||
></van-checkbox>
|
></van-checkbox>
|
||||||
</template>
|
</template>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
@@ -112,7 +113,8 @@ layout("/layouts/platform_h5.html"){
|
|||||||
</van-checkbox-group>
|
</van-checkbox-group>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-control" v-if="!answerRecord.isFinish">
|
<div class="button-control" v-if="!answerRecord.isFinish">
|
||||||
<van-button type="primary" @click="onSubmit" block :disabled="isEnd">{{isEnd ? '已结束' : '提交'}}</van-button>
|
<van-button type="primary" @click="onSubmit" block :disabled="isEnd">{{isEnd ? '已结束' : '提交'}}
|
||||||
|
</van-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -157,13 +159,12 @@ layout("/layouts/platform_h5.html"){
|
|||||||
methods: {
|
methods: {
|
||||||
//获取活动、题目
|
//获取活动、题目
|
||||||
listSubjects() {
|
listSubjects() {
|
||||||
this.$axios.post("/platform/h5/qsv/quiz/subjects", { activityId: this.id }).then((res) => {
|
this.$axios.post("/platform/h5/qsv/quiz/subjects", {activityId: this.id}).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.activity = res.data.activity
|
this.activity = res.data.activity
|
||||||
this.subjects = res.data.subjects
|
this.subjects = res.data.subjects
|
||||||
this.answerRecordId = res.data.answerRecordId
|
this.answerRecordId = res.data.answerRecordId
|
||||||
debugger
|
if (!this.H5JumpTo && this.activity.repeatable && res.data.repeatTips) {
|
||||||
if (!this.H5JumpTo && this.activity.repeatable && res.data.repeatTips){
|
|
||||||
// 如果是可重复答题,第二次答题进来弹出提示
|
// 如果是可重复答题,第二次答题进来弹出提示
|
||||||
vant.Dialog.confirm({
|
vant.Dialog.confirm({
|
||||||
title: '温馨提示',
|
title: '温馨提示',
|
||||||
@@ -185,14 +186,13 @@ layout("/layouts/platform_h5.html"){
|
|||||||
|
|
||||||
//获取回答记录
|
//获取回答记录
|
||||||
getAnswerRecord() {
|
getAnswerRecord() {
|
||||||
this.$axios.post("/platform/h5/qsv/quiz/answerRecord", { answerRecordId: this.answerRecordId }).then((res) => {
|
this.$axios.post("/platform/h5/qsv/quiz/answerRecord", {answerRecordId: this.answerRecordId}).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.answerRecord = res.data
|
this.answerRecord = res.data
|
||||||
|
|
||||||
if (this.answerRecord.isFinish || this.$moment().unix() > this.$moment(this.activity.endTime)) {
|
if (this.answerRecord.isFinish || this.$moment().unix() > this.$moment(this.activity.endTime)) {
|
||||||
this.$pjaxReplace("/platform/h5/qsv/quiz/result?answerRecordId=" + this.answerRecordId)
|
this.$pjaxReplace("/platform/h5/qsv/quiz/result?answerRecordId=" + this.answerRecordId)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.initAnswer()
|
this.initAnswer()
|
||||||
this.checkTimer()
|
this.checkTimer()
|
||||||
}
|
}
|
||||||
@@ -250,35 +250,10 @@ layout("/layouts/platform_h5.html"){
|
|||||||
startInterval()
|
startInterval()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (this.activity.timeLimit > 0 && !this.isEnd) {
|
|
||||||
// if (!this.answerRecord.isFinish) {
|
|
||||||
// this.$dialog
|
|
||||||
// .alert({
|
|
||||||
// title: "提示",
|
|
||||||
// message: "本次答题时间" + this.activity.timeLimit + "分钟,点击确认开始答题"
|
|
||||||
// })
|
|
||||||
// .then(() => {
|
|
||||||
// this.remainingTime = this.activity.timeLimit * 60
|
|
||||||
// this.timerInterval = setInterval(() => {
|
|
||||||
// if (this.remainingTime > 0) {
|
|
||||||
// this.remainingTime--
|
|
||||||
// } else {
|
|
||||||
// clearInterval(this.timerInterval)
|
|
||||||
// const loading = this.$toast.loading({
|
|
||||||
// message: "答题时间到,自动提交中",
|
|
||||||
// forbidClick: true
|
|
||||||
// })
|
|
||||||
// this.autoSubmit(loading)
|
|
||||||
// }
|
|
||||||
// }, 1000)
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
|
|
||||||
historyScore() {
|
historyScore() {
|
||||||
this.$axios.post("/platform/h5/qsv/quiz/historyScore", { activityId: this.activityId }).then((res) => {
|
this.$axios.post("/platform/h5/qsv/quiz/historyScore", {activityId: this.activityId}).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.historyScores = res.data
|
this.historyScores = res.data
|
||||||
}
|
}
|
||||||
@@ -323,52 +298,42 @@ layout("/layouts/platform_h5.html"){
|
|||||||
|
|
||||||
//自动提交
|
//自动提交
|
||||||
autoSubmit(loading = null) {
|
autoSubmit(loading = null) {
|
||||||
this.$axios
|
vant.Dialog.confirm({
|
||||||
.post("/platform/h5/qsv/quiz/submitAnswer", {
|
title: '温馨提示',
|
||||||
answer: JSON.stringify({
|
message: '您确定要提交当前题目吗?',
|
||||||
activityId: this.id,
|
}).then(() => {
|
||||||
answerRecordId: this.answerRecordId,
|
this.$axios
|
||||||
subjects: this.subjects.map((subject) => {
|
.post("/platform/h5/qsv/quiz/submitAnswer", {
|
||||||
return {
|
answer: JSON.stringify({
|
||||||
id: subject.id,
|
activityId: this.id,
|
||||||
userSelectOptionIds: ["checkbox", "radio"].includes(subject.type) ? subject.userSelectOptionIds : []
|
answerRecordId: this.answerRecordId,
|
||||||
}
|
subjects: this.subjects.map((subject) => {
|
||||||
}),
|
return {
|
||||||
answerTime: this.answerTime
|
id: subject.id,
|
||||||
|
userSelectOptionIds: ["checkbox", "radio"].includes(subject.type) ? subject.userSelectOptionIds : []
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
answerTime: this.answerTime
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
.then((res) => {
|
||||||
.then((res) => {
|
if (res.code === 0) {
|
||||||
if (res.code === 0) {
|
this.$toast.success(res.msg)
|
||||||
this.$toast.success(res.msg)
|
this.$pjaxReplace("/platform/h5/qsv/quiz/result?answerRecordId=" + this.answerRecordId)
|
||||||
this.$pjaxReplace("/platform/h5/qsv/quiz/result?answerRecordId=" + this.answerRecordId)
|
// this.getAnswerRecord()
|
||||||
// this.getAnswerRecord()
|
}
|
||||||
}
|
})
|
||||||
})
|
.finally(() => {
|
||||||
.finally(() => {
|
if (loading) {
|
||||||
if (loading) {
|
loading.clear()
|
||||||
loading.clear()
|
}
|
||||||
}
|
})
|
||||||
})
|
}).catch(() => {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async checkGroupPermission() {
|
|
||||||
const groupId = this.activity.groupId
|
|
||||||
if (groupId) {
|
|
||||||
const { code, data } = await this.$axios.post("/open/common/checkGroupPermission", { groupId })
|
|
||||||
if (code === 0) {
|
|
||||||
if (!data) {
|
|
||||||
this.$dialog
|
|
||||||
.alert({
|
|
||||||
title: "提示",
|
|
||||||
message: "您没有权限参与"
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
location.back()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
if (this.timerInterval) {
|
if (this.timerInterval) {
|
||||||
|
|||||||
@@ -281,7 +281,6 @@ layout("/layouts/platform_h5.html"){
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
pjaxReplace('/platform/h5/qsv/quiz?id=' + this.activity.id + "&H5JumpTo=true")
|
pjaxReplace('/platform/h5/qsv/quiz?id=' + this.activity.id + "&H5JumpTo=true")
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
// on cancel
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getAnswerResult() {
|
getAnswerResult() {
|
||||||
|
|||||||
Reference in New Issue
Block a user