Bladeren bron

feat():修改直播列表

geek 4 jaren geleden
bovenliggende
commit
eb21ea3370
1 gewijzigde bestanden met toevoegingen van 26 en 10 verwijderingen
  1. 26 10
      src/views/live/list.vue

+ 26 - 10
src/views/live/list.vue

@@ -17,12 +17,12 @@
           <span>{{ scope.row.create_time }}</span>
         </template>
       </el-table-column>
-      <el-table-column class-name="status-col" align="center" label="直播间id">
+      <el-table-column class-name="status-col" align="center" label="直播间id" width="80px">
         <template slot-scope="scope">
           <span>{{ scope.row.room_id }}</span>
         </template>
       </el-table-column>
-      <el-table-column class-name="status-col" label="直播间名称" align="center" >
+      <el-table-column class-name="status-col" label="直播间名称" align="center">
         <template slot-scope="scope">
           <span>{{ scope.row.name }}</span>
         </template>
@@ -47,14 +47,14 @@
           <span>{{ scope.row.type | typeFilter }}</span>
         </template>
       </el-table-column>-->
-      <el-table-column class-name="status-col" label="状态" align="center">
+      <el-table-column class-name="status-col" label="状态" align="center" width="100px">
         <template slot-scope="{row}">
           <el-tag type="success">
             {{ row | statusFilter }}
           </el-tag>
         </template>
       </el-table-column>
-      <el-table-column align="center" label="Actions" width="300" class-name="small-padding fixed-width">
+      <el-table-column align="center" label="Actions" width="350" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-row>
             <router-link :to="'/live/edit/'+scope.row.id">
@@ -67,12 +67,12 @@
                 查看聊天记录
               </el-button>
             </router-link>
-<!--            <el-button type="primary" size="mini" icon="el-icon-s-check" :disabled="(scope.row.status === 1 || scope.row.status === 3)" @click="handleUpdate(scope)">-->
-<!--              {{ scope.row.status === 1 || scope.row.status === 3 ? '已处理' : '处理' }}-->
-<!--            </el-button>-->
-            <!--<el-button type="danger" size="mini" icon="el-icon-delete" style="margin-left: 10px;" @click="handleDelete(scope)">
-              删除
+            <!--<el-button type="primary" size="mini" icon="el-icon-s-check" :disabled="(scope.row.status === 1 || scope.row.status === 3)" @click="handleUpdate(scope)">
+              {{ scope.row.status === 1 || scope.row.status === 3 ? '已处理' : '处理' }}
             </el-button>-->
+            <el-button type="danger" size="mini" icon="el-icon-delete" style="" @click="handleDelete(scope)">
+              删除
+            </el-button>
           </el-row>
         </template>
       </el-table-column>
@@ -83,7 +83,7 @@
 </template>
 
 <script>
-import { fetchList } from '@/api/live'
+import { fetchList, deleteLive } from '@/api/live'
 import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
 import waves from '@/directive/waves'
 
@@ -157,6 +157,22 @@ export default {
       this.$nextTick(() => {
         this.$refs['dataForm'].clearValidate()
       })
+    },
+    handleDelete({ $index, row }) {
+      console.log(row.id)
+      this.$confirm('您确定要删除吗', '警告', {
+        confirmButtonText: '是的',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+        .then(async() => {
+          await deleteLive(row.id)
+          this.list.splice($index, 1)
+          this.$message({
+            type: 'success',
+            message: '删除成功'
+          })
+        })
     }
   }
 }