mirror of
https://gitee.com/coder-xiaomo/flashsale
synced 2025-01-10 11:48:14 +08:00
gettop页面实现
This commit is contained in:
parent
f52fa51895
commit
080ca33954
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
target/*
|
target/*
|
||||||
|
temp*
|
5
Others/frontEnd/README.md
Normal file
5
Others/frontEnd/README.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# 前端框架模板下载
|
||||||
|
|
||||||
|
> https://www.imooc.com/video/18342
|
||||||
|
>
|
||||||
|
> 资料下载
|
54
frontend/getotp.html
Normal file
54
frontend/getotp.html
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
<script src="./static/assets/global/plugins/jquery-1.11.0.min.js" type="text/javascript"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<h3>获取OTP信息</h3>
|
||||||
|
<div>
|
||||||
|
<label>手机号</label>
|
||||||
|
<div>
|
||||||
|
<input type="text" placeholder="手机号" name="telephone" id="telephone">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button id="getotp" type="submit">
|
||||||
|
获取OTP短信
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
$("#getotp").on("click", function () {
|
||||||
|
var telephone = $("#telephone").val();
|
||||||
|
if (telephone == null || telephone == "") {
|
||||||
|
alert("手机号不能为空");
|
||||||
|
return false; // 捕获onclick事件,不让他传递到上一层
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
contentType: "application/x-www-form-urlencoded",
|
||||||
|
url: "http://localhost:8090/user/getotp",
|
||||||
|
data: {
|
||||||
|
"telephone": telephone,
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
if (data.status == "success") {
|
||||||
|
alert("OTP已经发送到了您的手机上,请注意查收");
|
||||||
|
} else {
|
||||||
|
alert("OTP发送失败,原因为" + data.data.errMsg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
alert("OTP发送失败,原因为" + data.responseText);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
4
frontend/static/assets/global/plugins/jquery-1.11.0.min.js
vendored
Normal file
4
frontend/static/assets/global/plugins/jquery-1.11.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -12,6 +12,9 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class BaseController {
|
public class BaseController {
|
||||||
|
|
||||||
|
public static final String CONTENT_TYPE_FORMED = "application/x-www-form-urlencoded";
|
||||||
|
|
||||||
// 定义ExceptionHandler解决未被Controller层吸收的Exception
|
// 定义ExceptionHandler解决未被Controller层吸收的Exception
|
||||||
@ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
@ResponseStatus(HttpStatus.OK)
|
@ResponseStatus(HttpStatus.OK)
|
||||||
|
@ -16,6 +16,7 @@ import java.util.Random;
|
|||||||
|
|
||||||
@Controller("user") // 允许被SpringBoot扫描到
|
@Controller("user") // 允许被SpringBoot扫描到
|
||||||
@RequestMapping("/user") // 通过 "/user" 访问到
|
@RequestMapping("/user") // 通过 "/user" 访问到
|
||||||
|
@CrossOrigin // 允许跨域
|
||||||
public class UserController extends BaseController {
|
public class UserController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -25,7 +26,7 @@ public class UserController extends BaseController {
|
|||||||
private HttpServletRequest httpServletRequest;
|
private HttpServletRequest httpServletRequest;
|
||||||
|
|
||||||
// 用户获取OTP短信接口
|
// 用户获取OTP短信接口
|
||||||
@RequestMapping("/getotp")
|
@RequestMapping(value = "/getotp", method = {RequestMethod.POST}, consumes = {CONTENT_TYPE_FORMED})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public CommonReturnType getOtp(@RequestParam(name = "telephone") String telephone) {
|
public CommonReturnType getOtp(@RequestParam(name = "telephone") String telephone) {
|
||||||
// 需要按照一定的规则生成OTP验证码
|
// 需要按照一定的规则生成OTP验证码
|
||||||
|
Loading…
Reference in New Issue
Block a user