lex 2 роки тому
батько
коміт
55cb87d7d9

+ 12 - 4
src/teacher/video-class/class-content.tsx

@@ -39,7 +39,6 @@ export default defineComponent({
         videoContent: '',
         videoUrl: '',
         coverUrl: '',
-        relationType: 'RECOMMEND',
         relationList: [],
         posterUrl: '' // 视频封面图
       })
@@ -164,16 +163,25 @@ export default defineComponent({
               <ColField title="关联曲目或专辑">
                 <Field
                   modelValue={
-                    item.relationList.length > 0 ? this.getName(item) : ''
+                    item.relationList.length > 0 &&
+                    item.relationList[0].musicAlbumId
+                      ? this.getName(item)
+                      : ''
                   }
                   readonly
                   isLink
                   clickable={false}
                   clearable
-                  rightIcon={item.relationList.length > 0 ? 'clear' : ''}
+                  rightIcon={
+                    item.relationList.length > 0 &&
+                    item.relationList[0].musicAlbumId
+                      ? 'clear'
+                      : ''
+                  }
                   onClick-right-icon={(e: MouseEvent) => {
                     e.stopPropagation()
-                    item.relationList = []
+                    item.relationList[0].musicAlbumId = 0
+                    item.relationList[0].musicAlbumName = ''
                   }}
                   onClick={() => {
                     this.selectItem = item

+ 12 - 0
src/teacher/video-class/create-submit.tsx

@@ -29,6 +29,18 @@ export default defineComponent({
       }
     },
     lessonList() {
+      const lessonList = createState.lessonList || []
+      lessonList.forEach((item: any) => {
+        const relationList = item.relationList
+        const temp = [] as any
+        relationList.forEach((relation: any) => {
+          // 判断是否有选择专辑或曲目
+          if (relation.musicAlbumId) {
+            temp.push(relation)
+          }
+        })
+        item.relationList = temp
+      })
       return createState.lessonList || []
     },
     groupId() {

+ 0 - 1
src/teacher/video-class/create.tsx

@@ -75,7 +75,6 @@ export default defineComponent({
             videoContent: item.videoContent,
             videoUrl: item.videoUrl,
             coverUrl: item.coverUrl,
-            relationType: item.relationType,
             relationList,
             posterUrl: item.posterUrl // 视频封面图
           })

+ 0 - 1
src/teacher/video-class/createState.tsx

@@ -40,7 +40,6 @@ export const createState = reactive({
       videoContent: '',
       videoUrl: '',
       coverUrl: '',
-      relationType: 'RECOMMEND',
       relationList: [] as any,
       posterUrl: '' // 视频封面图
     }

+ 1 - 1
src/teacher/video-class/model/music-album/index.tsx

@@ -5,7 +5,7 @@ import { state } from '@/state'
 import MusicGrid from '@/views/music/component/music-grid'
 import Song from '@/views/music/component/song'
 import { Cell, List, Sticky, Tab, Tabs } from 'vant'
-import { defineComponent } from 'vue'
+import { defineComponent, PropType } from 'vue'
 import styles from './index.module.less'
 
 export default defineComponent({