|
@@ -14,24 +14,42 @@
|
|
|
@click="changeCourse"
|
|
|
>切换科目</el-button
|
|
|
>
|
|
|
-
|
|
|
- <el-button v-if="
|
|
|
- goodsData.applyStatus === 1 &&
|
|
|
- !(
|
|
|
- sysTime <= goodsData.serviceStartTime ||
|
|
|
- sysTime >= goodsData.serviceEndTime ||
|
|
|
- (goodsData.classStartTime &&
|
|
|
- sysTime <= goodsData.classStartTime) ||
|
|
|
- (goodsData.classEndTime && sysTime >= goodsData.classEndTime) ||
|
|
|
- goodsData.learningStatus == 2 ||
|
|
|
- goodsData.classStatus == 0 ||
|
|
|
- (goodsData.learningStatus == 3 &&
|
|
|
- sysTime < goodsData.learningTimeStart) || !goodsData.examApplyGoodsList.length
|
|
|
- )
|
|
|
- " size="mini" type="warning" plain style="margin-left: 14px" @click="changeTest()">预约考试
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ v-if="
|
|
|
+ goodsData.applyStatus === 1 &&
|
|
|
+ !(
|
|
|
+ sysTime <= goodsData.serviceStartTime ||
|
|
|
+ sysTime >= goodsData.serviceEndTime ||
|
|
|
+ (goodsData.classStartTime &&
|
|
|
+ sysTime <= goodsData.classStartTime) ||
|
|
|
+ (goodsData.classEndTime && sysTime >= goodsData.classEndTime) ||
|
|
|
+ goodsData.learningStatus == 2 ||
|
|
|
+ goodsData.classStatus == 0 ||
|
|
|
+ (goodsData.learningStatus == 3 &&
|
|
|
+ sysTime < goodsData.learningTimeStart) ||
|
|
|
+ !goodsData.examApplyGoodsList.length
|
|
|
+ )
|
|
|
+ "
|
|
|
+ size="mini"
|
|
|
+ type="warning"
|
|
|
+ plain
|
|
|
+ style="margin-left: 14px"
|
|
|
+ @click="changeTest()"
|
|
|
+ >预约考试
|
|
|
</el-button>
|
|
|
</h4>
|
|
|
- <div v-for="(item, index) in courseList" :key="index">
|
|
|
+ <div style="margin: 14px 0px">
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ v-for="(item, index) in subjectList"
|
|
|
+ :type="newActiveSubjectId === item.id ? 'primary' : ''"
|
|
|
+ :key="index"
|
|
|
+ @click="newActiveSubjectId = item.id"
|
|
|
+ >{{ item.name }}</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <div v-for="(item, index) in filterList(courseList)" :key="index">
|
|
|
<p class="firstTop hoverStyle" @click="changeStatus(item)">
|
|
|
<span class="iconStyle">课</span
|
|
|
><span class="titles">{{ item.courseName }}</span
|
|
@@ -517,7 +535,10 @@
|
|
|
></RebuildModal>
|
|
|
|
|
|
<!-- 预约考试弹窗 -->
|
|
|
- <appoint-test :appointModal.sync="appointModal" :appointItem='goodsData'></appoint-test>
|
|
|
+ <appoint-test
|
|
|
+ :appointModal.sync="appointModal"
|
|
|
+ :appointItem="goodsData"
|
|
|
+ ></appoint-test>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -525,7 +546,7 @@
|
|
|
import { mapGetters, mapActions } from "vuex";
|
|
|
import courseData from "./courseData.vue";
|
|
|
import RebuildModal from "@/components/rebuildModal";
|
|
|
-import AppointTest from './components/AppointTest.vue'
|
|
|
+import AppointTest from "./components/AppointTest.vue";
|
|
|
export default {
|
|
|
name: "MyCourse",
|
|
|
components: { courseData, RebuildModal, AppointTest },
|
|
@@ -540,10 +561,26 @@ export default {
|
|
|
confirmTimer: null,
|
|
|
confirmLoading: false,
|
|
|
appointModal: false, // 预约考试弹窗
|
|
|
+ subjectList: [], //当前商品课程科目汇总
|
|
|
+ newActiveSubjectId: "", //当前选中ID
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters(["userInfo"]),
|
|
|
+ filterList:function(){
|
|
|
+ return function(item){
|
|
|
+ console.log(this.newActiveSubjectId)
|
|
|
+ let array = []
|
|
|
+ if(this.newActiveSubjectId){
|
|
|
+ array = item.filter(items => {
|
|
|
+ return items.subjectId === this.newActiveSubjectId
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ return item
|
|
|
+ }
|
|
|
+ return array
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getRecord();
|
|
@@ -570,16 +607,23 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
changeCourse() {
|
|
|
- console.log('this.goodsData', this.goodsData)
|
|
|
+ console.log("this.goodsData", this.goodsData);
|
|
|
this.$refs.courseData.openBoxs(this.goodsData);
|
|
|
},
|
|
|
changeTest() {
|
|
|
- this.appointModal = true
|
|
|
+ this.appointModal = true;
|
|
|
},
|
|
|
backData(item) {
|
|
|
this.goodsData = item;
|
|
|
this.getGoodsCourseList(item);
|
|
|
},
|
|
|
+ //数组对象去重
|
|
|
+ uniqueFunc(arr, uniId) {
|
|
|
+ const res = new Map();
|
|
|
+ return arr.filter(
|
|
|
+ (item) => !res.has(item[uniId]) && res.set(item[uniId], 1)
|
|
|
+ );
|
|
|
+ },
|
|
|
/**
|
|
|
* 获取课程列表
|
|
|
*/
|
|
@@ -591,11 +635,23 @@ export default {
|
|
|
gradeId: item.gradeId,
|
|
|
})
|
|
|
.then((res) => {
|
|
|
+ var array = [];
|
|
|
res.rows.forEach((element) => {
|
|
|
element.showStatus = false;
|
|
|
element.children = [];
|
|
|
+ array.push({
|
|
|
+ id: element.subjectId,
|
|
|
+ name: element.subjectName,
|
|
|
+ });
|
|
|
});
|
|
|
this.courseList = res.rows;
|
|
|
+ array = this.uniqueFunc(array, "id");
|
|
|
+ array.unshift({
|
|
|
+ id: "",
|
|
|
+ name: "全部",
|
|
|
+ });
|
|
|
+ this.subjectList = array;
|
|
|
+ this.newActiveSubjectId = "";
|
|
|
resolve();
|
|
|
// if (res.rows && res.rows.length > 0) {
|
|
|
// this.getRecord(res.rows[0]);
|