Browse Source

Merge branch 'master' of http://git.cc-lotus.info/count/webnew-count

reloaded 5 years ago
parent
commit
625a299f89
1 changed files with 32 additions and 11 deletions
  1. 32 11
      src/views/pcenter/parts/infoAdmin.vue

+ 32 - 11
src/views/pcenter/parts/infoAdmin.vue

@@ -31,11 +31,11 @@
                   <el-button size="mini" type="primary" @click="examineBtn(scope.row)" v-if="user.type == '0' || user.type == '1'">审核</el-button>
                   <el-button size="mini" type="primary" v-if="scope.row.status == '0'" @click="examineBtn(scope.row)">编辑</el-button>
                   <el-button size="mini" type="success" v-if="scope.row.status == '0'" @click="submitInfo(scope.row)">发布</el-button>
-                  <el-button size="mini" type="danger">删除</el-button>
+                  <el-button size="mini" type="danger" @click="deleteBtn(scope.row.id)">删除</el-button>
                 </template>
               </el-table-column>
             </el-table>
-            <page :total="total" position="right"></page>
+            <page :total="total" position="right" @query="searchInfo"></page>
           </el-col>
         </span>
         <span v-else>
@@ -65,9 +65,9 @@
                 </el-radio-group>
               </el-form-item>
               <el-form-item label="链接地址" prop="url" v-if="form.type == '1'">
-                <el-input v-model="form.url" placeholder="请输入链接地址"></el-input>
+                <el-input v-model="form.url" placeholder="请输入链接地址(https://)"></el-input>
               </el-form-item>
-              <el-form-item label="发布单位" prop="publish_unit" v-if="form.type == '0'">
+              <el-form-item label="发布单位" prop="publish_unit">
                 <el-input v-model="form.publish_unit" placeholder="请输入发布单位"></el-input>
               </el-form-item>
               <el-form-item label="图片" prop="img_url" v-if="form.type == '0'">
@@ -153,9 +153,7 @@ export default {
         { value: '党风廉政', label: '党风廉政' },
       ],
       // 发布
-      form: {
-        type: '0',
-      },
+      form: {},
       // 规则
       rules: {
         col_name: [{ required: true, message: '请选择栏目', trigger: 'blur' }],
@@ -173,7 +171,7 @@ export default {
     this.searchInfo();
   },
   methods: {
-    ...news({ newsQuery: 'query', newsCreate: 'create', newsUpdate: 'update' }),
+    ...news({ newsQuery: 'query', newsCreate: 'create', newsUpdate: 'update', newsDelete: 'delete' }),
     async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
       let res = await this.newsQuery({ skip, limit, ...info });
       if (this.$checkRes(res)) {
@@ -184,6 +182,7 @@ export default {
     // 添加
     add() {
       this.display = 'detail';
+      this.form = {};
     },
     // 返回
     back() {
@@ -215,6 +214,8 @@ export default {
           message: '审核通过',
           type: 'success',
         });
+        this.display = 'list';
+        this.searchInfo();
       }
     },
     // 详情审核拒绝
@@ -226,6 +227,8 @@ export default {
           message: '审核拒绝',
           type: 'error',
         });
+        this.display = 'list';
+        this.searchInfo();
       }
     },
     // 保存草稿
@@ -236,10 +239,12 @@ export default {
             let res = await this.newsUpdate(this.form);
             if (this.$checkRes(res)) {
               this.$message({
-                message: '保存修改成功',
+                message: '修改信息成功',
                 type: 'success',
               });
+              this.form = {};
               this.display = 'list';
+              this.searchInfo();
             }
           } else {
             this.form.publisher = this.user.uid;
@@ -247,10 +252,12 @@ export default {
             let res = await this.newsCreate(this.form);
             if (this.$checkRes(res)) {
               this.$message({
-                message: '保存成功',
+                message: '创建信息成功',
                 type: 'success',
               });
+              this.form = {};
               this.display = 'list';
+              this.searchInfo();
             }
           }
         } else {
@@ -272,6 +279,7 @@ export default {
                 type: 'success',
               });
               this.display = 'list';
+              this.searchInfo();
             }
           } else {
             this.form.publisher = this.user.uid;
@@ -279,10 +287,11 @@ export default {
             let res = await this.newsCreate(this.form);
             if (this.$checkRes(res)) {
               this.$message({
-                message: '创建信息成功',
+                message: '发布信息成功',
                 type: 'success',
               });
               this.display = 'list';
+              this.searchInfo();
             }
           }
         } else {
@@ -295,6 +304,18 @@ export default {
     resetForm(formName) {
       this.$refs[formName].resetFields();
       this.display = 'list';
+      this.searchInfo();
+    },
+    // 删除
+    async deleteBtn(id) {
+      let res = await this.newsDelete(id);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '删除信息成功',
+          type: 'success',
+        });
+        this.searchInfo();
+      }
     },
     // 图片
     uploadSuccess({ type, data }) {