guhongwei 2 năm trước cách đây
mục cha
commit
e9789b737a
2 tập tin đã thay đổi với 23 bổ sung10 xóa
  1. 4 1
      src/views/app/videos/add.vue
  2. 19 9
      src/views/app/videos/index.vue

+ 4 - 1
src/views/app/videos/add.vue

@@ -22,6 +22,9 @@
             <template #head_actor>
               <el-option v-for="i in actorList" :key="i._id" :label="i.title" :value="i._id"></el-option>
             </template>
+            <template #actor>
+              <el-option v-for="i in actorList" :key="i._id" :label="i.title" :value="i._id"></el-option>
+            </template>
             <template #img_url="{ item }">
               <c-upload v-model="form[item.model]" url="/files/projectadmin/imgurl/upload" accept="" listType="text" :limit="1"></c-upload>
             </template>
@@ -63,7 +66,7 @@ export default {
         { label: '产地', model: 'place_id', type: 'select' },
         { label: '年份', model: 'year', type: 'select' },
         { label: '领衔演员', model: 'head_actor', type: 'select' },
-        { label: '演员', model: 'actor' },
+        { label: '演员', model: 'actor', type: 'selectMany' },
         { label: '封面', model: 'img_url', custom: true },
         { label: '视频路径', model: 'video_url', custom: true },
         // { label: '观看次数', model: 'view_num', type: 'number' },

+ 19 - 9
src/views/app/videos/index.vue

@@ -54,7 +54,20 @@ export default {
           },
           isSearch: true,
         },
-        { label: '演员', model: 'actor' },
+        {
+          label: '演员',
+          model: 'actor',
+          format: (i) => {
+            let r = [];
+            for (const val of i) {
+              let data = this.actorList.find((r) => r._id == val);
+              if (data) {
+                r.push(data.title);
+              }
+            }
+            if (r.length > 0) return r.join(',');
+          },
+        },
         { label: '来源', model: 'origin' },
         { label: '时长', model: 'time_num' },
         {
@@ -142,15 +155,12 @@ export default {
         this.$set(this, `isnoList`, res.data);
       }
       // 领衔演员
-      res = await this.scQuery({ is_use: '0' });
+      res = await this.scQuery({ is_use: '0', title: '演员' });
       if (this.$checkRes(res)) {
-        for (const val of res.data) {
-          let arr;
-          let type = '';
-          if (val.title == '演员') type = 'actor';
-          arr = await this.scdQuery({ is_use: '0', type_id: val._id });
-          if (this.$checkRes(arr)) {
-            this.$set(this, `${type}List`, arr.data);
+        if (res.total > 0) {
+          res = await this.scdQuery({ is_use: '0', type_id: res.data[0]._id });
+          if (this.$checkRes(res)) {
+            this.$set(this, `actorList`, res.data);
           }
         }
       }