Skip to content

Commit

Permalink
优化更新
Browse files Browse the repository at this point in the history
  • Loading branch information
deatil committed Jun 3, 2024
1 parent 4c538b2 commit a0d78d1
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 26 deletions.
2 changes: 1 addition & 1 deletion app/controller/admin/art.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (this *Art) Index(ctx *fiber.Ctx) error {
// url 链接信息
uri := ctx.Request().URI()
parameters, _ := url.ParseQuery(uri.QueryArgs().String())
pageHtml := page.New().
pageHtml := page.
Paginate(listRows, int(total), string(uri.Path()), parameters).
PageHtml

Expand Down
2 changes: 1 addition & 1 deletion app/controller/admin/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (this *Attach) Index(ctx *fiber.Ctx) error {
// url 链接信息
uri := ctx.Request().URI()
parameters, _ := gourl.ParseQuery(uri.QueryArgs().String())
pageHtml := page.New().
pageHtml := page.
Paginate(listRows, int(total), string(uri.Path()), parameters).
PageHtml

Expand Down
2 changes: 1 addition & 1 deletion app/controller/admin/cate.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (this *Cate) Index(ctx *fiber.Ctx) error {
// url 链接信息
uri := ctx.Request().URI()
parameters, _ := url.ParseQuery(uri.QueryArgs().String())
pageHtml := page.New().
pageHtml := page.
Paginate(listRows, int(total), string(uri.Path()), parameters).
PageHtml

Expand Down
2 changes: 1 addition & 1 deletion app/controller/admin/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (this *Page) Index(ctx *fiber.Ctx) error {
// url 链接信息
uri := ctx.Request().URI()
parameters, _ := url.ParseQuery(uri.QueryArgs().String())
pageHtml := page.New().
pageHtml := page.
Paginate(listRows, int(total), string(uri.Path()), parameters).
PageHtml

Expand Down
4 changes: 2 additions & 2 deletions app/controller/admin/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (this *Tag) Index(ctx *fiber.Ctx) error {
}

// 每页数量
listRows := 5
listRows := 10
start := (currentPage - 1) * listRows

// 搜索关键字
Expand Down Expand Up @@ -68,7 +68,7 @@ func (this *Tag) Index(ctx *fiber.Ctx) error {
// url 链接信息
uri := ctx.Request().URI()
parameters, _ := url.ParseQuery(uri.QueryArgs().String())
pageHtml := page.New().
pageHtml := page.
Paginate(listRows, int(total), string(uri.Path()), parameters).
PageHtml

Expand Down
2 changes: 1 addition & 1 deletion app/controller/admin/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (this *User) Index(ctx *fiber.Ctx) error {
// url 链接信息
uri := ctx.Request().URI()
parameters, _ := url.ParseQuery(uri.QueryArgs().String())
pageHtml := page.New().
pageHtml := page.
Paginate(listRows, int(total), string(uri.Path()), parameters).
PageHtml

Expand Down
15 changes: 12 additions & 3 deletions pkg/page/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ import (
"net/url"
)

// 构造函数
func New() *Pagination {
return &Pagination{}
func Paginate(
listRows int,
total int,
urlPath string,
parameters url.Values,
) *Pagination {
return New().Paginate(listRows, total, urlPath, parameters)
}

// 分页
Expand All @@ -35,6 +39,11 @@ type Pagination struct {
PageHtml string
}

// 构造函数
func New() *Pagination {
return &Pagination{}
}

// 每页数量
// listRows 每页数量
// total 总数量,
Expand Down
1 change: 1 addition & 0 deletions resources/views/admin/art/index.jet.html
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ <h6 class="mb-4">
var url = $(this).data('url');

layer.confirm('您确定要删除该文章吗?', {
title: '提示',
offset: 'c',
btn: ['确定', '取消']
}, function(index){
Expand Down
1 change: 1 addition & 0 deletions resources/views/admin/attach/index.jet.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ <h6 class="mb-4">
var url = $(this).data('url');

layer.confirm('您确定要删除该附件吗?', {
title: '提示',
offset: 'c',
btn: ['确定', '取消']
}, function(index){
Expand Down
1 change: 1 addition & 0 deletions resources/views/admin/cate/index.jet.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ <h6 class="mb-4">
var url = $(this).data('url');

layer.confirm('您确定要删除该分类吗?', {
title: '提示',
offset: 'c',
btn: ['确定', '取消']
}, function(index){
Expand Down
26 changes: 22 additions & 4 deletions resources/views/admin/common/sidebar.jet.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,32 @@ <h3 class="text-primary">DoakCMS</h3>
<i class="fa fa-pager me-2"></i>
单页管理
</a>
<a href='{{ adminUrl("user") }}' class="nav-item nav-link sidebar-user-index">
<i class="fa fa-user me-2"></i>
账号管理
</a>
<a href='{{ adminUrl("attach") }}' class="nav-item nav-link sidebar-attach-index">
<i class="fa fa-file me-2"></i>
附件管理
</a>

<div class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle sidebar-system"
data-bs-toggle="dropdown"
aria-expanded="true"
>
<i class="fa fa-cog me-2"></i>
系统设置
</a>
<div class="dropdown-menu bg-transparent border-0 sidebar-system-menu"
data-bs-popper="none"
>
<a href='{{ adminUrl("user") }}' class="dropdown-item sidebar-system-user">
<i class="fa fa-user me-2"></i>
账号管理
</a>
<a href='{{ adminUrl("setting") }}' class="dropdown-item sidebar-system-setting">
<i class="fa fa-cog me-1"></i>
网站设置
</a>
</div>
</div>
{{end}}

</div>
Expand Down
9 changes: 2 additions & 7 deletions resources/views/admin/common/topnav.jet.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,10 @@ <h2 class="text-primary mb-0"><i class="fa fa-hashtag"></i></h2>
我的信息
</a>
<a href='{{ adminUrl("profile/password") }}' class="dropdown-item">
<i class="fa fa-star me-1"></i>
<i class="fa fa-star me-0"></i>
更改密码
</a>
{{if isAdmin}}
<a href='{{ adminUrl("setting") }}' class="dropdown-item">
<i class="fa fa-cog me-1"></i>
网站设置
</a>
{{end}}

<a href="javascript:;"
class="dropdown-item js-logout-btn"
data-url='{{ adminUrl("logout") }}'
Expand Down
1 change: 1 addition & 0 deletions resources/views/admin/page/index.jet.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ <h6 class="mb-4">
var url = $(this).data('url');

layer.confirm('您确定要删除该单页吗?', {
title: '提示',
offset: 'c',
btn: ['确定', '取消']
}, function(index){
Expand Down
4 changes: 3 additions & 1 deletion resources/views/admin/setting/index.jet.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ <h6 class="mb-4">网站设置</h6>
(function($) {
"use strict";

$(".sidebar-doak-index").addClass("active");
$(".sidebar-system").addClass("active show");
$(".sidebar-system-menu").addClass("show");
$(".sidebar-system-setting").addClass("active");

// 保存
$(".js-save-button").click(function(e) {
Expand Down
1 change: 1 addition & 0 deletions resources/views/admin/tag/index.jet.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ <h6 class="mb-4">
var url = $(this).data('url');

layer.confirm('您确定要删除该标签吗?', {
title: '提示',
offset: 'c',
btn: ['确定', '取消']
}, function(index){
Expand Down
4 changes: 3 additions & 1 deletion resources/views/admin/user/add.jet.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ <h6 class="mb-4">
(function($) {
"use strict";

$(".sidebar-user-index").addClass("active");
$(".sidebar-system").addClass("active show");
$(".sidebar-system-menu").addClass("show");
$(".sidebar-system-user").addClass("active");

// 保存
$(".js-save-button").click(function(e) {
Expand Down
4 changes: 3 additions & 1 deletion resources/views/admin/user/edit.jet.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ <h6 class="mb-4">
(function($) {
"use strict";

$(".sidebar-user-index").addClass("active");
$(".sidebar-system").addClass("active show");
$(".sidebar-system-menu").addClass("show");
$(".sidebar-system-user").addClass("active");

// 保存
$(".js-save-button").click(function(e) {
Expand Down
7 changes: 5 additions & 2 deletions resources/views/admin/user/index.jet.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,16 @@ <h6 class="mb-4">
(function($) {
"use strict";

$(".sidebar-user-index").addClass("active");

$(".sidebar-system").addClass("active show");
$(".sidebar-system-menu").addClass("show");
$(".sidebar-system-user").addClass("active");

// 删除
$('.js-delete-btn').click(function() {
var url = $(this).data('url');

layer.confirm('您确定要删除该账号吗?', {
title: '提示',
offset: 'c',
btn: ['确定', '取消']
}, function(index){
Expand Down

0 comments on commit a0d78d1

Please sign in to comment.