ソースを参照

文章分类模块

xiaoming_global 5 年 前
コミット
ab475f0819

+ 26 - 2
src/api/act/submitinfo.js ファイルの表示

@@ -1,7 +1,7 @@
1 1
 import request from '@/utils/request'
2 2
 
3 3
 export function submitForm (params){
4
-    console.log("文章列表",params)
4
+    //console.log("文章列表",params)
5 5
     return request({
6 6
         url: '/api/acticle/createacticle',
7 7
         method: 'Get',
@@ -19,10 +19,34 @@ export function getArticleType(params){
19 19
 }
20 20
 
21 21
 export function GetAllArticles(params){
22
-     console.log("文章列表")
23 22
      return request({
24 23
          url:'/api/acticle/getAllArticles',
25 24
          method:'Get',
26 25
          params:params
27 26
      })
27
+}
28
+
29
+export function addCategory(data){
30
+    return request({
31
+        url:'/api/article/addCategory',
32
+        method:'Post',
33
+        data:data
34
+    })
35
+}
36
+
37
+export function GetCategorys(params){
38
+      console.log("params",params)
39
+     return request({
40
+         url:'/api/acticle/getCategorys',
41
+         method:'Get',
42
+         params:params
43
+     })
44
+}
45
+
46
+export function EditArticleCategory(MenuId,data){
47
+    return request({
48
+        url:'/api/acticle/edit?MenuId='+MenuId,
49
+        method:'put',
50
+        data,data
51
+    })
28 52
 }

+ 1 - 0
src/api/member/member.js ファイルの表示

@@ -9,6 +9,7 @@ export function GetMembers(params) {
9 9
 }
10 10
 
11 11
 export function CreateMember(data) {
12
+  console.log("data是神",data)
12 13
   return request({
13 14
     url: '/api/member/create',
14 15
     method: 'post',

+ 78 - 16
src/scrm_pages/article/acticleCategory.vue ファイルの表示

@@ -2,24 +2,22 @@
2 2
     <div class="main-contain">
3 3
       <div class="position">
4 4
         <bread-crumb :crumbs='crumbs'></bread-crumb>
5
-        <el-button  style="float:right;" type="primary" size="small" icon="el-icon-circle-plus-outline">添加分类</el-button>
5
+        <el-button  style="float:right;" type="primary" size="small" icon="el-icon-circle-plus-outline" @click="openCreate()">添加分类</el-button>
6 6
       </div>
7 7
       <div class="app-container">
8 8
         <div class="filter-container" style="margin-top: 10px;margin-left: 5px">
9
-          <el-checkbox style="width: 30px" v-model="checked" @change="changeAllSelected">全选</el-checkbox>
10
-          <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
9
+          <el-checkbox style="width: 30px">全选</el-checkbox>
10
+          <el-button size="small" icon="el-icon-delete">批量删除</el-button>
11 11
 
12 12
         </div>
13 13
 
14 14
         <el-row :gutter="12" style="margin-top: 10px">
15 15
           <el-table
16
-            :data="cancelStockDate"
17
-            :class="signAndWeighBoxPatients"
18 16
             border
19 17
             highlight-current-row
20 18
             ref="multipleTable"
21
-            @selection-change="select"
22 19
             :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
20
+            :data="articsData"
23 21
           >
24 22
             <el-table-column
25 23
               type="selection"
@@ -28,19 +26,19 @@
28 26
 
29 27
             <el-table-column label="分类名称" align="center">
30 28
               <template slot-scope="scope">
31
-                123
29
+                {{scope.row.Name}}
32 30
               </template>
33 31
             </el-table-column>
34 32
 
35 33
             <el-table-column label="所属文章数量" align="center">
36 34
               <template slot-scope="scope">
37
-                456
35
+                {{scope.row.num}}
38 36
               </template>
39 37
             </el-table-column>
40 38
 
41 39
             <el-table-column label="分类排序" align="center">
42 40
               <template slot-scope="scope">
43
-                789
41
+                {{scope.row.Order}}
44 42
               </template>
45 43
             </el-table-column>
46 44
 
@@ -52,7 +50,7 @@
52 50
                     size="mini"
53 51
                     type="primary"
54 52
                     icon="el-icon-edit-outline"
55
-                    @click="handleEdit(scope.$index, scope.row)">
53
+                    @click="openEdit(scope.row,scope.$index)">
56 54
                   </el-button>
57 55
                 </el-tooltip>
58 56
                 <el-tooltip class="item" effect="dark" content="删除" placement="top">
@@ -69,17 +67,22 @@
69 67
 
70 68
           </el-table>
71 69
 
72
-          <el-pagination
70
+         <el-pagination
73 71
             @size-change="handleSizeChange"
74 72
             @current-change="handleCurrentChange"
75
-            :page-sizes="[7]"
76
-            :page-size="7"
73
+            :page-sizes="[10,20,50,100]"
74
+            :page-size="10"
77 75
             background
78
-            style="margin-top:20px;float: right"
76
+            style="margin-top:20px;"
77
+            align="right"
79 78
             layout="total, sizes, prev, pager, next, jumper"
80 79
             :total="total">
81 80
           </el-pagination>
82
-
81
+           <!-- 添加分类 -->
82
+           <create-article-form ref="createArticleForm" :articsData="articsData"></create-article-form>
83
+           <!-- 编辑分类 -->
84
+           <edit-article-form ref="editArticleForm" :artilceIndex="artilceIndex" :form="articData" :articsData="articsData" ></edit-article-form>
85
+         
83 86
         </el-row>
84 87
       </div>
85 88
     </div>
@@ -87,10 +90,15 @@
87 90
 
88 91
 <script>
89 92
   import BreadCrumb from '../components/bread-crumb'
93
+  import CreateArticleForm from "./components/CreateArticleForm";
94
+  import EditArticleForm from "./components/EditArticleForm";
95
+  import { GetCategorys } from '@/api/act/submitinfo'
90 96
   export default {
91 97
     name: 'acticleCategory',
92 98
     components:{
93
-      BreadCrumb
99
+      BreadCrumb,
100
+      CreateArticleForm,
101
+      EditArticleForm,
94 102
     },
95 103
     data(){
96 104
       return{
@@ -98,8 +106,62 @@
98 106
           { path: false, name: '文章管理' },
99 107
           { path: '/articles/acticleCategory', name: '发布文章' }
100 108
         ],
109
+        articsData:[],
110
+        articData:{
111
+          Name:'',
112
+          Summary:'',
113
+          Order:'',
114
+          MenuId:0,
115
+        },
116
+        total:0,
117
+        listQuery:{
118
+          page:1,
119
+          limit:10,
120
+          name:'',
121
+          content:'',
122
+          sort:'',
123
+        },
124
+         artilceIndex:-1,
101 125
       }
102 126
     },
127
+
128
+    methods:{
129
+      openCreate(){
130
+        this.$refs.createArticleForm.open();
131
+      },
132
+      GetCategorys(){
133
+        GetCategorys(this.listQuery).then(response=>{
134
+             console.log(response.data.state)
135
+             if(response.data.state === 1){
136
+               this.articsData = response.data.data.category 
137
+               console.log(this.articsData)
138
+               this.total = response.data.data.total
139
+             }
140
+        })
141
+      },
142
+       handleSizeChange(limit) {
143
+            this.listQuery.limit = limit;
144
+            this.GetCategorys();
145
+        },
146
+        handleCurrentChange(page) {
147
+            this.listQuery.page = page;
148
+            this.GetCategorys();
149
+        },
150
+        openEdit(row,index){          
151
+            for(const key in this.articData){
152
+               if(key in row){
153
+                 this.articData[key] = row[key]
154
+               }
155
+            }
156
+            console.log("是什么",this.articData) 
157
+            console.log("heh",this.articsData)  
158
+             this.artilceIndex = index 
159
+             this.$refs.editArticleForm.open();        
160
+        }
161
+    },
162
+     created(){
163
+         this.GetCategorys()
164
+       }
103 165
   }
104 166
 </script>
105 167
 

+ 33 - 17
src/scrm_pages/article/articleList.vue ファイルの表示

@@ -9,7 +9,7 @@
9 9
             <el-row :gutter="24">
10 10
               <el-col :span="8">
11 11
                   <el-input style="width: 300px" v-model="listQuery.search"  placeholder="请输入您需要搜索的内容"></el-input>
12
-                  <el-button type="primary"  icon="el-icon-search">搜索</el-button>
12
+                  <el-button type="primary"  icon="el-icon-search" @click="changeKey">搜索</el-button>
13 13
               </el-col>
14 14
             </el-row>
15 15
           </div>
@@ -18,7 +18,7 @@
18 18
              <div class="time">
19 19
                 <ul class="">
20 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
+                  <li :class="item.MenuId==schedulType?'active':''"  v-for="item in schedulArr" :key="item.MenuId" @click="selectsign(item.MenuId)">{{item.Name}}</li>
22 22
                 </ul>
23 23
              </div>
24 24
           </div>
@@ -37,32 +37,33 @@
37 37
           </div>
38 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;">
39 39
               <el-table-column
40
+                align="center" 
40 41
                 type="selection"
41 42
                 width="55">
42 43
               </el-table-column> 
43 44
              <el-table-column label="文章图片" align="center">
44 45
                <template slot-scope="scope">
45
-
46
+                  <img :src="memberAvatar(scope.row)" alt="" srcset="" style="width:100px;height:100px;" >
46 47
                </template>
47 48
              </el-table-column>
48 49
             <el-table-column label="文章标题" align="center">
49 50
               <template slot-scope="scope">
50
-
51
+                  {{scope.row.title}}
51 52
               </template>
52 53
             </el-table-column>
53 54
             <el-table-column label="阅读量" align="center">
54 55
               <template slot-scope="scope">
55
-
56
+                 {{scope.row.real_read_num}}
56 57
               </template>
57 58
             </el-table-column>
58 59
             <el-table-column label="评论数" align="center">
59 60
               <template slot-scope="scope">
60
-
61
+                  {{scope.row.comment_num}}
61 62
               </template>
62 63
             </el-table-column>
63 64
             <el-table-column label="点赞数" align="center">
64 65
               <template slot-scope="scope">
65
-
66
+                  {{scope.row.num}}
66 67
               </template>
67 68
             </el-table-column>
68 69
             <el-table-column label="操作" align="center">
@@ -75,14 +76,17 @@
75 76
                     @click="handleEdit(scope.$index, scope.row)">
76 77
                   </el-button>
77 78
                 </el-tooltip>
79
+                 <el-tooltip class="item" effect="dark" content="删除" placement="top">
80
+                  <el-button size="mini" type="danger" icon="el-icon-delete" @click="openDelete(scope.row, scope.$index)" ></el-button>
81
+                </el-tooltip>
78 82
               </template>
79 83
             </el-table-column>
80 84
           </el-table>
81 85
           <el-pagination
82 86
             @size-change="handleSizeChange"
83 87
             @current-change="handleCurrentChange"
84
-            :page-sizes="[7]"
85
-            :page-size="7"
88
+            :page-sizes="[10,20,50,100]"
89
+            :page-size="10"
86 90
             background
87 91
             style="margin-top:20px;float: right"
88 92
             layout="total, sizes, prev, pager, next, jumper"
@@ -109,7 +113,7 @@
109 113
         time: '',
110 114
         active: true,
111 115
         schedulType: 0,
112
-        schedulArr:0,
116
+        schedulArr:[],
113 117
         systemType: 0,
114 118
         systemArr: [
115 119
           { value: 0, label: "全部" },
@@ -129,17 +133,23 @@
129 133
     },
130 134
     methods:{
131 135
          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
+              GetAllArticles(this.listQuery).then(response=>{
137
+                     if(response.data.state === 1){
138
+                        this.ArticleData = response.data.data.articles  
136 139
                         this.total = response.data.data.total
140
+                        console.log("文章列表",this.ArticleData)
141
+                        console.log("total",this.total)                                                   
142
+                     }
143
+                     if(typeof(response.data.data.category != 'undefined')){
144
+                       this.schedulArr = response.data.data.category
145
+                        console.log("分类列表",response.data.data.category)
146
+                       
137 147
                      }
138 148
               })
139 149
          },
140
-         selectsign(id){
141
-            this.listQuery.classid = id;
142
-            this.schedulArr = id;
150
+         selectsign(MenuId){
151
+            this.listQuery.classid = MenuId;
152
+            this.schedulArr = MenuId;
143 153
             this.GetAllArticles();
144 154
          },
145 155
          selectStatus(id){
@@ -154,6 +164,12 @@
154 164
          handleCurrentChange(page) {
155 165
             this.listQuery.page = page;
156 166
             this.GetAllAritcles();
167
+        },
168
+        changeKey(){
169
+           this.GetAllArticles();
170
+        },
171
+        memberAvatar(row){
172
+             return row.imgs
157 173
         }
158 174
     },
159 175
     created(){

+ 101 - 0
src/scrm_pages/article/components/CreateArticleForm.vue ファイルの表示

@@ -0,0 +1,101 @@
1
+<template>
2
+
3
+    <div id="create-article-form-box">
4
+      <el-dialog
5
+        title="添加分类"
6
+        :visible.sync="centerDialogVisible"
7
+        width="1000px"
8
+        center>
9
+        <el-form label-width="90px" class="clearfix" :model="form" ref="acticleform" :rules="rules">
10
+          <el-row :span=20>
11
+            <el-form-item label="分类名称:" required prop="name">
12
+              <el-input v-model="form.name">
13
+
14
+              </el-input>
15
+            </el-form-item>
16
+          </el-row>
17
+          <el-row :span=20>
18
+            <el-form-item label="分类描述:" required prop="content">
19
+              <keep-alive>
20
+                <neditor ref="neditor"
21
+                         id="editor"
22
+                         v-bind:r_content="form.content">
23
+                </neditor>
24
+              </keep-alive>
25
+            </el-form-item>
26
+          </el-row>
27
+          <el-row :span=20>
28
+            <el-form-item label="排序" required prop="sort">
29
+              <el-input v-model="form.sort">
30
+
31
+              </el-input>
32
+            </el-form-item>
33
+          </el-row>
34
+        </el-form>
35
+        <span slot="footer" class="dialog-footer">
36
+               <el-button type="primary" @click="addCategory('acticleform');">添加</el-button>
37
+              <el-button  @click="centerDialogVisible = false">返回列表</el-button>
38
+             </span>
39
+      </el-dialog>
40
+    </div>
41
+
42
+</template>
43
+
44
+<script>
45
+    import Neditor from '@/components/Neditor'
46
+    import { addCategory } from '@/api/act/submitinfo'
47
+    export default {
48
+        name: "CreateArticleForm",
49
+         components:{
50
+           Neditor,
51
+        },
52
+            data(){
53
+                return {
54
+                    centerDialogVisible:false,
55
+                    rules: {
56
+                    name: [{required: true, message: "请填写分类名称",},],
57
+                    content: [{required: true,message:"请填写分类描述"}],
58
+                    sort: [{required: true,message:"请填写排序"}]
59
+                },
60
+                 form:{
61
+                   name:"",
62
+                   content:"",
63
+                   sort:"",
64
+                },
65
+                acticleform:[],
66
+             }
67
+          },   
68
+           methods:{
69
+                 open:function(){
70
+                    this.centerDialogVisible = true;
71
+                  },   
72
+                 resetForm(formName) {
73
+                     if (typeof(this.$refs[formName]) !='undefined') {
74
+                     this.$refs[formName].resetFields();
75
+                   }
76
+                  },
77
+               addCategory(formName){
78
+                  this.form.content = this.$refs.neditor.content
79
+                   this.$refs[formName].validate((valid)=>{
80
+                       if(valid){
81
+                            addCategory(this.form).then(response =>{
82
+                                  console.log(response.data.state)
83
+                                  if(response.data.state==1){
84
+                                    var category = response.data.data.category
85
+                                    this.centerDialogVisible=false
86
+                                    this.resetForm("acticleform");
87
+                                    this.$message.success("添加分类成功");
88
+                                    console.log("coo",category)
89
+                                  }
90
+                            });
91
+                       }   
92
+                   });         
93
+          },  
94
+       }
95
+    }
96
+</script>
97
+
98
+<style scoped>
99
+
100
+</style>
101
+   

+ 109 - 0
src/scrm_pages/article/components/EditArticleForm.vue ファイルの表示

@@ -0,0 +1,109 @@
1
+<template>
2
+    <div id="edit-article-form-box">
3
+        <el-dialog
4
+        title="编辑分类"
5
+        :visible.sync="centerDialogVisible"
6
+        width="1000px"
7
+        center>
8
+        <el-form label-width="90px" class="clearfix" :model="form" ref="acticleform" :rules="rules">
9
+          <el-row :span=20>
10
+            <el-form-item label="分类名称:" required prop="Name">
11
+              <el-input v-model="form.Name"></el-input>
12
+            </el-form-item>
13
+          </el-row>
14
+          <el-row :span=20>
15
+            <el-form-item label="分类描述:" required prop="Summary">
16
+              <keep-alive>
17
+                <neditor ref="neditor"
18
+                         id="editor"
19
+                         v-bind:r_content="form.Summary">
20
+                </neditor>
21
+              </keep-alive>
22
+            </el-form-item>
23
+          </el-row>
24
+          <el-row :span=20>
25
+            <el-form-item label="排序" required prop="Order">
26
+              <el-input v-model="form.Order"></el-input>
27
+            </el-form-item>
28
+          </el-row>
29
+        </el-form>
30
+        <span slot="footer" class="dialog-footer">
31
+               <el-button type="primary" @click="submitForm('acticleform')">保存</el-button>
32
+              <el-button  @click="centerDialogVisible = false">取消</el-button>
33
+             </span>
34
+      </el-dialog>   
35
+    </div>
36
+</template>
37
+<script>
38
+import Neditor from '@/components/Neditor'
39
+ import { EditArticleCategory } from '@/api/act/submitinfo'
40
+export default {
41
+    name: "EditArticleForm",
42
+     components:{
43
+        Neditor,
44
+      },
45
+      props:{
46
+        form:{
47
+           Name:'',
48
+          Summary:'',
49
+          Order:'',
50
+          MenuId:0,
51
+        },
52
+      artilceIndex:{
53
+          type:Number,
54
+          default:-1,
55
+        },
56
+      articsData:{
57
+          type: Array,
58
+          default: function () {
59
+          return [];
60
+        }
61
+      }
62
+    },
63
+     data(){
64
+          return {
65
+          centerDialogVisible:false,
66
+           rules: {
67
+             Name: [{required: true, message: "请填写分类名称",},],
68
+             Summary: [{required: true,message:"请填写分类描述"}],
69
+             Order: [{required: true,message:"请填写排序"}]
70
+              },
71
+             }
72
+          }, 
73
+          methods:{
74
+                open:function(){
75
+                  this.centerDialogVisible = true;
76
+                },
77
+                resetForm(formName) {
78
+                     if (typeof(this.$refs[formName]) !='undefined') {
79
+                     this.$refs[formName].resetFields();
80
+                   }
81
+                },  
82
+              submitForm(forname){ 
83
+                alert("aaa")
84
+                this.$refs[forname].validate((valid)=>{
85
+                   if(valid){
86
+                      EditArticleCategory(this.form.MenuId,this.form).then(response=>{
87
+                            console.log("id是谁",this.form.MenuId)
88
+                            console.log(this.form)
89
+                           var res =  response.data;
90
+                           console.log(res.state)
91
+                           if(res.state ===1 ){
92
+                              var categorys = res.data.categorys; 
93
+                              console.log("categorys是什么",categorys)
94
+                              this.articsData[this.artilceIndex].name = categorys.Name;
95
+                              this.articsData[this.artilceIndex].content = categorys.Summary;
96
+                              this.articsData[this.artilceIndex].sort = categorys.Order;
97
+                              this.centerDialogVisible = false;
98
+                              this.$message.success("编辑文章分类成功");
99
+                           }
100
+                      })
101
+                   }
102
+                })
103
+              },  
104
+          }
105
+}
106
+</script>
107
+<style scoped>
108
+
109
+</style>

+ 5 - 4
src/scrm_pages/article/createArticle.vue ファイルの表示

@@ -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;centerDialogVisible = true" :disabled="formsubmit">发布</el-button>
97
+                      <el-button size="small" type="primary" style="width: 100px"  @click="submitForm();centerDialogVisible = true">发布</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>
@@ -433,6 +433,7 @@
433 433
          console.log("所属分类",this.form.act_type)
434 434
       },
435 435
       submitForm(){
436
+        console.log("提交文章")
436 437
         var params  = new Object()
437 438
         params.act_name = this.form.act_name
438 439
         params.act_content = this.$refs.neditor.content
@@ -451,12 +452,12 @@
451 452
       },
452 453
       getArticleType(){
453 454
         getArticleType().then(response =>{
454
-            console.log("好嗨我")
455
+            //console.log("好嗨我")
455 456
             if(response.data.state === 1){
456 457
             var category = response.data.data.category
457 458
             this.options = response.data.data.category
458
-             console.log("文章内容:",category)
459
-             console.log("文章",this.options)
459
+            // console.log("文章内容:",category)
460
+            // console.log("文章",this.options)
460 461
             }
461 462
         })
462 463
       },

+ 2 - 2
src/scrm_pages/members/members.vue ファイルの表示

@@ -218,6 +218,7 @@
218 218
                 console.log("res是谁?",res)
219 219
                 if(res.state == 1) {
220 220
                     this.membersData = res.data.members;
221
+                    console.log("会员管理的数据",this.membersData)
221 222
                     this.total = res.data.total;
222 223
                     if(typeof(res.data.cards) != 'undefined') {
223 224
                         this.levelCards = res.data.cards;
@@ -367,9 +368,8 @@
367 368
                   this.memberData.ill_date = uParseTime(row.ill_date, "{y}-{m}-{d}");
368 369
               } else if (key in row) {
369 370
                   this.memberData[key] = row[key];                  
370
-              }
371
+              }            
371 372
           }
372
-          
373 373
           // this.memberData = row;
374 374
           this.memberIndex = index;
375 375
           this.$refs.editMemberForm.open();