feat:优化项目空间的显示数量

pull/425/head
lifei6671 2018-11-27 11:47:19 +08:00
parent 2460a32ac5
commit b240b85011
4 changed files with 10 additions and 28 deletions

View File

@ -48,12 +48,4 @@ func (c *HomeController) Index() {
c.Data["TotalPages"] = int(math.Ceil(float64(totalCount) / float64(pageSize)))
c.Data["Lists"] = books
labels, totalCount, err := models.NewLabel().FindToPager(1, 10)
if err != nil {
c.Data["Labels"] = make([]*models.Label, 0)
} else {
c.Data["Labels"] = labels
}
}

View File

@ -23,9 +23,11 @@ func (c *ItemsetsController) Prepare() {
func (c *ItemsetsController) Index() {
c.Prepare()
c.TplName = "items/index.tpl"
pageSize := 18
pageIndex, _ := c.GetInt("page", 0)
items, totalCount, err := models.NewItemsets().FindToPager(pageIndex, conf.PageSize)
items, totalCount, err := models.NewItemsets().FindToPager(pageIndex, pageSize)
if err != nil && err != orm.ErrNoRows {
c.ShowErrorPage(500, err.Error())
@ -38,7 +40,7 @@ func (c *ItemsetsController) Index() {
}
if totalCount > 0 {
pager := pagination.NewPagination(c.Ctx.Request, totalCount, conf.PageSize, c.BaseUrl())
pager := pagination.NewPagination(c.Ctx.Request, totalCount, pageSize, c.BaseUrl())
c.Data["PageHtml"] = pager.HtmlPages()
} else {
c.Data["PageHtml"] = ""
@ -50,6 +52,7 @@ func (c *ItemsetsController) Index() {
func (c *ItemsetsController) List() {
c.Prepare()
c.TplName = "items/list.tpl"
pageSize := 18
itemKey := c.Ctx.Input.Param(":key")
pageIndex, _ := c.GetInt("page", 1)
@ -70,13 +73,13 @@ func (c *ItemsetsController) List() {
if c.Member != nil {
memberId = c.Member.MemberId
}
searchResult, totalCount, err := models.NewItemsets().FindItemsetsByItemKey(itemKey, pageIndex, conf.PageSize, memberId)
searchResult, totalCount, err := models.NewItemsets().FindItemsetsByItemKey(itemKey, pageIndex, pageSize, memberId)
if err != nil && err != orm.ErrNoRows {
c.ShowErrorPage(500, "查询文档列表时出错")
}
if totalCount > 0 {
pager := pagination.NewPagination(c.Ctx.Request, totalCount, conf.PageSize, c.BaseUrl())
pager := pagination.NewPagination(c.Ctx.Request, totalCount, pageSize, c.BaseUrl())
c.Data["PageHtml"] = pager.HtmlPages()
} else {
c.Data["PageHtml"] = ""

View File

@ -244,7 +244,7 @@ as t group by book_id) as team
LEFT JOIN md_relationship AS rel1 ON rel1.book_id = book.book_id AND rel1.role_id = 0
LEFT JOIN md_members AS member ON rel1.member_id = member.member_id
WHERE book.item_id = ? AND (book.privately_owned = 0 or rel.role_id >= 0 or team.role_id >= 0)
ORDER BY order_index DESC ,book.book_id DESC LIMIT ?,?`
ORDER BY order_index ,book.book_id DESC LIMIT ?,?`
_, err = o.Raw(sql2, memberId, memberId, item.ItemId, offset, pageSize).QueryRows(&books)
@ -262,7 +262,7 @@ as t group by book_id) as team
sql := `SELECT book.*,rel.*,member.account AS create_name FROM md_books AS book
LEFT JOIN md_relationship AS rel ON rel.book_id = book.book_id AND rel.role_id = 0
LEFT JOIN md_members AS member ON rel.member_id = member.member_id
WHERE book.item_id = ? AND book.privately_owned = 0 ORDER BY order_index DESC ,book.book_id DESC LIMIT ?,?`
WHERE book.item_id = ? AND book.privately_owned = 0 ORDER BY order_index ,book.book_id DESC LIMIT ?,?`
_, err = o.Raw(sql, item.ItemId, offset, pageSize).QueryRows(&books)

View File

@ -21,19 +21,6 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{if gt (.Labels|len) 1000000}}
<div class="hide tag-container-outer">
<span class="title">热门标签:</span>
<span class="tags">
{{range $index,$item := .Labels}}
<a href="{{urlfor "LabelController.Index" ":key" $item.LabelName}}">{{$item.LabelName}}<span class="detail">{{$item.BookNumber}}</span></a>
{{end}}
</span>
</div>
{{end}}
<div class="manual-list">
{{range $index,$item := .Lists}}
<div class="list-item">