Browse Source

更新逻辑判断

lex 2 years ago
parent
commit
888f02243b

+ 4 - 1
src/student/member-center/member-record.tsx

@@ -74,7 +74,10 @@ export default defineComponent({
         )
         this.loading = false
         const result = res.data || {}
-        this.userTrainOverView = result.userTrainOverView
+        // 在第一页的时候才处理数据显示
+        if (result.detail.pageNo === 1) {
+          this.userTrainOverView = result.userTrainOverView
+        }
         // 处理重复请求数据
         if (this.list.length > 0 && result.detail.pageNo === 1) {
           return

+ 6 - 8
src/student/teacher-dependent/components/practice.tsx

@@ -166,7 +166,7 @@ export default defineComponent({
     onSelectDay(obj: any) {
       const result = obj || []
       let list = [...this.selectCourseList] as any
-      // console.log(obj, list)
+
       result.forEach((item: any) => {
         const isExist = list.some(
           (course: any) => course.startTime === item.startTime
@@ -174,23 +174,21 @@ export default defineComponent({
         !isExist && list.push({ ...item })
       })
       // 去掉不在
+      let tempList: any[] = []
       list.forEach((item: any) => {
         const isExist = result.some(
           (course: any) => course.startTime === item.startTime
         )
-        const index = result.findIndex(
-          (course: any) => course.startTime === item.startTime
-        )
-        !isExist && list.splice(index, 1)
+        isExist && tempList.push(item)
       })
       // 对数组进行排序
-      list.sort((first: any, second: any) => {
+      tempList.sort((first: any, second: any) => {
         if (first.startTime > second.startTime) return 1
         if (first.startTime < second.startTime) return -1
         return 0
       })
-      // console.log(list, 'list')
-      this.selectCourseList = [...list] as any
+      console.log(tempList, 'list')
+      this.selectCourseList = [...tempList] as any
     },
     onCloseTag(item: any) {
       Dialog.confirm({

+ 0 - 5
src/teacher/live-class/create-components/arrange.tsx

@@ -77,7 +77,6 @@ export default defineComponent({
     onSelectDay(obj: any) {
       const result = obj || []
       let list = [...createState.selectCourseList]
-      console.log(obj, list)
       result.forEach((item: any) => {
         const isExist = list.some(
           (course: any) => course.startTime === item.startTime
@@ -90,10 +89,6 @@ export default defineComponent({
         const isExist = result.some(
           (course: any) => course.startTime === item.startTime
         )
-        // const index = result.findIndex(
-        //   (course: any) => course.startTime === item.startTime
-        // )
-        // !isExist && list.splice(index, 1)
         isExist && tempList.push(item)
       })
       // 对数组进行排序