Quellcode durchsuchen

feat: 播客专辑内能调整配置内容顺序

Damon vor 11 Monaten
Ursprung
Commit
8d6cb2a76c

+ 7 - 4
src/views/music/album/detail.vue

@@ -1,3 +1,4 @@
+<!-- 专辑专辑 详情 -->
 <template>
   <div class="app-container">
     <el-form
@@ -121,15 +122,17 @@
               <el-button
                 type="text"
                 icon="el-icon-caret-top"
-                @click="getChangeDetail(scope.row, scope.row.sort - 1)"
-                :disabled="disabled"
+                @click="getChangeSort(scope.$index, scope.$index - 1)"
+                :disabled="scope.$index <= 0"
               />
+
               <el-button
                 type="text"
                 icon="el-icon-caret-bottom"
-                @click="getChangeDetail(scope.row, scope.row.sort + 1)"
-                :disabled="disabled"
+                @click="getChangeSort(scope.$index, scope.$index + 1)"
+                :disabled="scope.$index > form.list.length - 2"
               />
+
             </template>
           </el-table-column>
         </el-table>

+ 28 - 4
src/views/music/blog/detail.vue

@@ -1,3 +1,4 @@
+<!-- 博客专辑 详情 -->
 <template>
   <div class="app-container">
     <el-form
@@ -153,14 +154,17 @@
               <el-button
                 type="text"
                 icon="el-icon-caret-top"
-                @click="getChangeDetail(scope.row, scope.row.sort - 1)"
-                :disabled="disabled"
+                @click="getChangeSort(scope.$index, scope.$index - 1)"
+                :disabled="scope.$index <= 0"
               />
+
               <el-button
                 type="text"
                 icon="el-icon-caret-bottom"
-                @click="getChangeDetail(scope.row, scope.row.sort + 1)"
-                :disabled="disabled"
+                @click="getChangeSort(scope.$index, scope.$index + 1)"
+                :disabled="
+                  scope.$index > form.adminPodCastProgramDetailResp.length - 2
+                "
               />
             </template>
           </el-table-column>
@@ -430,6 +434,26 @@ export default {
     }
   },
   methods: {
+    // 排序
+    getChangeSort(row, sort) {
+      const rowBean = this.form.adminPodCastProgramDetailResp[row];
+      const sortBean = this.form.adminPodCastProgramDetailResp[sort];
+      this.form.adminPodCastProgramDetailResp[row] = sortBean;
+      this.form.adminPodCastProgramDetailResp[sort] = rowBean;
+
+      this.form.podcastProgramIds = [];
+      this.form.adminPodCastProgramDetailResp.map((i) => {
+        this.form.podcastProgramIds.push(i.id);
+      });
+      submit(this.form).then((res) => {
+        if (res.code === 0) {
+          let title = "修改成功!";
+          this.$message.success(`${title}`);
+          this.getDetail();
+        }
+      });
+    },
+
     // 详情
     getDetail() {
       detail(this.form.id).then((res) => {

+ 1 - 1
src/views/operation/channel/detail.vue

@@ -1,4 +1,4 @@
-<!-- 定制频道 -->
+<!-- 定制频道 详情-->
 <template>
   <div class="app-container">
     <!-- 表单 -->