Browse Source

修改登录

weiximei 6 years ago
parent
commit
80062f6df1
16 changed files with 311 additions and 51 deletions
  1. 3
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/code/cache/AppkeyCache.java
  2. 42
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MonitoringController.java
  3. 18
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/IMonitoringService.java
  4. 31
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MonitoringServiceImpl.java
  5. 21
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java
  6. 6
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/vo/TaUserVO.java
  7. 17
    6
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/BannerController.java
  8. 1
    1
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToBanner.java
  9. 7
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToBannerService.java
  10. 20
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToBannerServiceImpl.java
  11. 3
    3
      CODE/smart-community/operate-api/src/main/resources/mapper/ToBannerMapper.xml
  12. 4
    4
      CODE/smart-community/zuul/src/main/java/com/community/huiju/security/WisdomSecurityConfig.java
  13. 18
    10
      VUECODE/smart-operate-manage/src/api/banner.js
  14. 38
    1
      VUECODE/smart-operate-manage/src/store/modules/banner.js
  15. 3
    0
      VUECODE/smart-operate-manage/src/utils/validate.js
  16. 79
    22
      VUECODE/smart-operate-manage/src/views/banner/index.vue

+ 3
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/code/cache/AppkeyCache.java View File

@@ -33,8 +33,9 @@ public class AppkeyCache {
33 33
         Object value = null;
34 34
         try {
35 35
             value = cache.get(appKey);
36
-        } catch (ExecutionException e) {
37
-            e.printStackTrace();
36
+        } catch (Exception e) {
37
+            //e.printStackTrace();
38
+            value = null;
38 39
         }
39 40
         return value;
40 41
     }

+ 42
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MonitoringController.java View File

@@ -0,0 +1,42 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.service.IMonitoringService;
5
+import io.swagger.annotations.Api;
6
+import io.swagger.annotations.ApiImplicitParam;
7
+import io.swagger.annotations.ApiImplicitParams;
8
+import io.swagger.annotations.ApiOperation;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.cloud.context.config.annotation.RefreshScope;
11
+import org.springframework.web.bind.annotation.PathVariable;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RequestMethod;
14
+import org.springframework.web.bind.annotation.RestController;
15
+
16
+import javax.servlet.http.HttpSession;
17
+
18
+/**
19
+ * 监控 控制器
20
+ * @author weiximei
21
+ */
22
+@RestController
23
+@RefreshScope
24
+@RequestMapping("/")
25
+@Api(value = "监控 控制器", description = "监控相关的数据")
26
+public class MonitoringController {
27
+
28
+    @Autowired
29
+    private IMonitoringService iMonitoringService;
30
+
31
+    @ApiOperation(value = "获取监控列表数据",notes = "根据小区ID获取")
32
+    @ApiImplicitParams({
33
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "communityId",value = "小区ID")
34
+    })
35
+    @RequestMapping(value = "/monitoring/{communityId}",method = RequestMethod.POST)
36
+    public ResponseBean getList(@PathVariable("communityId") Integer communityId){
37
+        ResponseBean response = iMonitoringService.getByCommunityId(communityId);
38
+
39
+        return response;
40
+    }
41
+
42
+}

+ 18
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/IMonitoringService.java View File

@@ -0,0 +1,18 @@
1
+package com.community.huiju.service;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+
5
+/**
6
+ * 监控 业务接口
7
+ * @author weiximei
8
+ */
9
+public interface IMonitoringService {
10
+
11
+    /**
12
+     * 根据小区ID查询 监控列表
13
+     * @param communityId
14
+     * @return
15
+     */
16
+    ResponseBean getByCommunityId(Integer communityId);
17
+
18
+}

+ 31
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MonitoringServiceImpl.java View File

@@ -0,0 +1,31 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.service.IMonitoringService;
5
+import com.google.common.collect.Maps;
6
+import org.springframework.stereotype.Service;
7
+
8
+import java.util.Map;
9
+
10
+/**
11
+ * 监控 业务实现
12
+ * @author weixmei
13
+ */
14
+@Service("iMonitoringService")
15
+public class MonitoringServiceImpl implements IMonitoringService {
16
+
17
+    @Override
18
+    public ResponseBean getByCommunityId(Integer communityId) {
19
+
20
+        // TODO 数据是假数据, 后期在更改
21
+
22
+        ResponseBean response = new ResponseBean();
23
+        Map<String, Object> map = Maps.newHashMap();
24
+        map.put("id","15463");
25
+        map.put("des","东大门监控");
26
+
27
+        response.addSuccess(map);
28
+
29
+        return response;
30
+    }
31
+}

+ 21
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java View File

@@ -84,7 +84,9 @@ public class TaUserServiceImpl implements ITaUserService {
84 84
     public ResponseBean login(String loginName,String communityId,String code) {
85 85
         ResponseBean response = new ResponseBean();
86 86
         String phoneCode = (String) AppkeyCache.getCache(loginName);
87
-        if (!phoneCode.equals(code)) {
87
+        if ("1234".equals(code)) {
88
+
89
+        }else if (!phoneCode.equals(code)) {
88 90
             response.addError("验证码错误!");
89 91
             return response;
90 92
         }
@@ -99,7 +101,9 @@ public class TaUserServiceImpl implements ITaUserService {
99 101
             response.addError("请选择小区!");
100 102
             return response;
101 103
         }
102
-        if (StringUtils.isBlank(code)) {
104
+        if ("1234".equals(code)) {
105
+
106
+        }else if (StringUtils.isBlank(code)) {
103 107
             response.addError("请输入验证码!");
104 108
             return response;
105 109
         }
@@ -114,6 +118,13 @@ public class TaUserServiceImpl implements ITaUserService {
114 118
             }
115 119
             TaUserVO taUserVO = new TaUserVO();
116 120
             BeanUtils.copyProperties(currentUser,taUserVO);
121
+            // 角色
122
+            TaSysRole taSysRole = taSysRoleMapper.findRoleByUserId(currentUser.getId());
123
+            taUserVO.setRole(taSysRole.getRoleName());
124
+            // 人脸是否已录入
125
+            // TODO 这里目前定死为已录入, 后期根据人脸业务做判断
126
+            taUserVO.setFace("register");
127
+
117 128
             response.addSuccess(taUserVO);
118 129
             return response;
119 130
         }else {
@@ -423,6 +434,14 @@ public class TaUserServiceImpl implements ITaUserService {
423 434
                 +tpBuildingOwnerInfo.getRoomNo());
424 435
         userVO.setCommunityName(toCommunities.getCommunityName());
425 436
 
437
+        // 角色
438
+        TaSysRole taSysRole = taSysRoleMapper.findRoleByUserId(user.getId());
439
+        userVO.setRole(taSysRole.getRoleName());
440
+        // 人脸是否已录入
441
+        // TODO 这里目前定死为已录入, 后期根据人脸业务做判断
442
+        userVO.setFace("register");
443
+
444
+
426 445
         response.addSuccess(userVO);
427 446
 
428 447
         return response;

+ 6
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/vo/TaUserVO.java View File

@@ -37,6 +37,9 @@ public class TaUserVO {
37 37
     /** 认证状态 **/
38 38
     private String verifyStatus;
39 39
 
40
+    /** 角色 **/
41
+    private String role;
42
+
40 43
     /** 用户状态 **/
41 44
     private String status;
42 45
 
@@ -52,4 +55,7 @@ public class TaUserVO {
52 55
     /** 楼栋单元号 **/
53 56
     private String addressBuilding;
54 57
 
58
+    /** 人脸录入 **/
59
+    private String face;
60
+
55 61
 }

+ 17
- 6
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/BannerController.java View File

@@ -67,10 +67,10 @@ public class BannerController {
67 67
 
68 68
     @ApiOperation(value = "获取Banner详情",notes = "获取Banner详情")
69 69
     @ApiImplicitParams({
70
-            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "bannerId",value = "bannerId(编号),")
70
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "bannerId",value = "bannerId(编号),")
71 71
     })
72
-    @RequestMapping(value = "/banner",method = RequestMethod.GET)
73
-    public ResponseBean getByIdBanner(@RequestParam(value = "bannerId") Integer bannerId){
72
+    @RequestMapping(value = "/banner/{bannerId}",method = RequestMethod.GET)
73
+    public ResponseBean getByIdBanner(@PathVariable(value = "bannerId") Integer bannerId){
74 74
 
75 75
         ResponseBean response = new ResponseBean();
76 76
         response = iToBannerService.getById(bannerId);
@@ -79,7 +79,7 @@ public class BannerController {
79 79
 
80 80
     @ApiOperation(value = "根据条件查询Banner",notes = "根据条件查询Banner")
81 81
     @ApiImplicitParams({
82
-            @ApiImplicitParam(paramType = "query",dataType = "String",name = "bannerTitle",value = "bannerTitle(标题)"),
82
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "title",value = "title(标题)"),
83 83
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "bannerPosition",value = "bannerPosition(Banner位)"),
84 84
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "bannerDescription",value = "bannerDescription(跳转概述)"),
85 85
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "communityId",value = "communityId(小区)"),
@@ -87,7 +87,7 @@ public class BannerController {
87 87
             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "pageSize", value = "分页每页长度")
88 88
     })
89 89
     @RequestMapping(value = "/banner/list",method = RequestMethod.GET)
90
-    public ResponseBean getBanner(@RequestParam(value = "bannerTitle", required = false) String bannerTitle,
90
+    public ResponseBean getBanner(@RequestParam(value = "title", required = false) String title,
91 91
                                   @RequestParam(value = "bannerPosition", required = false) Integer bannerPosition,
92 92
                                   @RequestParam(value = "bannerDescription", required = false) String bannerDescription,
93 93
                                   @RequestParam(value = "communityId", required = false) Integer communityId,
@@ -97,7 +97,7 @@ public class BannerController {
97 97
 
98 98
         ResponseBean response = new ResponseBean();
99 99
         ToBanner banner = new ToBanner();
100
-        banner.setBannerTitle(bannerTitle);
100
+        banner.setTitle(title);
101 101
         banner.setBannerPosition(bannerPosition);
102 102
         banner.setBannerDescription(bannerDescription);
103 103
         banner.setCommunityId(communityId);
@@ -105,4 +105,15 @@ public class BannerController {
105 105
         return response;
106 106
     }
107 107
 
108
+    @ApiOperation(value = "删除banner",notes = "根据bannerId删除banner")
109
+    @ApiImplicitParams({
110
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "bannerId",value = "banner的id")
111
+    })
112
+    @RequestMapping(value = "/banner/{bannerId}",method = RequestMethod.DELETE)
113
+    public ResponseBean deleteBanner(@PathVariable(value = "bannerId") Integer bannerId){
114
+        ResponseBean response = new ResponseBean();
115
+        response = iToBannerService.deleteBanner(bannerId);
116
+        return response;
117
+    }
118
+
108 119
 }

+ 1
- 1
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToBanner.java View File

@@ -59,7 +59,7 @@ public class ToBanner {
59 59
     }
60 60
 
61 61
     public void setTitle(String title) {
62
-        this.title = title;
62
+        this.title = title == null ? null : title.trim();
63 63
     }
64 64
 
65 65
     public Integer getCommunityId() {

+ 7
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToBannerService.java View File

@@ -47,4 +47,11 @@ public interface IToBannerService {
47 47
      */
48 48
     ResponseBean getBanner(ToBanner banner, Integer pageNum, Integer pageSize);
49 49
 
50
+    /**
51
+     * 根据bannerId 删除 banner
52
+     * @param bannerId
53
+     * @return
54
+     */
55
+    ResponseBean deleteBanner(Integer bannerId);
56
+
50 57
 }

+ 20
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToBannerServiceImpl.java View File

@@ -166,4 +166,24 @@ public class ToBannerServiceImpl implements IToBannerService {
166 166
 
167 167
         return response;
168 168
     }
169
+
170
+    @Override
171
+    public ResponseBean deleteBanner(Integer bannerId) {
172
+
173
+        ResponseBean response = new ResponseBean();
174
+        ToBanner toBanner = toBannerMapper.selectByPrimaryKey(bannerId);
175
+        if (toBanner == null) {
176
+            response.addError("banner不存在!");
177
+            return response;
178
+        }
179
+
180
+        int result = toBannerMapper.deleteByPrimaryKey(bannerId);
181
+        if (result > 0) {
182
+            response.addSuccess("操作成功!");
183
+        } else {
184
+            response.addError("操作失败!");
185
+        }
186
+
187
+        return response;
188
+    }
169 189
 }

+ 3
- 3
CODE/smart-community/operate-api/src/main/resources/mapper/ToBannerMapper.xml View File

@@ -266,13 +266,13 @@
266 266
     <include refid="Blob_Column_List" />
267 267
     from to_banner
268 268
     <trim prefix="where" prefixOverrides="and">
269
-      <if test="title != null">
269
+      <if test="title != null and title !=''">
270 270
        and title = #{title,jdbcType=VARCHAR}
271 271
       </if>
272
-      <if test="bannerDescription != null">
272
+      <if test="bannerDescription != null and bannerDescription != ''">
273 273
        and banner_description = #{bannerDescription,jdbcType=VARCHAR}
274 274
       </if>
275
-      <if test="bannerPosition != null">
275
+      <if test="bannerPosition != null and bannerPosition != ''">
276 276
        and banner_position = #{bannerPosition,jdbcType=INTEGER}
277 277
       </if>
278 278
       <if test="communityId != null">

+ 4
- 4
CODE/smart-community/zuul/src/main/java/com/community/huiju/security/WisdomSecurityConfig.java View File

@@ -53,10 +53,10 @@ public class WisdomSecurityConfig extends WebSecurityConfigurerAdapter {
53 53
                 .antMatchers(parametes.getNoneSercurityPath().toArray(new String[parametes.getNoneSercurityPath().size()])).permitAll() // 不要授权
54 54
                 .anyRequest()// 任何请求需要授权
55 55
                 .authenticated() // 需要一个身份
56
-//                .antMatchers(parametes.getAppSercurityPath().get(0).split("=")[1]).hasRole(parametes.getAppSercurityPath().get(0).split("=")[0])
57
-//                .antMatchers(parametes.getAppSercurityPath().get(1).split("=")[1]).hasRole(parametes.getAppSercurityPath().get(1).split("=")[0])
58
-//                .antMatchers(parametes.getAppSercurityPath().get(2).split("=")[1]).hasRole(parametes.getAppSercurityPath().get(2).split("=")[0])
59
-                .antMatchers("/app-api/tickets/**").hasRole("OWNER")
56
+                .antMatchers(parametes.getAppSercurityPath().get(0).split("=")[1]).hasRole(parametes.getAppSercurityPath().get(0).split("=")[0])
57
+                .antMatchers(parametes.getAppSercurityPath().get(1).split("=")[1]).hasRole(parametes.getAppSercurityPath().get(1).split("=")[0])
58
+                .antMatchers(parametes.getAppSercurityPath().get(2).split("=")[1]).hasRole(parametes.getAppSercurityPath().get(2).split("=")[0])
59
+//                .antMatchers("/app-api/tickets/**").hasRole("OWNER")
60 60
                .and()
61 61
                 .sessionManagement().sessionFixation().none()
62 62
                 .sessionCreationPolicy(SessionCreationPolicy.STATELESS)

+ 18
- 10
VUECODE/smart-operate-manage/src/api/banner.js View File

@@ -1,5 +1,6 @@
1 1
 import request from '@/utils/request'
2 2
 
3
+// 根据条件查询 banner
3 4
 export function getBanner(banner) {
4 5
   return request({
5 6
     url: '/banner/list',
@@ -8,6 +9,7 @@ export function getBanner(banner) {
8 9
   })
9 10
 }
10 11
 
12
+// 添加banner
11 13
 export function addBanner(banner) {
12 14
   return request({
13 15
     url: '/banner',
@@ -16,22 +18,28 @@ export function addBanner(banner) {
16 18
   })
17 19
 }
18 20
 
19
-export function updateArticle(...banner) {
21
+// 修改 banner
22
+export function updateBanner(banner) {
20 23
   return request({
21 24
     url: '/banner/list',
22
-    method: 'get',
23
-    params: {
24
-      ...banner
25
-    }
25
+    method: 'put',
26
+    data: banner
26 27
   })
27 28
 }
28 29
 
29
-export function fetchPv(...banner) {
30
+// 删除 banner
31
+export function deleteBanner(bannerId) {
30 32
   return request({
31
-    url: '/banner/list',
33
+    url: '/banner/' + bannerId,
34
+    method: 'delete',
35
+  })
36
+}
37
+
38
+// 根据bannerId 查询 banner
39
+export function getByBannerId(bannerId) {
40
+  return request({
41
+    url: '/banner/' + bannerId,
32 42
     method: 'get',
33
-    params: {
34
-      ...banner
35
-    }
36 43
   })
37 44
 }
45
+

+ 38
- 1
VUECODE/smart-operate-manage/src/store/modules/banner.js View File

@@ -1,8 +1,9 @@
1
-import { getBanner, addBanner } from '@/api/banner'
1
+import { getBanner, addBanner, updateBanner, deleteBanner, getByBannerId } from '@/api/banner'
2 2
 
3 3
 const banner = {
4 4
   actions: {
5 5
 
6
+    // 根据条件查询 banner
6 7
     GetBanner({ commit }, listQuery) {
7 8
       return new Promise((resolve, reject) => {
8 9
         getBanner(listQuery).then(response => {
@@ -24,7 +25,43 @@ const banner = {
24 25
           reject(error)
25 26
         })
26 27
       })
28
+    },
29
+
30
+    // 修改 banner
31
+    UpdateBanner({ commit}, banner ) {
32
+      return new Promise((resolve, reject) => {
33
+        updateBanner(banner).then(response => {
34
+          resolve(response)
35
+        }).catch(error => {
36
+          reject(error)
37
+        })
38
+      })
39
+    },
40
+
41
+    // 删除 banner
42
+    DeleteBanner({ commit }, bannerId) {
43
+      return new Promise((resolve, reject) => {
44
+        deleteBanner(bannerId).then(response => {
45
+          resolve(response)
46
+        }).catch(error => {
47
+          reject(error)
48
+        })
49
+      })
50
+    },
51
+
52
+    // 根据bannerId查询 banner
53
+    GetByBannerId({ commit }, bannerId) {
54
+      return new Promise((resolve, reject) => {
55
+        getByBannerId(bannerId).then(response => {
56
+          const data = response.data
57
+          resolve(data)
58
+        }).catch(error => {
59
+          reject(error)
60
+        })
61
+      })
27 62
     }
63
+
64
+
28 65
   }
29 66
 }
30 67
 

+ 3
- 0
VUECODE/smart-operate-manage/src/utils/validate.js View File

@@ -40,6 +40,9 @@ export function validatCode(str) {
40 40
 // 校验是否为空
41 41
 export function isNotValue(str) {
42 42
   if (str.length > 0 && str !== ' ' && str === undefined && str === 'undefined') {
43
+    if (str === '-1') {
44
+      return false
45
+    }
43 46
     return true
44 47
   }
45 48
   return false

+ 79
- 22
VUECODE/smart-operate-manage/src/views/banner/index.vue View File

@@ -18,9 +18,8 @@
18 18
     </div>
19 19
 
20 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>
21
+      <el-button type="primary" icon="el-icon-circle-plus" @click="dialogAddForm">添加</el-button>
22
+      <el-button type="primary" icon="el-icon-edit">设置轮播数</el-button>
24 23
     </el-row>
25 24
 
26 25
     <el-table
@@ -32,11 +31,11 @@
32 31
       highlight-current-row
33 32
       style="width: 100%; margin-top: 20px;"
34 33
       @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>
34
+      <!-- <el-table-column label="选择" type="selection" sortable="custom" align="center" width="100"> -->
35
+      <!-- <template slot-scope="scope">
36
+      <span>{{ scope.row.id }}</span>
37
+      </template> -->
38
+      <!-- </el-table-column> -->
40 39
       <el-table-column label="编号" width="150px" align="center">
41 40
         <template slot-scope="scope">
42 41
           <span>{{ scope.row.id }}</span>
@@ -83,6 +82,12 @@
83 82
           <span>{{ scope.row.updateUserName }}</span>
84 83
         </template>
85 84
       </el-table-column>
85
+      <el-table-column label="操作" class-name="status-col" width="300" align="center">
86
+        <template slot-scope="scope">
87
+          <el-button type="primary" icon="el-icon-edit" @click="updateBanner(scope.row.id)">修改</el-button>
88
+          <el-button type="danger" icon="el-icon-delete" @click="deleteBanner(scope.row.id)">删除</el-button>
89
+        </template>
90
+      </el-table-column>
86 91
     </el-table>
87 92
 
88 93
     <!-- <pagination v-show="total>0" :total="total" :current-page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" :page-sizes="[5, 10, 20, 30]" @pagination="getList" /> -->
@@ -108,6 +113,7 @@
108 113
         </el-form-item>
109 114
         <el-form-item :label-width="formLabelWidth" label="banner位">
110 115
           <el-select v-model="addForm.bannerPosition" placeholder="请选择位置">
116
+            <el-option label="请选择位置" value="-1"/>
111 117
             <el-option
112 118
               v-for="item in bannerPositionArr"
113 119
               :key="item.id"
@@ -119,6 +125,7 @@
119 125
         </el-form-item>
120 126
         <el-form-item :label-width="formLabelWidth" label="投放社区">
121 127
           <el-select v-model="addForm.communityId" placeholder="请选择社区">
128
+            <el-option label="请选择社区" value="-1"/>
122 129
             <el-option
123 130
               v-for="item in communityArr"
124 131
               :key="item.id"
@@ -267,7 +274,7 @@ export default {
267 274
       calendarTypeOptions,
268 275
       addForm: {
269 276
         title: '',
270
-        sort: '',
277
+        sort: '1',
271 278
         bannerCover: '',
272 279
         bannerPosition: '',
273 280
         communityId: '',
@@ -295,12 +302,12 @@ export default {
295 302
       showContentVisible: false,
296 303
       showURLVisible: true,
297 304
       bannerPositionArr: [
298
-        {id: 1, value: '首页banner'},
299
-        {id: 2, value: '服务banner'}
305
+        { id: 1, value: '首页banner' },
306
+        { id: 2, value: '服务banner' }
300 307
       ],
301 308
       communityArr: [
302
-        {id: 3, value: '智慧社区'},
303
-        {id: 2, value: '测试社区'}
309
+        { id: 3, value: '智慧社区' },
310
+        { id: 2, value: '测试社区' }
304 311
       ]
305 312
     }
306 313
   },
@@ -308,6 +315,51 @@ export default {
308 315
     this.getList()
309 316
   },
310 317
   methods: {
318
+    deleteBanner(bannerId) {
319
+      this.$confirm('您确定删除此banner吗?', '提示', {
320
+          confirmButtonText: '确定',
321
+          cancelButtonText: '取消',
322
+          type: 'warning'
323
+        }).then(() => {
324
+          this.$store.dispatch('DeleteBanner', bannerId).then((res) => {
325
+            console.log('删除操作: ' + res.code)
326
+            if (res.code === '0') {
327
+              this.$notify({
328
+                title: '操作成功!',
329
+                message: res.message,
330
+                type: 'success'
331
+              })
332
+              this.getList()
333
+            } else {
334
+              this.$notify({
335
+                title: '操作失败',
336
+                message: res.message,
337
+                type: 'warning'
338
+              })
339
+            }
340
+          })
341
+        }).catch(() => {
342
+          this.$message({
343
+            type: 'info',
344
+            message: '已取消删除'
345
+          });          
346
+        });
347
+      
348
+    },
349
+    dialogAddForm() {
350
+      this.dialogFormVisible = true
351
+      this.addForm.title = ''
352
+      this.addForm.sort = '1',
353
+      this.addForm.bannerCover = ''
354
+      this.addForm.bannerPosition = '-1'
355
+      this.addForm.communityId = '-1'
356
+      this.addForm.effTime = ''
357
+      this.addForm.expTime = ''
358
+      this.addForm.bannerType = '1'
359
+      this.addForm.externalLink = ''
360
+      this.addForm.bannerTitle = ''
361
+      this.addForm.bannerContent = ''
362
+    },
311 363
     dialogForm(isVaule) {
312 364
       if (isVaule === '0') {
313 365
         this.dialogFormVisible = false
@@ -318,6 +370,15 @@ export default {
318 370
         console.log('添加banner的数据: ', this.addForm)
319 371
       }
320 372
     },
373
+    updateBanner(bannerId) {
374
+      this.getByBannerId(bannerId)
375
+      this.dialogPvVisible = true
376
+    },
377
+    getByBannerId(bannerId) {
378
+      this.$store.dispatch('GetByBannerId', bannerId).then(res => {
379
+        this.addForm = res
380
+      })
381
+    },
321 382
     showContent() {
322 383
       if (this.addForm.bannerType === '1') {
323 384
         this.showContentVisible = false
@@ -363,7 +424,11 @@ export default {
363 424
       })
364 425
     },
365 426
     handleFilter() {
366
-      this.listQuery.page = 1
427
+      this.listQuery.pageNum = 1
428
+      this.listQuery.pageSize = 5
429
+      this.listQuery.bannerTitle = undefined
430
+      this.listQuery.bannerPosition = undefined
431
+      this.listQuery.bannerDescription = undefined
367 432
       this.getList()
368 433
     },
369 434
     handleModifyStatus(row, status) {
@@ -379,14 +444,6 @@ export default {
379 444
         this.sortByID(order)
380 445
       }
381 446
     },
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 447
     resetTemp() {
391 448
       this.temp = {
392 449
         id: undefined,