Selaa lähdekoodia

Merge branch 'develop'

# Conflicts:
#	文档/MYSQL/smartCommunity.pdb
#	文档/MYSQL/smartCommunity.pdm
傅行帆 6 vuotta sitten
vanhempi
commit
2c998e7ed0
66 muutettua tiedostoa jossa 3971 lisäystä ja 957 poistoa
  1. 59
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/VistorController.java
  2. 25
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaVisitorLicenseMapper.java
  3. 27
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaVisitorMapper.java
  4. 166
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaVisitor.java
  5. 85
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaVisitorLicense.java
  6. 16
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/TaVistorServiceI.java
  7. 73
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaVistorServiceImpl.java
  8. 135
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TaVisitorLicenseMapper.xml
  9. 319
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TaVisitorMapper.xml
  10. 6
    3
      CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java
  11. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class
  12. 16
    6
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/BannerController.java
  13. 20
    6
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/CommunityController.java
  14. 21
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/UserController.java
  15. 9
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToSysRoleMapper.java
  16. 1
    1
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToBanner.java
  17. 42
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToCommunities.java
  18. 2
    1
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/CommunityServiceI.java
  19. 3
    1
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToBannerService.java
  20. 18
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToSysRoleService.java
  21. 7
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToUserService.java
  22. 9
    3
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/CommunityServiceImpl.java
  23. 16
    5
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToBannerServiceImpl.java
  24. 24
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToSysRoleServiceImpl.java
  25. 28
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToUserServerImpl.java
  26. 5
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/vo/ToUserVO.java
  27. 4
    0
      CODE/smart-community/operate-api/src/main/resources/mapper/ToBannerMapper.xml
  28. 6
    2
      CODE/smart-community/operate-api/src/main/resources/mapper/ToCommunitiesMapper.xml
  29. 6
    0
      CODE/smart-community/operate-api/src/main/resources/mapper/ToSysRoleMapper.xml
  30. 2
    3
      CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestAuthenticationEntryPoint.java
  31. 12
    1
      CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestPreAuthenticateProvider.java
  32. 2
    2
      CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestPreAuthenticatedProcessingFilter.java
  33. 1
    1
      CODE/smart-community/zuul/src/main/resources/mapper/ToSysRoleMapper.xml
  34. 4
    1
      VUECODE/smart-operate-manage/package.json
  35. 37
    0
      VUECODE/smart-operate-manage/src/api/banner.js
  36. 25
    0
      VUECODE/smart-operate-manage/src/api/community.js
  37. 3
    3
      VUECODE/smart-operate-manage/src/api/login.js
  38. 1
    1
      VUECODE/smart-operate-manage/src/api/table.js
  39. 99
    0
      VUECODE/smart-operate-manage/src/components/Pagination/index.vue
  40. 49
    0
      VUECODE/smart-operate-manage/src/directive/clipboard/clipboard.js
  41. 13
    0
      VUECODE/smart-operate-manage/src/directive/clipboard/index.js
  42. 77
    0
      VUECODE/smart-operate-manage/src/directive/el-dragDialog/drag.js
  43. 13
    0
      VUECODE/smart-operate-manage/src/directive/el-dragDialog/index.js
  44. 13
    0
      VUECODE/smart-operate-manage/src/directive/permission/index.js
  45. 23
    0
      VUECODE/smart-operate-manage/src/directive/permission/permission.js
  46. 91
    0
      VUECODE/smart-operate-manage/src/directive/sticky.js
  47. 13
    0
      VUECODE/smart-operate-manage/src/directive/waves/index.js
  48. 26
    0
      VUECODE/smart-operate-manage/src/directive/waves/waves.css
  49. 42
    0
      VUECODE/smart-operate-manage/src/directive/waves/waves.js
  50. 1
    0
      VUECODE/smart-operate-manage/src/permission.js
  51. 8
    8
      VUECODE/smart-operate-manage/src/router/index.js
  52. 5
    1
      VUECODE/smart-operate-manage/src/store/index.js
  53. 31
    0
      VUECODE/smart-operate-manage/src/store/modules/banner.js
  54. 84
    0
      VUECODE/smart-operate-manage/src/store/modules/community.js
  55. 4
    4
      VUECODE/smart-operate-manage/src/store/modules/user.js
  56. 1
    1
      VUECODE/smart-operate-manage/src/utils/auth.js
  57. 3
    3
      VUECODE/smart-operate-manage/src/utils/request.js
  58. 50
    0
      VUECODE/smart-operate-manage/src/utils/scrollTo.js
  59. 8
    0
      VUECODE/smart-operate-manage/src/utils/validate.js
  60. 206
    0
      VUECODE/smart-operate-manage/src/vendor/Export2Excel.js
  61. 24
    0
      VUECODE/smart-operate-manage/src/vendor/Export2Zip.js
  62. 494
    0
      VUECODE/smart-operate-manage/src/views/banner/index.vue
  63. 352
    0
      VUECODE/smart-operate-manage/src/views/community/communityTable.vue
  64. 35
    21
      VUECODE/smart-operate-manage/src/views/login/index.vue
  65. 489
    443
      文档/MYSQL/smartCommunity.pdb
  66. 482
    436
      文档/MYSQL/smartCommunity.pdm

+ 59
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/VistorController.java Näytä tiedosto

@@ -0,0 +1,59 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.model.TaVisitor;
7
+import com.community.huiju.service.TaVistorServiceI;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiImplicitParam;
10
+import io.swagger.annotations.ApiImplicitParams;
11
+import io.swagger.annotations.ApiOperation;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.cloud.context.config.annotation.RefreshScope;
14
+import org.springframework.web.bind.annotation.*;
15
+
16
+import javax.servlet.http.HttpSession;
17
+import java.util.List;
18
+
19
+/**
20
+ * @author weichaochao
21
+ * @Title: VistorController
22
+ * @Description: 访客相关API
23
+ * @date 2018/11/1
24
+ */
25
+@RestController
26
+@RefreshScope
27
+@RequestMapping("/")
28
+@Api(value = "访客相关的API", description = "访客相关的API")
29
+public class VistorController {
30
+
31
+    @Autowired
32
+    private TaVistorServiceI vistorServiceI;
33
+
34
+    @RequestMapping(value = "/vistorDetail/{communityId}", method = RequestMethod.POST)
35
+    @ApiOperation(value = "获取访客信息", notes = "获取访客信息")
36
+    @ApiImplicitParams({@ApiImplicitParam(name = "taVisitor", value = "访客", required = true, dataType = "TaVisitor"),
37
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
38
+            @ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id")})
39
+    public ResponseBean findVistorDetail(@PathVariable("communityId")Integer communityId, @RequestBody TaVisitor taVisitor, HttpSession session) {
40
+        ResponseBean responseBean = new ResponseBean();
41
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
42
+        Integer userId = userElement.getId();
43
+        vistorServiceI.insertTaVistor(taVisitor, communityId, userId);
44
+        return  responseBean;
45
+    }
46
+
47
+    @RequestMapping(value = "/invateVistorHis/{communityId}", method = RequestMethod.GET)
48
+    @ApiOperation(value = "邀请历史", notes = "邀请历史")
49
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
50
+            @ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id")})
51
+    public ResponseBean invateHis(@PathVariable("communityId")Integer communityId, HttpSession session) {
52
+        ResponseBean responseBean = new ResponseBean();
53
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
54
+        Integer userId = userElement.getId();
55
+        List<TaVisitor> taVisitors = vistorServiceI.invateHis(communityId, userId);
56
+        responseBean.addSuccess(taVisitors);
57
+        return  responseBean;
58
+    }
59
+}

+ 25
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaVisitorLicenseMapper.java Näytä tiedosto

@@ -0,0 +1,25 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaVisitorLicense;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+import java.util.List;
7
+
8
+@Mapper
9
+public interface TaVisitorLicenseMapper {
10
+    int deleteByPrimaryKey(Integer id);
11
+
12
+    int insert(TaVisitorLicense record);
13
+
14
+    int insertSelective(TaVisitorLicense record);
15
+
16
+    TaVisitorLicense selectByPrimaryKey(Integer id);
17
+
18
+    int updateByPrimaryKeySelective(TaVisitorLicense record);
19
+
20
+    int updateByPrimaryKey(TaVisitorLicense record);
21
+
22
+    void insertTaVistorLicense(TaVisitorLicense taVisitorLicense);
23
+
24
+    List<Integer> findTaVistorLicenseById(Integer id);
25
+}

+ 27
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaVisitorMapper.java Näytä tiedosto

@@ -0,0 +1,27 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaVisitor;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+@Mapper
10
+public interface TaVisitorMapper {
11
+    int deleteByPrimaryKey(Integer id);
12
+
13
+    int insert(TaVisitor record);
14
+
15
+    int insertSelective(TaVisitor record);
16
+
17
+    TaVisitor selectByPrimaryKey(Integer id);
18
+
19
+    int updateByPrimaryKeySelective(TaVisitor record);
20
+
21
+    int updateByPrimaryKey(TaVisitor record);
22
+
23
+    void insertVistorAndLicense();
24
+
25
+    List<TaVisitor> findAllVistors(@Param("communityId") Integer communityId, @Param("userId") Integer userId);
26
+
27
+}

+ 166
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaVisitor.java Näytä tiedosto

@@ -0,0 +1,166 @@
1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+import java.util.List;
5
+
6
+public class TaVisitor {
7
+    private Integer id;
8
+
9
+    private Integer communityId;
10
+
11
+    private String visitorName;
12
+
13
+    private String visitorTel;
14
+
15
+    private String visitorNum;
16
+
17
+    private Date visitorStatrtTime;
18
+
19
+    private Integer visitorEndTime;
20
+
21
+    private String drivingStatus;
22
+
23
+    private String payEntity;
24
+
25
+    private String visitorCode;
26
+
27
+    private Integer taUserId;
28
+
29
+    private Integer createUser;
30
+
31
+    private Date createDate;
32
+
33
+    private Integer updateUser;
34
+
35
+    private Date updateDate;
36
+
37
+    private List<Integer> carLicense;
38
+
39
+    public Integer getId() {
40
+        return id;
41
+    }
42
+
43
+    public void setId(Integer id) {
44
+        this.id = id;
45
+    }
46
+
47
+    public Integer getCommunityId() {
48
+        return communityId;
49
+    }
50
+
51
+    public void setCommunityId(Integer communityId) {
52
+        this.communityId = communityId;
53
+    }
54
+
55
+    public String getVisitorName() {
56
+        return visitorName;
57
+    }
58
+
59
+    public void setVisitorName(String visitorName) {
60
+        this.visitorName = visitorName == null ? null : visitorName.trim();
61
+    }
62
+
63
+    public String getVisitorTel() {
64
+        return visitorTel;
65
+    }
66
+
67
+    public void setVisitorTel(String visitorTel) {
68
+        this.visitorTel = visitorTel == null ? null : visitorTel.trim();
69
+    }
70
+
71
+    public String getVisitorNum() {
72
+        return visitorNum;
73
+    }
74
+
75
+    public void setVisitorNum(String visitorNum) {
76
+        this.visitorNum = visitorNum == null ? null : visitorNum.trim();
77
+    }
78
+
79
+    public Date getVisitorStatrtTime() {
80
+        return visitorStatrtTime;
81
+    }
82
+
83
+    public void setVisitorStatrtTime(Date visitorStatrtTime) {
84
+        this.visitorStatrtTime = visitorStatrtTime;
85
+    }
86
+
87
+    public Integer getVisitorEndTime() {
88
+        return visitorEndTime;
89
+    }
90
+
91
+    public void setVisitorEndTime(Integer visitorEndTime) {
92
+        this.visitorEndTime = visitorEndTime;
93
+    }
94
+
95
+    public String getDrivingStatus() {
96
+        return drivingStatus;
97
+    }
98
+
99
+    public void setDrivingStatus(String drivingStatus) {
100
+        this.drivingStatus = drivingStatus == null ? null : drivingStatus.trim();
101
+    }
102
+
103
+    public String getPayEntity() {
104
+        return payEntity;
105
+    }
106
+
107
+    public void setPayEntity(String payEntity) {
108
+        this.payEntity = payEntity == null ? null : payEntity.trim();
109
+    }
110
+
111
+    public String getVisitorCode() {
112
+        return visitorCode;
113
+    }
114
+
115
+    public void setVisitorCode(String visitorCode) {
116
+        this.visitorCode = visitorCode == null ? null : visitorCode.trim();
117
+    }
118
+
119
+    public Integer getTaUserId() {
120
+        return taUserId;
121
+    }
122
+
123
+    public void setTaUserId(Integer taUserId) {
124
+        this.taUserId = taUserId;
125
+    }
126
+
127
+    public Integer getCreateUser() {
128
+        return createUser;
129
+    }
130
+
131
+    public void setCreateUser(Integer createUser) {
132
+        this.createUser = createUser;
133
+    }
134
+
135
+    public Date getCreateDate() {
136
+        return createDate;
137
+    }
138
+
139
+    public void setCreateDate(Date createDate) {
140
+        this.createDate = createDate;
141
+    }
142
+
143
+    public Integer getUpdateUser() {
144
+        return updateUser;
145
+    }
146
+
147
+    public void setUpdateUser(Integer updateUser) {
148
+        this.updateUser = updateUser;
149
+    }
150
+
151
+    public Date getUpdateDate() {
152
+        return updateDate;
153
+    }
154
+
155
+    public void setUpdateDate(Date updateDate) {
156
+        this.updateDate = updateDate;
157
+    }
158
+
159
+    public List<Integer> getCarLicense() {
160
+        return carLicense;
161
+    }
162
+
163
+    public void setCarLicense(List<Integer> carLicense) {
164
+        this.carLicense = carLicense;
165
+    }
166
+}

+ 85
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaVisitorLicense.java Näytä tiedosto

@@ -0,0 +1,85 @@
1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+
5
+public class TaVisitorLicense {
6
+    private Integer id;
7
+
8
+    private Integer communityId;
9
+
10
+    private Integer visitorId;
11
+
12
+    private String license;
13
+
14
+    private Integer createUser;
15
+
16
+    private Date createDate;
17
+
18
+    private Integer updateUser;
19
+
20
+    private Date updateDate;
21
+
22
+    public Integer getId() {
23
+        return id;
24
+    }
25
+
26
+    public void setId(Integer id) {
27
+        this.id = id;
28
+    }
29
+
30
+    public Integer getCommunityId() {
31
+        return communityId;
32
+    }
33
+
34
+    public void setCommunityId(Integer communityId) {
35
+        this.communityId = communityId;
36
+    }
37
+
38
+    public Integer getVisitorId() {
39
+        return visitorId;
40
+    }
41
+
42
+    public void setVisitorId(Integer visitorId) {
43
+        this.visitorId = visitorId;
44
+    }
45
+
46
+    public String getLicense() {
47
+        return license;
48
+    }
49
+
50
+    public void setLicense(String license) {
51
+        this.license = license == null ? null : license.trim();
52
+    }
53
+
54
+    public Integer getCreateUser() {
55
+        return createUser;
56
+    }
57
+
58
+    public void setCreateUser(Integer createUser) {
59
+        this.createUser = createUser;
60
+    }
61
+
62
+    public Date getCreateDate() {
63
+        return createDate;
64
+    }
65
+
66
+    public void setCreateDate(Date createDate) {
67
+        this.createDate = createDate;
68
+    }
69
+
70
+    public Integer getUpdateUser() {
71
+        return updateUser;
72
+    }
73
+
74
+    public void setUpdateUser(Integer updateUser) {
75
+        this.updateUser = updateUser;
76
+    }
77
+
78
+    public Date getUpdateDate() {
79
+        return updateDate;
80
+    }
81
+
82
+    public void setUpdateDate(Date updateDate) {
83
+        this.updateDate = updateDate;
84
+    }
85
+}

+ 16
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/TaVistorServiceI.java Näytä tiedosto

@@ -0,0 +1,16 @@
1
+package com.community.huiju.service;
2
+
3
+import com.community.huiju.model.TaVisitor;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ * @author weichaochao
9
+ * @Title: TaVistorServiceI
10
+ * @Description: 访客相关service
11
+ * @date 2018/11/1
12
+ */
13
+public interface TaVistorServiceI {
14
+    void insertTaVistor(TaVisitor taVisitor, Integer communityId, Integer userId);
15
+    List<TaVisitor> invateHis(Integer communityId, Integer userId);
16
+}

+ 73
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaVistorServiceImpl.java Näytä tiedosto

@@ -0,0 +1,73 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.huiju.dao.TaVisitorLicenseMapper;
5
+import com.community.huiju.dao.TaVisitorMapper;
6
+import com.community.huiju.model.TaVisitor;
7
+import com.community.huiju.model.TaVisitorLicense;
8
+import com.community.huiju.service.TaVistorServiceI;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.stereotype.Service;
11
+
12
+import java.util.Date;
13
+import java.util.List;
14
+
15
+/**
16
+ * @author weichaochao
17
+ * @Title: TaVistorServiceImpl
18
+ * @Description: 访客实现类
19
+ * @date 2018/11/1
20
+ */
21
+@Service("TaVistorServiceImpl")
22
+public class TaVistorServiceImpl implements TaVistorServiceI {
23
+
24
+    @Autowired
25
+    private TaVisitorMapper taVisitorMapper;
26
+
27
+    @Autowired
28
+    private TaVisitorLicenseMapper taVisitorLicenseMapper;
29
+
30
+    @Override
31
+    public void insertTaVistor(TaVisitor taVisitor, Integer communityId, Integer userId) {
32
+
33
+        //todo 推送到海康然后返回给我们一个vistor_code,暂未提供
34
+
35
+        taVisitor.setTaUserId(userId);
36
+        taVisitor.setUpdateUser(userId);
37
+        taVisitor.setCreateUser(userId);
38
+        taVisitor.setCreateDate(new Date());
39
+        taVisitor.setUpdateDate(new Date());
40
+
41
+        if (Constant.EFFECTIVE.equals(taVisitor.getDrivingStatus())){
42
+            taVisitorMapper.insertSelective(taVisitor);
43
+
44
+            for (Integer taCarLicense : taVisitor.getCarLicense()){
45
+                TaVisitorLicense taVisitorLicense = new TaVisitorLicense();
46
+                taVisitorLicense.setCommunityId(communityId);
47
+                taVisitorLicense.setVisitorId(taVisitor.getId());
48
+                taVisitorLicense.setLicense(taCarLicense.toString());
49
+                taVisitorLicense.setCreateUser(userId);
50
+                taVisitorLicense.setCreateDate(new Date());
51
+                taVisitorLicense.setUpdateUser(userId);
52
+                taVisitorLicense.setUpdateDate(new Date());
53
+                taVisitorLicenseMapper.insertSelective(taVisitorLicense);
54
+            }
55
+        } else{
56
+            taVisitorMapper.insertSelective(taVisitor);
57
+        }
58
+
59
+
60
+    }
61
+
62
+    @Override
63
+    public List<TaVisitor> invateHis(Integer communityId, Integer userId) {
64
+        List<TaVisitor> taVisitors = taVisitorMapper.findAllVistors(communityId, userId);
65
+        for (TaVisitor taVisitor : taVisitors){
66
+            if (Constant.EFFECTIVE.equals(taVisitor.getDrivingStatus())){
67
+                List<Integer> taVisitorLicenses = taVisitorLicenseMapper.findTaVistorLicenseById(taVisitor.getId());
68
+                taVisitor.setCarLicense(taVisitorLicenses);
69
+            }
70
+        }
71
+        return taVisitors;
72
+    }
73
+}

+ 135
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaVisitorLicenseMapper.xml Näytä tiedosto

@@ -0,0 +1,135 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.community.huiju.dao.TaVisitorLicenseMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TaVisitorLicense" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="visitor_id" property="visitorId" jdbcType="INTEGER" />
8
+    <result column="license" property="license" jdbcType="VARCHAR" />
9
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
10
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
11
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
12
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
13
+  </resultMap>
14
+  <sql id="Base_Column_List" >
15
+    id, community_id, visitor_id, license, create_user, create_date, update_user, update_date
16
+  </sql>
17
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
18
+    select 
19
+    <include refid="Base_Column_List" />
20
+    from ta_visitor_license
21
+    where id = #{id,jdbcType=INTEGER}
22
+  </select>
23
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
24
+    delete from ta_visitor_license
25
+    where id = #{id,jdbcType=INTEGER}
26
+  </delete>
27
+  <insert id="insert" parameterType="com.community.huiju.model.TaVisitorLicense" >
28
+    insert into ta_visitor_license (id, community_id, visitor_id, 
29
+      license, create_user, create_date, 
30
+      update_user, update_date)
31
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{visitorId,jdbcType=INTEGER}, 
32
+      #{license,jdbcType=VARCHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, 
33
+      #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP})
34
+  </insert>
35
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TaVisitorLicense" >
36
+    insert into ta_visitor_license
37
+    <trim prefix="(" suffix=")" suffixOverrides="," >
38
+      <if test="id != null" >
39
+        id,
40
+      </if>
41
+      <if test="communityId != null" >
42
+        community_id,
43
+      </if>
44
+      <if test="visitorId != null" >
45
+        visitor_id,
46
+      </if>
47
+      <if test="license != null" >
48
+        license,
49
+      </if>
50
+      <if test="createUser != null" >
51
+        create_user,
52
+      </if>
53
+      <if test="createDate != null" >
54
+        create_date,
55
+      </if>
56
+      <if test="updateUser != null" >
57
+        update_user,
58
+      </if>
59
+      <if test="updateDate != null" >
60
+        update_date,
61
+      </if>
62
+    </trim>
63
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
64
+      <if test="id != null" >
65
+        #{id,jdbcType=INTEGER},
66
+      </if>
67
+      <if test="communityId != null" >
68
+        #{communityId,jdbcType=INTEGER},
69
+      </if>
70
+      <if test="visitorId != null" >
71
+        #{visitorId,jdbcType=INTEGER},
72
+      </if>
73
+      <if test="license != null" >
74
+        #{license,jdbcType=VARCHAR},
75
+      </if>
76
+      <if test="createUser != null" >
77
+        #{createUser,jdbcType=INTEGER},
78
+      </if>
79
+      <if test="createDate != null" >
80
+        #{createDate,jdbcType=TIMESTAMP},
81
+      </if>
82
+      <if test="updateUser != null" >
83
+        #{updateUser,jdbcType=INTEGER},
84
+      </if>
85
+      <if test="updateDate != null" >
86
+        #{updateDate,jdbcType=TIMESTAMP},
87
+      </if>
88
+    </trim>
89
+  </insert>
90
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaVisitorLicense" >
91
+    update ta_visitor_license
92
+    <set >
93
+      <if test="communityId != null" >
94
+        community_id = #{communityId,jdbcType=INTEGER},
95
+      </if>
96
+      <if test="visitorId != null" >
97
+        visitor_id = #{visitorId,jdbcType=INTEGER},
98
+      </if>
99
+      <if test="license != null" >
100
+        license = #{license,jdbcType=VARCHAR},
101
+      </if>
102
+      <if test="createUser != null" >
103
+        create_user = #{createUser,jdbcType=INTEGER},
104
+      </if>
105
+      <if test="createDate != null" >
106
+        create_date = #{createDate,jdbcType=TIMESTAMP},
107
+      </if>
108
+      <if test="updateUser != null" >
109
+        update_user = #{updateUser,jdbcType=INTEGER},
110
+      </if>
111
+      <if test="updateDate != null" >
112
+        update_date = #{updateDate,jdbcType=TIMESTAMP},
113
+      </if>
114
+    </set>
115
+    where id = #{id,jdbcType=INTEGER}
116
+  </update>
117
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TaVisitorLicense" >
118
+    update ta_visitor_license
119
+    set community_id = #{communityId,jdbcType=INTEGER},
120
+      visitor_id = #{visitorId,jdbcType=INTEGER},
121
+      license = #{license,jdbcType=VARCHAR},
122
+      create_user = #{createUser,jdbcType=INTEGER},
123
+      create_date = #{createDate,jdbcType=TIMESTAMP},
124
+      update_user = #{updateUser,jdbcType=INTEGER},
125
+      update_date = #{updateDate,jdbcType=TIMESTAMP}
126
+    where id = #{id,jdbcType=INTEGER}
127
+  </update>
128
+
129
+  <select id="findTaVistorLicenseById" resultType="java.lang.Integer" parameterType="java.lang.Integer" >
130
+    select
131
+      license
132
+    from ta_visitor_license
133
+    where visitor_id = #{id,jdbcType=INTEGER}
134
+  </select>
135
+</mapper>

+ 319
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaVisitorMapper.xml Näytä tiedosto

@@ -0,0 +1,319 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.community.huiju.dao.TaVisitorMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TaVisitor" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="visitor_name" property="visitorName" jdbcType="VARCHAR" />
8
+    <result column="visitor_tel" property="visitorTel" jdbcType="VARCHAR" />
9
+    <result column="visitor_num" property="visitorNum" jdbcType="VARCHAR" />
10
+    <result column="visitor_statrt_time" property="visitorStatrtTime" jdbcType="TIMESTAMP" />
11
+    <result column="visitor_end_time" property="visitorEndTime" jdbcType="INTEGER" />
12
+    <result column="driving_status" property="drivingStatus" jdbcType="CHAR" />
13
+    <result column="pay_entity" property="payEntity" jdbcType="VARCHAR" />
14
+    <result column="visitor_code" property="visitorCode" jdbcType="VARCHAR" />
15
+    <result column="ta_user_id" property="taUserId" jdbcType="INTEGER" />
16
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
17
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
18
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
19
+    <result column="update_darte" property="updateDate" jdbcType="TIMESTAMP" />
20
+  </resultMap>
21
+  <sql id="Base_Column_List" >
22
+    id, community_id, visitor_name, visitor_tel, visitor_num, visitor_statrt_time, visitor_end_time, 
23
+    driving_status, pay_entity, visitor_code, ta_user_id, create_user, create_date, update_user, 
24
+    update_darte
25
+  </sql>
26
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
27
+    select 
28
+    <include refid="Base_Column_List" />
29
+    from ta_visitor
30
+    where id = #{id,jdbcType=INTEGER}
31
+  </select>
32
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
33
+    delete from ta_visitor
34
+    where id = #{id,jdbcType=INTEGER}
35
+  </delete>
36
+  <insert id="insert" parameterType="com.community.huiju.model.TaVisitor" >
37
+    insert into ta_visitor (id, community_id, visitor_name, 
38
+      visitor_tel, visitor_num, visitor_statrt_time, 
39
+      visitor_end_time, driving_status, pay_entity, 
40
+      visitor_code, ta_user_id, create_user, 
41
+      create_date, update_user, update_darte
42
+      )
43
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{visitorName,jdbcType=VARCHAR}, 
44
+      #{visitorTel,jdbcType=VARCHAR}, #{visitorNum,jdbcType=VARCHAR}, #{visitorStatrtTime,jdbcType=TIMESTAMP}, 
45
+      #{visitorEndTime,jdbcType=INTEGER}, #{drivingStatus,jdbcType=CHAR}, #{payEntity,jdbcType=VARCHAR}, 
46
+      #{visitorCode,jdbcType=VARCHAR}, #{taUserId,jdbcType=INTEGER}, #{createUser,jdbcType=INTEGER}, 
47
+      #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP}
48
+      )
49
+  </insert>
50
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TaVisitor" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
51
+    insert into ta_visitor
52
+    <trim prefix="(" suffix=")" suffixOverrides="," >
53
+      <if test="id != null" >
54
+        id,
55
+      </if>
56
+      <if test="communityId != null" >
57
+        community_id,
58
+      </if>
59
+      <if test="visitorName != null" >
60
+        visitor_name,
61
+      </if>
62
+      <if test="visitorTel != null" >
63
+        visitor_tel,
64
+      </if>
65
+      <if test="visitorNum != null" >
66
+        visitor_num,
67
+      </if>
68
+      <if test="visitorStatrtTime != null" >
69
+        visitor_statrt_time,
70
+      </if>
71
+      <if test="visitorEndTime != null" >
72
+        visitor_end_time,
73
+      </if>
74
+      <if test="drivingStatus != null" >
75
+        driving_status,
76
+      </if>
77
+      <if test="payEntity != null" >
78
+        pay_entity,
79
+      </if>
80
+      <if test="visitorCode != null" >
81
+        visitor_code,
82
+      </if>
83
+      <if test="taUserId != null" >
84
+        ta_user_id,
85
+      </if>
86
+      <if test="createUser != null" >
87
+        create_user,
88
+      </if>
89
+      <if test="createDate != null" >
90
+        create_date,
91
+      </if>
92
+      <if test="updateUser != null" >
93
+        update_user,
94
+      </if>
95
+      <if test="updateDate != null" >
96
+        update_darte,
97
+      </if>
98
+    </trim>
99
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
100
+      <if test="id != null" >
101
+        #{id,jdbcType=INTEGER},
102
+      </if>
103
+      <if test="communityId != null" >
104
+        #{communityId,jdbcType=INTEGER},
105
+      </if>
106
+      <if test="visitorName != null" >
107
+        #{visitorName,jdbcType=VARCHAR},
108
+      </if>
109
+      <if test="visitorTel != null" >
110
+        #{visitorTel,jdbcType=VARCHAR},
111
+      </if>
112
+      <if test="visitorNum != null" >
113
+        #{visitorNum,jdbcType=VARCHAR},
114
+      </if>
115
+      <if test="visitorStatrtTime != null" >
116
+        #{visitorStatrtTime,jdbcType=TIMESTAMP},
117
+      </if>
118
+      <if test="visitorEndTime != null" >
119
+        #{visitorEndTime,jdbcType=INTEGER},
120
+      </if>
121
+      <if test="drivingStatus != null" >
122
+        #{drivingStatus,jdbcType=CHAR},
123
+      </if>
124
+      <if test="payEntity != null" >
125
+        #{payEntity,jdbcType=VARCHAR},
126
+      </if>
127
+      <if test="visitorCode != null" >
128
+        #{visitorCode,jdbcType=VARCHAR},
129
+      </if>
130
+      <if test="taUserId != null" >
131
+        #{taUserId,jdbcType=INTEGER},
132
+      </if>
133
+      <if test="createUser != null" >
134
+        #{createUser,jdbcType=INTEGER},
135
+      </if>
136
+      <if test="createDate != null" >
137
+        #{createDate,jdbcType=TIMESTAMP},
138
+      </if>
139
+      <if test="updateUser != null" >
140
+        #{updateUser,jdbcType=INTEGER},
141
+      </if>
142
+      <if test="updateDate != null" >
143
+        #{updateDate,jdbcType=TIMESTAMP},
144
+      </if>
145
+    </trim>
146
+  </insert>
147
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaVisitor" >
148
+    update ta_visitor
149
+    <set >
150
+      <if test="communityId != null" >
151
+        community_id = #{communityId,jdbcType=INTEGER},
152
+      </if>
153
+      <if test="visitorName != null" >
154
+        visitor_name = #{visitorName,jdbcType=VARCHAR},
155
+      </if>
156
+      <if test="visitorTel != null" >
157
+        visitor_tel = #{visitorTel,jdbcType=VARCHAR},
158
+      </if>
159
+      <if test="visitorNum != null" >
160
+        visitor_num = #{visitorNum,jdbcType=VARCHAR},
161
+      </if>
162
+      <if test="visitorStatrtTime != null" >
163
+        visitor_statrt_time = #{visitorStatrtTime,jdbcType=TIMESTAMP},
164
+      </if>
165
+      <if test="visitorEndTime != null" >
166
+        visitor_end_time = #{visitorEndTime,jdbcType=INTEGER},
167
+      </if>
168
+      <if test="drivingStatus != null" >
169
+        driving_status = #{drivingStatus,jdbcType=CHAR},
170
+      </if>
171
+      <if test="payEntity != null" >
172
+        pay_entity = #{payEntity,jdbcType=VARCHAR},
173
+      </if>
174
+      <if test="visitorCode != null" >
175
+        visitor_code = #{visitorCode,jdbcType=VARCHAR},
176
+      </if>
177
+      <if test="taUserId != null" >
178
+        ta_user_id = #{taUserId,jdbcType=INTEGER},
179
+      </if>
180
+      <if test="createUser != null" >
181
+        create_user = #{createUser,jdbcType=INTEGER},
182
+      </if>
183
+      <if test="createDate != null" >
184
+        create_date = #{createDate,jdbcType=TIMESTAMP},
185
+      </if>
186
+      <if test="updateUser != null" >
187
+        update_user = #{updateUser,jdbcType=INTEGER},
188
+      </if>
189
+      <if test="updateDate != null" >
190
+        update_darte = #{updateDate,jdbcType=TIMESTAMP},
191
+      </if>
192
+    </set>
193
+    where id = #{id,jdbcType=INTEGER}
194
+  </update>
195
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TaVisitor" >
196
+    update ta_visitor
197
+    set community_id = #{communityId,jdbcType=INTEGER},
198
+      visitor_name = #{visitorName,jdbcType=VARCHAR},
199
+      visitor_tel = #{visitorTel,jdbcType=VARCHAR},
200
+      visitor_num = #{visitorNum,jdbcType=VARCHAR},
201
+      visitor_statrt_time = #{visitorStatrtTime,jdbcType=TIMESTAMP},
202
+      visitor_end_time = #{visitorEndTime,jdbcType=INTEGER},
203
+      driving_status = #{drivingStatus,jdbcType=CHAR},
204
+      pay_entity = #{payEntity,jdbcType=VARCHAR},
205
+      visitor_code = #{visitorCode,jdbcType=VARCHAR},
206
+      ta_user_id = #{taUserId,jdbcType=INTEGER},
207
+      create_user = #{createUser,jdbcType=INTEGER},
208
+      create_date = #{createDate,jdbcType=TIMESTAMP},
209
+      update_user = #{updateUser,jdbcType=INTEGER},
210
+      update_darte = #{updateDate,jdbcType=TIMESTAMP}
211
+    where id = #{id,jdbcType=INTEGER}
212
+  </update>
213
+
214
+  <insert id="insertVistorAndLicense" parameterType="com.community.huiju.model.TaVisitor" >
215
+    insert into ta_visitor
216
+    <trim prefix="(" suffix=")" suffixOverrides="," >
217
+      <if test="id != null" >
218
+        id,
219
+      </if>
220
+      <if test="communityId != null" >
221
+        community_id,
222
+      </if>
223
+      <if test="visitorName != null" >
224
+        visitor_name,
225
+      </if>
226
+      <if test="visitorTel != null" >
227
+        visitor_tel,
228
+      </if>
229
+      <if test="visitorNum != null" >
230
+        visitor_num,
231
+      </if>
232
+      <if test="visitorStatrtTime != null" >
233
+        visitor_statrt_time,
234
+      </if>
235
+      <if test="visitorEndTime != null" >
236
+        visitor_end_time,
237
+      </if>
238
+      <if test="drivingStatus != null" >
239
+        driving_status,
240
+      </if>
241
+      <if test="payEntity != null" >
242
+        pay_entity,
243
+      </if>
244
+      <if test="visitorCode != null" >
245
+        visitor_code,
246
+      </if>
247
+      <if test="taUserId != null" >
248
+        ta_user_id,
249
+      </if>
250
+      <if test="createUser != null" >
251
+        create_user,
252
+      </if>
253
+      <if test="createDate != null" >
254
+        create_date,
255
+      </if>
256
+      <if test="updateUser != null" >
257
+        update_user,
258
+      </if>
259
+      <if test="updateDate != null" >
260
+        update_darte,
261
+      </if>
262
+    </trim>
263
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
264
+      <if test="id != null" >
265
+        #{id,jdbcType=INTEGER},
266
+      </if>
267
+      <if test="communityId != null" >
268
+        #{communityId,jdbcType=INTEGER},
269
+      </if>
270
+      <if test="visitorName != null" >
271
+        #{visitorName,jdbcType=VARCHAR},
272
+      </if>
273
+      <if test="visitorTel != null" >
274
+        #{visitorTel,jdbcType=VARCHAR},
275
+      </if>
276
+      <if test="visitorNum != null" >
277
+        #{visitorNum,jdbcType=VARCHAR},
278
+      </if>
279
+      <if test="visitorStatrtTime != null" >
280
+        #{visitorStatrtTime,jdbcType=TIMESTAMP},
281
+      </if>
282
+      <if test="visitorEndTime != null" >
283
+        #{visitorEndTime,jdbcType=INTEGER},
284
+      </if>
285
+      <if test="drivingStatus != null" >
286
+        #{drivingStatus,jdbcType=CHAR},
287
+      </if>
288
+      <if test="payEntity != null" >
289
+        #{payEntity,jdbcType=VARCHAR},
290
+      </if>
291
+      <if test="visitorCode != null" >
292
+        #{visitorCode,jdbcType=VARCHAR},
293
+      </if>
294
+      <if test="taUserId != null" >
295
+        #{taUserId,jdbcType=INTEGER},
296
+      </if>
297
+      <if test="createUser != null" >
298
+        #{createUser,jdbcType=INTEGER},
299
+      </if>
300
+      <if test="createDate != null" >
301
+        #{createDate,jdbcType=TIMESTAMP},
302
+      </if>
303
+      <if test="updateUser != null" >
304
+        #{updateUser,jdbcType=INTEGER},
305
+      </if>
306
+      <if test="updateDate != null" >
307
+        #{updateDate,jdbcType=TIMESTAMP},
308
+      </if>
309
+    </trim>
310
+  </insert>
311
+
312
+  <select id="findAllVistors" resultMap="BaseResultMap">
313
+    select
314
+    <include refid="Base_Column_List" />
315
+    from ta_visitor
316
+    where community_id = #{communityId,jdbcType=INTEGER}
317
+    and ta_user_id = #{userId,jdbcType=INTEGER}
318
+  </select>
319
+</mapper>

+ 6
- 3
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Näytä tiedosto

@@ -16,7 +16,10 @@ public class Constant {
16 16
     public static final String WEB_USER_SESSION = "webUser";
17 17
 
18 18
     /** 不需要权限的URL身份 **/
19
-    public static final String ROLE_NONE = "ROLE_NONEUSER";
19
+    public static final String ROLE_NONEUSER = "ROLE_NONEUSER";
20
+
21
+    /** 校验出现问题后的默认身份 **/
22
+    public static final String ROLE_NONE = "ROLE_NONE";
20 23
 
21 24
     /** app登陆类型 **/
22 25
     public static final String APP_LOGIN_TYPE = "app";
@@ -60,10 +63,10 @@ public class Constant {
60 63
     /** banner类型公告**/
61 64
     public static final String BANNER = "banner";
62 65
 
63
-    /**有效状态**/
66
+    /**有效状态,开车**/
64 67
     public static final String EFFECTIVE = "1";
65 68
 
66
-    /**无效状态**/
69
+    /**无效状态,不开车**/
67 70
     public static final String INVALID = "0";
68 71
 
69 72
     /**业主角色**/

BIN
CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class Näytä tiedosto


+ 16
- 6
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/BannerController.java Näytä tiedosto

@@ -17,6 +17,9 @@ import org.springframework.web.bind.annotation.*;
17 17
 import javax.servlet.http.HttpSession;
18 18
 import javax.validation.Valid;
19 19
 
20
+/**
21
+ * @author weiximei
22
+ */
20 23
 @RestController
21 24
 @RefreshScope
22 25
 @RequestMapping("/")
@@ -28,10 +31,10 @@ public class BannerController {
28 31
 
29 32
     @ApiOperation(value = "添加Banner",notes = "添加Banner")
30 33
     @ApiImplicitParams({
31
-            @ApiImplicitParam(paramType = "body",dataType = "ToBanner",name = "banner",value = "bannerTitle(标题)," +
34
+            @ApiImplicitParam(paramType = "body",dataType = "ToBanner",name = "banner",value = "title(标题)," +
32 35
                     "sort(权重),bannerCover(图片),bannerPosition(Banner位),communityId(小区)," +
33 36
                     "effTime(生效时间),expTime(失效时间),bannerType(Banner类型),externalLink(Banner的URL)," +
34
-                    "bannerContent(Banner内容)"),
37
+                    ",bannerTitle(内容标题),bannerContent(Banner内容)"),
35 38
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
36 39
     })
37 40
     @RequestMapping(value = "/banner",method = RequestMethod.POST)
@@ -79,11 +82,17 @@ public class BannerController {
79 82
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "bannerTitle",value = "bannerTitle(标题)"),
80 83
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "bannerPosition",value = "bannerPosition(Banner位)"),
81 84
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "bannerDescription",value = "bannerDescription(跳转概述)"),
85
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "communityId",value = "communityId(小区)"),
86
+            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "pageNum", value = "分页第几页"),
87
+            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "pageSize", value = "分页每页长度")
82 88
     })
83 89
     @RequestMapping(value = "/banner/list",method = RequestMethod.GET)
84
-    public ResponseBean getBanner(@RequestParam(value = "bannerTitle") String bannerTitle,
85
-                                  @RequestParam(value = "bannerPosition") Integer bannerPosition,
86
-                                  @RequestParam(value = "bannerDescription") String bannerDescription){
90
+    public ResponseBean getBanner(@RequestParam(value = "bannerTitle", required = false) String bannerTitle,
91
+                                  @RequestParam(value = "bannerPosition", required = false) Integer bannerPosition,
92
+                                  @RequestParam(value = "bannerDescription", required = false) String bannerDescription,
93
+                                  @RequestParam(value = "communityId", required = false) Integer communityId,
94
+                                  @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
95
+                                  @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
87 96
 
88 97
 
89 98
         ResponseBean response = new ResponseBean();
@@ -91,7 +100,8 @@ public class BannerController {
91 100
         banner.setBannerTitle(bannerTitle);
92 101
         banner.setBannerPosition(bannerPosition);
93 102
         banner.setBannerDescription(bannerDescription);
94
-        response = iToBannerService.getBanner(banner);
103
+        banner.setCommunityId(communityId);
104
+        response = iToBannerService.getBanner(banner,pageNum,pageSize);
95 105
         return response;
96 106
     }
97 107
 

+ 20
- 6
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/CommunityController.java Näytä tiedosto

@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam;
17 17
 import org.springframework.web.bind.annotation.RestController;
18 18
 
19 19
 import java.util.List;
20
+import java.util.Map;
20 21
 
21 22
 /**
22 23
  * @author FXF
@@ -33,18 +34,31 @@ public class CommunityController {
33 34
 	
34 35
 	@ApiOperation(value = "根据搜索条件获取小区列表", notes = "根据搜索条件获取小区列表")
35 36
 	@ApiImplicitParams({
36
-			@ApiImplicitParam(paramType = "body", name = "toCommunities", dataType = "String",value =
37
-					"id:社区编号,communityName:社区名称(模糊查询), provinceId:省份id,cityId:城市id,districtId:区县id"),
37
+			@ApiImplicitParam(paramType = "query", dataType = "Integer", name = "communityId", value = "社区编号"),
38
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "communityName", value = "社区名称(模糊查询)"),
39
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "provinceId", value = "省份id"),
40
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "cityId", value = "城市id"),
41
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "districtId", value = "区县id"),
38 42
 			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
39 43
 			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")
40 44
 	})
41
-	@RequestMapping(value = "/communitys",method = RequestMethod.POST)
42
-	public ResponseBean getCommunitys(@RequestBody ToCommunities toCommunities,
45
+	@RequestMapping(value = "/communitys",method = RequestMethod.GET)
46
+	public ResponseBean getCommunitys(@RequestParam(value = "communityId", required = false) Integer communityId,
47
+	                                  @RequestParam(value = "communityName", required = false) String communityName,
48
+	                                  @RequestParam(value = "provinceId", required = false) Integer provinceId,
49
+	                                  @RequestParam(value = "cityId", required = false) Integer cityId,
50
+	                                  @RequestParam(value = "districtId", required = false) Integer districtId,
43 51
 	                                  @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
44 52
 	                                  @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
45 53
 		ResponseBean responseBean = new ResponseBean();
46
-		List<ToCommunities> communitiesList = communityService.getCommunitys(toCommunities,pageNum,pageSize);
47
-		responseBean.addSuccess(communitiesList);
54
+		ToCommunities toCommunities = new ToCommunities();
55
+		toCommunities.setId(communityId);
56
+		toCommunities.setCommunityName(communityName);
57
+		toCommunities.setProvinceId(provinceId);
58
+		toCommunities.setCityId(cityId);
59
+		toCommunities.setDistrictId(districtId);
60
+		Map<String,Object> map = communityService.getCommunitys(toCommunities,pageNum,pageSize);
61
+		responseBean.addSuccess(map);
48 62
 		return responseBean;
49 63
 	}
50 64
 	

+ 21
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/UserController.java Näytä tiedosto

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
4 4
 import com.community.commom.constant.Constant;
5 5
 import com.community.commom.mode.ResponseBean;
6 6
 import com.community.commom.session.UserElement;
7
+import com.community.huiju.model.ToUser;
7 8
 import com.community.huiju.service.IToUserService;
8 9
 import com.community.huiju.vo.ToUserVO;
9 10
 import io.swagger.annotations.Api;
@@ -56,4 +57,24 @@ public class UserController {
56 57
     }
57 58
 
58 59
 
60
+    @ApiOperation(value = "获取用户信息",nickname = "获取用户信息")
61
+    @ApiImplicitParams({
62
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
63
+    })
64
+    @RequestMapping(value = "/user/info",method = RequestMethod.GET)
65
+    public ResponseBean getInfo(HttpSession session) {
66
+        ResponseBean response = new ResponseBean();
67
+
68
+        UserElement userElement = (UserElement) session.getAttribute(Constant.WEB_USER_SESSION);
69
+        if (null == userElement) {
70
+            response.addError("请登录!");
71
+            return response;
72
+        }
73
+
74
+        response = iToUserService.getInfo(userElement.getId());
75
+
76
+        return response;
77
+    }
78
+
79
+
59 80
 }

+ 9
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToSysRoleMapper.java Näytä tiedosto

@@ -3,6 +3,8 @@ package com.community.huiju.dao;
3 3
 import com.community.huiju.model.ToSysRole;
4 4
 import org.apache.ibatis.annotations.Mapper;
5 5
 
6
+import java.util.List;
7
+
6 8
 @Mapper
7 9
 public interface ToSysRoleMapper {
8 10
     int deleteByPrimaryKey(Integer id);
@@ -16,4 +18,11 @@ public interface ToSysRoleMapper {
16 18
     int updateByPrimaryKeySelective(ToSysRole record);
17 19
 
18 20
     int updateByPrimaryKey(ToSysRole record);
21
+
22
+    /**
23
+     * 根据用户ID查询所有角色
24
+     * @param userId
25
+     * @return
26
+     */
27
+    List<ToSysRole> selectRoleByUserId(Integer userId);
19 28
 }

+ 1
- 1
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToBanner.java Näytä tiedosto

@@ -8,6 +8,7 @@ import java.util.Date;
8 8
 public class ToBanner {
9 9
     private Integer id;
10 10
 
11
+    @NotBlank(message = "标题不能为空!")
11 12
     private String title;
12 13
 
13 14
     @Min(value = 0,message = "小区不能为空!")
@@ -33,7 +34,6 @@ public class ToBanner {
33 34
     @NotBlank(message = "跳转的URL不能为空!")
34 35
     private String externalLink;
35 36
 
36
-    @NotBlank(message = "banner标题不能为空!")
37 37
     private String bannerTitle;
38 38
 
39 39
     private Integer createUser;

+ 42
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToCommunities.java Näytä tiedosto

@@ -1,5 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3
+import java.util.Date;
4
+
3 5
 public class ToCommunities {
4 6
     private Integer id;
5 7
 
@@ -20,6 +22,14 @@ public class ToCommunities {
20 22
     private String userName;
21 23
     
22 24
     private String loginName;
25
+    
26
+    private Integer createUser;
27
+    
28
+    private Date createDate;
29
+    
30
+    private Integer updateUser;
31
+    
32
+    private Date updateDate;
23 33
 
24 34
     public Integer getId() {
25 35
         return id;
@@ -100,4 +110,36 @@ public class ToCommunities {
100 110
     public void setLoginName(String loginName) {
101 111
         this.loginName = loginName;
102 112
     }
113
+    
114
+    public Integer getCreateUser() {
115
+        return createUser;
116
+    }
117
+    
118
+    public void setCreateUser(Integer createUser) {
119
+        this.createUser = createUser;
120
+    }
121
+    
122
+    public Date getCreateDate() {
123
+        return createDate;
124
+    }
125
+    
126
+    public void setCreateDate(Date createDate) {
127
+        this.createDate = createDate;
128
+    }
129
+    
130
+    public Integer getUpdateUser() {
131
+        return updateUser;
132
+    }
133
+    
134
+    public void setUpdateUser(Integer updateUser) {
135
+        this.updateUser = updateUser;
136
+    }
137
+    
138
+    public Date getUpdateDate() {
139
+        return updateDate;
140
+    }
141
+    
142
+    public void setUpdateDate(Date updateDate) {
143
+        this.updateDate = updateDate;
144
+    }
103 145
 }

+ 2
- 1
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/CommunityServiceI.java Näytä tiedosto

@@ -3,6 +3,7 @@ package com.community.huiju.service;
3 3
 import com.community.huiju.model.ToCommunities;
4 4
 
5 5
 import java.util.List;
6
+import java.util.Map;
6 7
 
7 8
 public interface CommunityServiceI {
8 9
 	
@@ -13,7 +14,7 @@ public interface CommunityServiceI {
13 14
 	 * @param pageSize
14 15
 	 * @return
15 16
 	 */
16
-	List<ToCommunities> getCommunitys(ToCommunities toCommunities, Integer pageNum, Integer pageSize);
17
+	Map<String,Object> getCommunitys(ToCommunities toCommunities, Integer pageNum, Integer pageSize);
17 18
 	
18 19
 	/**
19 20
 	 * 添加新的小区

+ 3
- 1
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToBannerService.java Näytä tiedosto

@@ -41,8 +41,10 @@ public interface IToBannerService {
41 41
      *
42 42
      *
43 43
      * @param banner
44
+     * @param pageNum
45
+     * @param pageSize
44 46
      * @return
45 47
      */
46
-    ResponseBean getBanner(ToBanner banner);
48
+    ResponseBean getBanner(ToBanner banner, Integer pageNum, Integer pageSize);
47 49
 
48 50
 }

+ 18
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToSysRoleService.java Näytä tiedosto

@@ -0,0 +1,18 @@
1
+package com.community.huiju.service;
2
+
3
+import com.community.huiju.model.ToSysRole;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ * 角色 业务
9
+ * @author weiximei
10
+ */
11
+public interface IToSysRoleService {
12
+    /**
13
+     * 根据用户ID查询所有角色
14
+     * @param userId
15
+     * @return
16
+     */
17
+    List<ToSysRole> selectRoleByUserId(Integer userId);
18
+}

+ 7
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToUserService.java Näytä tiedosto

@@ -16,4 +16,11 @@ public interface IToUserService {
16 16
      */
17 17
     ResponseBean login(String loginName,String code);
18 18
 
19
+    /**
20
+     * 获取用户信息
21
+     * @param userId
22
+     * @return
23
+     */
24
+    ResponseBean getInfo(Integer userId);
25
+
19 26
 }

+ 9
- 3
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/CommunityServiceImpl.java Näytä tiedosto

@@ -8,13 +8,16 @@ import com.community.huiju.model.ToCommunities;
8 8
 import com.community.huiju.model.TpUser;
9 9
 import com.community.huiju.model.TpUserCommunity;
10 10
 import com.community.huiju.service.CommunityServiceI;
11
+import com.github.pagehelper.Page;
11 12
 import com.github.pagehelper.PageHelper;
12 13
 import org.springframework.beans.factory.annotation.Autowired;
13 14
 import org.springframework.stereotype.Service;
14 15
 import org.springframework.transaction.annotation.Transactional;
15 16
 
16 17
 import java.util.Date;
18
+import java.util.HashMap;
17 19
 import java.util.List;
20
+import java.util.Map;
18 21
 
19 22
 /**
20 23
  * @author FXF
@@ -41,12 +44,15 @@ public class CommunityServiceImpl implements CommunityServiceI {
41 44
 	 * @return
42 45
 	 */
43 46
 	@Override
44
-	public List<ToCommunities> getCommunitys(ToCommunities toCommunities, Integer pageNum, Integer pageSize) {
47
+	public Map<String,Object> getCommunitys(ToCommunities toCommunities, Integer pageNum, Integer pageSize) {
45 48
 		//使用分页插件
46
-		PageHelper.startPage(pageNum, pageSize);
49
+		Page page = PageHelper.startPage(pageNum, pageSize);
47 50
 		//获取数据
48 51
 		List<ToCommunities> list = toCommunitiesMapper.selectByCommunityName(toCommunities);
49
-		return list;
52
+		Map<String,Object> map = new HashMap<>();
53
+		map.put("items",list);
54
+		map.put("total",page.getTotal());
55
+		return map;
50 56
 	}
51 57
 	
52 58
 	@Override

+ 16
- 5
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToBannerServiceImpl.java Näytä tiedosto

@@ -12,6 +12,9 @@ import com.community.huiju.model.ToCommunities;
12 12
 import com.community.huiju.model.ToUser;
13 13
 import com.community.huiju.service.IToBannerService;
14 14
 import com.community.huiju.vo.ToBannerVO;
15
+import com.github.pagehelper.Page;
16
+import com.github.pagehelper.PageHelper;
17
+import com.google.common.collect.Maps;
15 18
 import org.apache.commons.lang.StringUtils;
16 19
 import org.springframework.beans.BeanUtils;
17 20
 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,6 +22,7 @@ import org.springframework.stereotype.Service;
19 22
 
20 23
 import java.util.Date;
21 24
 import java.util.List;
25
+import java.util.Map;
22 26
 import java.util.stream.Collectors;
23 27
 
24 28
 /**
@@ -44,7 +48,7 @@ public class ToBannerServiceImpl implements IToBannerService {
44 48
     public ResponseBean addBanner(ToBanner banner,Integer currentUserId) {
45 49
 
46 50
         ResponseBean response = new ResponseBean();
47
-        if (!Constant.BANNER_TYPE_ARTICLE.equals(banner.getBannerType())) {
51
+        if (Constant.BANNER_TYPE_ARTICLE.equals(banner.getBannerType())) {
48 52
             if (StringUtils.isBlank(banner.getBannerContent())) {
49 53
                 response.addError("Banner内容不能为空");
50 54
                 return response;
@@ -129,11 +133,13 @@ public class ToBannerServiceImpl implements IToBannerService {
129 133
     }
130 134
 
131 135
     @Override
132
-    public ResponseBean getBanner(ToBanner banner) {
136
+    public ResponseBean getBanner(ToBanner banner,Integer pageNum, Integer pageSize) {
133 137
 
134 138
         ResponseBean response = new ResponseBean();
135 139
 
140
+        Page<ToBanner> page = PageHelper.startPage(pageNum,pageSize);
136 141
         List<ToBanner> bannerList = toBannerMapper.selectBanner(banner);
142
+
137 143
         List<ToBannerVO> bannerVOList = bannerList.stream().map(e->{
138 144
             ToBannerVO toBannerVO = new ToBannerVO();
139 145
             BeanUtils.copyProperties(e,toBannerVO);
@@ -141,8 +147,10 @@ public class ToBannerServiceImpl implements IToBannerService {
141 147
             ToCommunities toCommunities = toCommunitiesMapper.selectByPrimaryKey(e.getCommunityId());
142 148
             toBannerVO.setCommunityName(toCommunities.getCommunityName());
143 149
 
144
-            SysDictionary sysDictionary = sysDictionaryMapper.selectByPrimaryKey(e.getBannerPosition());
145
-            toBannerVO.setBannerPositionName(sysDictionary.getName());
150
+            // TODO banner位置名称
151
+            //SysDictionary sysDictionary = sysDictionaryMapper.selectByPrimaryKey(e.getBannerPosition());
152
+            //toBannerVO.setBannerPositionName(sysDictionary.getName());
153
+            toBannerVO.setBannerPositionName("首页banner");
146 154
 
147 155
             ToUser toUser = toUserMapper.selectByPrimaryKey(e.getUpdateUser());
148 156
             toBannerVO.setUpdateUserName(toUser.getUserName());
@@ -151,7 +159,10 @@ public class ToBannerServiceImpl implements IToBannerService {
151 159
 
152 160
         }).collect(Collectors.toList());
153 161
 
154
-        response.addSuccess(bannerVOList);
162
+        Map<String,Object> map = Maps.newHashMap();
163
+        map.put("item",bannerVOList);
164
+        map.put("total",page.getTotal());
165
+        response.addSuccess(map);
155 166
 
156 167
         return response;
157 168
     }

+ 24
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToSysRoleServiceImpl.java Näytä tiedosto

@@ -0,0 +1,24 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.community.huiju.dao.ToSysRoleMapper;
4
+import com.community.huiju.model.ToSysRole;
5
+import com.community.huiju.service.IToSysRoleService;
6
+import lombok.extern.slf4j.Slf4j;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.stereotype.Service;
9
+
10
+import java.util.List;
11
+
12
+@Service("iToSysRoleService")
13
+@Slf4j
14
+public class ToSysRoleServiceImpl implements IToSysRoleService {
15
+
16
+    @Autowired
17
+    private ToSysRoleMapper toSysRoleMapper;
18
+
19
+    @Override
20
+    public List<ToSysRole> selectRoleByUserId(Integer userId) {
21
+
22
+        return toSysRoleMapper.selectRoleByUserId(userId);
23
+    }
24
+}

+ 28
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToUserServerImpl.java Näytä tiedosto

@@ -3,7 +3,9 @@ package com.community.huiju.service.impl;
3 3
 import com.community.commom.mode.ResponseBean;
4 4
 import com.community.commom.utils.AccountValidatorUtil;
5 5
 import com.community.huiju.common.code.cache.AppkeyCache;
6
+import com.community.huiju.dao.ToSysRoleMapper;
6 7
 import com.community.huiju.dao.ToUserMapper;
8
+import com.community.huiju.model.ToSysRole;
7 9
 import com.community.huiju.model.ToUser;
8 10
 import com.community.huiju.service.IToUserService;
9 11
 import com.community.huiju.vo.ToUserVO;
@@ -13,6 +15,8 @@ import org.springframework.beans.BeanUtils;
13 15
 import org.springframework.beans.factory.annotation.Autowired;
14 16
 import org.springframework.stereotype.Service;
15 17
 
18
+import java.util.List;
19
+
16 20
 @Service("iToUserServer")
17 21
 @Slf4j
18 22
 public class ToUserServerImpl implements IToUserService {
@@ -20,6 +24,9 @@ public class ToUserServerImpl implements IToUserService {
20 24
     @Autowired
21 25
     private ToUserMapper toUserMapper;
22 26
 
27
+    @Autowired
28
+    private ToSysRoleMapper toSysRoleMapper;
29
+
23 30
     @Override
24 31
     public ResponseBean login(String loginName, String code) {
25 32
 
@@ -52,4 +59,25 @@ public class ToUserServerImpl implements IToUserService {
52 59
         response.addSuccess(userVO);
53 60
         return response;
54 61
     }
62
+
63
+
64
+    @Override
65
+    public ResponseBean getInfo(Integer userId) {
66
+        ResponseBean response = new ResponseBean();
67
+        ToUser toUser = toUserMapper.selectByPrimaryKey(userId);
68
+        if (toUser == null) {
69
+            response.addError("用户不存在!");
70
+            return response;
71
+        }
72
+
73
+        ToUserVO toUserVO = new ToUserVO();
74
+        BeanUtils.copyProperties(toUser,toUserVO);
75
+
76
+        List<ToSysRole> sysRoleList = toSysRoleMapper.selectRoleByUserId(userId);
77
+        toUserVO.setRoles(sysRoleList);
78
+
79
+        response.addSuccess(toUserVO);
80
+
81
+        return response;
82
+    }
55 83
 }

+ 5
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/vo/ToUserVO.java Näytä tiedosto

@@ -1,10 +1,12 @@
1 1
 package com.community.huiju.vo;
2 2
 
3
+import com.community.huiju.model.ToSysRole;
3 4
 import lombok.AllArgsConstructor;
4 5
 import lombok.Data;
5 6
 import lombok.NoArgsConstructor;
6 7
 
7 8
 import java.util.Date;
9
+import java.util.List;
8 10
 
9 11
 /**
10 12
  * @author weiximei
@@ -49,4 +51,7 @@ public class ToUserVO {
49 51
     /** 用户token **/
50 52
     private String token;
51 53
 
54
+    /** 角色 **/
55
+    private List<ToSysRole> roles;
56
+
52 57
 }

+ 4
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/ToBannerMapper.xml Näytä tiedosto

@@ -275,6 +275,10 @@
275 275
       <if test="bannerPosition != null">
276 276
        and banner_position = #{bannerPosition,jdbcType=INTEGER}
277 277
       </if>
278
+      <if test="communityId != null">
279
+       and community_id = #{communityId,jdbcType=INTEGER}
280
+      </if>
278 281
     </trim>
282
+    order by create_user DESC
279 283
   </select>
280 284
 </mapper>

+ 6
- 2
CODE/smart-community/operate-api/src/main/resources/mapper/ToCommunitiesMapper.xml Näytä tiedosto

@@ -12,10 +12,14 @@
12 12
     <result column="latitude" property="latitude" jdbcType="VARCHAR" />
13 13
     <result column="user_name" property="userName" jdbcType="VARCHAR" />
14 14
     <result column="login_name" property="loginName" jdbcType="VARCHAR" />
15
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
16
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
17
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
18
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
15 19
   </resultMap>
16 20
   <sql id="Base_Column_List" >
17
-    id, community_name, community_alias, province_id, city_id, district_id, longitude, 
18
-    latitude,user_name,login_name
21
+    id, community_name, community_alias, province_id, city_id, district_id, longitude,
22
+    latitude,user_name,login_name,create_user,create_date,update_user,update_date
19 23
   </sql>
20 24
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
21 25
     select 

+ 6
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/ToSysRoleMapper.xml Näytä tiedosto

@@ -125,4 +125,10 @@
125 125
       update_date = #{updateDate,jdbcType=TIMESTAMP}
126 126
     where id = #{id,jdbcType=INTEGER}
127 127
   </update>
128
+
129
+  <select id="selectRoleByUserId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
130
+    select
131
+    role.*
132
+     from to_sys_user_role ur left join to_sys_role role on ur.role_id = role.id where ur.user_id=#{userId}
133
+  </select>
128 134
 </mapper>

+ 2
- 3
CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestAuthenticationEntryPoint.java Näytä tiedosto

@@ -35,10 +35,9 @@ public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
35 35
             }else if (Status.RESPONSE_STATUS_803.getValue().equals(headerError)) {
36 36
                 result.addError(Status.RESPONSE_STATUS_803.getValue(),Status.RESPONSE_STATUS_803.getComment());
37 37
             }
38
+        } else {
39
+            result.addError(Status.RESPONSE_STATUS_888.getValue(),Status.RESPONSE_STATUS_888.getComment());
38 40
         }
39
-//        else {
40
-//            result.addError(Status.RESPONSE_STATUS_888.getValue(),Status.RESPONSE_STATUS_888.getComment());
41
-//        }
42 41
 
43 42
         try {
44 43
             //设置跨域请求 请求结果json刷到响应里

+ 12
- 1
CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestPreAuthenticateProvider.java Näytä tiedosto

@@ -1,11 +1,16 @@
1 1
 package com.community.huiju.security;
2 2
 
3
+import com.community.commom.constant.Constant;
3 4
 import com.community.huiju.exception.WisdomSecurityException;
4 5
 import org.springframework.security.authentication.AuthenticationProvider;
5 6
 import org.springframework.security.core.Authentication;
6 7
 import org.springframework.security.core.AuthenticationException;
8
+import org.springframework.security.core.GrantedAuthority;
7 9
 import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
8 10
 
11
+import java.util.Collection;
12
+import java.util.List;
13
+
9 14
 /**
10 15
  * 授权过程
11 16
  *
@@ -18,7 +23,13 @@ public class RestPreAuthenticateProvider implements AuthenticationProvider {
18 23
 
19 24
 
20 25
         TokenAuthrentication tokenAuthrentication = (TokenAuthrentication) authentication.getPrincipal();
21
-        if (null != tokenAuthrentication.getAuthorities() && tokenAuthrentication.getAuthorities().size() > 0) {
26
+        Collection<GrantedAuthority> grantedAuthorityList = tokenAuthrentication.getAuthorities();
27
+        if (null != grantedAuthorityList && grantedAuthorityList.size() > 0) {
28
+             boolean isNone= grantedAuthorityList.stream().anyMatch(e->e.getAuthority().equals(Constant.ROLE_NONE));
29
+             if (isNone) {
30
+                 tokenAuthrentication.setAuthenticated(false);
31
+                 return tokenAuthrentication;
32
+             }
22 33
             tokenAuthrentication.setAuthenticated(true);
23 34
             return tokenAuthrentication;
24 35
         }

+ 2
- 2
CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestPreAuthenticatedProcessingFilter.java Näytä tiedosto

@@ -57,7 +57,7 @@ public class RestPreAuthenticatedProcessingFilter extends AbstractPreAuthenticat
57 57
         // 不需要的拦截请求处理
58 58
         if (isNoneSecurity(request.getRequestURI().toString()) || "OPTIONS".equals(request.getMethod())){
59 59
             GrantedAuthority[] authorities = new GrantedAuthority[1];
60
-            GrantedAuthority roleNone = new SimpleGrantedAuthority(Constant.ROLE_NONE);
60
+            GrantedAuthority roleNone = new SimpleGrantedAuthority(Constant.ROLE_NONEUSER);
61 61
             authorities[0]=roleNone;
62 62
             grantedAuthorityList.add(authorities[0]);
63 63
             return new TokenAuthrentication(grantedAuthorityList);
@@ -89,7 +89,7 @@ public class RestPreAuthenticatedProcessingFilter extends AbstractPreAuthenticat
89 89
         }else {
90 90
             // 校验有问题后, 需要给个角色, 让流程继续下去
91 91
             GrantedAuthority[] authorities = new GrantedAuthority[1];
92
-            GrantedAuthority roleNone = new SimpleGrantedAuthority("ROLE_NONE");
92
+            GrantedAuthority roleNone = new SimpleGrantedAuthority(Constant.ROLE_NONE);
93 93
             authorities[0]=roleNone;
94 94
             grantedAuthorityList.add(authorities[0]);
95 95
         }

+ 1
- 1
CODE/smart-community/zuul/src/main/resources/mapper/ToSysRoleMapper.xml Näytä tiedosto

@@ -129,7 +129,7 @@
129 129
   <select id="selectRoleByUserId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
130 130
     select
131 131
     role.*
132
-     from to_sys_user_role ur left join ta_sys_role role on ur.role_id = role.id where ur.user_id=#{userId}
132
+     from to_sys_user_role ur left join to_sys_role role on ur.role_id = role.id where ur.user_id=#{userId}
133 133
   </select>
134 134
 
135 135
 </mapper>

+ 4
- 1
VUECODE/smart-operate-manage/package.json Näytä tiedosto

@@ -16,12 +16,14 @@
16 16
   "dependencies": {
17 17
     "axios": "0.18.0",
18 18
     "element-ui": "2.4.6",
19
+    "file-saver": "^2.0.0-rc.4",
19 20
     "js-cookie": "2.2.0",
20 21
     "normalize.css": "7.0.0",
21 22
     "nprogress": "0.2.0",
22 23
     "vue": "2.5.17",
23 24
     "vue-router": "3.0.1",
24
-    "vuex": "3.0.1"
25
+    "vuex": "3.0.1",
26
+    "xlsx": "^0.14.0"
25 27
   },
26 28
   "devDependencies": {
27 29
     "autoprefixer": "8.5.0",
@@ -58,6 +60,7 @@
58 60
     "rimraf": "2.6.2",
59 61
     "sass-loader": "7.0.3",
60 62
     "script-ext-html-webpack-plugin": "2.0.1",
63
+    "script-loader": "^0.7.2",
61 64
     "semver": "5.5.0",
62 65
     "shelljs": "0.8.2",
63 66
     "svg-sprite-loader": "3.8.0",

+ 37
- 0
VUECODE/smart-operate-manage/src/api/banner.js Näytä tiedosto

@@ -0,0 +1,37 @@
1
+import request from '@/utils/request'
2
+
3
+export function getBanner(banner) {
4
+  return request({
5
+    url: '/banner/list',
6
+    method: 'get',
7
+    params: banner
8
+  })
9
+}
10
+
11
+export function addBanner(banner) {
12
+  return request({
13
+    url: '/banner',
14
+    method: 'post',
15
+    data: banner
16
+  })
17
+}
18
+
19
+export function updateArticle(...banner) {
20
+  return request({
21
+    url: '/banner/list',
22
+    method: 'get',
23
+    params: {
24
+      ...banner
25
+    }
26
+  })
27
+}
28
+
29
+export function fetchPv(...banner) {
30
+  return request({
31
+    url: '/banner/list',
32
+    method: 'get',
33
+    params: {
34
+      ...banner
35
+    }
36
+  })
37
+}

+ 25
- 0
VUECODE/smart-operate-manage/src/api/community.js Näytä tiedosto

@@ -0,0 +1,25 @@
1
+import request from '@/utils/request'
2
+
3
+export function fetchList(query) {
4
+  return request({
5
+    url: '/communitys',
6
+    method: 'get',
7
+    params: query
8
+  })
9
+}
10
+
11
+export function createCommunity(data) {
12
+  return request({
13
+    url: '/community/add',
14
+    method: 'post',
15
+    data
16
+  })
17
+}
18
+
19
+export function updateCommunity(data) {
20
+  return request({
21
+    url: '/community/update',
22
+    method: 'post',
23
+    data
24
+  })
25
+}

+ 3
- 3
VUECODE/smart-operate-manage/src/api/login.js Näytä tiedosto

@@ -13,11 +13,11 @@ export function login(username, password) {
13 13
   return request(config)
14 14
 }
15 15
 
16
-export function getInfo(token) {
16
+export function getInfo() {
17 17
   return request({
18 18
     url: '/user/info',
19
-    method: 'get',
20
-    params: { token }
19
+    method: 'get'
20
+    // params: { token }
21 21
   })
22 22
 }
23 23
 

+ 1
- 1
VUECODE/smart-operate-manage/src/api/table.js Näytä tiedosto

@@ -2,7 +2,7 @@ import request from '@/utils/request'
2 2
 
3 3
 export function getList(params) {
4 4
   return request({
5
-    url: '/table/list',
5
+    url: '/banner/list',
6 6
     method: 'get',
7 7
     params
8 8
   })

+ 99
- 0
VUECODE/smart-operate-manage/src/components/Pagination/index.vue Näytä tiedosto

@@ -0,0 +1,99 @@
1
+<template>
2
+  <div :class="{'hidden':hidden}" class="pagination-container">
3
+    <el-pagination
4
+      :background="background"
5
+      :current-page.sync="currentPage"
6
+      :page-size.sync="pageSize"
7
+      :layout="layout"
8
+      :total="total"
9
+      v-bind="$attrs"
10
+      @size-change="handleSizeChange"
11
+      @current-change="handleCurrentChange"/>
12
+  </div>
13
+</template>
14
+
15
+<script>
16
+import { scrollTo } from '@/utils/scrollTo'
17
+
18
+export default {
19
+  name: 'Pagination',
20
+  props: {
21
+    total: {
22
+      required: true,
23
+      type: Number
24
+    },
25
+    page: {
26
+      type: Number,
27
+      default: 1
28
+    },
29
+    limit: {
30
+      type: Number,
31
+      default: 20
32
+    },
33
+    pageSizes: {
34
+      type: Array,
35
+      default() {
36
+        return [10, 20, 30, 50]
37
+      }
38
+    },
39
+    layout: {
40
+      type: String,
41
+      default: 'total, sizes, prev, pager, next, jumper'
42
+    },
43
+    background: {
44
+      type: Boolean,
45
+      default: true
46
+    },
47
+    autoScroll: {
48
+      type: Boolean,
49
+      default: true
50
+    },
51
+    hidden: {
52
+      type: Boolean,
53
+      default: false
54
+    }
55
+  },
56
+  computed: {
57
+    currentPage: {
58
+      get() {
59
+        return this.page
60
+      },
61
+      set(val) {
62
+        this.$emit('update:page', val)
63
+      }
64
+    },
65
+    pageSize: {
66
+      get() {
67
+        return this.limit
68
+      },
69
+      set(val) {
70
+        this.$emit('update:limit', val)
71
+      }
72
+    }
73
+  },
74
+  methods: {
75
+    handleSizeChange(val) {
76
+      this.$emit('pagination', { page: this.currentPage, limit: val })
77
+      if (this.autoScroll) {
78
+        scrollTo(0, 800)
79
+      }
80
+    },
81
+    handleCurrentChange(val) {
82
+      this.$emit('pagination', { page: val, limit: this.pageSize })
83
+      if (this.autoScroll) {
84
+        scrollTo(0, 800)
85
+      }
86
+    }
87
+  }
88
+}
89
+</script>
90
+
91
+<style scoped>
92
+.pagination-container {
93
+  background: #fff;
94
+  padding: 32px 16px;
95
+}
96
+.pagination-container.hidden {
97
+  display: none;
98
+}
99
+</style>

+ 49
- 0
VUECODE/smart-operate-manage/src/directive/clipboard/clipboard.js Näytä tiedosto

@@ -0,0 +1,49 @@
1
+// Inspired by https://github.com/Inndy/vue-clipboard2
2
+const Clipboard = require('clipboard')
3
+if (!Clipboard) {
4
+  throw new Error('you should npm install `clipboard` --save at first ')
5
+}
6
+
7
+export default {
8
+  bind(el, binding) {
9
+    if (binding.arg === 'success') {
10
+      el._v_clipboard_success = binding.value
11
+    } else if (binding.arg === 'error') {
12
+      el._v_clipboard_error = binding.value
13
+    } else {
14
+      const clipboard = new Clipboard(el, {
15
+        text() { return binding.value },
16
+        action() { return binding.arg === 'cut' ? 'cut' : 'copy' }
17
+      })
18
+      clipboard.on('success', e => {
19
+        const callback = el._v_clipboard_success
20
+        callback && callback(e) // eslint-disable-line
21
+      })
22
+      clipboard.on('error', e => {
23
+        const callback = el._v_clipboard_error
24
+        callback && callback(e) // eslint-disable-line
25
+      })
26
+      el._v_clipboard = clipboard
27
+    }
28
+  },
29
+  update(el, binding) {
30
+    if (binding.arg === 'success') {
31
+      el._v_clipboard_success = binding.value
32
+    } else if (binding.arg === 'error') {
33
+      el._v_clipboard_error = binding.value
34
+    } else {
35
+      el._v_clipboard.text = function() { return binding.value }
36
+      el._v_clipboard.action = function() { return binding.arg === 'cut' ? 'cut' : 'copy' }
37
+    }
38
+  },
39
+  unbind(el, binding) {
40
+    if (binding.arg === 'success') {
41
+      delete el._v_clipboard_success
42
+    } else if (binding.arg === 'error') {
43
+      delete el._v_clipboard_error
44
+    } else {
45
+      el._v_clipboard.destroy()
46
+      delete el._v_clipboard
47
+    }
48
+  }
49
+}

+ 13
- 0
VUECODE/smart-operate-manage/src/directive/clipboard/index.js Näytä tiedosto

@@ -0,0 +1,13 @@
1
+import Clipboard from './clipboard'
2
+
3
+const install = function(Vue) {
4
+  Vue.directive('Clipboard', Clipboard)
5
+}
6
+
7
+if (window.Vue) {
8
+  window.clipboard = Clipboard
9
+  Vue.use(install); // eslint-disable-line
10
+}
11
+
12
+Clipboard.install = install
13
+export default Clipboard

+ 77
- 0
VUECODE/smart-operate-manage/src/directive/el-dragDialog/drag.js Näytä tiedosto

@@ -0,0 +1,77 @@
1
+export default{
2
+  bind(el, binding, vnode) {
3
+    const dialogHeaderEl = el.querySelector('.el-dialog__header')
4
+    const dragDom = el.querySelector('.el-dialog')
5
+    dialogHeaderEl.style.cssText += ';cursor:move;'
6
+    dragDom.style.cssText += ';top:0px;'
7
+
8
+    // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
9
+    const getStyle = (function() {
10
+      if (window.document.currentStyle) {
11
+        return (dom, attr) => dom.currentStyle[attr]
12
+      } else {
13
+        return (dom, attr) => getComputedStyle(dom, false)[attr]
14
+      }
15
+    })()
16
+
17
+    dialogHeaderEl.onmousedown = (e) => {
18
+      // 鼠标按下,计算当前元素距离可视区的距离
19
+      const disX = e.clientX - dialogHeaderEl.offsetLeft
20
+      const disY = e.clientY - dialogHeaderEl.offsetTop
21
+
22
+      const dragDomWidth = dragDom.offsetWidth
23
+      const dragDomHeight = dragDom.offsetHeight
24
+
25
+      const screenWidth = document.body.clientWidth
26
+      const screenHeight = document.body.clientHeight
27
+
28
+      const minDragDomLeft = dragDom.offsetLeft
29
+      const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth
30
+
31
+      const minDragDomTop = dragDom.offsetTop
32
+      const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomHeight
33
+
34
+      // 获取到的值带px 正则匹配替换
35
+      let styL = getStyle(dragDom, 'left')
36
+      let styT = getStyle(dragDom, 'top')
37
+
38
+      if (styL.includes('%')) {
39
+        styL = +document.body.clientWidth * (+styL.replace(/\%/g, '') / 100)
40
+        styT = +document.body.clientHeight * (+styT.replace(/\%/g, '') / 100)
41
+      } else {
42
+        styL = +styL.replace(/\px/g, '')
43
+        styT = +styT.replace(/\px/g, '')
44
+      }
45
+
46
+      document.onmousemove = function(e) {
47
+        // 通过事件委托,计算移动的距离
48
+        let left = e.clientX - disX
49
+        let top = e.clientY - disY
50
+
51
+        // 边界处理
52
+        if (-(left) > minDragDomLeft) {
53
+          left = -minDragDomLeft
54
+        } else if (left > maxDragDomLeft) {
55
+          left = maxDragDomLeft
56
+        }
57
+
58
+        if (-(top) > minDragDomTop) {
59
+          top = -minDragDomTop
60
+        } else if (top > maxDragDomTop) {
61
+          top = maxDragDomTop
62
+        }
63
+
64
+        // 移动当前元素
65
+        dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`
66
+
67
+        // emit onDrag event
68
+        vnode.child.$emit('dragDialog')
69
+      }
70
+
71
+      document.onmouseup = function(e) {
72
+        document.onmousemove = null
73
+        document.onmouseup = null
74
+      }
75
+    }
76
+  }
77
+}

+ 13
- 0
VUECODE/smart-operate-manage/src/directive/el-dragDialog/index.js Näytä tiedosto

@@ -0,0 +1,13 @@
1
+import drag from './drag'
2
+
3
+const install = function(Vue) {
4
+  Vue.directive('el-drag-dialog', drag)
5
+}
6
+
7
+if (window.Vue) {
8
+  window['el-drag-dialog'] = drag
9
+  Vue.use(install); // eslint-disable-line
10
+}
11
+
12
+drag.install = install
13
+export default drag

+ 13
- 0
VUECODE/smart-operate-manage/src/directive/permission/index.js Näytä tiedosto

@@ -0,0 +1,13 @@
1
+import permission from './permission'
2
+
3
+const install = function(Vue) {
4
+  Vue.directive('permission', permission)
5
+}
6
+
7
+if (window.Vue) {
8
+  window['permission'] = permission
9
+  Vue.use(install); // eslint-disable-line
10
+}
11
+
12
+permission.install = install
13
+export default permission

+ 23
- 0
VUECODE/smart-operate-manage/src/directive/permission/permission.js Näytä tiedosto

@@ -0,0 +1,23 @@
1
+
2
+import store from '@/store'
3
+
4
+export default{
5
+  inserted(el, binding, vnode) {
6
+    const { value } = binding
7
+    const roles = store.getters && store.getters.roles
8
+
9
+    if (value && value instanceof Array && value.length > 0) {
10
+      const permissionRoles = value
11
+
12
+      const hasPermission = roles.some(role => {
13
+        return permissionRoles.includes(role)
14
+      })
15
+
16
+      if (!hasPermission) {
17
+        el.parentNode && el.parentNode.removeChild(el)
18
+      }
19
+    } else {
20
+      throw new Error(`need roles! Like v-permission="['admin','editor']"`)
21
+    }
22
+  }
23
+}

+ 91
- 0
VUECODE/smart-operate-manage/src/directive/sticky.js Näytä tiedosto

@@ -0,0 +1,91 @@
1
+const vueSticky = {}
2
+let listenAction
3
+vueSticky.install = Vue => {
4
+  Vue.directive('sticky', {
5
+    inserted(el, binding) {
6
+      const params = binding.value || {}
7
+      const stickyTop = params.stickyTop || 0
8
+      const zIndex = params.zIndex || 1000
9
+      const elStyle = el.style
10
+
11
+      elStyle.position = '-webkit-sticky'
12
+      elStyle.position = 'sticky'
13
+      // if the browser support css sticky(Currently Safari, Firefox and Chrome Canary)
14
+      // if (~elStyle.position.indexOf('sticky')) {
15
+      //     elStyle.top = `${stickyTop}px`;
16
+      //     elStyle.zIndex = zIndex;
17
+      //     return
18
+      // }
19
+      const elHeight = el.getBoundingClientRect().height
20
+      const elWidth = el.getBoundingClientRect().width
21
+      elStyle.cssText = `top: ${stickyTop}px; z-index: ${zIndex}`
22
+
23
+      const parentElm = el.parentNode || document.documentElement
24
+      const placeholder = document.createElement('div')
25
+      placeholder.style.display = 'none'
26
+      placeholder.style.width = `${elWidth}px`
27
+      placeholder.style.height = `${elHeight}px`
28
+      parentElm.insertBefore(placeholder, el)
29
+
30
+      let active = false
31
+
32
+      const getScroll = (target, top) => {
33
+        const prop = top ? 'pageYOffset' : 'pageXOffset'
34
+        const method = top ? 'scrollTop' : 'scrollLeft'
35
+        let ret = target[prop]
36
+        if (typeof ret !== 'number') {
37
+          ret = window.document.documentElement[method]
38
+        }
39
+        return ret
40
+      }
41
+
42
+      const sticky = () => {
43
+        if (active) {
44
+          return
45
+        }
46
+        if (!elStyle.height) {
47
+          elStyle.height = `${el.offsetHeight}px`
48
+        }
49
+
50
+        elStyle.position = 'fixed'
51
+        elStyle.width = `${elWidth}px`
52
+        placeholder.style.display = 'inline-block'
53
+        active = true
54
+      }
55
+
56
+      const reset = () => {
57
+        if (!active) {
58
+          return
59
+        }
60
+
61
+        elStyle.position = ''
62
+        placeholder.style.display = 'none'
63
+        active = false
64
+      }
65
+
66
+      const check = () => {
67
+        const scrollTop = getScroll(window, true)
68
+        const offsetTop = el.getBoundingClientRect().top
69
+        if (offsetTop < stickyTop) {
70
+          sticky()
71
+        } else {
72
+          if (scrollTop < elHeight + stickyTop) {
73
+            reset()
74
+          }
75
+        }
76
+      }
77
+      listenAction = () => {
78
+        check()
79
+      }
80
+
81
+      window.addEventListener('scroll', listenAction)
82
+    },
83
+
84
+    unbind() {
85
+      window.removeEventListener('scroll', listenAction)
86
+    }
87
+  })
88
+}
89
+
90
+export default vueSticky
91
+

+ 13
- 0
VUECODE/smart-operate-manage/src/directive/waves/index.js Näytä tiedosto

@@ -0,0 +1,13 @@
1
+import waves from './waves'
2
+
3
+const install = function(Vue) {
4
+  Vue.directive('waves', waves)
5
+}
6
+
7
+if (window.Vue) {
8
+  window.waves = waves
9
+  Vue.use(install); // eslint-disable-line
10
+}
11
+
12
+waves.install = install
13
+export default waves

+ 26
- 0
VUECODE/smart-operate-manage/src/directive/waves/waves.css Näytä tiedosto

@@ -0,0 +1,26 @@
1
+.waves-ripple {
2
+    position: absolute;
3
+    border-radius: 100%;
4
+    background-color: rgba(0, 0, 0, 0.15);
5
+    background-clip: padding-box;
6
+    pointer-events: none;
7
+    -webkit-user-select: none;
8
+    -moz-user-select: none;
9
+    -ms-user-select: none;
10
+    user-select: none;
11
+    -webkit-transform: scale(0);
12
+    -ms-transform: scale(0);
13
+    transform: scale(0);
14
+    opacity: 1;
15
+}
16
+
17
+.waves-ripple.z-active {
18
+    opacity: 0;
19
+    -webkit-transform: scale(2);
20
+    -ms-transform: scale(2);
21
+    transform: scale(2);
22
+    -webkit-transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out;
23
+    transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out;
24
+    transition: opacity 1.2s ease-out, transform 0.6s ease-out;
25
+    transition: opacity 1.2s ease-out, transform 0.6s ease-out, -webkit-transform 0.6s ease-out;
26
+}

+ 42
- 0
VUECODE/smart-operate-manage/src/directive/waves/waves.js Näytä tiedosto

@@ -0,0 +1,42 @@
1
+import './waves.css'
2
+
3
+export default{
4
+  bind(el, binding) {
5
+    el.addEventListener('click', e => {
6
+      const customOpts = Object.assign({}, binding.value)
7
+      const opts = Object.assign({
8
+        ele: el, // 波纹作用元素
9
+        type: 'hit', // hit 点击位置扩散 center中心点扩展
10
+        color: 'rgba(0, 0, 0, 0.15)' // 波纹颜色
11
+      }, customOpts)
12
+      const target = opts.ele
13
+      if (target) {
14
+        target.style.position = 'relative'
15
+        target.style.overflow = 'hidden'
16
+        const rect = target.getBoundingClientRect()
17
+        let ripple = target.querySelector('.waves-ripple')
18
+        if (!ripple) {
19
+          ripple = document.createElement('span')
20
+          ripple.className = 'waves-ripple'
21
+          ripple.style.height = ripple.style.width = Math.max(rect.width, rect.height) + 'px'
22
+          target.appendChild(ripple)
23
+        } else {
24
+          ripple.className = 'waves-ripple'
25
+        }
26
+        switch (opts.type) {
27
+          case 'center':
28
+            ripple.style.top = (rect.height / 2 - ripple.offsetHeight / 2) + 'px'
29
+            ripple.style.left = (rect.width / 2 - ripple.offsetWidth / 2) + 'px'
30
+            break
31
+          default:
32
+            ripple.style.top = (e.pageY - rect.top - ripple.offsetHeight / 2 - document.documentElement.scrollTop || document.body.scrollTop) + 'px'
33
+            ripple.style.left = (e.pageX - rect.left - ripple.offsetWidth / 2 - document.documentElement.scrollLeft || document.body.scrollLeft) + 'px'
34
+        }
35
+        ripple.style.backgroundColor = opts.color
36
+        ripple.className = 'waves-ripple z-active'
37
+        return false
38
+      }
39
+    }, false)
40
+  }
41
+}
42
+

+ 1
- 0
VUECODE/smart-operate-manage/src/permission.js Näytä tiedosto

@@ -34,6 +34,7 @@ router.beforeEach((to, from, next) => {
34 34
       NProgress.done()
35 35
     }
36 36
   }
37
+  next()
37 38
 })
38 39
 
39 40
 router.afterEach(() => {

+ 8
- 8
VUECODE/smart-operate-manage/src/router/index.js Näytä tiedosto

@@ -45,9 +45,9 @@ export const constantRouterMap = [
45 45
     meta: { title: '社区数据', icon: 'zip' },
46 46
     children: [
47 47
       {
48
-        path: 'download',
49
-        component: () => import('@/views/table/index'),
50
-        name: 'ExportZip',
48
+        path: 'community',
49
+        component: () => import('@/views/community/communityTable'),
50
+        name: 'community',
51 51
         meta: { title: '社区列表', icon: 'table' }
52 52
       }
53 53
     ]
@@ -56,14 +56,14 @@ export const constantRouterMap = [
56 56
   {
57 57
     path: '/banner',
58 58
     component: Layout,
59
-    redirect: '/banner/download',
59
+    redirect: '/banner/index',
60 60
     alwaysShow: true,
61 61
     meta: { title: '运营数据', icon: 'zip' },
62
-    children: [   
62
+    children: [
63 63
       {
64
-        path: 'download',
65
-        component: () => import('@/views/table/index'),
66
-        name: 'ExportZip',
64
+        path: 'index',
65
+        component: () => import('@/views/banner/index'),
66
+        name: 'banner-index',
67 67
         meta: { title: 'banner运营', icon: 'table' }
68 68
       }
69 69
     ]

+ 5
- 1
VUECODE/smart-operate-manage/src/store/index.js Näytä tiedosto

@@ -2,6 +2,8 @@ import Vue from 'vue'
2 2
 import Vuex from 'vuex'
3 3
 import app from './modules/app'
4 4
 import user from './modules/user'
5
+import banner from './modules/banner'
6
+import community from './modules/community'
5 7
 import getters from './getters'
6 8
 
7 9
 Vue.use(Vuex)
@@ -9,7 +11,9 @@ Vue.use(Vuex)
9 11
 const store = new Vuex.Store({
10 12
   modules: {
11 13
     app,
12
-    user
14
+    user,
15
+    community,
16
+    banner
13 17
   },
14 18
   getters
15 19
 })

+ 31
- 0
VUECODE/smart-operate-manage/src/store/modules/banner.js Näytä tiedosto

@@ -0,0 +1,31 @@
1
+import { getBanner, addBanner } from '@/api/banner'
2
+
3
+const banner = {
4
+  actions: {
5
+
6
+    GetBanner({ commit }, listQuery) {
7
+      return new Promise((resolve, reject) => {
8
+        getBanner(listQuery).then(response => {
9
+          const data = response.data
10
+          resolve(data)
11
+        }).catch(error => {
12
+          reject(error)
13
+        })
14
+        resolve
15
+      })
16
+    },
17
+
18
+    // 添加 banner
19
+    AddBanner({ commit }, banner) {
20
+      return new Promise((resolve, reject) => {
21
+        addBanner(banner).then(response => {
22
+          resolve(response)
23
+        }).catch(error => {
24
+          reject(error)
25
+        })
26
+      })
27
+    }
28
+  }
29
+}
30
+
31
+export default banner

+ 84
- 0
VUECODE/smart-operate-manage/src/store/modules/community.js Näytä tiedosto

@@ -0,0 +1,84 @@
1
+import { fetchList, createCommunity, updateCommunity } from '@/api/community'
2
+
3
+const community = {
4
+  namespaced: true,
5
+  state: {
6
+    total: '',
7
+    list: [],
8
+    detail: {},
9
+  },
10
+
11
+  mutations: {
12
+    SET_LIST: (state, list) => {
13
+      state.list = list
14
+    },
15
+    Insert_LIST: (state, detail) => {
16
+      state.list = [detail, ...list]
17
+    },
18
+    UpdateList: (state, detail) => {
19
+      state.list = state.list.map(item => {
20
+        if (item.id === detail.id) {
21
+          return detail
22
+        }
23
+        return item
24
+      })
25
+    },
26
+    SET_TOTAL: (state, total) => {
27
+      state.total = total
28
+    },
29
+    setDetail: (state, item) => {
30
+      state.detail = item
31
+    },
32
+    resetDetail: (state) => {
33
+      state.detail = {
34
+        ...{
35
+          id: undefined,
36
+          importance: 1,
37
+          remark: '',
38
+          timestamp: new Date(),
39
+          title: '',
40
+          status: 'published',
41
+          type: ''
42
+        }
43
+      }
44
+    }
45
+  },
46
+
47
+  actions: {
48
+    // fetchList,获取社区列表
49
+    FetchCommunityList({ commit }, listQuery) {
50
+      return new Promise((resolve, reject) => {
51
+        fetchList(listQuery).then(response => {
52
+          const data = response.data
53
+          commit('SET_LIST', data.items)
54
+          commit('SET_TOTAL', data.total)
55
+          resolve()
56
+        }).catch(error => {
57
+          reject(error)
58
+        })
59
+      })
60
+    },
61
+
62
+    CreateCommunity({ commit }, datail) {
63
+      return new Promise((resolve, reject) => {
64
+        createCommunity(datail).then(response => {
65
+          resolve()
66
+        }).catch(error => {
67
+          reject(error)
68
+        })
69
+      })
70
+    },
71
+
72
+    UpdateCommunity({ commit }, datail) {
73
+      return new Promise((resolve, reject) => {
74
+        updateCommunity(datail).then(response => {
75
+          resolve()
76
+        }).catch(error => {
77
+          reject(error)
78
+        })
79
+      })
80
+    }
81
+  }
82
+}
83
+
84
+export default community

+ 4
- 4
VUECODE/smart-operate-manage/src/store/modules/user.js Näytä tiedosto

@@ -33,7 +33,7 @@ const user = {
33 33
           const data = response.data
34 34
           setToken(data.token)
35 35
           commit('SET_TOKEN', data.token)
36
-          resolve()
36
+          resolve(response)
37 37
         }).catch(error => {
38 38
           reject(error)
39 39
         })
@@ -43,15 +43,15 @@ const user = {
43 43
     // 获取用户信息
44 44
     GetInfo({ commit, state }) {
45 45
       return new Promise((resolve, reject) => {
46
-        getInfo(state.token).then(response => {
46
+        getInfo().then(response => {
47 47
           const data = response.data
48 48
           if (data.roles && data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
49 49
             commit('SET_ROLES', data.roles)
50 50
           } else {
51 51
             reject('getInfo: roles must be a non-null array !')
52 52
           }
53
-          commit('SET_NAME', data.name)
54
-          commit('SET_AVATAR', data.avatar)
53
+          commit('SET_NAME', data.userName)
54
+          commit('SET_AVATAR', data.loginName)
55 55
           resolve(response)
56 56
         }).catch(error => {
57 57
           reject(error)

+ 1
- 1
VUECODE/smart-operate-manage/src/utils/auth.js Näytä tiedosto

@@ -1,6 +1,6 @@
1 1
 import Cookies from 'js-cookie'
2 2
 
3
-const TokenKey = 'Admin-Token'
3
+const TokenKey = 'X-Auth-Token'
4 4
 
5 5
 export function getToken() {
6 6
   return Cookies.get(TokenKey)

+ 3
- 3
VUECODE/smart-operate-manage/src/utils/request.js Näytä tiedosto

@@ -13,7 +13,7 @@ const service = axios.create({
13 13
 service.interceptors.request.use(
14 14
   config => {
15 15
     if (store.getters.token) {
16
-      config.headers['X-Token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
16
+      config.headers['X-Auth-Token'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
17 17
     }
18 18
     return config
19 19
   },
@@ -38,8 +38,8 @@ service.interceptors.response.use(
38 38
         duration: 5 * 1000
39 39
       })
40 40
 
41
-      // 50008:非法的token; 50012:其他客户端登录了;  50014:Token 过期了;
42
-      if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
41
+      // 802:Token 身份凭证不存在; 50012:其他客户端登录了;  803:Token 过期了;
42
+      if (res.code === 802 || res.code === 50012 || res.code === 803) {
43 43
         MessageBox.confirm(
44 44
           '你已被登出,可以取消继续留在该页面,或者重新登录',
45 45
           '确定登出',

+ 50
- 0
VUECODE/smart-operate-manage/src/utils/scrollTo.js Näytä tiedosto

@@ -0,0 +1,50 @@
1
+Math.easeInOutQuad = function(t, b, c, d) {
2
+  t /= d / 2
3
+  if (t < 1) {
4
+    return c / 2 * t * t + b
5
+  }
6
+  t--
7
+  return -c / 2 * (t * (t - 2) - 1) + b
8
+}
9
+
10
+// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
11
+var requestAnimFrame = (function() {
12
+  return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) }
13
+})()
14
+
15
+// because it's so fucking difficult to detect the scrolling element, just move them all
16
+function move(amount) {
17
+  document.documentElement.scrollTop = amount
18
+  document.body.parentNode.scrollTop = amount
19
+  document.body.scrollTop = amount
20
+}
21
+
22
+function position() {
23
+  return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
24
+}
25
+
26
+export function scrollTo(to, duration, callback) {
27
+  const start = position()
28
+  const change = to - start
29
+  const increment = 20
30
+  let currentTime = 0
31
+  duration = (typeof (duration) === 'undefined') ? 500 : duration
32
+  var animateScroll = function() {
33
+    // increment the time
34
+    currentTime += increment
35
+    // find the value with the quadratic in-out easing function
36
+    var val = Math.easeInOutQuad(currentTime, start, change, duration)
37
+    // move the document.body
38
+    move(val)
39
+    // do the animation unless its over
40
+    if (currentTime < duration) {
41
+      requestAnimFrame(animateScroll)
42
+    } else {
43
+      if (callback && typeof (callback) === 'function') {
44
+        // the animation is done so lets callback
45
+        callback()
46
+      }
47
+    }
48
+  }
49
+  animateScroll()
50
+}

+ 8
- 0
VUECODE/smart-operate-manage/src/utils/validate.js Näytä tiedosto

@@ -36,3 +36,11 @@ export function validatCode(str) {
36 36
   const reg = /^\d{4}$/
37 37
   return reg.test(str)
38 38
 }
39
+
40
+// 校验是否为空
41
+export function isNotValue(str) {
42
+  if (str.length > 0 && str !== ' ' && str === undefined && str === 'undefined') {
43
+    return true
44
+  }
45
+  return false
46
+}

+ 206
- 0
VUECODE/smart-operate-manage/src/vendor/Export2Excel.js Näytä tiedosto

@@ -0,0 +1,206 @@
1
+/* eslint-disable */
2
+require('script-loader!file-saver');
3
+import XLSX from 'xlsx'
4
+
5
+function generateArray(table) {
6
+  var out = [];
7
+  var rows = table.querySelectorAll('tr');
8
+  var ranges = [];
9
+  for (var R = 0; R < rows.length; ++R) {
10
+    var outRow = [];
11
+    var row = rows[R];
12
+    var columns = row.querySelectorAll('td');
13
+    for (var C = 0; C < columns.length; ++C) {
14
+      var cell = columns[C];
15
+      var colspan = cell.getAttribute('colspan');
16
+      var rowspan = cell.getAttribute('rowspan');
17
+      var cellValue = cell.innerText;
18
+      if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
19
+
20
+      //Skip ranges
21
+      ranges.forEach(function (range) {
22
+        if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
23
+          for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
24
+        }
25
+      });
26
+
27
+      //Handle Row Span
28
+      if (rowspan || colspan) {
29
+        rowspan = rowspan || 1;
30
+        colspan = colspan || 1;
31
+        ranges.push({
32
+          s: {
33
+            r: R,
34
+            c: outRow.length
35
+          },
36
+          e: {
37
+            r: R + rowspan - 1,
38
+            c: outRow.length + colspan - 1
39
+          }
40
+        });
41
+      };
42
+
43
+      //Handle Value
44
+      outRow.push(cellValue !== "" ? cellValue : null);
45
+
46
+      //Handle Colspan
47
+      if (colspan)
48
+        for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
49
+    }
50
+    out.push(outRow);
51
+  }
52
+  return [out, ranges];
53
+};
54
+
55
+function datenum(v, date1904) {
56
+  if (date1904) v += 1462;
57
+  var epoch = Date.parse(v);
58
+  return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
59
+}
60
+
61
+function sheet_from_array_of_arrays(data, opts) {
62
+  var ws = {};
63
+  var range = {
64
+    s: {
65
+      c: 10000000,
66
+      r: 10000000
67
+    },
68
+    e: {
69
+      c: 0,
70
+      r: 0
71
+    }
72
+  };
73
+  for (var R = 0; R != data.length; ++R) {
74
+    for (var C = 0; C != data[R].length; ++C) {
75
+      if (range.s.r > R) range.s.r = R;
76
+      if (range.s.c > C) range.s.c = C;
77
+      if (range.e.r < R) range.e.r = R;
78
+      if (range.e.c < C) range.e.c = C;
79
+      var cell = {
80
+        v: data[R][C]
81
+      };
82
+      if (cell.v == null) continue;
83
+      var cell_ref = XLSX.utils.encode_cell({
84
+        c: C,
85
+        r: R
86
+      });
87
+
88
+      if (typeof cell.v === 'number') cell.t = 'n';
89
+      else if (typeof cell.v === 'boolean') cell.t = 'b';
90
+      else if (cell.v instanceof Date) {
91
+        cell.t = 'n';
92
+        cell.z = XLSX.SSF._table[14];
93
+        cell.v = datenum(cell.v);
94
+      } else cell.t = 's';
95
+
96
+      ws[cell_ref] = cell;
97
+    }
98
+  }
99
+  if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
100
+  return ws;
101
+}
102
+
103
+function Workbook() {
104
+  if (!(this instanceof Workbook)) return new Workbook();
105
+  this.SheetNames = [];
106
+  this.Sheets = {};
107
+}
108
+
109
+function s2ab(s) {
110
+  var buf = new ArrayBuffer(s.length);
111
+  var view = new Uint8Array(buf);
112
+  for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
113
+  return buf;
114
+}
115
+
116
+export function export_table_to_excel(id) {
117
+  var theTable = document.getElementById(id);
118
+  var oo = generateArray(theTable);
119
+  var ranges = oo[1];
120
+
121
+  /* original data */
122
+  var data = oo[0];
123
+  var ws_name = "SheetJS";
124
+
125
+  var wb = new Workbook(),
126
+    ws = sheet_from_array_of_arrays(data);
127
+
128
+  /* add ranges to worksheet */
129
+  // ws['!cols'] = ['apple', 'banan'];
130
+  ws['!merges'] = ranges;
131
+
132
+  /* add worksheet to workbook */
133
+  wb.SheetNames.push(ws_name);
134
+  wb.Sheets[ws_name] = ws;
135
+
136
+  var wbout = XLSX.write(wb, {
137
+    bookType: 'xlsx',
138
+    bookSST: false,
139
+    type: 'binary'
140
+  });
141
+
142
+  saveAs(new Blob([s2ab(wbout)], {
143
+    type: "application/octet-stream"
144
+  }), "test.xlsx")
145
+}
146
+
147
+export function export_json_to_excel({
148
+  header,
149
+  data,
150
+  filename,
151
+  autoWidth = true,
152
+  bookType=  'xlsx'
153
+} = {}) {
154
+  /* original data */
155
+  filename = filename || 'excel-list'
156
+  data = [...data]
157
+  data.unshift(header);
158
+  var ws_name = "SheetJS";
159
+  var wb = new Workbook(),
160
+    ws = sheet_from_array_of_arrays(data);
161
+
162
+  if (autoWidth) {
163
+    /*设置worksheet每列的最大宽度*/
164
+    const colWidth = data.map(row => row.map(val => {
165
+      /*先判断是否为null/undefined*/
166
+      if (val == null) {
167
+        return {
168
+          'wch': 10
169
+        };
170
+      }
171
+      /*再判断是否为中文*/
172
+      else if (val.toString().charCodeAt(0) > 255) {
173
+        return {
174
+          'wch': val.toString().length * 2
175
+        };
176
+      } else {
177
+        return {
178
+          'wch': val.toString().length
179
+        };
180
+      }
181
+    }))
182
+    /*以第一行为初始值*/
183
+    let result = colWidth[0];
184
+    for (let i = 1; i < colWidth.length; i++) {
185
+      for (let j = 0; j < colWidth[i].length; j++) {
186
+        if (result[j]['wch'] < colWidth[i][j]['wch']) {
187
+          result[j]['wch'] = colWidth[i][j]['wch'];
188
+        }
189
+      }
190
+    }
191
+    ws['!cols'] = result;
192
+  }
193
+
194
+  /* add worksheet to workbook */
195
+  wb.SheetNames.push(ws_name);
196
+  wb.Sheets[ws_name] = ws;
197
+
198
+  var wbout = XLSX.write(wb, {
199
+    bookType: bookType,
200
+    bookSST: false,
201
+    type: 'binary'
202
+  });
203
+  saveAs(new Blob([s2ab(wbout)], {
204
+    type: "application/octet-stream"
205
+  }), `${filename}.${bookType}`);
206
+}

+ 24
- 0
VUECODE/smart-operate-manage/src/vendor/Export2Zip.js Näytä tiedosto

@@ -0,0 +1,24 @@
1
+/* eslint-disable */
2
+require('script-loader!file-saver');
3
+import JSZip from 'jszip'
4
+
5
+export function export_txt_to_zip(th, jsonData, txtName, zipName) {
6
+  const zip = new JSZip()
7
+  const txt_name = txtName || 'file'
8
+  const zip_name = zipName || 'file'
9
+  const data = jsonData
10
+  let txtData = `${th}\r\n`
11
+  data.forEach((row) => {
12
+    let tempStr = ''
13
+    tempStr = row.toString()
14
+    txtData += `${tempStr}\r\n`
15
+  })
16
+  zip.file(`${txt_name}.txt`, txtData)
17
+  zip.generateAsync({
18
+    type: "blob"
19
+  }).then((blob) => {
20
+    saveAs(blob, `${zip_name}.zip`)
21
+  }, (err) => {
22
+    alert('导出失败')
23
+  })
24
+}

+ 494
- 0
VUECODE/smart-operate-manage/src/views/banner/index.vue Näytä tiedosto

@@ -0,0 +1,494 @@
1
+<template>
2
+  <div class="app-container">
3
+    <div class="filter-container">
4
+      <label>标题</label>
5
+      <el-input v-model="listQuery.title" placeholder="请输入标题" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter"/>
6
+      <label>跳转概述</label>
7
+      <el-input v-model="listQuery.bannerDescription" placeholder="请输入跳转概述" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter"/>
8
+      <label>选择小区</label>
9
+      <el-select v-model="listQuery.communityId" placeholder="选择小区" clearable style="width: 200px" class="filter-item">
10
+        <el-option v-for="item in importanceOptions" :key="item" :value="item" label="item"/>
11
+      </el-select>
12
+      <label>位置</label>
13
+      <el-select v-model="listQuery.bannerPosition" placeholder="banner位置" clearable class="filter-item" style="width: 200px">
14
+        <el-option v-for="item in calendarTypeOptions" :key="item.key" :value="item.key" label="item.display_name+'('+item.key+')'"/>
15
+      </el-select>
16
+      <el-button v-waves class="filter-item" type="info" icon="el-icon-warning" @click="handleFilter">清空</el-button>
17
+      <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
18
+    </div>
19
+
20
+    <el-row style="margin-top: 20px; margin-bottom: 20px;">
21
+      <el-button type="primary" icon="el-icon-circle-plus" @click="dialogFormVisible = true">添加</el-button>
22
+      <el-button type="primary" icon="el-icon-edit">修改</el-button>
23
+      <el-button type="danger" icon="el-icon-delete">删除</el-button>
24
+    </el-row>
25
+
26
+    <el-table
27
+      v-loading="listLoading"
28
+      :key="tableKey"
29
+      :data="list"
30
+      border
31
+      fit
32
+      highlight-current-row
33
+      style="width: 100%; margin-top: 20px;"
34
+      @sort-change="sortChange">
35
+      <el-table-column label="选择" type="selection" sortable="custom" align="center" width="100">
36
+        <!-- <template slot-scope="scope">
37
+          <span>{{ scope.row.id }}</span>
38
+        </template> -->
39
+      </el-table-column>
40
+      <el-table-column label="编号" width="150px" align="center">
41
+        <template slot-scope="scope">
42
+          <span>{{ scope.row.id }}</span>
43
+        </template>
44
+      </el-table-column>
45
+      <el-table-column label="标题" min-width="150px" align="center">
46
+        <template slot-scope="scope">
47
+          <!-- <span class="link-type" @click="handleUpdate(scope.row)">{{ scope.row.title }}</span> -->
48
+          <el-tag>{{ scope.row.title }}</el-tag>
49
+        </template>
50
+      </el-table-column>
51
+      <el-table-column label="适用社区" width="200" align="center">
52
+        <template slot-scope="scope">
53
+          <span>{{ scope.row.communityName }}</span>
54
+        </template>
55
+      </el-table-column>
56
+      <el-table-column label="banner位置" width="200" align="center">
57
+        <template slot-scope="scope">
58
+          <span>{{ scope.row.bannerPositionName }}</span>
59
+        </template>
60
+      </el-table-column>
61
+      <el-table-column label="权重" width="200" align="center">
62
+        <template slot-scope="scope">
63
+          <span>{{ scope.row.sort }}</span>
64
+        </template>
65
+      </el-table-column>
66
+      <el-table-column label="生效时间" align="center" width="200">
67
+        <template slot-scope="scope">
68
+          <span>{{ formatDate(scope.row.effTime) }}</span>
69
+        </template>
70
+      </el-table-column>
71
+      <el-table-column label="失效时间" class-name="status-col" width="200" align="center">
72
+        <template slot-scope="scope">
73
+          <span>{{ formatDate(scope.row.expTime) }}</span>
74
+        </template>
75
+      </el-table-column>
76
+      <el-table-column label="修改时间" class-name="status-col" width="200" align="center">
77
+        <template slot-scope="scope">
78
+          <span>{{ formatDate(scope.row.updateDate) }}</span>
79
+        </template>
80
+      </el-table-column>
81
+      <el-table-column label="修改人" class-name="status-col" width="200" align="center">
82
+        <template slot-scope="scope">
83
+          <span>{{ scope.row.updateUserName }}</span>
84
+        </template>
85
+      </el-table-column>
86
+    </el-table>
87
+
88
+    <!-- <pagination v-show="total>0" :total="total" :current-page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" :page-sizes="[5, 10, 20, 30]" @pagination="getList" /> -->
89
+    <el-pagination
90
+      :total="total"
91
+      :current-page="listQuery.pageNum"
92
+      :page-sizes="[5, 10, 20, 30]"
93
+      :page-size="listQuery.pageSize"
94
+      layout="total, sizes, prev, pager, next, jumper"
95
+      @size-change="handleSizeChange"
96
+      @current-change="handleCurrentChange"/>
97
+
98
+    <el-dialog :visible.sync="dialogFormVisible" title="添加">
99
+      <el-form ref="addForm" :model="addForm" :rules="addFormRules">
100
+        <el-form-item :label-width="formLabelWidth" label="标题">
101
+          <el-input v-model="addForm.title"/>
102
+        </el-form-item>
103
+        <el-form-item :label-width="formLabelWidth" label="权重">
104
+          <el-input v-model="addForm.sort"/>
105
+        </el-form-item>
106
+        <el-form-item :label-width="formLabelWidth" label="banner图">
107
+          <el-input v-model="addForm.bannerCover"/>
108
+        </el-form-item>
109
+        <el-form-item :label-width="formLabelWidth" label="banner位">
110
+          <el-select v-model="addForm.bannerPosition" placeholder="请选择位置">
111
+            <el-option
112
+              v-for="item in bannerPositionArr"
113
+              :key="item.id"
114
+              :label="item.value"
115
+              :value="item.id"
116
+            />
117
+            <!-- <el-option v-for="item in bannerPositionArr" label="item.value" value="item.id"/> -->
118
+          </el-select>
119
+        </el-form-item>
120
+        <el-form-item :label-width="formLabelWidth" label="投放社区">
121
+          <el-select v-model="addForm.communityId" placeholder="请选择社区">
122
+            <el-option
123
+              v-for="item in communityArr"
124
+              :key="item.id"
125
+              :label="item.value"
126
+              :value="item.id"
127
+            />
128
+            <!-- <el-option label="区域一" value="shanghai"/> -->
129
+          </el-select>
130
+        </el-form-item>
131
+        <el-form-item :label-width="formLabelWidth" label="生效时间">
132
+          <el-date-picker
133
+            v-model="addForm.effTime"
134
+            type="datetime"
135
+            placeholder="选择日期时间"/>
136
+        </el-form-item>
137
+        <el-form-item :label-width="formLabelWidth" label="失效时间">
138
+          <el-date-picker
139
+            v-model="addForm.expTime"
140
+            type="datetime"
141
+            placeholder="选择日期时间"/>
142
+        </el-form-item>
143
+        <el-form-item :label-width="formLabelWidth" label="banner跳转">
144
+          <el-radio v-model="addForm.bannerType" label="1" @change="showContent">外部超链接</el-radio>
145
+          <el-radio v-model="addForm.bannerType" label="2" @change="showContent">自写文章</el-radio>
146
+        </el-form-item>
147
+        <el-form-item v-if="showURLVisible" :label-width="formLabelWidth" label="URL">
148
+          <el-input v-model="addForm.externalLink" placeholder="URL"/>
149
+        </el-form-item>
150
+        <div v-if="showContentVisible">
151
+          <el-form-item :label-width="formLabelWidth" label="内容标题">
152
+            <el-input v-model="addForm.bannerTitle" placeholder="内容标题"/>
153
+          </el-form-item>
154
+          <el-form-item :label-width="formLabelWidth" label="内容详情">
155
+            <el-input v-model="addForm.bannerContent" placeholder="内容详情"/>
156
+          </el-form-item>
157
+        </div>
158
+      </el-form>
159
+      <div slot="footer" class="dialog-footer">
160
+        <el-button @click="dialogForm('0')">取 消</el-button>
161
+        <el-button type="primary" @click="dialogForm('1')">确 定</el-button>
162
+      </div>
163
+    </el-dialog>
164
+
165
+    <el-dialog :visible.sync="dialogPvVisible" title="Reading statistics"/>
166
+
167
+  </div>
168
+</template>
169
+
170
+<script>
171
+// import { updateArticle, createBanner } from '@/api/banner' // getBanner
172
+import waves from '@/directive/waves' // Waves directive
173
+import { isNotValue } from '@/utils/validate'
174
+import { parseTime } from '@/utils/index'
175
+import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
176
+const calendarTypeOptions = [
177
+  { key: 'CN', display_name: 'China' },
178
+  { key: 'US', display_name: 'USA' },
179
+  { key: 'JP', display_name: 'Japan' },
180
+  { key: 'EU', display_name: 'Eurozone' }
181
+]
182
+// arr to obj ,such as { CN : "China", US : "USA" }
183
+const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
184
+  acc[cur.key] = cur.display_name
185
+  return acc
186
+}, {})
187
+export default {
188
+  name: 'ComplexTable',
189
+  components: { Pagination },
190
+  directives: { waves },
191
+  filters: {
192
+    statusFilter(status) {
193
+      const statusMap = {
194
+        published: 'success',
195
+        draft: 'info',
196
+        deleted: 'danger'
197
+      }
198
+      return statusMap[status]
199
+    },
200
+    typeFilter(type) {
201
+      return calendarTypeKeyValue[type]
202
+    }
203
+  },
204
+  data() {
205
+    const isTitle = (rule, value, callback) => {
206
+      if (!isNotValue(value)) {
207
+        callback(new Error('标题不能为空!'))
208
+      } else {
209
+        callback()
210
+      }
211
+    }
212
+    const isBannerCover = (rule, value, callback) => {
213
+      if (!isNotValue(value)) {
214
+        callback(new Error('banner图片不能为空!'))
215
+      } else {
216
+        callback()
217
+      }
218
+    }
219
+    const isBannerPosition = (rule, value, callback) => {
220
+      if (!isNotValue(value)) {
221
+        callback(new Error('banner位不能为空!'))
222
+      } else {
223
+        callback()
224
+      }
225
+    }
226
+    const isCommunityId = (rule, value, callback) => {
227
+      if (!isNotValue(value)) {
228
+        callback(new Error('小区不能为空!'))
229
+      } else {
230
+        callback()
231
+      }
232
+    }
233
+    const isEffTime = (rule, value, callback) => {
234
+      if (!isNotValue(value)) {
235
+        callback(new Error('生效时间不能为空'))
236
+      } else {
237
+        callback()
238
+      }
239
+    }
240
+    const isExpTime = (rule, value, callback) => {
241
+      if (!isNotValue(value)) {
242
+        callback(new Error('失效时间不能为空!'))
243
+      } else {
244
+        callback()
245
+      }
246
+    }
247
+    const isBannerType = (rule, value, callback) => {
248
+      if (!isNotValue(value)) {
249
+        callback(new Error('banner类型不能为空!'))
250
+      } else {
251
+        callback()
252
+      }
253
+    }
254
+    return {
255
+      tableKey: 0,
256
+      list: null,
257
+      total: 0,
258
+      listLoading: true,
259
+      listQuery: {
260
+        pageNum: 1,
261
+        pageSize: 5,
262
+        bannerTitle: undefined,
263
+        bannerPosition: undefined,
264
+        bannerDescription: undefined
265
+      },
266
+      importanceOptions: [1, 2, 3],
267
+      calendarTypeOptions,
268
+      addForm: {
269
+        title: '',
270
+        sort: '',
271
+        bannerCover: '',
272
+        bannerPosition: '',
273
+        communityId: '',
274
+        effTime: '',
275
+        expTime: '',
276
+        bannerType: '1',
277
+        externalLink: '',
278
+        bannerTitle: '',
279
+        bannerContent: ''
280
+      },
281
+      addFormRules: {
282
+        title: [{ required: true, trigger: 'blur', validator: isTitle }],
283
+        bannerCover: [{ required: true, trigger: 'blur', validator: isBannerCover }],
284
+        bannerPosition: [{ required: true, trigger: 'blur', validator: isBannerPosition }],
285
+        communityId: [{ required: true, trigger: 'blur', validator: isCommunityId }],
286
+        effTime: [{ required: true, trigger: 'blur', validator: isEffTime }],
287
+        expTime: [{ required: true, trigger: 'blur', validator: isExpTime }],
288
+        bannerType: [{ required: true, trigger: 'blur', validator: isBannerType }]
289
+      },
290
+      dialogFormVisible: false,
291
+      dialogStatus: '',
292
+      dialogPvVisible: false,
293
+      downloadLoading: false,
294
+      formLabelWidth: '120px',
295
+      showContentVisible: false,
296
+      showURLVisible: true,
297
+      bannerPositionArr: [
298
+        {id: 1, value: '首页banner'},
299
+        {id: 2, value: '服务banner'}
300
+      ],
301
+      communityArr: [
302
+        {id: 3, value: '智慧社区'},
303
+        {id: 2, value: '测试社区'}
304
+      ]
305
+    }
306
+  },
307
+  created() {
308
+    this.getList()
309
+  },
310
+  methods: {
311
+    dialogForm(isVaule) {
312
+      if (isVaule === '0') {
313
+        this.dialogFormVisible = false
314
+      } else {
315
+        // 进行提交数据,成功后关闭dialog
316
+        this.createData()
317
+        this.dialogFormVisible = false
318
+        console.log('添加banner的数据: ', this.addForm)
319
+      }
320
+    },
321
+    showContent() {
322
+      if (this.addForm.bannerType === '1') {
323
+        this.showContentVisible = false
324
+        this.showURLVisible = true
325
+      } else {
326
+        this.showContentVisible = true
327
+        this.showURLVisible = false
328
+      }
329
+    },
330
+    handleSizeChange(val) {
331
+      // console.log(`每页 ${val} 条`);
332
+      this.listQuery.pageSize = val
333
+      this.getList()
334
+    },
335
+    handleCurrentChange(val) {
336
+      // console.log(`当前页: ${val}`);
337
+      this.listQuery.pageNum = val
338
+      this.getList()
339
+    },
340
+    padDate(value) {
341
+      value = value < 10 ? '0' + value : value
342
+      return value
343
+    },
344
+    formatDate(val) {
345
+      var value = new Date(val)
346
+      var year = value.getFullYear()
347
+      var month = this.padDate(value.getMonth() + 1)
348
+      var day = this.padDate(value.getDate())
349
+      var hour = this.padDate(value.getHours())
350
+      var minutes = this.padDate(value.getMinutes())
351
+      var seconds = this.padDate(value.getSeconds())
352
+      return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
353
+    },
354
+    getList() {
355
+      this.listLoading = true
356
+      this.$store.dispatch('GetBanner', this.listQuery).then(response => {
357
+        this.list = response.item
358
+        this.total = response.total
359
+        // Just to simulate the time of the request
360
+        setTimeout(() => {
361
+          this.listLoading = false
362
+        }, 1.5 * 1000)
363
+      })
364
+    },
365
+    handleFilter() {
366
+      this.listQuery.page = 1
367
+      this.getList()
368
+    },
369
+    handleModifyStatus(row, status) {
370
+      this.$message({
371
+        message: '操作成功',
372
+        type: 'success'
373
+      })
374
+      row.status = status
375
+    },
376
+    sortChange(data) {
377
+      const { prop, order } = data
378
+      if (prop === 'id') {
379
+        this.sortByID(order)
380
+      }
381
+    },
382
+    sortByID(order) {
383
+      if (order === 'ascending') {
384
+        this.listQuery.sort = '+id'
385
+      } else {
386
+        this.listQuery.sort = '-id'
387
+      }
388
+      this.handleFilter()
389
+    },
390
+    resetTemp() {
391
+      this.temp = {
392
+        id: undefined,
393
+        importance: 1,
394
+        remark: '',
395
+        timestamp: new Date(),
396
+        title: '',
397
+        status: 'published',
398
+        type: ''
399
+      }
400
+    },
401
+    handleSearch() {
402
+      this.getList()
403
+    },
404
+    createData() {
405
+      this.$refs['addForm'].validate((valid) => {
406
+        if (valid) {
407
+          this.$store.dispatch('AddBanner', this.addForm).then((res) => {
408
+            if (res.code === '0') {
409
+              this.$notify({
410
+                title: '操作成功!',
411
+                message: res.message,
412
+                type: 'success'
413
+              })
414
+              this.getList()
415
+            } else {
416
+              this.$notify({
417
+                title: '操作失败',
418
+                message: res.message,
419
+                type: 'warning'
420
+              })
421
+            }
422
+          })
423
+        }
424
+      })
425
+    },
426
+    handleUpdate(row) {
427
+      this.temp = Object.assign({}, row) // copy obj
428
+      this.temp.timestamp = new Date(this.temp.timestamp)
429
+      this.dialogStatus = 'update'
430
+      this.dialogFormVisible = true
431
+      this.$nextTick(() => {
432
+        this.$refs['dataForm'].clearValidate()
433
+      })
434
+    },
435
+    updateData() {
436
+      this.$refs['dataForm'].validate((valid) => {
437
+        if (valid) {
438
+          const tempData = Object.assign({}, this.temp)
439
+          tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
440
+          // updateArticle(tempData).then(() => {
441
+          //   for (const v of this.list) {
442
+          //     if (v.id === this.temp.id) {
443
+          //       const index = this.list.indexOf(v)
444
+          //       this.list.splice(index, 1, this.temp)
445
+          //       break
446
+          //     }
447
+          //   }
448
+          //   this.dialogFormVisible = false
449
+          //   this.$notify({
450
+          //     title: '成功',
451
+          //     message: '更新成功',
452
+          //     type: 'success',
453
+          //     duration: 2000
454
+          //   })
455
+          // })
456
+        }
457
+      })
458
+    },
459
+    handleDelete(row) {
460
+      this.$notify({
461
+        title: '成功',
462
+        message: '删除成功',
463
+        type: 'success',
464
+        duration: 2000
465
+      })
466
+      const index = this.list.indexOf(row)
467
+      this.list.splice(index, 1)
468
+    },
469
+    handleDownload() {
470
+      this.downloadLoading = true
471
+      import('@/vendor/Export2Excel').then(excel => {
472
+        const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
473
+        const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
474
+        const data = this.formatJson(filterVal, this.list)
475
+        excel.export_json_to_excel({
476
+          header: tHeader,
477
+          data,
478
+          filename: 'table-list'
479
+        })
480
+        this.downloadLoading = false
481
+      })
482
+    },
483
+    formatJson(filterVal, jsonData) {
484
+      return jsonData.map(v => filterVal.map(j => {
485
+        if (j === 'timestamp') {
486
+          return parseTime(v[j])
487
+        } else {
488
+          return v[j]
489
+        }
490
+      }))
491
+    }
492
+  }
493
+}
494
+</script>

+ 352
- 0
VUECODE/smart-operate-manage/src/views/community/communityTable.vue Näytä tiedosto

@@ -0,0 +1,352 @@
1
+<template>
2
+  <div class="app-container">
3
+    <div class="filter-container">
4
+      <el-input v-model="listQuery.title" placeholder="社区编号" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter"/>
5
+      <el-input v-model="listQuery.title" placeholder="社区名称" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter"/>
6
+      <el-select v-model="listQuery.importance" placeholder="省" clearable style="width: 90px" class="filter-item">
7
+        <el-option v-for="item in importanceOptions" :key="item" :label="item" :value="item"/>
8
+      </el-select>
9
+      <el-select v-model="listQuery.type" placeholder="市" clearable class="filter-item" style="width: 130px">
10
+        <el-option v-for="item in calendarTypeOptions" :key="item.key" :label="item.display_name+'('+item.key+')'" :value="item.key"/>
11
+      </el-select>
12
+      <el-select v-model="listQuery.type" placeholder="区县乡" clearable class="filter-item" style="width: 130px">
13
+        <el-option v-for="item in calendarTypeOptions" :key="item.key" :label="item.display_name+'('+item.key+')'" :value="item.key"/>
14
+      </el-select>
15
+      <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查询</el-button>
16
+      <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-edit" @click="handleCreate">添加</el-button>
17
+    </div>
18
+
19
+    <el-table
20
+      v-loading="listLoading"
21
+      :key="tableKey"
22
+      :data="list"
23
+      border
24
+      fit
25
+      highlight-current-row
26
+      style="width: 100%;"
27
+      @sort-change="sortChange">
28
+      <el-table-column
29
+        label="序号"
30
+        align="center"
31
+        type="index"
32
+        width="50"/>
33
+      <el-table-column label="社区编号" align="center" width="105">
34
+        <template slot-scope="scope">
35
+          <span>{{ scope.row.id }}</span>
36
+        </template>
37
+      </el-table-column>
38
+      <el-table-column label="社区名称" align="center" width="105">
39
+        <template slot-scope="scope">
40
+          <span>{{ scope.row.communityName }}</span>
41
+        </template>
42
+      </el-table-column>
43
+      <el-table-column label="社区别名" align="center" width="105">
44
+        <template slot-scope="scope">
45
+          <span>{{ scope.row.communityAlias }}</span>
46
+        </template>
47
+      </el-table-column>
48
+      <el-table-column label="所在地区" align="center" width="305">
49
+        <template slot-scope="scope">
50
+          <span>{{ scope.row.provinceId }}{{ scope.row.cityId }}{{ scope.row.districtId }}</span>
51
+        </template>
52
+      </el-table-column>
53
+      <el-table-column label="物业人员数量" align="center" width="105">
54
+        <template slot-scope="scope">
55
+          <span>52</span>
56
+        </template>
57
+      </el-table-column>
58
+      <el-table-column label="已核业主数量" align="center" width="105">
59
+        <template slot-scope="scope">
60
+          <span>123</span>
61
+        </template>
62
+      </el-table-column>
63
+      <el-table-column label="已核家属数量" align="center" width="105">
64
+        <template slot-scope="scope">
65
+          <span>345</span>
66
+        </template>
67
+      </el-table-column>
68
+      <el-table-column label="已核租客数量" align="center" width="105">
69
+        <template slot-scope="scope">
70
+          <span>234</span>
71
+        </template>
72
+      </el-table-column>
73
+      <el-table-column label="物业管理员" align="center" width="105">
74
+        <template slot-scope="scope">
75
+          <span>{{ scope.row.userName }}</span>
76
+        </template>
77
+      </el-table-column>
78
+      <el-table-column label="高德坐标" align="center" width="105">
79
+        <template slot-scope="scope">
80
+          <span>{{ scope.row.longitude }},{{ scope.row.latitude }}</span>
81
+        </template>
82
+      </el-table-column>
83
+      <el-table-column label="录入时间" width="150px" align="center">
84
+        <template slot-scope="scope">
85
+          <span>{{ scope.row.createDate }}</span>
86
+        </template>
87
+      </el-table-column>
88
+      <el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
89
+        <template slot-scope="scope">
90
+          <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
91
+          <el-button v-if="scope.row.status!='published'" size="mini" type="success" @click="handleModifyStatus(scope.row,'published')">查看</el-button>
92
+        </template>
93
+      </el-table-column>
94
+    </el-table>
95
+
96
+    <pagination v-show="total>0" :total="total" :current-page.sync="listQuery.pageNum" :page-size.sync="listQuery.pageSize" @pagination="getList" />
97
+
98
+    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
99
+      <el-form ref="dataForm" :rules="rules" :model="detail" label-position="left" label-width="100px" style="width: 400px; margin-left:50px;">
100
+        <el-form-item label="社区名称">
101
+           <el-input v-model="detail.communityName"/>
102
+        </el-form-item>
103
+        <el-form-item label="社区别名">
104
+          <el-input v-model="detail.communityAlias"/>
105
+        </el-form-item>
106
+        <!-- <el-form-item label="所在区县" prop="title">
107
+          <el-input v-model="detail.title"/>
108
+        </el-form-item> -->
109
+        <el-form-item label="高德坐标">
110
+          <el-input v-model="detail.longitude"
111
+                    placeholder="经度"/>
112
+          <el-input v-model="detail.latitude"
113
+                    placeholder="纬度"/>
114
+        </el-form-item>
115
+        <el-form-item label="管理员姓名">
116
+          <el-input v-model="detail.userName"
117
+                    placeholder="建议先填写运营人员姓名"/>
118
+        </el-form-item>
119
+        <el-form-item label="管理员账号">
120
+          <el-input v-model="detail.loginName"
121
+                    placeholder="建议先填写运营人员手机号"/>
122
+        </el-form-item>
123
+      </el-form>
124
+      <div slot="footer" class="dialog-footer">
125
+        <el-button @click="dialogFormVisible = false">取 消</el-button>
126
+        <el-button type="primary" @click="dialogStatus==='create'?createData():updateData()">确 定</el-button>
127
+      </div>
128
+    </el-dialog>
129
+
130
+    <el-dialog :visible.sync="dialogPvVisible" title="Reading statistics">
131
+      <el-table :data="pvData" border fit highlight-current-row style="width: 100%">
132
+        <el-table-column prop="key" label="Channel"/>
133
+        <el-table-column prop="pv" label="Pv"/>
134
+      </el-table>
135
+      <span slot="footer" class="dialog-footer">
136
+        <el-button type="primary" @click="dialogPvVisible = false">确 定</el-button>
137
+      </span>
138
+    </el-dialog>
139
+
140
+  </div>
141
+</template>
142
+
143
+<script>
144
+import { mapState, mapActions, mapMutations } from 'vuex'
145
+import waves from '@/directive/waves' // Waves directive
146
+import { parseTime } from '@/utils'
147
+import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
148
+
149
+const calendarTypeOptions = [
150
+  { key: 'CN', display_name: 'China' },
151
+  { key: 'US', display_name: 'USA' },
152
+  { key: 'JP', display_name: 'Japan' },
153
+  { key: 'EU', display_name: 'Eurozone' }
154
+]
155
+
156
+// arr to obj ,such as { CN : "China", US : "USA" }
157
+const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
158
+  acc[cur.key] = cur.display_name
159
+  return acc
160
+}, {})
161
+
162
+export default {
163
+  name: 'ComplexTable',
164
+  components: { Pagination },
165
+  directives: { waves },
166
+  filters: {
167
+    statusFilter(status) {
168
+      const statusMap = {
169
+        published: 'success',
170
+        draft: 'info',
171
+        deleted: 'danger'
172
+      }
173
+      return statusMap[status]
174
+    },
175
+    typeFilter(type) {
176
+      return calendarTypeKeyValue[type]
177
+    }
178
+  },
179
+  computed: {
180
+    ...mapState('community', {
181
+      list: s => s.list,
182
+      detail: s => s.detail,
183
+      total: s => s.total,
184
+    }),
185
+  },
186
+  data() {
187
+    return {
188
+      tableKey: 0,
189
+      listLoading: true,
190
+      listQuery: {
191
+        pageNum: 1,
192
+        pageSize: 20,
193
+        importance: undefined,
194
+        title: undefined,
195
+        type: undefined,
196
+        sort: undefined
197
+      },
198
+      importanceOptions: [1, 2, 3],
199
+      calendarTypeOptions,
200
+      sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
201
+      statusOptions: ['published', 'draft', 'deleted'],
202
+      showReviewer: false,
203
+      dialogFormVisible: false,
204
+      dialogStatus: '',
205
+      textMap: {
206
+        update: 'Edit',
207
+        create: 'Create'
208
+      },
209
+      dialogPvVisible: false,
210
+      pvData: [],
211
+      rules: {
212
+        type: [{ required: true, message: 'type is required', trigger: 'change' }],
213
+        createData: [{ type: 'date', required: true, message: 'createData is required', trigger: 'change' }],
214
+        title: [{ required: true, message: 'title is required', trigger: 'blur' }]
215
+      },
216
+      downloadLoading: false
217
+    }
218
+  },
219
+  created() {
220
+    this.getList()
221
+  },
222
+  methods: {
223
+    ...mapMutations('community',{
224
+      resetDetail: 'resetDetail',
225
+      setDetail: 'setDetail',
226
+    }),
227
+    ...mapActions('community', [
228
+      'FetchCommunityList',
229
+      'CreateCommunity',
230
+      'UpdateCommunity',
231
+    ]),
232
+    setCurrent(item) {
233
+      this.setDetail({...item})
234
+    },
235
+    getList() {
236
+      this.listLoading = true
237
+      this.FetchCommunityList(this.listQuery).then(() => {
238
+        this.listLoading = false 
239
+      }).catch(() => {
240
+        this.loading = false
241
+        console.log('get list error')
242
+      })
243
+    },
244
+    handleFilter() {
245
+      this.listQuery.pageNum = 1
246
+      this.getList()
247
+    },
248
+    handleModifyStatus(row, status) {
249
+      this.$message({
250
+        message: '操作成功',
251
+        type: 'success'
252
+      })
253
+      row.status = status
254
+    },
255
+    sortChange(data) {
256
+      const { prop, order } = data
257
+      if (prop === 'id') {
258
+        this.sortByID(order)
259
+      }
260
+    },
261
+    sortByID(order) {
262
+      if (order === 'ascending') {
263
+        this.listQuery.sort = '+id'
264
+      } else {
265
+        this.listQuery.sort = '-id'
266
+      }
267
+      this.handleFilter()
268
+    },
269
+   handleCreate() {
270
+      this.resetDetail()
271
+      this.dialogStatus = 'create'
272
+      this.dialogFormVisible = true
273
+      this.$nextTick(() => {
274
+        this.$refs['dataForm'].clearValidate()
275
+      })
276
+    },
277
+    createData() {
278
+      this.$refs['dataForm'].validate((valid) => {
279
+        if (valid) {
280
+          this.CreateCommunity(this.detail).then(() => {
281
+            this.dialogFormVisible = false
282
+            this.$notify({
283
+              title: '成功',
284
+              message: '创建成功',
285
+              type: 'success',
286
+              duration: 2000
287
+            })
288
+            this.getList()
289
+          })
290
+        }
291
+      })
292
+    },
293
+    handleUpdate(row) {
294
+      this.setCurrent(row)
295
+      this.dialogStatus = 'update'
296
+      this.dialogFormVisible = true
297
+      this.$nextTick(() => {
298
+        this.$refs['dataForm'].clearValidate()
299
+      })
300
+    },
301
+    updateData() {
302
+      this.$refs['dataForm'].validate((valid) => {
303
+        if (valid) {
304
+          this.UpdateCommunity(this.detail).then(() => {
305
+            this.dialogFormVisible = false
306
+            this.$notify({
307
+              title: '成功',
308
+              message: '更新成功',
309
+              type: 'success',
310
+              duration: 2000
311
+            })
312
+            this.getList()
313
+          })
314
+        }
315
+      })
316
+    },
317
+    handleDelete(row) {
318
+      this.$notify({
319
+        title: '成功',
320
+        message: '删除成功',
321
+        type: 'success',
322
+        duration: 2000
323
+      })
324
+      const index = this.list.indexOf(row)
325
+      this.list.splice(index, 1)
326
+    },
327
+    handleDownload() {
328
+      this.downloadLoading = true
329
+      import('@/vendor/Export2Excel').then(excel => {
330
+        const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
331
+        const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
332
+        const data = this.formatJson(filterVal, this.list)
333
+        excel.export_json_to_excel({
334
+          header: tHeader,
335
+          data,
336
+          filename: 'table-list'
337
+        })
338
+        this.downloadLoading = false
339
+      })
340
+    },
341
+    formatJson(filterVal, jsonData) {
342
+      return jsonData.map(v => filterVal.map(j => {
343
+        if (j === 'timestamp') {
344
+          return parseTime(v[j])
345
+        } else {
346
+          return v[j]
347
+        }
348
+      }))
349
+    }
350
+  }
351
+}
352
+</script>

+ 35
- 21
VUECODE/smart-operate-manage/src/views/login/index.vue Näytä tiedosto

@@ -8,24 +8,21 @@
8 8
         </span>
9 9
         <el-input v-model="loginForm.username" name="username" type="text" auto-complete="on" placeholder="请输入手机号" />
10 10
       </el-form-item>
11
-      <el-form-item prop="password">
12
-        <span class="svg-container">
13
-          <svg-icon icon-class="password" />
14
-        </span>
15
-        <el-input
16
-          v-model="loginForm.password"
17
-          name="password"
18
-          type="text"
19
-          auto-complete="on"
20
-          placeholder="请输入验证码"
21
-          @keyup.enter.native="handleLogin" />
22
-      </el-form-item>
23
-      <el-button type="primary" @click="sendCode();">发送验证码</el-button>
24
-      <el-form-item>
25
-        <el-button :loading="loading" type="primary" style="width:100%;" @click.native.prevent="handleLogin">
26
-          登录
27
-        </el-button>
28
-      </el-form-item>
11
+      <div class="pwdSend">
12
+        <el-form-item prop="password">
13
+          <el-input
14
+            v-model="loginForm.password"
15
+            name="password"
16
+            type="text"
17
+            auto-complete="on"
18
+            placeholder="请输入验证码"
19
+            @keyup.enter.native="handleLogin" />
20
+        </el-form-item>
21
+        <el-button type="primary" @click="sendCode();">发送验证码</el-button>
22
+      </div>
23
+      <el-button :loading="loading" type="primary" style="width:100%;" @click.native.prevent="handleLogin">
24
+        登录
25
+      </el-button>
29 26
     </el-form>
30 27
   </div>
31 28
 </template>
@@ -76,9 +73,13 @@ export default {
76 73
       this.$refs.loginForm.validate(valid => {
77 74
         if (valid) {
78 75
           this.loading = true
79
-          this.$store.dispatch('Login', this.loginForm).then(() => {
80
-            this.loading = false
81
-            this.$router.push({ path: this.redirect || '/' })
76
+          this.$store.dispatch('Login', this.loginForm).then((res) => {
77
+            if (res.code === '0') {
78
+              this.loading = false
79
+              this.$router.push({ path: this.redirect || '/' })
80
+            } else {
81
+              this.loading = false
82
+            }
82 83
           }).catch(() => {
83 84
             this.loading = false
84 85
           })
@@ -87,6 +88,7 @@ export default {
87 88
           return false
88 89
         }
89 90
       })
91
+      this.$router.push({ path: this.redirect || '/' })
90 92
     },
91 93
     sendCode() {
92 94
       this.$store.dispatch('SendCode', this.loginForm.username).then((res) => {
@@ -149,6 +151,18 @@ $light_gray:#eee;
149 151
     max-width: 100%;
150 152
     padding: 35px 35px 15px 35px;
151 153
     margin: 120px auto;
154
+    .pwdSend {
155
+      float: left;
156
+      .el-form-item {
157
+        float: left;
158
+        .el-input {
159
+          float: left;
160
+        }
161
+      }
162
+      .el-button {
163
+        margin-left: 20px;
164
+      }
165
+    }
152 166
   }
153 167
   .tips {
154 168
     font-size: 14px;

+ 489
- 443
文档/MYSQL/smartCommunity.pdb
File diff suppressed because it is too large
Näytä tiedosto


+ 482
- 436
文档/MYSQL/smartCommunity.pdm
File diff suppressed because it is too large
Näytä tiedosto