🔖 [dashboard 0.9.17] 404 页面

This commit is contained in:
naiba
2021-08-10 20:13:17 +08:00
parent 985ecc7c65
commit c848b9a08b
7 changed files with 20 additions and 6 deletions

View File

@@ -45,6 +45,7 @@ func (p *commonPage) issueViewPassword(c *gin.Context) {
}
if err != nil {
mygin.ShowErrorPage(c, mygin.ErrInfo{
Code: http.StatusOK,
Title: "出现错误",
Msg: fmt.Sprintf("请求错误:%s", err),
}, true)

View File

@@ -113,6 +113,19 @@ func ServeWeb(port uint) *http.Server {
r.Static("/static", "resource/static")
r.LoadHTMLGlob("resource/template/**/*")
routers(r)
page404 := func(c *gin.Context) {
mygin.ShowErrorPage(c, mygin.ErrInfo{
Code: http.StatusNotFound,
Title: "该页面不存在",
Msg: "该页面内容可能已着陆火星",
Link: "/",
Btn: "返回首页",
}, true)
}
r.NoRoute(page404)
r.NoMethod(page404)
srv := &http.Server{
Addr: fmt.Sprintf(":%d", port),
Handler: r,