|
@@ -22,7 +22,7 @@
|
|
|
<view class="ui-flex-1"></view>
|
|
|
</view>
|
|
|
<view style="background: #0000003b;">
|
|
|
- <u-tabs :list="courseList" :activeStyle="{
|
|
|
+ <u-tabs :list="viewCourseList" :activeStyle="{
|
|
|
color: '#fff',
|
|
|
fontWeight: 'bold',
|
|
|
transform: 'scale(1.2)'
|
|
@@ -36,14 +36,14 @@
|
|
|
<view class="ui-p">
|
|
|
<u-grid :col="6" :border="false" style="align-items: baseline;">
|
|
|
<u-grid-item @click="toActive(index,item)" v-for="(item, index) in list" :key="index" class="ui-p"
|
|
|
- v-if="course_id ? item.course_id == course_id : true"
|
|
|
+ v-if="course_id ? item.course_id == course_id : (course_name ? item.course_name == course_name : true)"
|
|
|
:bgColor="activeId == index ? '#ffffff42' : '#0000'"
|
|
|
:class="{
|
|
|
'no-select' : activeId >= 0 && activeId != index,
|
|
|
'item-active' : activeId == index
|
|
|
}">
|
|
|
<u--image :src="item.img" width="46px" height="46px"></u--image>
|
|
|
- <view class="ui-pt10">
|
|
|
+ <view class="ui-pt10 text-center">
|
|
|
<text class="grid-text txt-white f28">{{item.tab_name}}</text>
|
|
|
</view>
|
|
|
<!-- <u-badge v-if="activeId == index" absolute :offset="[0,10]" :value="score"></u-badge> -->
|
|
@@ -71,9 +71,6 @@
|
|
|
// 标签缓存
|
|
|
let tabList = {};
|
|
|
|
|
|
- import {
|
|
|
- getStudentTabs
|
|
|
- } from "@/common/api/studentTab.js"
|
|
|
export default {
|
|
|
props: {
|
|
|
stuList: {
|
|
@@ -94,6 +91,7 @@
|
|
|
score: 0, //加扣分分数
|
|
|
activeId: -1, //选中项
|
|
|
course_id : 0,
|
|
|
+ course_name : '',
|
|
|
itemTab: '',
|
|
|
courseList: [],
|
|
|
}
|
|
@@ -107,6 +105,35 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ computed : {
|
|
|
+ viewCourseList(){
|
|
|
+ let custom = [];
|
|
|
+ this.list.forEach(item => {
|
|
|
+ if(item.course_id == 0 && item.course_name){
|
|
|
+ if(!custom.includes(item.course_name)){
|
|
|
+ custom.push(item.course_name)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(custom)
|
|
|
+
|
|
|
+
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ id : 0,
|
|
|
+ name : '全部'
|
|
|
+ },
|
|
|
+ ...this.courseList,
|
|
|
+ ...custom.map(item => {
|
|
|
+ return {
|
|
|
+ id : 0,
|
|
|
+ name : item
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
change(e){
|
|
|
this.curIndex = e
|
|
@@ -114,7 +141,7 @@
|
|
|
},
|
|
|
changeCourse(item){
|
|
|
this.course_id = item.id;
|
|
|
- // this.getTipList();
|
|
|
+ this.course_name = item.name == '全部' ? '' : item.name;
|
|
|
},
|
|
|
getTipList() {
|
|
|
if(tabList[this.curIndex]){
|
|
@@ -134,45 +161,30 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- getStudentTabs() {
|
|
|
- this.$api.sendRequest({
|
|
|
- url: getStudentTabs,
|
|
|
- method: "post",
|
|
|
- data: {
|
|
|
- type: this.type
|
|
|
- },
|
|
|
- success: res => {
|
|
|
- console.log(res, "res");
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ getAllCourse(){
|
|
|
+ if(this.courseList.length){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$api.sendRequest({
|
|
|
+ url: '/mobile/systemBaseData/getAllCourse',
|
|
|
+ method: "post",
|
|
|
+ success: res => {
|
|
|
+ // console.log(res);
|
|
|
+ this.courseList = res.data.map(item => {
|
|
|
+ return {
|
|
|
+ name : item.course_name,
|
|
|
+ id : item.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 外部访问使用
|
|
|
open(title) {
|
|
|
this.title = title;
|
|
|
this.show = true;
|
|
|
this.getTipList();
|
|
|
-
|
|
|
- if(this.courseList.length == 0){
|
|
|
- this.$api.sendRequest({
|
|
|
- url: '/mobile/systemBaseData/getAllCourse',
|
|
|
- method: "post",
|
|
|
- success: res => {
|
|
|
- console.log(res);
|
|
|
- this.courseList = [
|
|
|
- {
|
|
|
- id : 0,
|
|
|
- name : '全部'
|
|
|
- },
|
|
|
- ...res.data.map(item => {
|
|
|
- return {
|
|
|
- name : item.course_name,
|
|
|
- id : item.id
|
|
|
- }
|
|
|
- })
|
|
|
- ]
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ this.getAllCourse();
|
|
|
},
|
|
|
toActive(index, item) {
|
|
|
// 是否旧的选中项
|