This commit is contained in:
@jyuhsin
2025-04-24 16:06:36 +08:00
parent e4ef2da1ae
commit fd3dda9bb2
25 changed files with 377 additions and 95 deletions
+4 -3
View File
@@ -223,10 +223,11 @@ layout("/mobile/platform.html"){
<template slot="loading">
<van-loading size="13" type="spinner"/>
</template>
<template slot="error">
<van-image src="/assets/mobile/img/commonActivity.png" class="middle_item_img"></van-image>
</template>
</van-image>
<van-image height="84" src="xxxxxx" v-else width="120">
<template slot="error">图片查询失败</template>
</van-image>
<van-image src="/assets/mobile/img/commonActivity.png" class="middle_item_img" v-else></van-image>
</div>
<div class="middle_item_text">
@@ -110,9 +110,20 @@ layout("/mobile/platform.html"){
if (path) {
pjaxReplace(path + "?id=" + item.id)
}
},
init() {
const queryId = GetQueryString('id')
const category = GetQueryString('category')
if(category) {
this.pageForm.category = category
}
if(queryId) {
this.pageForm.queryId = queryId
}
}
},
created() {
this.init()
this.onLoad()
}
})
@@ -11,8 +11,8 @@ layout("/mobile/platform.html"){
text-align: center;
padding: 20px;
background: #ffffff;
/*margin: 10px 0;*/
margin-bottom: 10px;
margin: 0 0 10px 0 !important;
/*margin-bottom: 10px;*/
color: var(--color-primary);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
@@ -80,7 +80,7 @@ layout("/mobile/platform.html"){
<h2 class="title">{{ activity.title }}</h2>
</van-sticky>
<div v-if="!answerRecord.isFinish">
<div style="margin-top: 50px" v-if="!answerRecord.isFinish">
<div v-for="(subject, index) in subjects" :key="index" class="subject">
<p>{{index+1}}、{{ subject.title }}</p>
<div class="tag">
@@ -125,6 +125,7 @@ layout("/mobile/platform.html"){
return {
list: [],
id: GetQueryString("id"),
H5JumpTo: GetQueryString("H5JumpTo"),
subjects: [],
activity: {},
// remainingTime: 0,
@@ -161,8 +162,30 @@ layout("/mobile/platform.html"){
this.activity = res.data.activity
this.subjects = res.data.subjects
this.answerRecordId = res.data.answerRecordId
this.checkGroupPermission()
this.getAnswerRecord()
// this.checkGroupPermission()
if (!this.H5JumpTo && this.activity.repeatable && res.data.repeatTips){
// 如果是可重复答题,第二次答题进来弹出提示
vant.Dialog.confirm({
title: '温馨提示',
message: '您已完成本次答题,是否要重新答题?',
confirmButtonText: '重新答题',
cancelButtonText: '查看答题记录',
}).then(() => {
this.getAnswerRecord()
}).catch(() => {
pjaxReplace("/platform/h5/qsv/quiz/result?answerRecordId=" + this.answerRecordId)
// pjaxReplace("/mobile/index")
});
} else {
this.getAnswerRecord()
}
} else {
vant.Dialog.alert({
title: '温馨提示',
message: res.msg,
}).then(() => {
pjaxReplace("/mobile/index")
})
}
})
},
@@ -174,7 +197,7 @@ layout("/mobile/platform.html"){
this.answerRecord = res.data
if (this.answerRecord.isFinish || this.$moment().unix() > this.$moment(this.activity.endTime)) {
this.$pjaxReplace("/platform/h5/qsv/quiz/result?answerRecordId=" + this.answerRecordId)
pjaxReplace("/platform/h5/qsv/quiz/result?answerRecordId=" + this.answerRecordId)
}
this.initAnswer()
@@ -307,8 +330,7 @@ layout("/mobile/platform.html"){
//自动提交
autoSubmit(loading = null) {
$
.post("/platform/h5/qsv/quiz/submitAnswer", {
$.post("/platform/h5/qsv/quiz/submitAnswer", {
answer: JSON.stringify({
activityId: this.id,
answerRecordId: this.answerRecordId,
@@ -324,35 +346,35 @@ layout("/mobile/platform.html"){
.then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.$pjaxReplace("/platform/h5/qsv/quiz/result?answerRecordId=" + this.answerRecordId)
pjaxReplace("/platform/h5/qsv/quiz/result?answerRecordId=" + this.answerRecordId)
// this.getAnswerRecord()
}
})
.finally(() => {
.always(() => {
if (loading) {
loading.clear()
}
})
},
async checkGroupPermission() {
const groupId = this.activity.groupId
if (groupId) {
const { code, data } = await $.post("/open/common/checkGroupPermission", { groupId })
if (code === 0) {
if (!data) {
this.$dialog
.alert({
title: "提示",
message: "您没有权限参与"
})
.then(() => {
location.back()
})
}
}
}
}
// async checkGroupPermission() {
// const groupId = this.activity.groupId
// if (groupId) {
// const { code, data } = await $.post("/open/common/checkGroupPermission", { groupId })
// if (code === 0) {
// if (!data) {
// this.$dialog
// .alert({
// title: "提示",
// message: "您没有权限参与"
// })
// .then(() => {
// location.back()
// })
// }
// }
// }
// }
},
created() {
if (this.timerInterval) {
@@ -10,6 +10,7 @@ layout("/mobile/platform.html"){
.container .title {
text-align: center;
padding: 20px;
margin: 0 !important;
background: #ffffff;
color: var(--color-primary);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
@@ -168,7 +169,7 @@ layout("/mobile/platform.html"){
</div>
</van-sticky>
<div>
<div style="margin-top: 50px">
<div v-for="(subject, index) in subjects" :key="index" class="subject">
<p>{{index+1}}、{{ subject.title }}</p>
<div class="tag">
@@ -208,11 +209,14 @@ layout("/mobile/platform.html"){
</div>
<div class="button-control">
<van-button v-if="canAgainQuestion" type="primary" @click="againQuestion" block>重新答题</van-button>
<!-- 女性知识答题 -->
<van-button v-if="activity.id === 'c3372eb3ee774e86b373fcacf8eb89c7'" type="primary" @click="goWelfareChoose" block>纪念品选择</van-button>
<van-button type="primary" @click="openHistory" block>查看全部答题记录</van-button>
</div>
</div>
<van-action-sheet v-model="historyShow" title="历史记录">
<van-action-sheet v-model="historyShow" title="历史记录" >
<div class="history-list">
<div v-for="item in historyList" class="history-item">
<div class="history-header">
@@ -239,7 +243,9 @@ layout("/mobile/platform.html"){
activity: {},
list: [],
historyShow: false,
historyList: []
historyList: [],
canAgainQuestion: false
}
},
computed: {
@@ -268,12 +274,44 @@ layout("/mobile/platform.html"){
}
},
methods: {
/**
* 福利选择
*/
goWelfareChoose(){
// 女性答题的福利
pjaxReplace('/mobile/welfare/list/receive?projectId=8799d66b0bb640078f50feb029e506ed')
},
/**
* 重新答题
*/
againQuestion() {
vant.Dialog.confirm({
title: '温馨提示',
message: '确定要重新答题吗?',
}).then(() => {
pjaxReplace('/platform/h5/qsv/quiz?id=' + this.activity.id + "&H5JumpTo=true")
}).catch(() => {
// on cancel
});
},
getAnswerResult() {
$.post("/platform/h5/qsv/quiz/answerResult", { answerRecordId: this.answerRecordId }).then((res) => {
if (res.code === 0) {
this.subjects = res.data.subjects
this.activity = res.data.activity
this.getAnswerRecord()
if (this.activity.id === 'c3372eb3ee774e86b373fcacf8eb89c7') {
vant.Dialog.alert({
title: '温馨提示',
message: "感谢您参与女性健康知识竞赛。请选取活动纪念品",
}).then(() => {
this.getAnswerRecord()
this.getHistoryQuestion()
})
} else {
this.getAnswerRecord()
this.getHistoryQuestion()
}
}
})
},
@@ -305,16 +343,19 @@ layout("/mobile/platform.html"){
}
})
},
historyBack() {
pjaxReplace('/platform/h5/qsv')
},
openHistory() {
this.historyShow = true
},
getHistoryQuestion() {
$.post("/platform/h5/qsv/quiz/historyScore", { activityId: this.activity.id }).then((res) => {
if (res.code === 0) {
this.historyList = res.data
if (this.activity.maxAttempts > res.data.length) {
this.canAgainQuestion = true
}
}
})
}
@@ -90,6 +90,16 @@ layout("/mobile/platform.html"){
max-width: 100%!important;
}
.desc {
background: #ffffff;
margin: 0 0 10px 0;
padding: 10px;
line-height: 22px;
}
.desc p{
margin: 0;
}
</style>
@@ -97,6 +107,7 @@ layout("/mobile/platform.html"){
<van-nav-bar title="问卷调查" left-arrow @click-left="pjaxReplace('/mobile/index')" placeholder fixed></van-nav-bar>
<div class="container" :style="{'padding-bottom': answerRecord.isFinish ? 0 : '84px'}">
<h2 class="title">{{ activity.title }}</h2>
<div class="desc" v-html="activity.description"></div>
<div v-if="!isFinished">
<div v-for="(subject, index) in subjects" :key="index" class="subject">
<p>{{index+1}}、{{ subject.title }}</p>