|
@@ -15,15 +15,24 @@
|
|
|
<div slot="default" class="contentItemDiv">
|
|
|
<div class="contentBox">
|
|
|
<div>
|
|
|
- <div class="contentItemTitle">{{ item.name || "期中考试" }}</div>
|
|
|
+ <div class="contentItemTitle">{{ item.examName }}</div>
|
|
|
<div class="contentItemDescription">
|
|
|
- <div>
|
|
|
- 考试时间:
|
|
|
- {{ formateDateTimeFun(item.startTime) || item.startTime }}
|
|
|
- </div>
|
|
|
+ 考试时间:
|
|
|
+ <span>{{
|
|
|
+ formateDateTimeFun(item.startTime) || item.startTime
|
|
|
+ }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="exam-point">{{ item.points }}</div>
|
|
|
+ <div
|
|
|
+ :class="{
|
|
|
+ 'exam-point': true,
|
|
|
+ 'exam-point-green': item.points >= 90,
|
|
|
+ 'exam-point-yellow': item.points >= 60 && item.points < 90,
|
|
|
+ 'exam-point-red': item.points < 60
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ {{ item.points }}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</van-cell>
|
|
@@ -38,14 +47,7 @@ export default {
|
|
|
components: {},
|
|
|
data() {
|
|
|
return {
|
|
|
- examHistoryList: [
|
|
|
- { name: "期中考试", time: "2021-02-10", score: "98" },
|
|
|
- { name: "期中考试", time: "2021-02-10", score: "98" },
|
|
|
- { name: "期中考试", time: "2021-02-10", score: "98" },
|
|
|
- { name: "期中考试", time: "2021-02-10", score: "98" },
|
|
|
- { name: "期中考试", time: "2021-02-10", score: "98" },
|
|
|
- { name: "期中考试", time: "2021-02-10", score: "98" }
|
|
|
- ],
|
|
|
+ examHistoryList: [],
|
|
|
loading: false,
|
|
|
finished: false
|
|
|
};
|
|
@@ -59,49 +61,49 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 查询:考试记录
|
|
|
getExamHistory() {
|
|
|
+ this.$store.commit("toggleLoading", true);
|
|
|
let params = {
|
|
|
user: this.user.userInfo.userName
|
|
|
};
|
|
|
this.$_http
|
|
|
.get(this.$_API.JTXT_GET_USER_EXAMS_HISTORY, { params })
|
|
|
.then(res => {
|
|
|
- this.examHistoryList = res.data;
|
|
|
- console.log(
|
|
|
- "--user-exam-history--" + JSON.stringify(this.examHistoryList)
|
|
|
- );
|
|
|
- this.finished = true;
|
|
|
+ res.data.forEach((item, index) => {
|
|
|
+ this.getExamDetailFun(item, index, index + 1 === res.data.length);
|
|
|
+ });
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.$store.commit("toggleLoading", false);
|
|
|
});
|
|
|
},
|
|
|
+ // 查询:某个考试的详情
|
|
|
+ getExamDetailFun(item, index, isLast) {
|
|
|
+ this.$_http
|
|
|
+ .get(
|
|
|
+ this.$pathParams(this.$_API.GET_JTXT_GET_EXAMS_ONE_DETAIL, {
|
|
|
+ examId: item.examId
|
|
|
+ })
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ this.examHistoryList.push({ ...item, examName: res.data.name });
|
|
|
+ if (isLast) {
|
|
|
+ this.finished = true;
|
|
|
+ this.$store.commit("toggleLoading", false);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$store.commit("toggleLoading", false);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 操作:返回
|
|
|
onClickLeft() {
|
|
|
this.$router.back();
|
|
|
},
|
|
|
onLoad() {},
|
|
|
chooseExam(index) {
|
|
|
console.log("---exam-index---" + index);
|
|
|
- },
|
|
|
- formateDateTimeFun(time) {
|
|
|
- // 获取当前日期
|
|
|
- let date = new Date(time);
|
|
|
- // 获取当前月份
|
|
|
- let nowMonth = date.getMonth() + 1;
|
|
|
- // 获取当前是几号
|
|
|
- let strDate = date.getDate();
|
|
|
- // 添加分隔符“-”
|
|
|
- let seperator = "-";
|
|
|
- // 对月份进行处理,1-9月在前面添加一个“0”
|
|
|
- if (nowMonth >= 1 && nowMonth <= 9) {
|
|
|
- nowMonth = "0" + nowMonth;
|
|
|
- }
|
|
|
- // 对月份进行处理,1-9号在前面添加一个“0”
|
|
|
- if (strDate >= 0 && strDate <= 9) {
|
|
|
- strDate = "0" + strDate;
|
|
|
- }
|
|
|
- // 最后拼接字符串,得到一个格式为(yyyy-MM-dd)的日期
|
|
|
- return date.getFullYear() + seperator + nowMonth + seperator + strDate;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -121,13 +123,25 @@ export default {
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
.contentItemDescription {
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
+ margin-top: 0.25rem;
|
|
|
+ color: #afafaf;
|
|
|
+ span {
|
|
|
+ margin-left: 0.5rem;
|
|
|
+ }
|
|
|
}
|
|
|
.exam-point {
|
|
|
font-size: 1rem;
|
|
|
font-weight: bold;
|
|
|
+ margin-top: 0.25rem;
|
|
|
+ }
|
|
|
+ .exam-point-green {
|
|
|
+ color: green;
|
|
|
+ }
|
|
|
+ .exam-point-yellow {
|
|
|
+ color: yellow;
|
|
|
+ }
|
|
|
+ .exam-point-red {
|
|
|
+ color: red;
|
|
|
}
|
|
|
}
|
|
|
}
|