diff --git a/pom.xml b/pom.xml index b817a6f..b4f4870 100644 --- a/pom.xml +++ b/pom.xml @@ -100,6 +100,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/phy/ebuy/EbuyApplication.java b/src/main/java/com/phy/ebuy/EbuyApplication.java index 1c53365..ef46c33 100644 --- a/src/main/java/com/phy/ebuy/EbuyApplication.java +++ b/src/main/java/com/phy/ebuy/EbuyApplication.java @@ -1,8 +1,9 @@ package com.phy.ebuy; +import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; - +@MapperScan(basePackages = {"com.phy.ebuy.dao"}) @SpringBootApplication public class EbuyApplication { diff --git a/src/main/java/com/phy/ebuy/controller/EbuyController.java b/src/main/java/com/phy/ebuy/controller/EbuyController.java index 0162bd9..4b5436e 100644 --- a/src/main/java/com/phy/ebuy/controller/EbuyController.java +++ b/src/main/java/com/phy/ebuy/controller/EbuyController.java @@ -1,14 +1,42 @@ package com.phy.ebuy.controller; +import com.phy.ebuy.service.EbuyService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.HashMap; +import java.util.Map; @Controller @RequestMapping("/ebuy") public class EbuyController { + @Autowired + private EbuyService ebuyService; + //跳转登录页面 @RequestMapping("/login") public String login() { return "/login.html"; } + + //验证登录 + @ResponseBody + @RequestMapping("/verifyLogin") + public Map verifyLogin(@RequestParam("userName")String userName,@RequestParam("passWord")String passWord) { + //参数 + Map parameter = new HashMap<>(); + parameter.put("userName",userName); + parameter.put("passWord",passWord); + //返回结果 + Map result = null; + try { + result = ebuyService.verifyLogin(parameter); + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } } diff --git a/src/main/java/com/phy/ebuy/dao/EbuyMapper.java b/src/main/java/com/phy/ebuy/dao/EbuyMapper.java new file mode 100644 index 0000000..8aa0dfc --- /dev/null +++ b/src/main/java/com/phy/ebuy/dao/EbuyMapper.java @@ -0,0 +1,14 @@ +package com.phy.ebuy.dao; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; + +import java.util.Map; + +@Mapper +public interface EbuyMapper { + /** + * 验证登录 + */ + Map verifyLogin(Map map); +} diff --git a/src/main/java/com/phy/ebuy/dao/mapping/Ebuymapper.xml b/src/main/java/com/phy/ebuy/dao/mapping/Ebuymapper.xml new file mode 100644 index 0000000..43c1474 --- /dev/null +++ b/src/main/java/com/phy/ebuy/dao/mapping/Ebuymapper.xml @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/phy/ebuy/service/EbuyService.java b/src/main/java/com/phy/ebuy/service/EbuyService.java new file mode 100644 index 0000000..1e82831 --- /dev/null +++ b/src/main/java/com/phy/ebuy/service/EbuyService.java @@ -0,0 +1,11 @@ +package com.phy.ebuy.service; + +import java.util.HashMap; +import java.util.Map; + +public interface EbuyService{ + /** + * 验证登录 + */ + Map verifyLogin(Map parameter); +} diff --git a/src/main/java/com/phy/ebuy/service/impl/EbuyServiceImpl.java b/src/main/java/com/phy/ebuy/service/impl/EbuyServiceImpl.java new file mode 100644 index 0000000..16dfa7c --- /dev/null +++ b/src/main/java/com/phy/ebuy/service/impl/EbuyServiceImpl.java @@ -0,0 +1,22 @@ +package com.phy.ebuy.service.impl; + +import com.phy.ebuy.dao.EbuyMapper; +import com.phy.ebuy.service.EbuyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Map; + +@Service +public class EbuyServiceImpl implements EbuyService { + /** + * 验证登录 + */ + @Autowired + private EbuyMapper ebuyMapper; + public Map verifyLogin(Map parameter) { + //返回结果 + Map result = ebuyMapper.verifyLogin(parameter); + return result; + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 27d39de..d713458 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -41,9 +41,9 @@ spring: ############################## mybatis-plus配置 开始 ############################## mybatis-plus: - mapper-locations: classpath*:com/**/mapping/*.xml - typeAliasesPackage: com.jxdinfo.hussar.**.model,com.xxxx.**.model - typeEnumsPackage: com.jxdinfo.hussar.common.constant.enums + mapper-locations: classpath*:com/phy/ebuy/dao/mapping/*.xml + typeAliasesPackage: com.phy.ebuy.model + global-config: id-type: 3 # 0:数据库ID自增 1:用户输入id 2:全局唯一id(IdWorker) 3:全局唯一ID(uuid) db-column-underline: false diff --git a/src/main/webapp/WEB-INF/view/index.html b/src/main/webapp/WEB-INF/view/index.html new file mode 100644 index 0000000..d6d40cf --- /dev/null +++ b/src/main/webapp/WEB-INF/view/index.html @@ -0,0 +1,10 @@ + + + + + E-BUY - 买你想买 + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/view/login.html b/src/main/webapp/WEB-INF/view/login.html index 4c59666..0b184f6 100644 --- a/src/main/webapp/WEB-INF/view/login.html +++ b/src/main/webapp/WEB-INF/view/login.html @@ -4,11 +4,18 @@ 登录页面 + + + +
-
- +
+
@@ -16,23 +23,30 @@ -
+
- - +
+
- - +
+
- +
+
+
忘记密码
+
免费注册
+
+ + + \ No newline at end of file diff --git a/src/main/webapp/static/css/login.css b/src/main/webapp/static/css/login.css index 72e05b0..46400ee 100644 --- a/src/main/webapp/static/css/login.css +++ b/src/main/webapp/static/css/login.css @@ -14,6 +14,36 @@ body{ } .head{ flex: 1; + display: flex; +} +.head .log{ + background: url("../img/E-Buy2.png"); + background-repeat: no-repeat; + background-size: 80% 50%; + -moz-background-size: 80% 80%; + background-position: center; + height: 100%; + width: 10%; + margin-left: 8%; +} +.head .login-msg{ + text-align: center; + width: 880px; + background-color: #fef2f2; + color: #6C6C6C; + line-height: 16px; + padding: 6px 10px; + overflow: hidden; + background: #fef2f2; + border: 1px solid #ffb4a8; + font-size: 0.8em; + height: 1em; + margin: auto; + margin-left: 40px; +} +.head .login-msg error .error{ + float: none; + width: auto; } .middle{ flex: 8; @@ -27,7 +57,7 @@ body{ margin-left: 65%; width: 20%; height: 42%; - background: #E9E9F2; + background: #FFF3E6; padding: 1em; } .middle .login-box .login-title{ @@ -39,52 +69,80 @@ body{ padding-bottom: 8px; font-weight: 700; } -.middle .login-box form .userName{ +.middle .login-box .form .userName{ height: 2.5em; width: 90%; background: white; margin: 0 auto; margin-top: 1em; } -.middle .login-box form .userName .ico1{ +.middle .login-box .form .userName .ico1{ + background-color: #ddd; width: 40px; float: left; height: 100%; - background-size: 100% 100%; - background: url("../img/person.png"); + background-image:url("../img/person.png"); + background-repeat:no-repeat; + background-size:80% 80%; + -moz-background-size:80% 80%; + background-position: center; } -.middle .login-box form .passWord .ico2{ +.middle .login-box .form .passWord .ico2{ + background-color: #ddd; width: 40px; float: left; height: 100%; - background-size: 100% 100%; - background: url("../img/password.png"); + background-image:url("../img/password.png"); + background-repeat:no-repeat; + background-size:80% 80%; + -moz-background-size:80% 80%; + background-position: center; } -.middle .login-box form .input1{ - padding: 10px 10px 10px 10px; +.middle .login-box .form .input1{ + padding: 9px 10px 9px 10px; height: 50%; - width: calc(100% - 60px); + width: calc(100% - 62px); background: white; - border: none; + border: 1px solid #ddd; } -.middle .login-box form .passWord{ +.middle .login-box .form .passWord{ height: 2.5em; width: 90%; background: white; margin: 0 auto; margin-top: 1em; } -.middle .login-box form .login-btu{ - display: block; +.middle .login-box .form .login-btu{ height: 3em; width: 90%; - background: #FBBE6E; margin: 0 auto; margin-top: 1em; - font-weight:bold; - color: #5E5E5E; - border-radius: 10%; letter-spacing: 15px; + border: 0; + display: block; + overflow: hidden; + vertical-align: middle; + line-height: 42px; + font-weight: 700; + color: #fff; + background: #f40; + border-radius: 3px; + cursor: pointer; + zoom: 1; +} +.middle .login-box .function{ + color: #6C6C6C; + margin-top: 1em; + display: flex; + font-size: 0.8em; + width: 60%; + float: right; +} +.middle .login-box .function .forget-password{ + flex: 1; +} +.middle .login-box .function .register{ + flex: 1; } .bottom{ flex: 1; diff --git a/src/main/webapp/static/img/E-Buy2.png b/src/main/webapp/static/img/E-Buy2.png new file mode 100644 index 0000000..ba64330 Binary files /dev/null and b/src/main/webapp/static/img/E-Buy2.png differ diff --git a/src/main/webapp/static/img/person.png b/src/main/webapp/static/img/person.png new file mode 100644 index 0000000..8008d14 Binary files /dev/null and b/src/main/webapp/static/img/person.png differ diff --git a/src/main/webapp/static/js/login.js b/src/main/webapp/static/js/login.js new file mode 100644 index 0000000..f9f5758 --- /dev/null +++ b/src/main/webapp/static/js/login.js @@ -0,0 +1,23 @@ +layui.use(['layer',"jquery"], function() { + const layer = layui.layer + ,$ = layui.jquery; + $(".login-btu").on("click", function () { + //登录验证 + $.ajax({ + url: "/ebuy/verifyLogin", + type: "post", + data: { + userName: $("#userName").val(), + passWord: $("#passWord").val() + }, + dataType: "json", + success: function (data) { + console.log(data); + + }, + error: function () { + layer.msg("你输入的密码和账户名不匹配!") + } + }) + }) +}) \ No newline at end of file