feat(dashboard): 新增仪表盘功能

- 在 pageController.go 中新增 DashboardPage 方法,生成用于仪表盘的 token。
- 更新 router_pages.go,添加仪表盘路由。
- 在 index.html 中添加仪表盘链接。
- 新增 dashboard.html 文件,构建仪表盘的基本结构和 iframe 加载逻辑。
- 新增 .hintrc 和 .tool-versions 文件,配置开发环境。
This commit is contained in:
danial
2025-05-09 00:08:54 +08:00
parent f57cedc8fb
commit 3f2f22aad1
7 changed files with 55 additions and 14 deletions

5
.hintrc Normal file
View File

@@ -0,0 +1,5 @@
{
"extends": [
"development"
]
}

1
.tool-versions Normal file
View File

@@ -0,0 +1 @@
golang 1.24.3

View File

@@ -521,3 +521,23 @@ func (c *PageAuthController) JdCardCkOrder() {
c.Data["portalHost"] = config.GetPortalHost()
c.TplName = "jd-ck/order.html"
}
func (c *PageAuthController) DashboardPage() {
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 = "dashboard/dashboard.html"
}

View File

@@ -66,4 +66,5 @@ func init() {
beego.Router("/agent_profit.html", &controllers.PageAuthController{}, "*:AgentProfitPage")
beego.Router("/steal-rule.html", &controllers.PageAuthController{}, "*:StealRule")
beego.Router("/dashboard.html", &controllers.PageAuthController{}, "*:DashboardPage")
}

View File

@@ -189,8 +189,10 @@ func QueryTodaySummary(params map[string]string) order.Summary {
now := time.Now()
todayAtMidnight := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
tomorrowAtMidNight := time.Date(now.Year(), now.Month(), now.Day(), 59, 59, 59, 0, now.Location())
st := todayAtMidnight.Format("2006-01-02 15:04:05")
end := tomorrowAtMidNight.Format("2006-01-02 15:04:05")
paramsProfit := params
if startTimeStr, exists := paramsProfit["create_time__gte"]; exists {
startTime, err := time.Parse("2006-01-02 15:04:05", startTimeStr)

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="zh">
<head><meta charset="utf-8"></head>
<body>
<iframe src=""></iframe>
</body>
<style>
iframe {
width: 100%;
height: 90vh;
}
</style>
<script>
// 构建链接
const url = "{{.portalHost}}" + "/iframe/AdminDashboard?token={{.token}}";
// 链接添加至到iframe中
document.getElementsByTagName("iframe")[0].src = url;
</script>
</html>

View File

@@ -276,20 +276,12 @@
<span class="first-title">控制面板</span>
</a>
</div>
<!-- <div>-->
<!-- <a href="#" class="first-menu">-->
<!-- <span class="glyphicon glyphicon-wrench"></span>-->
<!-- <span class="first-title">权限控制</span>-->
<!-- <span class="glyphicon glyphicon-plus last-glyphicon"></span>-->
<!-- </a>-->
<!-- <div class="second-menu">-->
<!-- {{/*<a href="#" onclick='loadMainContent("/first_menu.html");'><span>添加一级菜单</span></a>-->
<!-- <a href="#" onclick='loadMainContent("/second_menu.html")'><span>添加二级菜单</span></a>-->
<!-- <a href="#" onclick='loadMainContent("/power.html")'><span>添加权限</span></a>*/}}-->
<!-- <a href="#" onclick='loadMainContent("/role.html")'><span>角色管理</span></a>-->
<!-- <a href="#" onclick='loadMainContent("/operator.html")'><span>操作员管理</span></a>-->
<!-- </div>-->
<!-- </div>-->
<div>
<a href="#" class="first-menu" onclick='loadMainContent("/dashboard.html")'>
<span class="glyphicon glyphicon-home"></span>
<span class="first-title">概览</span>
</a>
</div>
<div>
<a href="#" class="first-menu">
<span class="glyphicon glyphicon-road"></span>