dingxin 6 gadus atpakaļ
vecāks
revīzija
907820d838
22 mainītis faili ar 1624 papildinājumiem un 1115 dzēšanām
  1. 2
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKConstant.java
  2. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaVisitorLicenseMapper.java
  3. 3
    3
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaVisitor.java
  4. 32
    6
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpMessage.java
  5. 13
    4
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java
  6. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java
  7. 3
    3
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaVistorServiceImpl.java
  8. 1
    1
      CODE/smart-community/app-api/src/main/resources/mapper/TaVisitorLicenseMapper.xml
  9. 1
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TaVisitorMapper.xml
  10. 7
    3
      CODE/smart-community/app-api/src/main/resources/mapper/TpMessageMapper.xml
  11. 5
    2
      CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java
  12. 45
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/ImageController.java
  13. 0
    1
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToBanner.java
  14. 15
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/ImageServiceI.java
  15. 43
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ImageServiceimpl.java
  16. 5
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToBannerServiceImpl.java
  17. 4
    0
      CODE/smart-community/operate-api/src/main/resources/bootstrap.yml
  18. 105
    0
      VUECODE/smart-operate-manage/src/components/Wangeditor/index.vue
  19. 10
    2
      VUECODE/smart-operate-manage/src/views/banner/addBanner/index.vue
  20. 16
    6
      VUECODE/smart-operate-manage/src/views/banner/ediBanner/index.vue
  21. 656
    540
      文档/MYSQL/smartCommunity.pdb
  22. 656
    540
      文档/MYSQL/smartCommunity.pdm

+ 2
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKConstant.java Parādīt failu

@@ -31,10 +31,10 @@ public class HKConstant {
31 31
      * <p>请将地址配置正确.</p>
32 32
      * <p>默认情况下是127.0.0.1:80 ,如果地址不通请根据实际情况修改IP端口</p>
33 33
      */
34
-   public static final String OPENAPI_IP_PORT_HTTP = "http://192.168.0.122";
34
+   // public static final String OPENAPI_IP_PORT_HTTP = "http://192.168.0.122";
35 35
     //  public static final String OPENAPI_IP_PORT_HTTPS = "http://192.168.0.122";
36 36
     //public static final String OPENAPI_IP_PORT_HTTP = "http://huiju.ngrok.xiaomiqiu.cn";
37
-    //public static final String OPENAPI_IP_PORT_HTTP = "http://huifang.vipgz1.idcfengye.com";
37
+    public static final String OPENAPI_IP_PORT_HTTP = "http://huifang.vipgz1.idcfengye.com";
38 38
 
39 39
     /**
40 40
      * <p>操作用户UUID,即用户UUID,首次使用操作用户UUID可以通过接口 [获取默认用户UUID]来获取</p>

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaVisitorLicenseMapper.java Parādīt failu

@@ -21,5 +21,5 @@ public interface TaVisitorLicenseMapper {
21 21
 
22 22
     void insertTaVistorLicense(TaVisitorLicense taVisitorLicense);
23 23
 
24
-    List<Integer> findTaVistorLicenseById(Integer id);
24
+    List<String> findTaVistorLicenseById(Integer id);
25 25
 }

+ 3
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaVisitor.java Parādīt failu

@@ -34,7 +34,7 @@ public class TaVisitor {
34 34
 
35 35
     private Date updateDate;
36 36
 
37
-    private List<Integer> carLicense;
37
+    private List<String> carLicense;
38 38
 
39 39
     public Integer getId() {
40 40
         return id;
@@ -156,11 +156,11 @@ public class TaVisitor {
156 156
         this.updateDate = updateDate;
157 157
     }
158 158
 
159
-    public List<Integer> getCarLicense() {
159
+    public List<String> getCarLicense() {
160 160
         return carLicense;
161 161
     }
162 162
 
163
-    public void setCarLicense(List<Integer> carLicense) {
163
+    public void setCarLicense(List<String> carLicense) {
164 164
         this.carLicense = carLicense;
165 165
     }
166 166
 }

+ 32
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpMessage.java Parādīt failu

@@ -50,9 +50,19 @@ public class TpMessage {
50 50
     private String content;
51 51
     
52 52
     /**
53
-     * 消息图标
53
+     * 已读消息图标
54 54
      */
55
-    private String messageIcon;
55
+    private String readMessageIcon;
56
+    
57
+    /**
58
+     * 未读消息图标
59
+     */
60
+    private String unreadMessageIcon;
61
+    
62
+    /**
63
+     * 消息详情url链接
64
+     */
65
+    private String messageDetailUrl;
56 66
 
57 67
     public Integer getId() {
58 68
         return id;
@@ -214,11 +224,27 @@ public class TpMessage {
214 224
         this.content = content;
215 225
     }
216 226
     
217
-    public String getMessageIcon() {
218
-        return messageIcon;
227
+    public String getReadMessageIcon() {
228
+        return readMessageIcon;
229
+    }
230
+    
231
+    public void setReadMessageIcon(String readMessageIcon) {
232
+        this.readMessageIcon = readMessageIcon;
233
+    }
234
+    
235
+    public String getUnreadMessageIcon() {
236
+        return unreadMessageIcon;
237
+    }
238
+    
239
+    public void setUnreadMessageIcon(String unreadMessageIcon) {
240
+        this.unreadMessageIcon = unreadMessageIcon;
241
+    }
242
+    
243
+    public String getMessageDetailUrl() {
244
+        return messageDetailUrl;
219 245
     }
220 246
     
221
-    public void setMessageIcon(String messageIcon) {
222
-        this.messageIcon = messageIcon;
247
+    public void setMessageDetailUrl(String messageDetailUrl) {
248
+        this.messageDetailUrl = messageDetailUrl;
223 249
     }
224 250
 }

+ 13
- 4
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Parādīt failu

@@ -75,7 +75,8 @@ public class SocialServiceImpl implements SocialServiceI {
75 75
         if (null != allViewNum){
76 76
             tpAnnouncementMapper.updateByPrimaryKeySelective(id, allViewNum);
77 77
         }
78
-        return tpAnnouncementMapper.selectByPrimaryKey(id, communityId);
78
+        TpAnnouncement tpAnnouncement = tpAnnouncementMapper.selectByPrimaryKey(id, communityId);
79
+        return tpAnnouncement;
79 80
     }
80 81
 
81 82
     /**
@@ -289,7 +290,7 @@ public class SocialServiceImpl implements SocialServiceI {
289 290
 
290 291
         if (Constant.EFFECTIVE.equals(taUser.getStatus()) && (Constant.RELATION.equals(sysRole.getRoleName()) || Constant.TENANT.equals(sysRole.getRoleName()) || Constant.OWNER.equals(sysRole.getRoleName()))){
291 292
             tpTransactionMapper.insertSelective(tpTransaction);
292
-            insertTdImage(tpTransaction, imageUrl, userId);
293
+            insertTdImage(tpTransaction, imageUrl, userId,Constant.TRANSACTION);
293 294
             TpTransaction tpTransaction1=tpTransactionMapper.getById(tpTransaction.getId());
294 295
             response.addSuccess(tpTransaction1);
295 296
             return response;
@@ -298,11 +299,19 @@ public class SocialServiceImpl implements SocialServiceI {
298 299
         return response;
299 300
     }
300 301
 
301
-    private void insertTdImage(TpTransaction tpTransaction, String imageUrl, Integer userId) throws IOException {
302
+    /**
303
+     * 图片入库
304
+     * @param tpTransaction
305
+     * @param imageUrl
306
+     * @param userId
307
+     * @param type 服务:service, 公告:announcement , 活动:activity  租赁 : transaction
308
+     * @throws IOException
309
+     */
310
+    private void insertTdImage(TpTransaction tpTransaction, String imageUrl, Integer userId,String type) throws IOException {
302 311
         TdImages tdImages = new TdImages();
303 312
         Integer uuId = tpTransaction.getId();
304 313
         tdImages.setImageUrl(imageUrl);
305
-        tdImages.setType(Constant.SOCIAL);
314
+        tdImages.setType(type);
306 315
         tdImages.setUuid(uuId);
307 316
         tdImages.setCreateUser(userId);
308 317
         tdImages.setCreateTime(new Date());

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Parādīt failu

@@ -137,7 +137,6 @@ public class TaUserServiceImpl implements ITaUserService {
137 137
             TaSysRole taSysRole = taSysRoleMapper.findRoleByUserId(currentUser.getId());
138 138
             taUserVO.setRole(taSysRole.getRoleName());
139 139
             // 人脸是否已录入
140
-            // TODO 这里目前定死为已录入, 后期根据人脸业务做判断
141 140
             // taUserVO.setFace("register");
142 141
             if ("1".equals(currentUser.getFaceStatus())) {
143 142
                 taUserVO.setFace("register");
@@ -405,6 +404,7 @@ public class TaUserServiceImpl implements ITaUserService {
405 404
         user.setStatus(Constant.EFFECTIVE+"");
406 405
         user.setVerifyStatus("1");
407 406
         user.setAcceptAgreementStatus("1");
407
+        user.setFaceStatus("0");
408 408
         user.setRemark("这是业主添加的!");
409 409
         if (StringUtils.isEmpty(userName)) {
410 410
             user.setUserName(user.getLoginName());

+ 3
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaVistorServiceImpl.java Parādīt failu

@@ -57,11 +57,11 @@ public class TaVistorServiceImpl implements TaVistorServiceI {
57 57
         if (Constant.EFFECTIVE.equals(taVisitor.getDrivingStatus())){
58 58
             taVisitorMapper.insertSelective(taVisitor);
59 59
 
60
-            for (Integer taCarLicense : taVisitor.getCarLicense()){
60
+            for (String taCarLicense : taVisitor.getCarLicense()){
61 61
                 TaVisitorLicense taVisitorLicense = new TaVisitorLicense();
62 62
                 taVisitorLicense.setCommunityId(communityId);
63 63
                 taVisitorLicense.setVisitorId(taVisitor.getId());
64
-                taVisitorLicense.setLicense(taCarLicense.toString());
64
+                taVisitorLicense.setLicense(taCarLicense);
65 65
                 taVisitorLicense.setCreateUser(userId);
66 66
                 taVisitorLicense.setCreateDate(new Date());
67 67
                 taVisitorLicense.setUpdateUser(userId);
@@ -84,7 +84,7 @@ public class TaVistorServiceImpl implements TaVistorServiceI {
84 84
 
85 85
         for (TaVisitor taVisitor : taVisitors){
86 86
             if (Constant.EFFECTIVE.equals(taVisitor.getDrivingStatus())){
87
-                List<Integer> taVisitorLicenses = taVisitorLicenseMapper.findTaVistorLicenseById(taVisitor.getId());
87
+                List<String> taVisitorLicenses = taVisitorLicenseMapper.findTaVistorLicenseById(taVisitor.getId());
88 88
                 taVisitor.setCarLicense(taVisitorLicenses);
89 89
             }
90 90
         }

+ 1
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TaVisitorLicenseMapper.xml Parādīt failu

@@ -126,7 +126,7 @@
126 126
     where id = #{id,jdbcType=INTEGER}
127 127
   </update>
128 128
 
129
-  <select id="findTaVistorLicenseById" resultType="java.lang.Integer" parameterType="java.lang.Integer" >
129
+  <select id="findTaVistorLicenseById" resultType="java.lang.String" parameterType="java.lang.Integer" >
130 130
     select
131 131
       license
132 132
     from ta_visitor_license

+ 1
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaVisitorMapper.xml Parādīt failu

@@ -315,5 +315,6 @@
315 315
     from ta_visitor
316 316
     where community_id = #{communityId,jdbcType=INTEGER}
317 317
     and ta_user_id = #{userId,jdbcType=INTEGER}
318
+    order by create_date DESC
318 319
   </select>
319 320
 </mapper>

+ 7
- 3
CODE/smart-community/app-api/src/main/resources/mapper/TpMessageMapper.xml Parādīt failu

@@ -22,7 +22,9 @@
22 22
     <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
23 23
     <result column="ticket_status" property="ticketStatus" jdbcType="VARCHAR" />
24 24
     <result column="content" property="content" jdbcType="VARCHAR" />
25
-    <result column="message_icon" property="messageIcon" jdbcType="VARCHAR" />
25
+    <result column="read_message_icon" property="readMessageIcon" jdbcType="VARCHAR" />
26
+    <result column="unread_message_icon" property="unreadMessageIcon" jdbcType="VARCHAR" />
27
+    <result column="message_detail_url" property="messageDetailUrl" jdbcType="VARCHAR" />
26 28
   </resultMap>
27 29
   <sql id="Base_Column_List" >
28 30
     id, ticket_id,community_id, message_type, advice_type, model_type, uuid, uuid_type, source,
@@ -284,13 +286,15 @@
284 286
         k.status,
285 287
         r.content,
286 288
         d.name as ticket_status,
287
-        y.name as message_icon
289
+        i.read_message_icon,
290
+		i.unread_message_icon,
291
+		i.message_detail_url
288 292
     FROM
289 293
         tp_message t
290 294
     LEFT JOIN tp_ticket k on t.ticket_id = k.id  AND k.community_id = #{communityId,jdbcType=INTEGER}
291 295
     LEFT JOIN tp_ticket_record r on t.ticket_id = r.ticket_id AND r.community_id = #{communityId,jdbcType=INTEGER}  AND k.status = r.status
292 296
     LEFT JOIN sys_dictionary d on k.status = d.code AND d.group_id = ( SELECT id FROM sys_dictionary WHERE CODE = "ticket_status" )
293
-    LEFT JOIN sys_dictionary y on t.message_type = y.code AND y.group_id = ( SELECT id FROM sys_dictionary WHERE CODE = "message_type_img" )
297
+    LEFT JOIN tp_message_icon i on t.message_type = i.message_type
294 298
     WHERE
295 299
         t.uuid_type = 1
296 300
         AND t.community_id = #{communityId,jdbcType=INTEGER}

+ 5
- 2
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Parādīt failu

@@ -51,12 +51,15 @@ public class Constant {
51 51
     /** 住户APP端待办 **/
52 52
     public static final Integer MODEL_TYPE_UPCOMING = 2;
53 53
 
54
-    /** 社交公告类型**/
54
+    /** 社交/图片 公告类型**/
55 55
     public static final String ANNOUNCEMENT = "announcement";
56 56
 
57
-    /** 社交活动类型**/
57
+    /** 社交/图片 活动类型**/
58 58
     public static final String ACTIVITY = "activity";
59 59
 
60
+    /** 社交/图片 租贷类型**/
61
+    public static final String TRANSACTION = "transaction";
62
+
60 63
     /** 社交二手租赁类型**/
61 64
     public static final String LEASE = "lease";
62 65
 

+ 45
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/ImageController.java Parādīt failu

@@ -0,0 +1,45 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.service.ImageServiceI;
5
+import io.swagger.annotations.Api;
6
+import io.swagger.annotations.ApiOperation;
7
+import io.swagger.annotations.ApiParam;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.cloud.context.config.annotation.RefreshScope;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.RequestMapping;
12
+import org.springframework.web.bind.annotation.RestController;
13
+import org.springframework.web.multipart.MultipartFile;
14
+
15
+import java.util.ArrayList;
16
+import java.util.List;
17
+
18
+/**
19
+ * @author weichaochao
20
+ * @Title: ImageController
21
+ * @Description: 图片上传以及获取url
22
+ * @date 2018/10/31
23
+ */
24
+@RestController
25
+@RefreshScope
26
+@RequestMapping("/")
27
+@Api(value = "图片操作API", description = "图片操作API")
28
+public class ImageController {
29
+
30
+    @Autowired
31
+    private ImageServiceI imageService;
32
+
33
+    @ApiOperation(value = "图片上传以及获取url", notes = "图片上传以及获取url")
34
+    @PostMapping(value = "/uploadimage", consumes = "multipart/*", headers = "content-type=multipart/form-data")
35
+    public ResponseBean uploadImgAndGetUrl(@ApiParam(value = "uploadFiles" ,required = true) MultipartFile[] uploadFiles) throws Exception {
36
+        ResponseBean responseBean = new ResponseBean();
37
+        List<String> urls = new ArrayList<String>();
38
+        for (MultipartFile uploadFile : uploadFiles){
39
+            String url = imageService.getImageUrl(uploadFile);
40
+            urls.add(url);
41
+        }
42
+        responseBean.addSuccess(urls);
43
+        return responseBean;
44
+    }
45
+}

+ 0
- 1
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToBanner.java Parādīt failu

@@ -32,7 +32,6 @@ public class ToBanner {
32 32
     @NotBlank(message = "banner类型不能为空!")
33 33
     private String bannerType;
34 34
 
35
-    @NotBlank(message = "跳转的URL不能为空!")
36 35
     private String externalLink;
37 36
 
38 37
     private String bannerTitle;

+ 15
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/ImageServiceI.java Parādīt failu

@@ -0,0 +1,15 @@
1
+package com.community.huiju.service;
2
+
3
+import org.springframework.web.multipart.MultipartFile;
4
+
5
+import java.io.IOException;
6
+
7
+/**
8
+ * @author admin
9
+ * @Title: ImageServiceI
10
+ * @Description: TODO
11
+ * @date 2018/11/5
12
+ */
13
+public interface ImageServiceI {
14
+    String getImageUrl(MultipartFile uploadFile) throws IOException;
15
+}

+ 43
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ImageServiceimpl.java Parādīt failu

@@ -0,0 +1,43 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.aliyun.oss.OSSClient;
4
+import com.community.huiju.service.ImageServiceI;
5
+import org.springframework.stereotype.Service;
6
+import org.springframework.web.multipart.MultipartFile;
7
+
8
+import java.io.ByteArrayInputStream;
9
+import java.io.IOException;
10
+import java.util.Date;
11
+
12
+/**
13
+ * @author weichaochao
14
+ * @Title: ImageServiceimpl
15
+ * @Description: 获取图片地址实现类
16
+ * @date 2018/11/5
17
+ */
18
+@Service("ImageService")
19
+public class ImageServiceimpl implements ImageServiceI {
20
+
21
+    private static String endpoint = "http://oss-cn-shanghai.aliyuncs.com";
22
+    private static String accessKeyId = "LTAIkc75dpkJw8Lb";
23
+    private static String accessKeySecret = "v4bvXCaix6vSDTCFfwSAdqV53iFEQw";
24
+    private static String bucketName = "jingcheng-h5temp";
25
+
26
+    @Override
27
+    public String getImageUrl(MultipartFile uploadFile) throws IOException {
28
+
29
+        String imgName = System.currentTimeMillis() + ".png";
30
+        // 创建OSSClient实例
31
+        OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
32
+        // 上传
33
+        long time = System.currentTimeMillis();
34
+
35
+        ossClient.putObject(bucketName, imgName, new ByteArrayInputStream(uploadFile.getBytes()));
36
+
37
+        // 关闭client
38
+        ossClient.shutdown();
39
+        Date expiration = new Date(time + 3600 * 1000 * 24 * 365 * 10);
40
+        String url = ossClient.generatePresignedUrl(bucketName, imgName, expiration).toString();
41
+        return url;
42
+    }
43
+}

+ 5
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToBannerServiceImpl.java Parādīt failu

@@ -55,6 +55,11 @@ public class ToBannerServiceImpl implements IToBannerService {
55 55
                 response.addError("Banner内容不能为空");
56 56
                 return response;
57 57
             }
58
+        }else {
59
+            if (StringUtils.isBlank(banner.getExternalLink())) {
60
+                response.addError("跳转URL不能为空");
61
+                return response;
62
+            }
58 63
         }
59 64
 
60 65
         Date effTime = banner.getEffTime();

+ 4
- 0
CODE/smart-community/operate-api/src/main/resources/bootstrap.yml Parādīt failu

@@ -13,6 +13,10 @@ spring:
13 13
         serviceId: config-server
14 14
   session:
15 15
     store-type: jdbc
16
+  servlet:
17
+    multipart:
18
+      max-file-size: 10MB
19
+      max-request-size: 100MB
16 20
 eureka:
17 21
   client:
18 22
     service-url:

+ 105
- 0
VUECODE/smart-operate-manage/src/components/Wangeditor/index.vue Parādīt failu

@@ -0,0 +1,105 @@
1
+<template>
2
+  <div id="wangeditor">
3
+    <div ref="editorElem" style="text-align:left"/>
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+import E from 'wangeditor'
9
+import { mapGetters } from 'vuex'
10
+export default {
11
+  name: 'EditorElem',
12
+  props:['content'], // 接收父组件的方法
13
+  data() {
14
+    return {
15
+      editorContent: this.content, // 内容
16
+      editorObject: ''
17
+    }
18
+  },
19
+  computed: {
20
+    ...mapGetters([
21
+      'token'
22
+    ])
23
+  },
24
+  mounted() {
25
+    this.editorObject = new E(this.$refs.editorElem) // 创建富文本实例
26
+    var editor = this.editorObject
27
+    editor.customConfig.onchange = (html) => {
28
+      this.editorContent = html
29
+      this.childWangeditorValue() // 把这个html通过catchData的方法传入父组件
30
+      // this.catchData(html) // 把这个html通过catchData的方法传入父组件
31
+    }
32
+    editor.customConfig.uploadImgServer = process.env.BASE_API + '/uploadimage'
33
+    editor.customConfig.uploadFileName = 'uploadFiles'
34
+    editor.customConfig.uploadImgHeaders = {
35
+      'Accept': '*/*',
36
+      'Authorization': 'Bearer ' + this.token // 头部token
37
+    }
38
+    editor.customConfig.menus = [ // 菜单配置
39
+      'head',
40
+      'list', // 列表
41
+      'justify', // 对齐方式
42
+      'bold',
43
+      'fontSize', // 字号
44
+      'italic',
45
+      'underline',
46
+      'image', // 插入图片
47
+      'foreColor', // 文字颜色
48
+      'undo', // 撤销
49
+      'redo' // 重复
50
+    ]
51
+    // 下面是最重要的的方法
52
+    editor.customConfig.uploadImgHooks = {
53
+      before: function(xhr, editor, files) {
54
+        // 图片上传之前触发
55
+        // xhr 是 XMLHttpRequst 对象,editor 是编辑器对象,files是选择的图片文件
56
+        // 如果返回的结果是 {prevent: true, msg: 'xxxx'} 则表示用户放弃上传
57
+        // return {
58
+        //     prevent: true,
59
+        //     msg: '放弃上传'
60
+        // }
61
+      },
62
+      success: function(xhr, editor, result) {
63
+        // 图片上传并返回结果,图片插入成功之后触发
64
+        // xhr 是 XMLHttpRequst 对象,editor 是编辑器对象,result 是服务器端返回的结果
65
+        this.imgUrl = Object.values(result.data).toString()
66
+      },
67
+      fail: function(xhr, editor, result) {
68
+        // 图片上传并返回结果,但图片插入错误时触发
69
+        // xhr 是 XMLHttpRequst 对象,editor 是编辑器对象,result 是服务器端返回的结果
70
+      },
71
+      error: function(xhr, editor) {
72
+        // 图片上传出错时触发
73
+        // xhr 是 XMLHttpRequst 对象,editor 是编辑器对象
74
+      },
75
+      timeout: function(xhr, editor) {
76
+        // 图片上传超时时触发
77
+        // xhr 是 XMLHttpRequst 对象,editor 是编辑器对象
78
+      },
79
+      // 如果服务器端返回的不是 {errno:0, data: [...]} 这种格式,可使用该配置
80
+      // (但是,服务器端返回的必须是一个 JSON 格式字符串!!!否则会报错)
81
+      customInsert: function(insertImg, result, editor) {
82
+        // 图片上传并返回结果,自定义插入图片的事件(而不是编辑器自动插入图片!!!)
83
+        // insertImg 是插入图片的函数,editor 是编辑器对象,result 是服务器端返回的结果
84
+        // 举例:假如上传图片成功后,服务器端返回的是 {url:'....'} 这种格式,即可这样插入图片:
85
+        const url = Object.values(result.data)// result.data就是服务器返回的图片名字和链接
86
+        JSON.stringify(url)// 在这里转成JSON格式
87
+        insertImg(url)
88
+        // result 必须是一个 JSON 格式字符串!!!否则报错
89
+      }
90
+    }
91
+    editor.create()
92
+    editor.txt.html(this.editorContent)
93
+  },
94
+  methods: {
95
+    childWangeditorValue() {
96
+      console.log('富文本组件的值:', this.editorContent)
97
+      this.$emit('wangeditorEvent', this.editorContent)
98
+    },
99
+    setWangeditorValue(value) { // 父组件调用此方法传入参数
100
+      this.editorObject.txt.html(value)
101
+    }
102
+  }
103
+}
104
+
105
+</script>

+ 10
- 2
VUECODE/smart-operate-manage/src/views/banner/addBanner/index.vue Parādīt failu

@@ -60,7 +60,10 @@
60 60
           <el-input v-model="addForm.bannerTitle" placeholder="内容标题"/>
61 61
         </el-form-item>
62 62
         <el-form-item :label-width="formLabelWidth" label="内容详情">
63
-          <el-input v-model="addForm.bannerContent" placeholder="内容详情"/>
63
+          <!-- <el-input v-model="addForm.bannerContent" placeholder="内容详情"/> -->
64
+          <div id="father">
65
+            <wangeditor v-on:wangeditorEvent="wangeditorValue"></wangeditor>
66
+          </div>
64 67
         </el-form-item>
65 68
       </div>
66 69
     </el-form>
@@ -76,6 +79,7 @@
76 79
 import { mapState, mapActions } from 'vuex'
77 80
 import waves from '@/directive/waves' // Waves directive
78 81
 import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
82
+import Wangeditor from '@/components/Wangeditor'
79 83
 const calendarTypeOptions = [
80 84
   { key: 'CN', display_name: 'China' },
81 85
   { key: 'US', display_name: 'USA' },
@@ -89,7 +93,7 @@ const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
89 93
 }, {})
90 94
 export default {
91 95
   name: 'AddBanner',
92
-  components: { Pagination },
96
+  components: { Pagination, Wangeditor },
93 97
   directives: { waves },
94 98
   filters: {
95 99
     statusFilter(status) {
@@ -171,6 +175,10 @@ export default {
171 175
       this.addForm.bannerContent = ''
172 176
       this.addForm.bannerDescription = ''
173 177
     },
178
+    wangeditorValue(value){
179
+      console.log("富文本内容:" + value)
180
+      this.addForm.bannerContent = value      //在这里接受子组件传过来的参数,赋值给data里的参数
181
+    },
174 182
     dialogForm(isVaule) {
175 183
       if (isVaule === '0') {
176 184
         this.$router.push({ name: 'banner-index', params: { listQuery: this.listQuery }})

+ 16
- 6
VUECODE/smart-operate-manage/src/views/banner/ediBanner/index.vue Parādīt failu

@@ -1,5 +1,5 @@
1 1
 <template>
2
-  <div class="app-container">
2
+  <div id="app" class="app-container">
3 3
     <el-form ref="form" :model="form">
4 4
       <el-form-item :label-width="formLabelWidth" label="标题">
5 5
         <el-input v-model="form.title"/>
@@ -62,9 +62,11 @@
62 62
         <!-- <el-form-item :label-width="formLabelWidth" label="内容详情">
63 63
           <el-input v-model="form.bannerContent" placeholder="内容详情"/>
64 64
         </el-form-item> -->
65
-        <div id="wangeditor">
66
-          <div ref="editorElem" style="text-align:left"></div>
67
-        </div>  
65
+        <el-form-item :label-width="formLabelWidth" label="内容详情">
66
+          <div id="father">
67
+            <wangeditor ref="refEditor" v-on:wangeditorEvent="wangeditorValue"></wangeditor>
68
+          </div>
69
+        </el-form-item>
68 70
       </div>
69 71
     </el-form>
70 72
     <div slot="footer" class="dialog-footer">
@@ -77,9 +79,9 @@
77 79
 <script>
78 80
 // import { updateArticle, createBanner } from '@/api/banner' // getBanner
79 81
 import { mapState, mapActions } from 'vuex'
80
-import wangeditor from 'wangeditor'
81 82
 import waves from '@/directive/waves' // Waves directive
82 83
 import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
84
+import Wangeditor from '@/components/Wangeditor'
83 85
 const calendarTypeOptions = [
84 86
   { key: 'CN', display_name: 'China' },
85 87
   { key: 'US', display_name: 'USA' },
@@ -93,7 +95,7 @@ const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
93 95
 }, {})
94 96
 export default {
95 97
   name: 'UpdateBanner',
96
-  components: { Pagination },
98
+  components: { Pagination, Wangeditor },
97 99
   directives: { waves },
98 100
   filters: {
99 101
     statusFilter(status) {
@@ -155,6 +157,9 @@ export default {
155 157
     this.getByBannerId(this.$route.params.id)
156 158
     this.listQuery = this.$route.params.listQuery
157 159
   },
160
+  updated() {
161
+    this.$refs.refEditor.setWangeditorValue(this.form.bannerContent)
162
+  },
158 163
   methods: {
159 164
     ...mapActions('community', [
160 165
       'FetchCommunityList',
@@ -176,6 +181,10 @@ export default {
176 181
       this.form.bannerContent = ''
177 182
       this.form.bannerDescription = ''
178 183
     },
184
+    wangeditorValue(value){
185
+      console.log("富文本内容:" + value)
186
+      this.form.bannerContent = value      //在这里接受子组件传过来的参数,赋值给data里的参数
187
+    },
179 188
     dialogForm(isVaule) {
180 189
       if (isVaule === '0') {
181 190
         this.$router.push({ name: 'banner-index', params: { listQuery: this.listQuery }})
@@ -217,6 +226,7 @@ export default {
217 226
     getByBannerId(bannerId) {
218 227
       this.$store.dispatch('GetByBannerId', bannerId).then(res => {
219 228
         this.form = res
229
+        // this.catchData(this.form.bannerContent)
220 230
         this.showContent()
221 231
       })
222 232
     },

+ 656
- 540
文档/MYSQL/smartCommunity.pdb
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 656
- 540
文档/MYSQL/smartCommunity.pdm
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu