diff --git a/controllers/UserController.go b/controllers/UserController.go index 9051e07..1c0e394 100644 --- a/controllers/UserController.go +++ b/controllers/UserController.go @@ -88,82 +88,6 @@ func (this *UserController) PersonBlog() { this.Data["User"] = user this.TplName = "ublogs.html" } - -func (this *UserController) PersonNote() { - userService := service.UserService{} - noteService := service.NoteService{} - uid := this.GetSession("userid") - if uid == nil { - this.Redirect("/login", 302) - return - } - notColl, err := noteService.GetNoteColl(uid.(int64)) - if err == nil { - if len(notColl) > 0 { - for i := 0; i < len(notColl); i++ { - count, _ := noteService.CountNote(notColl[i].Id) - notColl[i].Count = count - } - } - } else { - notColl = make([]*models.NoteColl, 0) - } - if err != nil { - this.Redirect("/404", 302) - return - } - user, uerr := userService.GetUser(uid.(int64)) - if uerr != nil { - if uid == nil { - this.Redirect("/404", 302) - return - } - } - this.Data["UserId"] = this.GetSession("userid") - this.Data["HeadImg"] = this.GetSession("headimg") - this.Data["NickName"] = this.GetSession("nickname") - this.Data["IsLogin"] = this.GetSession("nickname") != nil - this.Data["Note"] = notColl - this.Data["IsMeNote"] = true - this.Data["User"] = user - this.TplName = "unote.html" -} - -func (this *UserController) PersonLike() { - userService := service.UserService{} - likeService := service.LikeService{} - uid := this.GetSession("userid") - if uid == nil { - this.Redirect("/login", 302) - return - } - size := 15 - num, _ := this.GetInt("num") - if num <= 0 { - num = 1 - } - page, err := likeService.MeLikes(num, size, uid.(int64)) - if err != nil { - this.Redirect("/404", 302) - return - } - user, uerr := userService.GetUser(uid.(int64)) - if uerr != nil { - if uid == nil { - this.Redirect("/404", 302) - return - } - } - this.Data["UserId"] = this.GetSession("userid") - this.Data["HeadImg"] = this.GetSession("headimg") - this.Data["NickName"] = this.GetSession("nickname") - this.Data["IsLogin"] = this.GetSession("nickname") != nil - this.Data["Page"] = page - this.Data["IsMeLike"] = true - this.Data["User"] = user - this.TplName = "ulike.html" -} - func (this *UserController) PersonInfo() { userService := service.UserService{} uid := this.GetSession("userid") diff --git a/routers/UserRouter.go b/routers/UserRouter.go index 7059155..1efff76 100644 --- a/routers/UserRouter.go +++ b/routers/UserRouter.go @@ -17,7 +17,5 @@ func init() { beego.Router("/api/login", &controllers.UserController{}, "post:Login") beego.Router("/api/regist", &controllers.UserController{}, "post:Regist") beego.Router("/me/blog", &controllers.UserController{}, "get:PersonBlog") - beego.Router("/me/note", &controllers.UserController{}, "get:PersonNote") - beego.Router("/me/like", &controllers.UserController{}, "get:PersonLike") beego.Router("/me/info", &controllers.UserController{}, "get:PersonInfo") } diff --git a/views/T.nav.tpl b/views/T.nav.tpl index 03a2790..6105611 100644 --- a/views/T.nav.tpl +++ b/views/T.nav.tpl @@ -9,9 +9,6 @@
  • 写文章
  • -
  • - 首页 -
  • 博客
  • diff --git a/views/blogs.html b/views/blogs.html index c27c0f7..919abd3 100644 --- a/views/blogs.html +++ b/views/blogs.html @@ -1,27 +1,28 @@ {{template "header" .}} - - 博客列表 - 码农随笔 + +博客列表 - 码农随笔
    -{{template "nav" .}} + {{template "nav" .}}
    - + + 选择分类 + + -
    - - -
    + + + + + +
    -
    @@ -41,7 +42,7 @@

    - {{range .Page.List}} + {{range .Page.List}}
    @@ -59,25 +60,25 @@
    - {{end}} + {{end}}
    @@ -94,14 +95,18 @@ el: ".root-container", delimiters: ['${', '}'], data: { - user: {} + cateId: -1, + cats: [] }, - }) - $(function () { - $("#selCat").val({{.Cat}}) - $("#selCat").change(function () { - window.location.href = "/blogs?num=1&flag={{.Flag}}&cat=" + $("#selCat").val() - }) + created () { + this.cateId = {{.Cat}} + this.cats = {{.Cats}} + }, + methods: { + catChange (){ + window.location.href = "/blogs?num=1&flag={{.Flag}}&cat=" + this.cateId + } + } }) \ No newline at end of file diff --git a/views/snow.html b/views/snow.html deleted file mode 100644 index 55e2cfd..0000000 --- a/views/snow.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - Title - - - - - - - - - - - - - \ No newline at end of file diff --git a/views/ulike.html b/views/ulike.html deleted file mode 100644 index fd89618..0000000 --- a/views/ulike.html +++ /dev/null @@ -1,80 +0,0 @@ -{{template "header" .}} -博客 - 码农随笔 - - -
    -{{template "nav" .}} -{{template "memenu" .}} - -
    -
    - - {{range .Page.List}} -
    -

    {{.Blog.Title}}

    -
    - 收藏时间:{{.Ltime.Format "2006/01/02"}} - 浏览量:{{.Blog.Browses}} - 删除 -
    -
    -
    - {{end}} -
    - -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/views/unote.html b/views/unote.html deleted file mode 100644 index a32ef67..0000000 --- a/views/unote.html +++ /dev/null @@ -1,117 +0,0 @@ -{{template "header" .}} -博客 - 码农随笔 - - -
    -{{template "nav" .}} -{{template "memenu" .}} - -
    -
    - -
    - - {{range .Note}} -
    -
    -

    {{.Title}}{{.Count}}

    - 删除 - 重命名 -
    -
    -
    - - {{end}} -
    -
    - - - - \ No newline at end of file diff --git a/views/user.html b/views/user.html index 0a86fd3..0779042 100644 --- a/views/user.html +++ b/views/user.html @@ -17,11 +17,8 @@ {{.User.DescInfo}}
    - 加入 {{.User.Ctime.Format "2006-01-02"}} 文章 {{.User.BlogCount}} 访问 {{.User.BlogBrowes}} - 评论 {{.User.BlogComment}} - 收藏 {{.User.BlogLike}}