From 208541b9b3290552f42eb41f606b2e162ba59ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E5=A3=AB=E6=B6=B5?= <630892807@qq.com> Date: Sat, 20 Jun 2020 16:05:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A8=A1=E6=9D=BF=E8=AF=AD?= =?UTF-8?q?=E6=B3=95=E5=92=8Cmysql=E8=AE=BE=E7=BD=AE=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/mysql.go | 7 ++++ server.go | 5 +++ static/html/header.html | 4 ++- static/html/setting.html | 6 ++-- static/html/setting_bottom.html | 60 ++++++++++++++++++++++++++++++++- static/html/setting_left.html | 8 +++-- tmpl/setting.go | 20 +++++++++-- 7 files changed, 100 insertions(+), 10 deletions(-) diff --git a/controller/mysql.go b/controller/mysql.go index e6b7353..0661fef 100644 --- a/controller/mysql.go +++ b/controller/mysql.go @@ -1,10 +1,17 @@ package controller import ( + "github.com/gin-gonic/gin" "github.com/taoshihan1991/imaptool/tmpl" "net/http" ) +func MysqlGetConf(c *gin.Context) { + c.JSON(200, gin.H{ + "code": 200, + "msg": "验证成功", + }) +} func ActionMysqlSet(w http.ResponseWriter, r *http.Request) { render := tmpl.NewSettingHtml(w) render.SetLeft("setting_left") diff --git a/server.go b/server.go index f9df902..c19eef3 100644 --- a/server.go +++ b/server.go @@ -31,6 +31,11 @@ func main() { engine.POST("/check_auth",middleware.JwtApiMiddleware, controller.MainCheckAuth) //前后聊天 engine.GET("/chat_server", controller.NewChatServer) + //设置页 + engine.GET("/setting", tmpl.PageSetting) + //设置mysql + engine.GET("/setting_mysql", tmpl.PageSettingMysql) + engine.GET("/get_setting_mysql",middleware.JwtApiMiddleware, controller.MysqlGetConf) //------------------old code----------------------------- mux := &http.ServeMux{} //根路径 diff --git a/static/html/header.html b/static/html/header.html index 656d017..2d9e028 100644 --- a/static/html/header.html +++ b/static/html/header.html @@ -1,3 +1,4 @@ +{{define "header"}}
@@ -51,4 +52,5 @@ - \ No newline at end of file + +{{end}} \ No newline at end of file diff --git a/static/html/setting.html b/static/html/setting.html index 69a7a67..3511d4f 100644 --- a/static/html/setting.html +++ b/static/html/setting.html @@ -1,9 +1,9 @@ -{{.Header}} +{{template "header" }}