2022-03-03 15:51:14 +08:00
|
|
|
<template>
|
2022-03-03 17:47:28 +08:00
|
|
|
<div class="content">
|
|
|
|
<!-- 头部 -->
|
|
|
|
<div :class="{ header: true, 'scroll white': isScrollTop, white: true }">
|
|
|
|
<div class="back" @click="$router.go(-1)">
|
|
|
|
<img src="../../../assets/images/home/expert/back.png" alt="" />
|
|
|
|
</div>
|
2022-03-10 17:35:06 +08:00
|
|
|
<div class="header-title">{{title}}</div>
|
2022-03-03 17:47:28 +08:00
|
|
|
</div>
|
|
|
|
<div class="question pull-content list-section">
|
|
|
|
<div class="question-item">
|
|
|
|
<div class="number">
|
|
|
|
<span>{{ num + 1 }}</span
|
|
|
|
><em>/</em>{{ lastquestions.total }}
|
|
|
|
</div>
|
|
|
|
<h3 v-if="state == 'student'">
|
|
|
|
{{ lastquestions.list[num].question.content_student }}
|
|
|
|
</h3>
|
|
|
|
<h3 v-if="state == 'parents'">
|
|
|
|
{{ lastquestions.list[num].question.content_parents }}
|
|
|
|
</h3>
|
|
|
|
<div class="question-btns">
|
2022-03-18 20:35:34 +08:00
|
|
|
<span :class="{'active':cur==item.key}"
|
2022-03-03 17:47:28 +08:00
|
|
|
v-for="(item, index) in optionsData"
|
|
|
|
:key="index"
|
|
|
|
@click="setQuestionEV(item.key)"
|
|
|
|
>{{ item.name }}</span
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-03-03 15:51:14 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-03-03 17:47:28 +08:00
|
|
|
export default {
|
|
|
|
name: "evaluation-question",
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isScrollTop: false,
|
|
|
|
lastquestions: [],
|
2022-03-04 20:25:37 +08:00
|
|
|
stateBtn: true,
|
2022-03-03 17:47:28 +08:00
|
|
|
num: 0,
|
|
|
|
optionsData: [],
|
2022-03-10 17:35:06 +08:00
|
|
|
title: '',
|
2022-03-18 20:35:34 +08:00
|
|
|
state:'',
|
|
|
|
cur: ''
|
2022-03-03 17:47:28 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.isScroll = true;
|
|
|
|
window.addEventListener("scroll", this.eventScrollTop);
|
2022-03-10 17:35:06 +08:00
|
|
|
this.title = (JSON.parse(localStorage.getItem("evaluationTitle")));
|
2022-03-03 17:47:28 +08:00
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.getLastquestions();
|
2022-03-10 17:35:06 +08:00
|
|
|
this.getQuestionAnswerOptions();
|
|
|
|
this.state = this.$route.query.state;
|
2022-03-03 17:47:28 +08:00
|
|
|
},
|
|
|
|
computed: {},
|
|
|
|
methods: {
|
|
|
|
// 题目
|
|
|
|
getLastquestions() {
|
|
|
|
let that = this;
|
|
|
|
this.axios
|
|
|
|
.post(this.HOME + "/api/evaluation/get-last-questions", {
|
|
|
|
role_type: this.$route.query.state,
|
|
|
|
})
|
|
|
|
.then(function (res) {
|
|
|
|
that.lastquestions = res.data.data;
|
2022-03-18 20:35:34 +08:00
|
|
|
console.log(that.lastquestions,'试题数据')
|
2022-03-03 17:47:28 +08:00
|
|
|
});
|
|
|
|
},
|
2022-03-10 17:35:06 +08:00
|
|
|
// 选项
|
2022-03-03 17:47:28 +08:00
|
|
|
getQuestionAnswerOptions() {
|
|
|
|
let that = this;
|
|
|
|
this.axios
|
|
|
|
.post(this.HOME + "/api/evaluation/question-answer-options")
|
|
|
|
.then(function (res) {
|
|
|
|
that.optionsData = res.data.data;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
// 滚动改变样式
|
|
|
|
eventScrollTop() {
|
|
|
|
let scrollTop =
|
|
|
|
document.body.scrollTop || document.documentElement.scrollTop;
|
|
|
|
if (scrollTop >= 5) {
|
|
|
|
if (this.isScroll) {
|
|
|
|
this.isScroll = false;
|
|
|
|
this.isScrollTop = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!this.isScroll) {
|
|
|
|
this.isScroll = true;
|
|
|
|
this.isScrollTop = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2022-03-18 20:35:34 +08:00
|
|
|
|
2022-03-03 17:47:28 +08:00
|
|
|
setQuestionEV(key) {
|
|
|
|
let that = this;
|
2022-03-18 20:35:34 +08:00
|
|
|
that.cur = key;
|
2022-03-04 20:25:37 +08:00
|
|
|
if (this.stateBtn) {
|
|
|
|
this.stateBtn = false;
|
|
|
|
this.axios
|
|
|
|
.post(this.HOME + "/api/evaluation/answer-question", {
|
|
|
|
id: this.lastquestions.list[this.num].id,
|
|
|
|
option_key: key,
|
|
|
|
})
|
|
|
|
.then(function () {
|
2022-03-18 20:35:34 +08:00
|
|
|
that.num++;
|
2022-03-04 20:25:37 +08:00
|
|
|
that.stateBtn = true;
|
2022-03-18 20:35:34 +08:00
|
|
|
that.cur = '';
|
2022-03-04 20:25:37 +08:00
|
|
|
if (that.num >= 117) {
|
|
|
|
console.log(that.num);
|
2022-03-18 20:35:34 +08:00
|
|
|
that.$router.push({
|
|
|
|
path: "/report",
|
|
|
|
query: {
|
|
|
|
id: that.lastquestions.evaluation_id
|
|
|
|
},
|
|
|
|
});
|
2022-03-04 20:25:37 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2022-03-03 17:47:28 +08:00
|
|
|
},
|
|
|
|
destroyed() {
|
|
|
|
window.removeEventListener("scroll", this.eventScrollTop);
|
|
|
|
},
|
|
|
|
//keep-alive进入时触发
|
|
|
|
activated() {
|
|
|
|
this.isScroll = true;
|
|
|
|
window.addEventListener("scroll", this.eventScrollTop);
|
|
|
|
},
|
|
|
|
//keep-alive离开时触发
|
|
|
|
deactivated() {
|
|
|
|
window.removeEventListener("scroll", this.eventScrollTop);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2022-03-03 15:51:14 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
</style>
|