From 1c5661e442f4cf269535824c1d497da5d6527085 Mon Sep 17 00:00:00 2001 From: peihaoyu <617594538@qq.com> Date: Thu, 21 May 2020 21:46:21 +0800 Subject: [PATCH] 20200521 --- .../traffic/controller/trafficController.java | 8 ++++++-- .../traffic/dao/mapping/trafficMapper.xml | 4 +++- .../springboot/traffic/dao/trafficMapper.java | 14 +++++++++++--- .../service/impl/trafficServiceImpl.java | 19 +++++++++++++++++-- .../traffic/service/trafficService.java | 15 ++++++++++----- traffic-front/src/components/index.vue | 11 +++++++++-- 6 files changed, 56 insertions(+), 15 deletions(-) diff --git a/traffic-back/src/main/java/com/springboot/traffic/controller/trafficController.java b/traffic-back/src/main/java/com/springboot/traffic/controller/trafficController.java index d7edfb1..76e81fa 100644 --- a/traffic-back/src/main/java/com/springboot/traffic/controller/trafficController.java +++ b/traffic-back/src/main/java/com/springboot/traffic/controller/trafficController.java @@ -33,11 +33,15 @@ public class trafficController { /**登录验证*/ - @RequestMapping(value = "/login", method = {RequestMethod.POST, RequestMethod.GET}) + @RequestMapping(value = "/logon", method = {RequestMethod.POST, RequestMethod.GET}) @ResponseBody public Map login(@RequestBody Map param) { Map result = new HashMap<>(); - result = trafficService.getUser(); + try { + result = trafficService.getUser(param); + } catch(Exception e){ + e.printStackTrace(); + } return result; } diff --git a/traffic-back/src/main/java/com/springboot/traffic/dao/mapping/trafficMapper.xml b/traffic-back/src/main/java/com/springboot/traffic/dao/mapping/trafficMapper.xml index cfb5ec0..a57f4a6 100644 --- a/traffic-back/src/main/java/com/springboot/traffic/dao/mapping/trafficMapper.xml +++ b/traffic-back/src/main/java/com/springboot/traffic/dao/mapping/trafficMapper.xml @@ -1,6 +1,7 @@ + insert into traffic_user(user_id,user_name,user_password,user_phone) values @@ -11,8 +12,9 @@ #{formName.phone} ) + \ No newline at end of file diff --git a/traffic-back/src/main/java/com/springboot/traffic/dao/trafficMapper.java b/traffic-back/src/main/java/com/springboot/traffic/dao/trafficMapper.java index d33a1bc..e0be967 100644 --- a/traffic-back/src/main/java/com/springboot/traffic/dao/trafficMapper.java +++ b/traffic-back/src/main/java/com/springboot/traffic/dao/trafficMapper.java @@ -8,11 +8,19 @@ import java.util.Map; @Mapper public interface trafficMapper { - /**用户注册 - * @param param**/ + /** + * 用户注册 + * @param 用户名、密码、手机号 + * @return 1:注册成功 0:注册失败 + */ int userRegister(Map param); - List> getUser(); + /** + * 用户登录 + * @param 用户名、密码 + * @return 用户是否注册 + */ + List> getUser(Map param); } diff --git a/traffic-back/src/main/java/com/springboot/traffic/service/impl/trafficServiceImpl.java b/traffic-back/src/main/java/com/springboot/traffic/service/impl/trafficServiceImpl.java index 68910ba..ca2956e 100644 --- a/traffic-back/src/main/java/com/springboot/traffic/service/impl/trafficServiceImpl.java +++ b/traffic-back/src/main/java/com/springboot/traffic/service/impl/trafficServiceImpl.java @@ -14,6 +14,11 @@ public class trafficServiceImpl implements trafficService { @Autowired trafficMapper trafficMapper; + /** + * 用户注册 + * @param 用户名、密码、手机号 + * @return 成功与否、数据 + */ @Override public Map register(Map param) { Map result = new HashMap<>(); @@ -28,10 +33,20 @@ public class trafficServiceImpl implements trafficService { return result; } + /** + * 用户登录 + * @param 用户名、密码 + * @return 用户是否注册 + */ @Override - public Map getUser() { + public Map getUser(Map param) { Map result = new HashMap<>(); - List> res = trafficMapper.getUser(); + List> res = null; + try { + res = trafficMapper.getUser(param); + } catch(Exception e){ + e.printStackTrace(); + } result.put("success", true); result.put("data", res); return result; diff --git a/traffic-back/src/main/java/com/springboot/traffic/service/trafficService.java b/traffic-back/src/main/java/com/springboot/traffic/service/trafficService.java index 2e0b3c2..cfe5a74 100644 --- a/traffic-back/src/main/java/com/springboot/traffic/service/trafficService.java +++ b/traffic-back/src/main/java/com/springboot/traffic/service/trafficService.java @@ -3,15 +3,20 @@ package com.springboot.traffic.service; import java.util.Map; public interface trafficService { - - /**用户注册**/ + + /** + * 用户注册 + * @param 用户名、密码、手机号 + * @return 成功与否、数据 + */ Map register(Map param); /** - * - * @return + * 用户登录 + * @param 用户名、密码 + * @return 用户是否注册 */ - Map getUser(); + Map getUser(Map param); } diff --git a/traffic-front/src/components/index.vue b/traffic-front/src/components/index.vue index 735d658..5c566e6 100644 --- a/traffic-front/src/components/index.vue +++ b/traffic-front/src/components/index.vue @@ -37,7 +37,7 @@ - 登录 + 登录 @@ -181,7 +181,14 @@ export default { this.$message.error('用户名已存在!'); } },r=>{ + this.$message.error('注册失败!'); + }) + }, + //用户登录 + submitLogon(formName){ + this.$ajax.post("/traffic/logon",{formName},r=>{ + debugger }) }, @@ -210,6 +217,6 @@ export default { .menu{ height:4rem; - width:100% + width: % }