Asdbt 2 年之前
父节点
当前提交
1d1ef577e8
共有 4 个文件被更改,包括 65 次插入38 次删除
  1. 8 0
      src/api/publisher/publish.js
  2. 1 1
      src/router/index.js
  3. 2 4
      src/views/publishers/addPublisher.vue
  4. 54 33
      src/views/publishers/publisherList.vue

+ 8 - 0
src/api/publisher/publish.js

@@ -32,3 +32,11 @@ export function upload(file) {
     data: file
   });
 }
+
+// 删除
+export function deletePublish(id) {
+  return request({
+      url: '/system/issuer/' + id,
+      method: 'delete'
+  })
+}

+ 1 - 1
src/router/index.js

@@ -150,7 +150,7 @@ export const constantRoutes = [
     meta: { title: '发行方管理', icon : "log" },
     children: [
       {
-        path: 'messageList',
+        path: 'publisherList',
         component: () => import('@/views/publishers/publisherList'),
         name: 'publisherList',
         meta: { title: '发行方列表', icon: 'textarea' }

+ 2 - 4
src/views/publishers/addPublisher.vue

@@ -51,7 +51,6 @@ export default {
   data() {
     return {
       imageUrl: '',
-      fileList: [], //上传的文件列表
       pubform: {
         collectionTitle: "",
         issuerName: "",
@@ -61,7 +60,6 @@ export default {
         headPortrait: "",
         remark: "",
       },
-
       rules: {
         pname: [
           { required: true, message: "请输入发行方名称", trigger: "blur" },
@@ -78,7 +76,6 @@ export default {
       let formData = new FormData();
       formData.append('file', file);
       upload(formData).then(res => {
-        console.log(res);
         this.pubform.headPortrait = res.url;
       })
     },
@@ -100,7 +97,7 @@ export default {
             message: "创建消息成功",
             type: "success",
           });
-          // this.$router.push("./publisherList");
+          this.$router.push("./publisherList");
         } else {
           this.$notify({
             title: "警告",
@@ -154,6 +151,7 @@ export default {
 
 .avatar {
   width: 100%;
+  height: 100%;
   display: block;
 }
 </style>

+ 54 - 33
src/views/publishers/publisherList.vue

@@ -4,7 +4,7 @@
       <el-row :style="{ padding: '12px' }">
         <el-col :span="12">
           <i class="el-icon-search"></i>
-          <span :style="{ padding: '4px' }">筛选发行商 </span>    
+          <span :style="{ padding: '4px' }">筛选发行商 </span>
         </el-col>
         <el-col :span="12" :style="{ textAlign: 'right' }">
           <el-button @click="empty">重置</el-button>
@@ -32,32 +32,27 @@
       </el-row>
     </div>
     <div class="pubform">
-      <el-table
-        :data="tableData"
-        stripe
-        border
-        :style="{ borderRadius: '4px' }"
-        :header-cell-style="{ 'text-align': 'center' }"
-        :cell-style="{ 'text-align': 'center' }"
-      >
+      <el-table :data="tableData" stripe border :style="{ borderRadius: '4px' }"
+        :header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }">
         <el-table-column prop="issuerId" label="ID"> </el-table-column>
-        <el-table-column prop="headPortraits" label="头像"> </el-table-column>
+        <el-table-column prop="headPortrait" label="头像">
+          <template v-slot="scope">
+            <img class="avaImg" :src="scope.row.headPortrait" width="40" height="40">
+          </template>
+        </el-table-column>
         <el-table-column prop="collectionTitle" label="发行方名称">
         </el-table-column>
         <el-table-column prop="opreation" label="操作">
-          <el-button type="text">修改</el-button>
-          <el-button type="text">删除</el-button>
+          <template slot-scope="scope">
+            <el-button type="text">修改</el-button>
+            <el-button type="text" @click="deleteInfo(scope.row)">删除</el-button>
+          </template>
         </el-table-column>
       </el-table>
       <el-row :style="{ marginTop: '16px' }">
         <el-col :span="24" :style="{ textAlign: 'right' }">
-          <el-pagination
-            background
-            :page-size="10"
-            layout="total, prev, pager, next"
-            :total="total"
-            @current-change="handleCurrentChange"
-          >
+          <el-pagination background :page-size="10" layout="total, prev, pager, next" :total="total"
+            @current-change="handleCurrentChange">
           </el-pagination>
         </el-col>
       </el-row>
@@ -66,8 +61,7 @@
 </template>
 
 <script>
-import { publishList } from "@/api/publisher/publish";
-import { searchPublish } from "@/api/publisher/publish";
+import { publishList, searchPublish, deletePublish } from "@/api/publisher/publish";
 export default {
   name: "publisherList",
   data() {
@@ -79,31 +73,28 @@ export default {
       },
       tableData: [], // 具体数据
       total: 1, // 数据个数
-
-      issuerID:'' //发行商ID
-
+      issuerID: '' //发行商ID
     };
   },
-  created() {
+  mounted() {
     this.getpublishList();
   },
   methods: {
-    empty(){
-      this.issuerID=''
+    empty() {
+      this.issuerID = ''
     },
     search() {
-        if(this.issuerId){
-          searchPublish(issuerId).then((res)=>{
-            console.log(res);
-          })
-        }
+      if (this.issuerId) {
+        searchPublish(issuerId).then((res) => {
+          console.log(res);
+        })
+      }
     },
     addPublish() {
       this.$router.push("./addPublisher");
     },
     getpublishList() {
       publishList(this.pageInfo).then((data) => {
-        console.log(data);
         this.tableData = data.rows;
         this.total = data.total;
       });
@@ -112,6 +103,30 @@ export default {
       this.pageInfo.pageNum = newPage;
       this.getpublishList();
     },
+    deleteInfo(id) {
+      console.log(id.issuerId);
+      this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let issuerId = id.issuerId
+        deletePublish(issuerId).then(() => {
+          this.$message({
+            type: 'success',
+            message: '删除成功!'
+          });
+          this.getpublishList();
+        }).catch(err => {
+          console.log(err);
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
+    }
   },
 };
 </script>
@@ -121,12 +136,18 @@ export default {
   border-radius: 4px;
   margin: 16px;
 }
+
 .addpub {
   border: 1px solid #ccc;
   border-radius: 4px;
   margin: 16px;
 }
+
 .pubform {
   padding: 0 16px;
 }
+
+.avaImg {
+  border-radius: 50%;
+}
 </style>