feat(page): 新增沃尔玛分组页面及相关路由
- 在 PageAuthController 中添加了 WalmartGroupPage 方法,用于处理沃尔玛分组页面的逻辑。 - 在 router_pages.go 中新增了对应的路由配置。 - 新增了 group.html 文件,构建了沃尔玛分组页面的基本结构和 iframe 加载逻辑。 - 更新了 index.html 文件,调整了模态框的结构和样式,确保用户体验更佳。
This commit is contained in:
@@ -7,10 +7,11 @@ import (
|
||||
"boss/internal/utils"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"github.com/beego/beego/v2/core/config/env"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/beego/beego/v2/core/config/env"
|
||||
|
||||
"github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
@@ -200,6 +201,24 @@ func (c *PageAuthController) WalmartOrderPage() {
|
||||
c.TplName = "walmart-card/order.html"
|
||||
}
|
||||
|
||||
func (c *PageAuthController) WalmartGroupPage() {
|
||||
token := ""
|
||||
// 获取当前时间的时间戳
|
||||
currentTime := time.Now()
|
||||
targetMinute := (currentTime.Minute() / 10) * 10
|
||||
targetTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), currentTime.Hour(), targetMinute, 0, 0, currentTime.Location())
|
||||
now := strconv.Itoa(int(targetTime.Unix()))
|
||||
secretCfg := config.GetSecret()
|
||||
tokenB, err := utils.AesCBCEncrypt([]byte(now), []byte(secretCfg.Key), []byte(secretCfg.IV))
|
||||
if err == nil {
|
||||
//base64编码
|
||||
token = base64.URLEncoding.EncodeToString(tokenB)
|
||||
}
|
||||
c.Data["token"] = token
|
||||
c.Data["portalHost"] = config.GetPortalHost()
|
||||
c.TplName = "walmart-card/group.html"
|
||||
}
|
||||
|
||||
func (c *PageAuthController) WalmartAccountPage() {
|
||||
token := ""
|
||||
// 获取当前时间的时间戳
|
||||
|
||||
@@ -31,6 +31,7 @@ func init() {
|
||||
beego.Router("/recharge-jd-account.html", &controllers.PageAuthController{}, "*:JDAccountPage")
|
||||
beego.Router("/recharge-jd-order.html", &controllers.PageAuthController{}, "*:JDOrderPage")
|
||||
|
||||
beego.Router("/recharge-walmart-group.html", &controllers.PageAuthController{}, "*:WalmartGroupPage")
|
||||
beego.Router("/recharge-walmart-account.html", &controllers.PageAuthController{}, "*:WalmartAccountPage")
|
||||
beego.Router("/recharge-walmart-order.html", &controllers.PageAuthController{}, "*:WalmartOrderPage")
|
||||
|
||||
|
||||
@@ -327,8 +327,7 @@
|
||||
<div class="second-menu">
|
||||
<a href="#"
|
||||
onclick='loadMainContent("/recharge-apple-card-account.html")'><span>苹果账户管理</span></a>
|
||||
<a href="#"
|
||||
onclick='loadMainContent("/recharge-apple-card-order.html")'><span>充值订单管理</span></a>
|
||||
<a href="#" onclick='loadMainContent("/recharge-apple-card-order.html")'><span>充值订单管理</span></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div>-->
|
||||
@@ -374,6 +373,9 @@
|
||||
<span class="glyphicon glyphicon-plus last-glyphicon"></span>
|
||||
</a>
|
||||
<div class="second-menu">
|
||||
<a href="#" onclick='loadMainContent("/recharge-walmart-group.html")'>
|
||||
<span>分组管理</span>
|
||||
</a>
|
||||
<a href="#" onclick='loadMainContent("/recharge-walmart-account.html")'>
|
||||
<span>账号管理</span>
|
||||
</a>
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<!--[if lt IE 7]>
|
||||
<html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
|
||||
<!--[if IE 7]>
|
||||
<html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->
|
||||
<!--[if IE 8]>
|
||||
<html class="lt-ie9" lang="en"> <![endif]-->
|
||||
<!--[if gt IE 8]><!-->
|
||||
<html lang="en">
|
||||
<!--<![endif]-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<title>管理后台系统</title>
|
||||
<link href="../static/css/login.css" rel="stylesheet">
|
||||
<script src="../static/js/jquery.min.js"></script>
|
||||
<script src="../static/js/filter.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="../static/js/html5.js"></script><![endif]-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<section class="container">
|
||||
<div class="login">
|
||||
<h1>管理员登录</h1>
|
||||
|
||||
<p>
|
||||
<input class="userID" name="login" placeholder="注册手机号" type="text" value="">
|
||||
</p>
|
||||
<div class="userIDERROR" style="color: red;margin-left: 10px; font-size: small"></div>
|
||||
<p><input class="passwd" name="password" placeholder="密码" type="password" value=""></p>
|
||||
<p><input class="totp" name="totp" placeholder="二次验证(如果设置了就需要填写)" type="text" value=""></p>
|
||||
<div class="passwdDERROR" style="color: red;margin-left: 10px; font-size: small"></div>
|
||||
<div class="verify">
|
||||
<div class="left_f">
|
||||
<input class="verifyText" placeholder="验证码" type="text">
|
||||
<div class="CodeDERROR" style="color: red;margin-left: 10px; font-size: small"></div>
|
||||
</div>
|
||||
<div class="right_f">
|
||||
<img ALT="" class="verifyImg" src="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="remember_me">
|
||||
<label>
|
||||
<input id="remember_me" name="remember_me" type="checkbox">
|
||||
记住密码
|
||||
</label>
|
||||
</div>
|
||||
<div class="submit"><input id="login" name="commit" type="submit" value="登录"></div>
|
||||
</div>
|
||||
</section>
|
||||
<script>
|
||||
//页面展示自动加载验证码
|
||||
$(".verifyImg").attr("src", "/getVerifyImg?rand=" + new Date().getTime());
|
||||
//注册用户点击验证,更换验证码图片
|
||||
var flushCode = function () {
|
||||
let verifyImg = $(".verifyImg");
|
||||
verifyImg.click(function () {
|
||||
verifyImg.attr("src", "/getVerifyImg?rand=" + new Date().getTime());
|
||||
});
|
||||
}
|
||||
flushCode();
|
||||
//点击登录按钮,进行用户登录操作
|
||||
$("#login").click(function () {
|
||||
login();
|
||||
});
|
||||
|
||||
function login() {
|
||||
let userID = $.trim($(".userID").val());
|
||||
let passwd = $.trim($(".passwd").val());
|
||||
let Code = $(".verifyText").val();
|
||||
let totp = $(".totp").val();
|
||||
|
||||
Code = $.trim(Code);
|
||||
if (userID.length <= 0) {
|
||||
$(".userIDERROR").text("").append("* 登录手机号不能为空!");
|
||||
$(".verifyImg").attr("src", "/getVerifyImg?rand=" + new Date().getTime());
|
||||
return;
|
||||
}
|
||||
if (passwd.length <= 0) {
|
||||
$(".passwdDERROR").text("").append("* 密码不能为空!");
|
||||
$(".verifyImg").attr("src", "/getVerifyImg?rand=" + new Date().getTime());
|
||||
return;
|
||||
}
|
||||
if (Code.length < 4) {
|
||||
$(".CodeDERROR").text("").append("* 验证码不正确!");
|
||||
$(".verifyImg").attr("src", "/getVerifyImg?rand=" + new Date().getTime());
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: "/login",
|
||||
data: {
|
||||
userID: userID,
|
||||
passwd: passwd,
|
||||
Code: Code,
|
||||
totpCode: totp,
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.Key === "userID") {
|
||||
$(".userIDERROR").text("").append(data.Msg);
|
||||
$(".verifyImg").attr("src", "/getVerifyImg?rand=" + new Date().getTime());
|
||||
} else if (data.Key === "passWD") {
|
||||
$(".passwdDERROR").text("").append(data.Msg);
|
||||
$(".verifyImg").attr("src", "/getVerifyImg?rand=" + new Date().getTime());
|
||||
} else if (data.Key === "code") {
|
||||
$(".CodeDERROR").text("").append(data.Msg);
|
||||
$(".verifyImg").attr("src", "/getVerifyImg?rand=" + new Date().getTime());
|
||||
} else if (data.Key === "unactive" || data.Key === "del") {
|
||||
alert(data.Msg);
|
||||
$(".verifyImg").attr("src", "/getVerifyImg?rand=" + new Date().getTime());
|
||||
}
|
||||
//登录成功,跳转到管理界面主页
|
||||
if (data.Key.length <= 0) {
|
||||
window.parent.location = "/index.html";
|
||||
} else {
|
||||
$(".verifyImg").attr("src", "/getVerifyImg?rand=" + new Date().getTime());
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
alert("系统异常,请求稍后再尝试!");
|
||||
$(".verifyImg").attr("src", "/getVerifyImg?rand=" + new Date().getTime());
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
21
views/walmart-card/group.html
Normal file
21
views/walmart-card/group.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
|
||||
<body>
|
||||
<iframe src="">
|
||||
</iframe>
|
||||
</body>
|
||||
<style>
|
||||
iframe {
|
||||
width: 100%;
|
||||
height: 90vh;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
// 构建链接
|
||||
const url = "{{.portalHost}}" + "/iframe/WalmartGroup?token={{.token}}";
|
||||
// 链接添加至到iframe中
|
||||
document.getElementsByTagName("iframe")[0].src = url;
|
||||
</script>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user