yirenyishi il y a 6 ans
Parent
révision
543e258f62
  1. 10
      controllers/PageController.go
  2. 4
      controllers/UserController.go
  3. BIN
      data/beeblog.db
  4. 5
      routers/UserRouter.go
  5. 17
      static/css/me.css
  6. 10
      views/404.html
  7. 3
      views/blog.html
  8. 45
      views/ublogs.html

10
controllers/PageController.go

@ -24,3 +24,13 @@ func (this *PageController) Blog() {
func (this *PageController) IframeNote() {
this.TplName = "iframe/note.html"
}
// @router /404 [get]
func (this *PageController) PageNotFound() {
this.TplName = "404.html"
}
// @router /500 [get]
func (this *PageController) ServerError() {
this.TplName = "500.html"
}

4
controllers/UserController.go

@ -23,6 +23,10 @@ func (u *UserController) RegistPage() {
u.TplName = "regist.html"
}
func (u *UserController) PersonBlog() {
u.TplName = "ublogs.html"
}
func (this *UserController) Login() {
username := this.GetString("username")
userpwd := this.GetString("userpwd")

BIN
data/beeblog.db

Fichier binaire non affiché.

5
routers/UserRouter.go

@ -11,4 +11,9 @@ func init() {
beego.Router("/login", &controllers.UserController{}, "post:Login")
beego.Router("/regist", &controllers.UserController{}, "post:Regist")
beego.Router("/regist", &controllers.UserController{}, "get:RegistPage")
beego.Router("/me/blog", &controllers.UserController{}, "get:PersonBlog")
}

17
static/css/me.css

@ -0,0 +1,17 @@
.me-menu{
position: fixed;
top: 60px;
left: 20px;
width: 260px;
height: 100%;
background-color: #f9f9f9;
}
.me-blog-root{
height: 100%;
margin: 50px 4% 0 4%;
}
.me-blog-list{
margin-left: 300px;
}

10
views/404.html

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>404</h1>
</body>
</html>

3
views/blog.html

@ -48,8 +48,9 @@
<div style="width: 100%">
{{str2html .Blog.BlogHtml}}
</div>
{{template "footer"}}
</div>
</div>
</div>
</body>
</html>

45
views/ublogs.html

@ -0,0 +1,45 @@
{{template "header"}}
<title>博客 - 个人随笔</title>
<link type="text/css" rel="styleSheet" href="/static/css/me.css"/>
</head>
<body>
<div class="root-container">
{{template "nav" .}}
<div class="me-menu">
<div style="height: 50px;line-height: 50px">
<a href=""><img src="/static/img/2.png" alt="头像" class="img-circle"></a>
<a href="" style="margin-left: 15px;font-size: 18px;text-decoration: none">{{.Blog.User.NickName}}</a>
</div>
<hr style="height:1px;border:none;border-top:1px solid #EEE;margin: 6px;"/>
<div style="display: flex;height: 30px;line-height: 30px;">
<div style="display: inline-block;width: 100px">
<span>文章: </span>
<span>{{.Blog.User.BlogCount}}</span>
</div>
<div style="display: inline-block;flex: 1">
<span>访问: </span>
<span>{{.Blog.User.BlogBrowes}}</span>
</div>
</div>
<div style="display: flex;height: 30px;line-height: 30px;">
<div style="display: inline-block;width: 100px">
<span>评论: </span>
<span>{{.Blog.User.BlogComment}}</span>
</div>
<div style="display: inline-block;flex: 1">
<span>喜欢: </span>
<span>{{.Blog.User.BlogLike}}</span>
</div>
</div>
<hr style="height:1px;border:none;border-top:1px solid #EEE;margin: 6px;"/>
</div>
<div class="me-blog-root">
<div class="me-blog-list">
<p>vue webpack方式调用amap高德地图及其UI组件</p>
</div>
{{template "footer"}}
</div>
</div>
</div>
</body>
</html>
Chargement…
Annuler
Enregistrer