Bläddra i källkod

运营管理 推荐管理 添加酷狗专栏 去除banner模块的上限

DESKTOP-2S67K1S\31396 2 år sedan
förälder
incheckning
f03d56af8a
1 ändrade filer med 111 tillägg och 44 borttagningar
  1. 111 44
      src/views/operation/recommend/index.vue

+ 111 - 44
src/views/operation/recommend/index.vue

@@ -55,7 +55,7 @@
                 v-hasPermi="['operation:recommend:down']">下架</el-button>
             </el-form-item>
           </el-form>
-          <el-button type="primary" style="margin-left: 30px" @click="getAdd"
+          <el-button type="primary" style="margin-left: 30px" @click="getAddTime"
             v-hasPermi="['operation:recommend:add']">新增</el-button>
         </div>
 
@@ -70,7 +70,7 @@
         <div v-else :style="{ 'display': tabIndex === 1 && active === 0 ? 'inline-block' : 'block' }">
           <el-form label-width="auto" v-for="(item, index) in list" :key="item.id">
             <el-form-item label-width="0" :label="(index + 1).toString()">
-              <el-link v-if="tabIndex === 2 && active === 1" icon="el-icon-close" :underline="false" style="float:right"
+              <el-link v-if="close()" icon="el-icon-close" :underline="false" style="float:right"
                 @click="getRemoveList(item, index)" />
             </el-form-item>
 
@@ -84,7 +84,7 @@
             </el-form-item>
 
             <el-form-item label="模式:" v-if="model()">
-              <el-select v-model="item.model" placeholder="请选择模式">
+              <el-select v-model="item.model" placeholder="请选择模式" @change="getModel(item)">
                 <el-option v-for="item in contentOptions" :key="item.value" :label="item.label"
                   :value="Number(item.value)" />
               </el-select>
@@ -97,6 +97,12 @@
               </el-select>
             </el-form-item>
 
+            <el-form-item label="专区页面:" v-if="item.forwardType === 7">
+              <el-select placeholder="请选择跳转专区">
+                <el-option v-for="item in locationOptions" :key="item.value" :value="item.value" :label="item.label" />
+              </el-select>
+            </el-form-item>
+
             <el-form-item label="内容:" v-if="contentName(item)">
               <el-input v-model="item.contentName" prefix-icon="el-icon-search" placeholder="选择内容"
                 @focus="getDialog(index)" />
@@ -121,7 +127,7 @@
               <Upload listType="picture-card" :url="item.pic" @upload="getUpload($event, index)" />
             </el-form-item>
 
-            <el-form-item label="排序:" v-if="tabIndex === 2 && active === 1">
+            <el-form-item label="排序:" v-if="sort()">
               <el-input-number v-model="item.sort" />
             </el-form-item>
 
@@ -153,7 +159,7 @@
                 v-hasPermi="['operation:recommend:down']">下架</el-button>
             </el-form-item>
           </el-form>
-          <el-button v-if="tabIndex === 2 && active === 1" type="primary" style="margin-left: 30px" @click="getAdd"
+          <el-button v-if="add()" type="primary" style="margin-left: 30px" @click="getAdd"
             v-hasPermi="['operation:recommend:add']">新增</el-button>
         </div>
       </div>
@@ -227,14 +233,10 @@ import {
   expandSave,
   removeList
 } from '@/api/operation/recommend'
-import Upload from '@/components/Upload/index'
 import { isFreeMixin, audioMixin, platformMixin, onOrOffMixin, coverMixin } from '@/mixin/index'
 
 export default {
   mixins: [isFreeMixin, audioMixin, platformMixin, onOrOffMixin, coverMixin],
-  components: {
-    Upload
-  },
   data() {
     return {
       // 遮罩层
@@ -254,7 +256,8 @@ export default {
         '2': require('@/assets/images/operation/music.svg'),
         '3': require('@/assets/images/operation/story.svg'),
         '4': require('@/assets/images/operation/kid.svg'),
-        '5': require('@/assets/images/operation/other.svg')
+        '5': require('@/assets/images/operation/other.svg'),
+        '27': require('@/assets/images/operation/kugou.png')
       },
       img: require('@/assets/images/operation/recommend.svg'),
       // 选中模块
@@ -327,6 +330,13 @@ export default {
           { top: 1885, height: 385 },
           { top: 2480, height: 390 },
           { top: 2875, height: 590 }
+        ],
+        '7': [
+          { top: 130, height: 160 },
+          { top: 375, height: 205 },
+          { top: 585, height: 205 },
+          { top: 800, height: 150 },
+          { top: 960, height: 300 }
         ]
       },
       active: 0,
@@ -367,9 +377,12 @@ export default {
         type: 8
       }, {
         value: 4,
-        label: 'APP内打开节目',
+        label: 'APP内容跳转节目',
         type: 6
       }, {
+        value: 7,
+        label: 'APP内容跳转专区'
+      }, {
         value: 5,
         label: 'H5内链'
       }, {
@@ -382,6 +395,17 @@ export default {
       }, {
         value: 1,
         label: '手动推荐内容'
+      }],
+      // 专区
+      locationOptions: [{
+        value: 0,
+        label: '运动专区'
+      }, {
+        value: 1,
+        label: '睡眠专区'
+      }, {
+        value: 2,
+        label: '儿童专区'
       }]
     }
   },
@@ -415,7 +439,7 @@ export default {
     handleClick(e) {
       this.activeTab = this.tabs[e.index].id.toString()
       this.tabIndex = this.tabs[e.index].tabIndex
-      e.index >= 5 ? e.index = 5 : e.index
+      e.index = e.index < 5 ? e.index : e.index == 27 ? 27 : 5
       this.img = this.imgOptions[e.index]
       this.active = 0
       this.list = []
@@ -538,9 +562,6 @@ export default {
         this.form.audioType = this.audioOptions[0].value
       } else {
         this.form.audioType = this.list[index].forwardType ? this.typeOptions.find(i => i.value === this.list[index].forwardType).type : 2
-        // await this.getPlatform({
-        //   audioType: this.form.audioType
-        // })
         this.disabled = this.tabIndex == 2 && this.active === 1 || this.list[index].forwardType !== null ? true : false
       }
       this.getContentList()
@@ -680,15 +701,16 @@ export default {
     },
 
     // 新增时间段
+    getAddTime() {
+      this.timeList.push({})
+    },
+
+    // 新增列表
     getAdd() {
-      if (this.tabIndex === 2 && this.active === 1) {
-        this.list.push({
-          moduleId: this.module[this.active].id,
-          childList: []
-        })
-      } else {
-        this.timeList.push({})
-      }
+      this.list.push({
+        moduleId: this.module[this.active].id,
+        childList: []
+      })
     },
 
     // 上下架 / 删除时间段
@@ -710,6 +732,11 @@ export default {
       }
     },
 
+    // 监听模式模块
+    getModel(item) {
+      item.isCustom = item.model === 0 ? 1 : 0
+    },
+
     // 字典翻译
     audioFormatter(row) {
       return this.selectDictLabel(this.audioOptions, row.audioType)
@@ -730,7 +757,8 @@ export default {
         '3': [2, 4, 6, 7, 8, 9].includes(this.active),
         '4': [2, 4, 6, 8, 9, 10, 11].includes(this.active),
         '5': [2, 4, 5, 6, 7].includes(this.active),
-        '6': [2, 3, 5, 7, 8, 9].includes(this.active)
+        '6': [2, 3, 5, 7, 8, 9].includes(this.active),
+        '7': ![0].includes(this.active)
       }
       return rules[this.tabIndex]
     },
@@ -738,11 +766,22 @@ export default {
     // 标签模块
     label() {
       let rules = {
-        '2': this.tabIndex === 2 && this.active === 2,
-        '3': this.tabIndex === 3 && this.active === 1,
-        '4': [1, 5].includes(this.active) && this.tabIndex === 4,
-        '5': [1, 3].includes(this.active) && this.tabIndex === 5,
-        '6': [1, 4].includes(this.active) && this.tabIndex === 6
+        '2': this.active === 2,
+        '3': this.active === 1,
+        '4': [1, 5].includes(this.active),
+        '5': [1, 3].includes(this.active),
+        '6': [1, 4].includes(this.active),
+      }
+      return rules[this.tabIndex]
+    },
+
+    // 删除按钮
+    close() {
+      let rules = {
+        '1': [1].includes(this.active),
+        '2': [0, 1].includes(this.active),
+        '3': [0].includes(this.active),
+        '7': ![3].includes(this.active)
       }
       return rules[this.tabIndex]
     },
@@ -752,10 +791,11 @@ export default {
       let rules = {
         '1': ![3, 8].includes(this.active),
         '2': [0, 3].includes(this.active),
-        '3': this.active !== 1,
-        '4': this.active !== 1 || this.active !== 5,
-        '5': this.active !== 1 || this.active !== 3,
-        '6': this.active !== 1 || this.active !== 4
+        '3': ![1].includes(this.active),
+        '4': ![1, 5].includes(this.active),
+        '5': ![1, 3].includes(this.active),
+        '6': ![1, 4].includes(this.active),
+        '7': [0, 1, 2, 3, 4].includes(this.active)
       }
       return rules[this.tabIndex]
     },
@@ -763,8 +803,8 @@ export default {
     // 标题
     title() {
       let rules = {
-        '1': this.active === 10,
-        '2': this.active === 1,
+        '1': [10].includes(this.active),
+        '2': [1].includes(this.active),
         '3': [3, 5, 9].includes(this.active),
         '4': [7].includes(this.active),
         '5': [5].includes(this.active)
@@ -780,7 +820,8 @@ export default {
         '3': [4, 7, 8].includes(this.active),
         '4': [2, 4, 6, 8, 9, 10, 11].includes(this.active),
         '5': [2, 4, 6, 7].includes(this.active),
-        '6': [2, 3, 5, 7, 8, 9].includes(this.active)
+        '6': [2, 3, 5, 7, 8, 9].includes(this.active),
+        '7': [4].includes(this.active)
       }
       return rules[this.tabIndex]
     },
@@ -793,7 +834,8 @@ export default {
         '3': [0].includes(this.active),
         '4': [0, 3].includes(this.active),
         '5': [0].includes(this.active),
-        '6': [0].includes(this.active)
+        '6': [0].includes(this.active),
+        '7': [0].includes(this.active)
       }
       return rules[this.tabIndex]
     },
@@ -805,7 +847,8 @@ export default {
         '3': [2, 3, 5, 6, 9].includes(this.active),
         '4': [7].includes(this.active),
         '5': [5].includes(this.active),
-        '6': [6].includes(this.active)
+        '6': [6].includes(this.active),
+        '7': ![0, 4].includes(this.active)
       }
       return rules[this.tabIndex] || [0, 1, 2, 3, 4].includes(item.forwardType) || item.model === 1
     },
@@ -813,11 +856,12 @@ export default {
     // 简介
     description(item) {
       let rules = {
-        '1': (this.active === 7 && item.model === 1) || this.active === 10,
-        '3': [3, 5].includes(this.active) || [4, 7, 8].includes(this.active) && item.model === 1,
-        '4': [7].includes(this.active)
+        '1': [7, 10].includes(this.active),
+        '3': [3, 4, 5, 7, 8].includes(this.active),
+        '4': [7].includes(this.active),
+        '7': [3].includes(this.active)
       }
-      return rules[this.tabIndex]
+      return rules[this.tabIndex] || item.model === 1
     },
 
     // 跳转连接
@@ -829,7 +873,7 @@ export default {
     isCustom(item) {
       let rules = {
         '1': [0, 8].includes(this.active),
-        '5': [5].includes(this.active),
+        '5': [5].includes(this.active)
       }
       return rules[this.tabIndex] || item.model === 1
     },
@@ -842,14 +886,37 @@ export default {
         '3': [0, 2, 3, 5, 6, 9].includes(this.active),
         '4': [0, 3, 7].includes(this.active),
         '5': [0, 5].includes(this.active),
-        '6': [0, 6].includes(this.active)
+        '6': [0, 6].includes(this.active),
+        '7': ![4].includes(this.active)
       }
       return rules[this.tabIndex] || item.isCustom === 0
     },
 
+    // 排序
+    sort() {
+      let rules = {
+        '1': [1].includes(this.active),
+        '2': [0, 1].includes(this.active),
+        '3': [0].includes(this.active),
+        '7': ![3].includes(this.active)
+      }
+      return rules[this.tabIndex]
+    },
+
     // 列表
     isList() {
       return this.tabIndex === 2 && this.active === 1
+    },
+
+    // 新增
+    add() {
+      let rules = {
+        '1': [1].includes(this.active),
+        '2': [0, 1].includes(this.active),
+        '3': [0].includes(this.active),
+        '7': ![3].includes(this.active)
+      }
+      return rules[this.tabIndex]
     }
   }
 }