傅行帆 5 anos atrás
pai
commit
e181bf3d26

+ 10
- 2
foyo-service/src/main/java/com/huiju/foyo/controller/TaCaseController.java Ver arquivo

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.foyo.common.BaseController;
7
+import com.huiju.foyo.common.ConstantFoyo;
7 8
 import com.huiju.foyo.common.ResponseBean;
8 9
 import com.huiju.foyo.model.TaCase;
9 10
 import com.huiju.foyo.service.ITaCaseService;
@@ -18,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestParam;
18 19
 import org.springframework.web.bind.annotation.ResponseBody;
19 20
 import org.springframework.web.bind.annotation.RestController;
20 21
 
22
+import java.time.LocalDateTime;
23
+
21 24
 /**
22 25
  * <p>
23 26
     * 案例表  前端控制器
@@ -42,7 +45,7 @@ public class TaCaseController extends BaseController {
42 45
      * @param pageSize
43 46
      * @return
44 47
      */
45
-    @RequestMapping(value="/taCase",method= RequestMethod.GET)
48
+    @RequestMapping(value="/admin/case/list",method= RequestMethod.GET)
46 49
     public ResponseBean taCaseList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47 50
                                    @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
48 51
         ResponseBean responseBean = new ResponseBean();
@@ -50,6 +53,8 @@ public class TaCaseController extends BaseController {
50 53
             //使用分页插件
51 54
 		    IPage<TaCase> pg = new Page<>(pageNum, pageSize);
52 55
             QueryWrapper<TaCase> queryWrapper = new QueryWrapper<>();
56
+            queryWrapper.eq("status", ConstantFoyo.STATUS_EFFECTIVE);
57
+            queryWrapper.orderByDesc("sort");
53 58
             queryWrapper.orderByDesc("create_time");
54 59
 
55 60
             IPage<TaCase> result = iTaCaseService.page(pg, queryWrapper);
@@ -67,10 +72,13 @@ public class TaCaseController extends BaseController {
67 72
      * @param taCase 实体对象
68 73
      * @return
69 74
      */
70
-    @RequestMapping(value="/taCase",method= RequestMethod.POST)
75
+    @RequestMapping(value="/admin/case/add",method= RequestMethod.POST)
71 76
     public ResponseBean taCaseAdd(@RequestBody TaCase taCase){
72 77
         ResponseBean responseBean = new ResponseBean();
73 78
         try {
79
+            taCase.setStatus(ConstantFoyo.STATUS_EFFECTIVE);
80
+            taCase.setCreateBy(ConstantFoyo.USER_ADMIN);
81
+            taCase.setCreateTime(LocalDateTime.now());
74 82
             if (iTaCaseService.save(taCase)){
75 83
                 responseBean.addSuccess(taCase);
76 84
             }else {

+ 19
- 0
foyo-service/src/main/java/com/huiju/foyo/controller/TaCaseTypeController.java Ver arquivo

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.foyo.common.BaseController;
7
+import com.huiju.foyo.common.ConstantFoyo;
7 8
 import com.huiju.foyo.common.ResponseBean;
8 9
 import com.huiju.foyo.model.TaCaseType;
9 10
 import com.huiju.foyo.service.ITaCaseTypeService;
@@ -146,4 +147,22 @@ public class TaCaseTypeController extends BaseController {
146 147
         }
147 148
         return responseBean;
148 149
     }
150
+    
151
+    /**
152
+     * 查询列表
153
+     */
154
+    @RequestMapping(value="/admin/caseType/list",method= RequestMethod.GET)
155
+    public ResponseBean getCaseTypeList(){
156
+        ResponseBean responseBean = new ResponseBean();
157
+        try {
158
+            QueryWrapper<TaCaseType> queryWrapper = new QueryWrapper<>();
159
+            queryWrapper.orderByDesc("create_time");
160
+            responseBean.addSuccess(iTaCaseTypeService.list(queryWrapper));
161
+        }catch (Exception e){
162
+            e.printStackTrace();
163
+            logger.error("taCaseTypeList -=- {}",e.toString());
164
+            responseBean.addError(e.getMessage());
165
+        }
166
+        return responseBean;
167
+    }
149 168
 }

+ 1
- 1
foyo-service/src/main/java/com/huiju/foyo/model/TaCase.java Ver arquivo

@@ -95,7 +95,7 @@ public class TaCase implements Serializable {
95 95
     /**
96 96
      * 案例内容
97 97
      */
98
-    private String caseContent;
98
+    private String content;
99 99
 
100 100
 
101 101
 }

+ 1
- 1
foyo.pdman.json Ver arquivo

@@ -414,7 +414,7 @@
414 414
               "chnname": "所属行业"
415 415
             },
416 416
             {
417
-              "name": "case_content",
417
+              "name": "content",
418 418
               "type": "LongText",
419 419
               "remark": "",
420 420
               "chnname": "案例内容"

+ 1
- 0
vue-element-admin/package.json Ver arquivo

@@ -61,6 +61,7 @@
61 61
     "vue-splitpane": "1.0.2",
62 62
     "vuedraggable": "^2.16.0",
63 63
     "vuex": "3.0.1",
64
+    "wangeditor": "^3.1.1",
64 65
     "xlsx": "^0.11.16"
65 66
   },
66 67
   "devDependencies": {

+ 23
- 0
vue-element-admin/src/api/case.js Ver arquivo

@@ -23,3 +23,26 @@ export function deleteServiceBatch(data) {
23 23
     data
24 24
   })
25 25
 }
26
+
27
+export function getCaseListData(query) {
28
+  return request({
29
+    url: '/case/list',
30
+    method: 'get',
31
+    params: query
32
+  })
33
+}
34
+
35
+export function getCaseTypeListData(query) {
36
+  return request({
37
+    url: '/caseType/list',
38
+    method: 'get'
39
+  })
40
+}
41
+
42
+export function addCase(data) {
43
+  return request({
44
+    url: '/case/add',
45
+    method: 'post',
46
+    data
47
+  })
48
+}

+ 77
- 0
vue-element-admin/src/components/Wangeditor/index.vue Ver arquivo

@@ -0,0 +1,77 @@
1
+<template>
2
+    <div id="websiteEditorElem" style="height: 400px"></div>
3
+</template>
4
+
5
+<script>
6
+    import E from 'wangeditor'
7
+    export default {
8
+        name: "index",
9
+        props:[
10
+          'content'
11
+        ],
12
+        watch: {
13
+            text(newVal, oldVal) {
14
+                console.log(newVal, oldVal)
15
+                //this.phoneEditor.txt.html(this.text)
16
+                if (!newVal && oldVal) {
17
+                    this.text = newVal
18
+                    this.intiPhoneEditor()
19
+                }
20
+                this.sendContent()
21
+            }
22
+        },
23
+        data() {
24
+          return {
25
+              text: this.content,
26
+              phoneEditor: ''
27
+          }
28
+        },
29
+        mounted() {
30
+            this.$nextTick(() => {
31
+                this.intiPhoneEditor()
32
+            })
33
+        },
34
+        methods: {
35
+            sendContent() {
36
+                this.$emit('get-content', this.text)
37
+            },
38
+            intiPhoneEditor() {
39
+                console.log('初始化值:', this.text)
40
+                const _that = this
41
+                _that.phoneEditor = new E('#websiteEditorElem')
42
+                const phoneEditor = _that.phoneEditor
43
+                phoneEditor.customConfig.zIndex = 1
44
+                phoneEditor.customConfig.onchange = function (html) {
45
+                    _that.text = html
46
+                }
47
+                // phoneEditor.customConfig.uploadImgServer = this.upFileUrl
48
+                // phoneEditor.customConfig.uploadFileName = 'uploadFiles'
49
+
50
+                // phoneEditor.customConfig.customUploadImg = function (files, insert) {
51
+                //     _that.uploadImg(files[0]).then(data => {
52
+                //         insert(data)
53
+                //     })
54
+                // }
55
+                phoneEditor.customConfig.menus = [
56
+                    'head',  // 标题
57
+                    'bold',  // 粗体
58
+                    'fontSize',  // 字号
59
+                    'fontName',  // 字体
60
+                    'italic',  // 斜体
61
+                    'underline',  // 下划线
62
+                    'strikeThrough',  // 删除线
63
+                    'foreColor',  // 文字颜色
64
+                    'backColor',  // 背景颜色
65
+                    'justify',  // 对齐方式
66
+                    'image',  // 插入图片
67
+                ]
68
+                phoneEditor.create()
69
+                phoneEditor.txt.html(this.text)
70
+            },
71
+        }
72
+    }
73
+</script>
74
+
75
+<style scoped>
76
+
77
+</style>

+ 28
- 1
vue-element-admin/src/store/modules/case.js Ver arquivo

@@ -1,4 +1,4 @@
1
-import { serviceCaseCover, addCaseCover, deleteServiceBatch } from '@/api/case'
1
+import { serviceCaseCover, addCaseCover, getCaseListData, deleteServiceBatch, addCase, getCaseTypeListData } from '@/api/case'
2 2
 
3 3
 const servicecase = {
4 4
   namespaced: true,
@@ -22,6 +22,33 @@ const servicecase = {
22 22
         })
23 23
       })
24 24
     },
25
+    createCase({ commit, state }, data) {
26
+      return new Promise((resolve, reject) => {
27
+        addCase(data).then(response => {
28
+          resolve(response)
29
+        }).catch(error => {
30
+          reject(error)
31
+        })
32
+      })
33
+    },
34
+    getCaseList({ commit, state }, data) {
35
+      return new Promise((resolve, reject) => {
36
+        getCaseListData(data).then(response => {
37
+          resolve(response)
38
+        }).catch(error => {
39
+          reject(error)
40
+        })
41
+      })
42
+    },
43
+    getCaseTypeList({ commit, state }, data) {
44
+      return new Promise((resolve, reject) => {
45
+        getCaseTypeListData(data).then(response => {
46
+          resolve(response)
47
+        }).catch(error => {
48
+          reject(error)
49
+        })
50
+      })
51
+    },
25 52
     deleteService({ commit, state }, data) { // 删除 活动报名人员
26 53
       return new Promise((resolve, reject) => {
27 54
         deleteServiceBatch(data).then(response => {

+ 99
- 32
vue-element-admin/src/views/case/add.vue Ver arquivo

@@ -1,13 +1,10 @@
1 1
 <template>
2 2
   <div id="app" class="app-container">
3 3
     <el-form ref="form" :model="form">
4
-      <el-form-item :label-width="formLabelWidth" label="业务名称">
5
-        <el-input v-model="form.serviceName"/>
4
+      <el-form-item :label-width="formLabelWidth" label="案例标题">
5
+        <el-input v-model="form.caseTitle"/>
6 6
       </el-form-item>
7
-      <el-form-item :label-width="formLabelWidth" label="权重">
8
-        <el-input v-model="form.sort"/>
9
-      </el-form-item>
10
-      <el-form-item :label-width="formLabelWidth" label="banner图">
7
+      <el-form-item :label-width="formLabelWidth" label="案例封面图">
11 8
         <el-upload
12 9
           :action= "uploadImgUrl"
13 10
           :show-file-list="false"
@@ -18,24 +15,42 @@
18 15
           <i v-else class="el-icon-plus avatar-uploader-icon"/>
19 16
         </el-upload>
20 17
       </el-form-item>
18
+      <el-form-item :label-width="formLabelWidth" label="案例简介">
19
+        <el-input v-model="form.caseSummary"/>
20
+      </el-form-item>
21
+      <el-form-item :label-width="formLabelWidth" label="案例类型">
22
+        <el-select v-model="form.taCaseTypeId" placeholder="请选择案例类型">
23
+          <el-option v-for="item in caseTypeList" :key="item.id" :value="item.id" :label="item.typeName"/>
24
+        </el-select>
25
+      </el-form-item>
26
+      <el-form-item :label-width="formLabelWidth" label="案例客户方logo">
27
+        <el-upload
28
+          :action= "uploadImgUrl"
29
+          :show-file-list="false"
30
+          :on-success="handleLogoSuccess"
31
+          class="avatar-uploader"
32
+          name="uploadFiles">
33
+          <img v-if="logoUrl" :src="logoUrl" class="avatar">
34
+          <i v-else class="el-icon-plus avatar-uploader-icon"/>
35
+        </el-upload>
36
+      </el-form-item>
37
+      <el-form-item :label-width="formLabelWidth" label="所属行业">
38
+        <el-input v-model="form.caseIndustry"/>
39
+      </el-form-item>
21 40
       <el-form-item>
22
-        <el-tag
23
-          v-for="tag in dynamicTags"
24
-          :key="tag"
25
-          :disable-transitions="false"
26
-          closable
27
-          @close="handleClose(tag)">
28
-          {{ tag }}
29
-        </el-tag>
30
-        <el-input
31
-          v-if="inputVisible"
32
-          ref="saveTagInput"
33
-          v-model="inputValue"
34
-          size="small"
35
-          class="input-new-tag"
36
-          @keyup.enter.native="handleInputConfirm"
37
-          @blur="handleInputConfirm"/>
38
-        <el-button v-else class="button-new-tag" closable @click="showInput">+ 添加标签</el-button>
41
+        <p class="title">案例内容</p>
42
+        <div id="websiteEditorElem" style="height: 400px"/>
43
+      </el-form-item>
44
+      <el-form-item :label-width="formLabelWidth" label="权重">
45
+        <el-input v-model="form.sort"/>
46
+      </el-form-item>
47
+      <el-form-item :label-width="formLabelWidth" label="是否置顶">
48
+        <el-switch
49
+          v-model="form.topping"
50
+          active-color="#13ce66"
51
+          inactive-color="#ff4949"
52
+          active-value="1"
53
+          inactive-value="0"/>
39 54
       </el-form-item>
40 55
     </el-form>
41 56
     <div slot="footer" class="dialog-footer">
@@ -49,6 +64,7 @@
49 64
 // import { updateArticle, createBanner } from '@/api/banner' // getBanner
50 65
 import waves from '@/directive/waves' // Waves directive
51 66
 import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
67
+import E from 'wangeditor'
52 68
 const calendarTypeOptions = [
53 69
   { key: 'CN', display_name: 'China' },
54 70
   { key: 'US', display_name: 'USA' },
@@ -84,6 +100,7 @@ export default {
84 100
       total: 0,
85 101
       listLoading: true,
86 102
       imageUrl: '', // 图片预览
103
+      logoUrl: '', // 图片预览
87 104
       importanceOptions: [1, 2, 3],
88 105
       calendarTypeOptions,
89 106
       communityQuery: {
@@ -98,10 +115,14 @@ export default {
98 115
       listQuery: [],
99 116
       form: {
100 117
         id: '',
101
-        serviceName: '',
118
+        caseTitle: '',
102 119
         sort: '',
103
-        serviceImageUrl: '',
104
-        labelList: []
120
+        caseCoverImg: '',
121
+        caseLogoImg: '',
122
+        caseSummary: '',
123
+        caseIndustry: '',
124
+        topping: 0,
125
+        content: ''
105 126
       },
106 127
       uploadImgUrl: process.env.BASE_API + '/uploadimage',
107 128
       dialogStatus: '',
@@ -109,6 +130,7 @@ export default {
109 130
       formLabelWidth: '120px',
110 131
       showContentVisible: false,
111 132
       showURLVisible: true,
133
+      caseTypeList: [],
112 134
       bannerPositionArr: [
113 135
         { id: 1, value: '首页banner' },
114 136
         { id: 2, value: '服务banner' }
@@ -118,17 +140,50 @@ export default {
118 140
       inputValue: ''
119 141
     }
120 142
   },
121
-  computed: {
143
+  mounted() {
144
+    const _that = this
145
+    const phoneEditor = new E('#websiteEditorElem')
146
+    phoneEditor.customConfig.zIndex = 1
147
+    phoneEditor.customConfig.onchange = function(html) {
148
+      _that.form.content = html
149
+      console.log('that.dynamic.url', _that.form.content)
150
+    }
151
+    // phoneEditor.customConfig.uploadImgServer = this.upFileUrl
152
+    // phoneEditor.customConfig.uploadFileName = 'uploadFiles'
153
+
154
+    phoneEditor.customConfig.customUploadImg = function(files, insert) {
155
+      _that.uploadImg(files[0]).then(data => {
156
+        insert(data)
157
+      })
158
+    }
159
+    phoneEditor.customConfig.menus = [
160
+      'head', // 标题
161
+      'bold', // 粗体
162
+      'fontSize', // 字号
163
+      'fontName', // 字体
164
+      'italic', // 斜体
165
+      'underline', // 下划线
166
+      'strikeThrough', // 删除线
167
+      'foreColor', // 文字颜色
168
+      'backColor', // 背景颜色
169
+      'justify', // 对齐方式
170
+      'image' // 插入图片
171
+    ]
172
+    phoneEditor.create()
122 173
   },
123 174
   created() {
124
-    this.listQuery = this.$route.params.listQuery
175
+    this.getCaseTypeList()
125 176
   },
126 177
   updated() {
127 178
   },
128 179
   methods: {
129 180
     handleAvatarSuccess(res, file) { // 上传成功回调
130 181
       this.imageUrl = URL.createObjectURL(file.raw)
131
-      this.form.serviceImageUrl = res.data[0]
182
+      this.form.caseCoverImg = res.data[0]
183
+    },
184
+    handleLogoSuccess(res, file) { // 上传成功回调
185
+      this.logoUrl = URL.createObjectURL(file.raw)
186
+      this.form.caseLogoImg = res.data[0]
132 187
     },
133 188
     dialogAddForm() {
134 189
       this.dialogFormVisible = true
@@ -138,7 +193,7 @@ export default {
138 193
     },
139 194
     dialogForm(isVaule) {
140 195
       if (isVaule === '0') {
141
-        this.$router.push({ name: 'service-index' })
196
+        this.$router.push({ name: 'case-index' })
142 197
       } else {
143 198
         this.createData()
144 199
       }
@@ -156,13 +211,13 @@ export default {
156 211
       this.$refs['form'].validate((valid) => {
157 212
         if (valid) {
158 213
           this.form.labelList = this.dynamicTags
159
-          this.$store.dispatch('service/createService', this.form).then((res) => {
214
+          this.$store.dispatch('servicecase/createCase', this.form).then((res) => {
160 215
             if (res.data.code === '0') {
161 216
               this.$message({
162 217
                 message: res.data.message,
163 218
                 type: 'success'
164 219
               })
165
-              this.$router.push({ name: 'service-index' })
220
+              this.$router.push({ name: 'case-index' })
166 221
             } else {
167 222
               this.$message({
168 223
                 message: res.data.message,
@@ -189,12 +244,24 @@ export default {
189 244
       }
190 245
       this.inputVisible = false
191 246
       this.inputValue = ''
247
+    },
248
+    getCaseTypeList() {
249
+      this.$store.dispatch('servicecase/getCaseTypeList', this.form).then((res) => {
250
+        if (res.data.code === '0') {
251
+          this.caseTypeList = res.data.data
252
+        }
253
+      })
192 254
     }
193 255
   }
194 256
 }
195 257
 </script>
196 258
 
197 259
 <style scoped>
260
+.title{
261
+    font-size: 14px;
262
+    color: #606266;
263
+    font-weight: 600;
264
+}
198 265
 .app-container {
199 266
   width: 50%;
200 267
   margin: auto;

+ 16
- 11
vue-element-admin/src/views/case/index.vue Ver arquivo

@@ -11,27 +11,32 @@
11 11
     </el-form>
12 12
     <div class="operation">
13 13
       <div>
14
-        <el-button type="primary" @click="addService">新增业务</el-button>
14
+        <el-button type="primary" @click="addCase">新增案例</el-button>
15 15
         <el-button type="danger" @click="deleteService">删除</el-button>
16 16
       </div>
17 17
     </div>
18 18
     <el-table
19 19
       v-loading="listLoading"
20 20
       ref="multipleTable"
21
-      :data="serviceList"
21
+      :data="caseList"
22 22
       border
23 23
       tooltip-effect="dark"
24 24
       style="width: 100%; margin-top: 20px;"
25 25
       @selection-change="handleSelectionChange">
26 26
       <el-table-column type="selection" width="55" align="center"/>
27
-      <el-table-column label="业务名称" align="center">
27
+      <el-table-column label="案例名称" align="center">
28 28
         <template slot-scope="scope">
29
-          <span>{{ scope.row.serviceName }}</span>
29
+          <span>{{ scope.row.caseTitle }}</span>
30 30
         </template>
31 31
       </el-table-column>
32
-      <el-table-column label="业务图片" align="center">
32
+      <el-table-column label="案例封面图" align="center">
33 33
         <template slot-scope="scope">
34
-          <img v-if="scope.row.serviceImageUrl !== ''" :src="scope.row.serviceImageUrl" width="50" height="50">
34
+          <img v-if="scope.row.caseCoverImg !== ''" :src="scope.row.caseCoverImg" width="50" height="50">
35
+        </template>
36
+      </el-table-column>
37
+      <el-table-column label="案例客户方logo" align="center">
38
+        <template slot-scope="scope">
39
+          <img v-if="scope.row.caseLogoImg !== ''" :src="scope.row.caseLogoImg" width="50" height="50">
35 40
         </template>
36 41
       </el-table-column>
37 42
       <el-table-column label="排序" align="center">
@@ -79,7 +84,7 @@ export default {
79 84
         city: '南京',
80 85
         citylimit: false
81 86
       },
82
-      serviceList: [],
87
+      caseList: [],
83 88
       total: 0,
84 89
       listLoading: true,
85 90
       listQuery: {
@@ -101,9 +106,9 @@ export default {
101 106
     },
102 107
     getList() {
103 108
       this.listLoading = true
104
-      this.$store.dispatch('service/getServiceList', this.listQuery).then((res) => {
109
+      this.$store.dispatch('servicecase/getCaseList', this.listQuery).then((res) => {
105 110
         console.log(res)
106
-        this.serviceList = res.data.data.records
111
+        this.caseList = res.data.data.records
107 112
         this.total = res.data.data.total
108 113
         this.listLoading = false
109 114
       }).catch(() => {
@@ -126,8 +131,8 @@ export default {
126 131
         this.$router.push({ name: 'bill-info', query: { id: billId }})
127 132
       }
128 133
     },
129
-    addService() {
130
-      this.$router.push({ name: 'service-edit' })
134
+    addCase() {
135
+      this.$router.push({ name: 'case-add' })
131 136
     },
132 137
     handleFilter() {
133 138
       this.listQuery.pageNum = 1