diff --git a/controllers/BlogController.go b/controllers/BlogController.go index 0790b35..3dc8521 100644 --- a/controllers/BlogController.go +++ b/controllers/BlogController.go @@ -42,6 +42,8 @@ func (this *BlogController) Get() { if err == nil { this.Data["Blog"] = blog } + this.Data["NickName"] = this.GetSession("nickname") + this.Data["IsLogin"] = this.GetSession("nickname") != nil this.TplName = "blog.html" } @@ -83,9 +85,7 @@ func (this *BlogController) BlogsPage() { return } - NickName:= this.GetSession("nickname") - fmt.Print("current user ",NickName) - this.Data["NickName"] = NickName + this.Data["NickName"] = this.GetSession("nickname") this.Data["IsLogin"] = this.GetSession("nickname") != nil this.Data["Page"] = pages this.Data["Cats"] = cats diff --git a/controllers/MapController.go b/controllers/MapController.go index b5ec7f1..4e15142 100644 --- a/controllers/MapController.go +++ b/controllers/MapController.go @@ -7,6 +7,8 @@ type MapController struct { } func (this *MapController) Get() { + this.Data["NickName"] = this.GetSession("nickname") + this.Data["IsLogin"] = this.GetSession("nickname") != nil this.Data["IsMap"] = true this.TplName = "map.html" } diff --git a/data/beeblog.db b/data/beeblog.db index 41694e6..8189a01 100644 Binary files a/data/beeblog.db and b/data/beeblog.db differ diff --git a/models/Blog.go b/models/Blog.go index 9c5fa52..f467c86 100644 --- a/models/Blog.go +++ b/models/Blog.go @@ -1,6 +1,8 @@ package models -import "time" +import ( + "time" +) type Blog struct { Id int64 @@ -18,6 +20,7 @@ type Blog struct { Delflag int `orm:"default(0)"` CategoryId int64 + User *User `orm:"-"` UserName string `orm:"-"` HeadImg string `orm:"-"` CateName string `orm:"-"` diff --git a/models/User.go b/models/User.go index 9fba273..735d11c 100644 --- a/models/User.go +++ b/models/User.go @@ -17,4 +17,9 @@ type User struct { Sex int DescInfo string Ctime time.Time `orm:"auto_now_add;type(datetime)"` + + BlogCount int + BlogBrowes int + BlogComment int + BlogLike int } diff --git a/service/BlogService.go b/service/BlogService.go index 58cd702..8054874 100644 --- a/service/BlogService.go +++ b/service/BlogService.go @@ -33,8 +33,7 @@ func GetBlog(id int64) (*models.Blog, error) { user := &models.User{Id: blog.UserId} err = o.Read(user) if err == nil { - blog.UserName = user.UserName - blog.HeadImg = user.Headimg + blog.User = user } var labels []*models.NLabel qs := o.QueryTable(&models.NLabel{}) diff --git a/static/css/blog.css b/static/css/blog.css index 801a55a..c31359f 100644 --- a/static/css/blog.css +++ b/static/css/blog.css @@ -1,13 +1,21 @@ .blog-root{ height: 100%; - margin: 50px 4% 0 4%; + margin: 50px 4% 0 300px; } - .blog-info{ text-align: center; } .blog-info em{ padding: 0 8px !important; +} + +.blog-user{ + position: fixed; + top: 60px; + left: 20px; + width: 260px; + height: 100%; + background-color: #f9f9f9; } \ No newline at end of file diff --git a/static/css/common.css b/static/css/common.css index 94e4808..b8929bf 100644 --- a/static/css/common.css +++ b/static/css/common.css @@ -46,3 +46,30 @@ body { .cursor { cursor: pointer } + +.footer-root{ + position: relative; + width: 100%; + height: 105px; +} + +.footer-friend{ + text-align: center; + height: 25px; + line-height: 25px; + color: #555; +} +.footer-friend a{ + color: #555; + text-decoration: none; +} + +.wxcode{ + position: absolute; + right: 0; + top: -5px; +} + +.login-footer .wxcode{ + margin-right: 20px; +} diff --git a/static/css/login.css b/static/css/login.css index 8e3a4e2..c94f37a 100644 --- a/static/css/login.css +++ b/static/css/login.css @@ -33,3 +33,10 @@ height: 35px !important; } +.login-footer{ + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 110px; +} \ No newline at end of file diff --git a/static/img/wxcode.png b/static/img/wxcode.png new file mode 100644 index 0000000..cab59c5 Binary files /dev/null and b/static/img/wxcode.png differ diff --git a/views/blog.html b/views/blog.html index c00f1e7..ca28d7c 100644 --- a/views/blog.html +++ b/views/blog.html @@ -5,10 +5,38 @@