Browse Source

文章列表页面的开发

xiaoming_global 5 years ago
parent
commit
d41d38d591

+ 9 - 0
src/api/act/submitinfo.js View File

@@ -16,4 +16,13 @@ export function getArticleType(params){
16 16
          method: 'Get',
17 17
          params: params
18 18
      })
19
+}
20
+
21
+export function GetAllArticles(params){
22
+     console.log("文章列表")
23
+     return request({
24
+         url:'/api/acticle/getAllArticles',
25
+         method:'Get',
26
+         params:params
27
+     })
19 28
 }

+ 54 - 26
src/scrm_pages/article/articleList.vue View File

@@ -8,7 +8,7 @@
8 8
           <div style="margin-bottom: 10px">
9 9
             <el-row :gutter="24">
10 10
               <el-col :span="8">
11
-                  <el-input style="width: 300px"  placeholder="请输入您需要搜索的内容"></el-input>
11
+                  <el-input style="width: 300px" v-model="listQuery.search"  placeholder="请输入您需要搜索的内容"></el-input>
12 12
                   <el-button type="primary"  icon="el-icon-search">搜索</el-button>
13 13
               </el-col>
14 14
             </el-row>
@@ -17,7 +17,8 @@
17 17
             <label class="title"><span class="name">标签</span>:</label>
18 18
              <div class="time">
19 19
                 <ul class="">
20
-                  <li :class="item.value==schedulType?'active':''"  v-for="item in schedulArr" :key="item.value">{{item.label}}</li>
20
+                  <li :class="0==schedulType?'active':''" @click="selectsign(0)">全部</li>
21
+                  <li :class="item.MenuId==schedulType?'active':''"  v-for="item in schedulArr" :key="item.MenuId">{{item.Name}}</li>
21 22
                 </ul>
22 23
              </div>
23 24
           </div>
@@ -25,15 +26,16 @@
25 26
             <label class="title"><span class="name">状态:</span></label>
26 27
             <div class="time">
27 28
               <ul class="">
29
+                <!-- <li :class="0==systemType?'active':''" @click="selectStatus(0)">全部</li> -->
28 30
                 <li :class="item.value==systemType?'active':''" v-for="item in systemArr" :key="item.value">{{item.label}}</li>
29 31
               </ul>
30 32
             </div>
31 33
           </div>
32 34
           <div class="filter-container" style="margin-top: 10px;margin-left: 5px">
33
-            <el-checkbox style="width: 30px" v-model="checked" @change="changeAllSelected">全选</el-checkbox>
34
-            <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
35
+            <el-checkbox style="width: 30px">全选</el-checkbox>
36
+            <el-button size="small" icon="el-icon-delete">删除</el-button>
35 37
           </div>
36
-          <el-table ref="multipleTable" :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}" :data="tableData" border fit highlight-current-row  style="width: 100%;margin-top: 10px;">
38
+          <el-table ref="multipleTable" :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}" :data="ArticleData" border fit highlight-current-row  style="width: 100%;margin-top: 10px;">
37 39
               <el-table-column
38 40
                 type="selection"
39 41
                 width="55">
@@ -92,6 +94,7 @@
92 94
 
93 95
 <script>
94 96
   import BreadCrumb from '../components/bread-crumb'
97
+  import { GetAllArticles } from '@/api/act/submitinfo'
95 98
   export default {
96 99
     name: 'commentList',
97 100
     components:{
@@ -106,34 +109,59 @@
106 109
         time: '',
107 110
         active: true,
108 111
         schedulType: 0,
109
-        schedulArr:[
110
-          {value: 0, label: '全部'},
111
-          {value: 1, label: '食物库'},
112
-          {value: 2, label: '肾病常识'},
113
-          {value: 3, label: '科普教育'},
114
-        ],
112
+        schedulArr:0,
115 113
         systemType: 0,
116 114
         systemArr: [
117
-          { value: 0, label: '全部' },
118
-          { value: 1, label: '已发布'},
119
-          { value: 2, label: '草稿箱'},
120
-          { value: 3, label: '未通过'},
115
+          { value: 0, label: "全部" },
116
+          { value: 1, label: "已发布" },
117
+          { value: 2, label: "草稿箱" },
118
+          { value: 2, label: "未通过" }
121 119
         ],
120
+        listQuery:{
121
+            page:1,
122
+            limit:10,
123
+            search:'',
124
+            classid:'',
125
+        },
126
+        ArticleData:[],
127
+        total:0,
122 128
       }
129
+    },
130
+    methods:{
131
+         GetAllArticles(){
132
+              GetAllArticles(this.listQuery).then(response =>{
133
+                     if(response.data.status === 1){
134
+                       this.ArticleData = response.data.data.articles
135
+                        console.log("文章列表",this.ArticleData)
136
+                        this.total = response.data.data.total
137
+                     }
138
+              })
139
+         },
140
+         selectsign(id){
141
+            this.listQuery.classid = id;
142
+            this.schedulArr = id;
143
+            this.GetAllArticles();
144
+         },
145
+         selectStatus(id){
146
+            this.listQuery.status = id;
147
+            this.systemType = id;
148
+            this.GetAllArticles();
149
+         },
150
+          handleSizeChange(limit) {
151
+            this.listQuery.limit = limit;
152
+            this.GetAllAritcles();
153
+        },
154
+         handleCurrentChange(page) {
155
+            this.listQuery.page = page;
156
+            this.GetAllAritcles();
157
+        }
158
+    },
159
+    created(){
160
+      this.GetAllArticles()
123 161
     }
124 162
   }
125 163
 </script>
126 164
 
127 165
 <style scoped>
128
-  /*.app-container .cell.clearfix .time ul li {*/
129
-    /*float: left;*/
130
-    /*list-style: none;*/
131
-    /*cursor: pointer;*/
132
-    /*padding: 6px 20px;*/
133
-    /*color: #606266;*/
134
-    /*border-radius: 4px;*/
135
-    /*margin: 0 8px 0 0;*/
136
-    /*font-size: 14px;*/
137
-    /*text-align: center;*/
138
-  /*}*/
166
+     
139 167
 </style>

+ 29 - 11
src/scrm_pages/article/createArticle.vue View File

@@ -79,12 +79,12 @@
79 79
                 </el-col>
80 80
               </el-form-item>
81 81
                <el-form-item label="所属分类:">
82
-                 <el-select v-model="value" placeholder="请先选择文章所属分类" prop="act_type">
82
+                 <el-select v-model="form.act_type" placeholder="请先选择文章所属分类"  @change="changeActtype()">
83 83
                    <el-option
84 84
                      v-for="item in options"
85
-                     :key="item.id"
85
+                     :key="item.MenuId"
86 86
                      :label="item.Name"
87
-                     :value="item.id">
87
+                     :value="item.MenuId">
88 88
                    </el-option>
89 89
                  </el-select>
90 90
                </el-form-item>
@@ -94,7 +94,7 @@
94 94
           <el-row :span="24">
95 95
             <el-col :span="24">
96 96
                 <el-form-item>
97
-                      <el-button size="small" type="primary" style="width: 100px"  @click="submitForm" :disabled="formsubmit">发布</el-button>
97
+                      <el-button size="small" type="primary" style="width: 100px"  @click="submitForm;centerDialogVisible = true" :disabled="formsubmit">发布</el-button>
98 98
                       <el-button size="small" style="width: 100px">预览</el-button>
99 99
                       <el-button size="small" style="width: 100px">保存草稿</el-button>
100 100
                   <el-button size="small" style="width: 100px">取消</el-button>
@@ -170,6 +170,17 @@
170 170
     </el-tabs>
171 171
      </div>
172 172
     </div>
173
+      <el-dialog
174
+        title="发布成功"
175
+        :visible.sync="centerDialogVisible"
176
+         width="30%"
177
+         center>
178
+         <!-- <span>需要注意的是内容是默认不居中的</span> -->
179
+         <span slot="footer" class="dialog-footer">
180
+        <el-button @click="gotolink;centerDialogVisible = false">再发一条</el-button>
181
+        <el-button type="primary" @click="gobacklist">返回文章列表</el-button>
182
+       </span>
183
+      </el-dialog>
173 184
   </div>
174 185
 </template>
175 186
 
@@ -239,6 +250,7 @@
239 250
                 // 关闭自动保存
240 251
                 enableAutoSave: false
241 252
             },
253
+         centerDialogVisible: false,
242 254
       }
243 255
     },
244 256
     created(){
@@ -417,24 +429,24 @@
417 429
       beforeRemove(file, fileList) {
418 430
         return this.$confirm(`确定移除 ${ file.name }?`);
419 431
       },
432
+      changeActtype(){
433
+         console.log("所属分类",this.form.act_type)
434
+      },
420 435
       submitForm(){
421 436
         var params  = new Object()
422 437
         params.act_name = this.form.act_name
423 438
         params.act_content = this.$refs.neditor.content
424 439
         params.org_logo = this.form.org_logo
440
+        params.act_type = this.form.act_type
425 441
         this.formloading=true
426 442
         this.submitForm =true
427 443
         console.log("文章标题",params.act_name)
428 444
         console.log("文章内容",params.act_content)
429 445
         console.log("富文本编辑器的内容",params.act_content)
430
-        console.log("图片",params.org_logo)
446
+        console.log("图片",params.org_logo)  
447
+        console.log("所属分类",params.act_type)    
431 448
         submitForm(params).then(response => {
432
-           if(response.data.state === 1){
433
-             this.$message({
434
-               type: 'success',
435
-               message: '成功!'
436
-             })
437
-           }
449
+         
438 450
         })
439 451
       },
440 452
       getArticleType(){
@@ -447,6 +459,12 @@
447 459
              console.log("文章",this.options)
448 460
             }
449 461
         })
462
+      },
463
+      gotolink(){
464
+        this.$router.push({path:"/articles/createArticle"})
465
+      },
466
+      gobacklist(){
467
+        this.$router.push({path:'/articles/articleList'})
450 468
       }
451 469
     },
452 470
   }

+ 1 - 0
src/scrm_pages/members/members.vue View File

@@ -153,6 +153,7 @@
153 153
         GetMembers(){
154 154
             GetMembers(this.listQuery).then(response=>{
155 155
                 var res = response.data;
156
+                console.log("res是谁?",res)
156 157
                 if(res.state == 1) {
157 158
                     this.membersData = res.data.members;
158 159
                     this.total = res.data.total;