diff --git a/api/handler/sd_handler.go b/api/handler/sd_handler.go index c0e01f19..ee80802d 100644 --- a/api/handler/sd_handler.go +++ b/api/handler/sd_handler.go @@ -163,14 +163,26 @@ func (h *SdJobHandler) Image(c *gin.Context) { // JobList 获取 MJ 任务列表 func (h *SdJobHandler) JobList(c *gin.Context) { status := h.GetInt(c, "status", 0) - var items []model.SdJob - var res *gorm.DB - userId, _ := c.Get(types.LoginUserID) + userId := h.GetInt(c, "user_id", 0) + page := h.GetInt(c, "page", 0) + pageSize := h.GetInt(c, "page_size", 0) + + session := h.db.Session(&gorm.Session{}) if status == 1 { - res = h.db.Where("user_id = ? AND progress = 100", userId).Order("id DESC").Find(&items) + session = session.Where("progress = ?", 100).Order("id DESC") } else { - res = h.db.Where("user_id = ? AND progress < 100", userId).Order("id ASC").Find(&items) + session = session.Where("progress < ?", 100).Order("id ASC") } + if userId > 0 { + session = session.Where("user_id = ?", userId) + } + if page > 0 && pageSize > 0 { + offset := (page - 1) * pageSize + session = session.Offset(offset).Limit(pageSize) + } + + var items []model.SdJob + res := session.Find(&items) if res.Error != nil { resp.ERROR(c, types.NoData) return diff --git a/web/src/assets/css/custom-scroll.css b/web/src/assets/css/custom-scroll.css new file mode 100644 index 00000000..eb7e1d0a --- /dev/null +++ b/web/src/assets/css/custom-scroll.css @@ -0,0 +1,13 @@ +.custom-scroll ::-webkit-scrollbar { + width: 8px; /* 滚动条宽度 */ +} +.custom-scroll ::-webkit-scrollbar-track { + background-color: #282c34; +} +.custom-scroll ::-webkit-scrollbar-thumb { + background-color: #444; + border-radius: 8px; +} +.custom-scroll ::-webkit-scrollbar-thumb:hover { + background-color: #666; +} diff --git a/web/src/assets/css/custom-scroll.styl b/web/src/assets/css/custom-scroll.styl new file mode 100644 index 00000000..61784075 --- /dev/null +++ b/web/src/assets/css/custom-scroll.styl @@ -0,0 +1,26 @@ +.custom-scroll { + /* 修改滚动条的颜色 */ + + ::-webkit-scrollbar { + width: 8px; /* 滚动条宽度 */ + } + + /* 修改滚动条轨道的背景颜色 */ + + ::-webkit-scrollbar-track { + background-color: #282C34; + } + + /* 修改滚动条的滑块颜色 */ + + ::-webkit-scrollbar-thumb { + background-color: #444444; + border-radius 8px + } + + /* 修改滚动条的滑块的悬停颜色 */ + + ::-webkit-scrollbar-thumb:hover { + background-color: #666666; + } +} \ No newline at end of file diff --git a/web/src/assets/css/image-mj.css b/web/src/assets/css/image-mj.css index f5e16543..dfe095ee 100644 --- a/web/src/assets/css/image-mj.css +++ b/web/src/assets/css/image-mj.css @@ -3,10 +3,6 @@ } .page-mj .inner { display: flex; -/* 修改滚动条的颜色 */ -/* 修改滚动条轨道的背景颜色 */ -/* 修改滚动条的滑块颜色 */ -/* 修改滚动条的滑块的悬停颜色 */ } .page-mj .inner .mj-box { margin: 10px; @@ -147,19 +143,6 @@ .page-mj .inner .el-form .el-slider { width: 180px; } -.page-mj .inner ::-webkit-scrollbar { - width: 10px; /* 滚动条宽度 */ -} -.page-mj .inner ::-webkit-scrollbar-track { - background-color: #282c34; -} -.page-mj .inner ::-webkit-scrollbar-thumb { - background-color: #444; - border-radius: 10px; -} -.page-mj .inner ::-webkit-scrollbar-thumb:hover { - background-color: #666; -} .page-mj .inner .task-list-box { width: 100%; padding: 10px; diff --git a/web/src/assets/css/image-mj.styl b/web/src/assets/css/image-mj.styl index 767cc5fb..23a59b7c 100644 --- a/web/src/assets/css/image-mj.styl +++ b/web/src/assets/css/image-mj.styl @@ -182,160 +182,7 @@ } } - /* 修改滚动条的颜色 */ - - ::-webkit-scrollbar { - width: 10px; /* 滚动条宽度 */ - } - - /* 修改滚动条轨道的背景颜色 */ - - ::-webkit-scrollbar-track { - background-color: #282C34; - } - - /* 修改滚动条的滑块颜色 */ - - ::-webkit-scrollbar-thumb { - background-color: #444444; - border-radius 10px - } - - /* 修改滚动条的滑块的悬停颜色 */ - - ::-webkit-scrollbar-thumb:hover { - background-color: #666666; - } - - .task-list-box { - width 100% - padding 10px - color #ffffff - overflow-x hidden - - .running-job-list { - .job-item { - //border: 1px solid #454545; - width: 100%; - padding 2px - background-color #555555 - - .job-item-inner { - position relative - height 100% - overflow hidden - - .progress { - position absolute - width 100% - height 100% - top 0 - left 0 - display flex - justify-content center - align-items center - - span { - font-size 20px - color #ffffff - } - } - } - } - } - - - .finish-job-list { - .job-item { - width 100% - height 100% - - .opt { - .opt-line { - margin 6px 0 - - ul { - display flex - flex-flow row - - li { - margin-right 10px - - a { - padding 3px 0 - width 44px - text-align center - border-radius 5px - display block - cursor pointer - background-color #4E5058 - color #ffffff - - &:hover { - background-color #6D6F78 - } - } - } - - .show-prompt { - font-size 20px - cursor pointer - } - } - } - } - - } - - } - - .el-image { - width 100% - height 100% - max-height 240px - - img { - height 240px - } - - .el-image-viewer__wrapper { - img { - width auto - height auto - } - } - - .image-slot { - display flex - flex-flow column - justify-content center - align-items center - height 100% - min-height 200px - color #ffffff - - .iconfont { - font-size 50px - margin-bottom 10px - } - } - } - - .el-image.upscale { - max-height 304px - - img { - height 304px - } - - .el-image-viewer__wrapper { - img { - width auto - height auto - } - } - } - } + @import "task-list.styl" } } diff --git a/web/src/assets/css/image-sd.css b/web/src/assets/css/image-sd.css index ca40e1b6..3b6b89cb 100644 --- a/web/src/assets/css/image-sd.css +++ b/web/src/assets/css/image-sd.css @@ -231,16 +231,3 @@ position: relative; top: 2px; } -.custom-scroll ::-webkit-scrollbar { - width: 10px; /* 滚动条宽度 */ -} -.custom-scroll ::-webkit-scrollbar-track { - background-color: #282c34; -} -.custom-scroll ::-webkit-scrollbar-thumb { - background-color: #444; - border-radius: 10px; -} -.custom-scroll ::-webkit-scrollbar-thumb:hover { - background-color: #666; -} diff --git a/web/src/assets/css/image-sd.styl b/web/src/assets/css/image-sd.styl index 1d925f0a..edd7ef5f 100644 --- a/web/src/assets/css/image-sd.styl +++ b/web/src/assets/css/image-sd.styl @@ -87,222 +87,11 @@ } } - .task-list-box { - width 100% - padding 10px - color #ffffff - overflow-x hidden - - .running-job-list { - .job-item { - //border: 1px solid #454545; - width: 100%; - padding 2px - background-color #555555 - - .job-item-inner { - position relative - height 100% - overflow hidden - - .progress { - position absolute - width 100% - height 100% - top 0 - left 0 - display flex - justify-content center - align-items center - - span { - font-size 20px - color #ffffff - } - } - } - } - } - - - .finish-job-list { - .job-item { - width 100% - height 100% - - .opt { - .opt-line { - margin 6px 0 - - ul { - display flex - flex-flow row - - li { - margin-right 10px - - a { - padding 3px 0 - width 44px - text-align center - border-radius 5px - display block - cursor pointer - background-color #4E5058 - color #ffffff - - &:hover { - background-color #6D6F78 - } - } - } - - .show-prompt { - font-size 20px - cursor pointer - } - } - } - } - - } - - } - - .el-image { - width 100% - height 100% - max-height 240px - - img { - height 240px - } - - .el-image-viewer__wrapper { - img { - width auto - height auto - } - } - - .image-slot { - display flex - flex-flow column - justify-content center - align-items center - height 100% - min-height 200px - color #ffffff - - .iconfont { - font-size 50px - margin-bottom 10px - } - } - } - - .el-image.upscale { - max-height 304px - - img { - height 304px - } - - .el-image-viewer__wrapper { - img { - width auto - height auto - } - } - } - } + @import "task-list.styl" } - .el-overlay-dialog { - .el-dialog { - background-color #1a1b1e + @import "sd-task-dialog.styl" - .el-dialog__header { - .el-dialog__title { - color #F5F5F5 - } - } - - .el-dialog__body { - padding 0 0 0 15px !important - display flex - height 100% - - .el-row { - width 100% - - .img-container { - display flex - justify-content center - } - - .task-info { - background-color #25262b - padding 1rem 1.5rem - - .info-line { - width 100% - - .prompt { - background-color #35363b - padding 10px - color #999999 - overflow auto - max-height 100px - min-height 50px - - position relative - - .el-icon { - position absolute - right 10px - bottom 10px - cursor pointer - } - } - - .wrapper { - margin-top 10px - display flex - - label { - display flex - width 100px - color #a5a5a5 - } - - .item-value { - display flex - width 100% - background-color #35363b - padding 2px 5px - border-radius 5px - color #F5F5F5 - } - } - - } - - .copy-params { - padding 20px 0 10px 0 - - .el-button { - width 100% - } - } - } - } - - // end el-row - - } - } - } .mj-list-item-prompt { .el-icon { @@ -315,30 +104,3 @@ } -.custom-scroll { - /* 修改滚动条的颜色 */ - - ::-webkit-scrollbar { - width: 10px; /* 滚动条宽度 */ - } - - /* 修改滚动条轨道的背景颜色 */ - - ::-webkit-scrollbar-track { - background-color: #282C34; - } - - /* 修改滚动条的滑块颜色 */ - - ::-webkit-scrollbar-thumb { - background-color: #444444; - border-radius 10px - } - - /* 修改滚动条的滑块的悬停颜色 */ - - ::-webkit-scrollbar-thumb:hover { - background-color: #666666; - } -} - diff --git a/web/src/assets/css/images-wall.css b/web/src/assets/css/images-wall.css index 435bdd59..7bcfd395 100644 --- a/web/src/assets/css/images-wall.css +++ b/web/src/assets/css/images-wall.css @@ -36,6 +36,7 @@ } .page-images-wall .inner .waterfall .list-item .image .el-image { transition: transform 0.3s; + cursor: pointer; } .page-images-wall .inner .waterfall .list-item .prompt { display: none; @@ -68,27 +69,77 @@ .page-images-wall .inner .waterfall .list-item:hover .image .el-image { transform: scale(1.2); /* 放大图像到1.2倍大小 */ } -.page-images-wall .inner .waterfall .footer { +.page-images-wall .inner .footer { display: flex; padding: 20px; align-items: center; justify-content: center; } -.page-images-wall .inner .waterfall .footer .iconfont { +.page-images-wall .inner .footer .iconfont { margin-left: 6px; } -.page-images-wall .custom-scroll ::-webkit-scrollbar { - width: 10px; /* 滚动条宽度 */ +.page-images-wall .el-overlay-dialog .el-dialog { + background-color: #1a1b1e; } -.page-images-wall .custom-scroll ::-webkit-scrollbar-track { - background-color: #282c34; +.page-images-wall .el-overlay-dialog .el-dialog .el-dialog__header .el-dialog__title { + color: #f5f5f5; } -.page-images-wall .custom-scroll ::-webkit-scrollbar-thumb { - background-color: #444; - border-radius: 10px; +.page-images-wall .el-overlay-dialog .el-dialog .el-dialog__body { + padding: 0 0 0 15px !important; + display: flex; + height: 100%; } -.page-images-wall .custom-scroll ::-webkit-scrollbar-thumb:hover { - background-color: #666; +.page-images-wall .el-overlay-dialog .el-dialog .el-dialog__body .el-row { + width: 100%; +} +.page-images-wall .el-overlay-dialog .el-dialog .el-dialog__body .el-row .img-container { + display: flex; + justify-content: center; +} +.page-images-wall .el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info { + background-color: #25262b; + padding: 1rem 1.5rem; +} +.page-images-wall .el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .info-line { + width: 100%; +} +.page-images-wall .el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .info-line .prompt { + background-color: #35363b; + padding: 10px; + color: #999; + overflow: auto; + max-height: 100px; + min-height: 50px; + position: relative; +} +.page-images-wall .el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .info-line .prompt .el-icon { + position: absolute; + right: 10px; + bottom: 10px; + cursor: pointer; +} +.page-images-wall .el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .info-line .wrapper { + margin-top: 10px; + display: flex; +} +.page-images-wall .el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .info-line .wrapper label { + display: flex; + width: 100px; + color: #a5a5a5; +} +.page-images-wall .el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .info-line .wrapper .item-value { + display: flex; + width: 100%; + background-color: #35363b; + padding: 2px 5px; + border-radius: 5px; + color: #f5f5f5; +} +.page-images-wall .el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .copy-params { + padding: 20px 0 10px 0; +} +.page-images-wall .el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .copy-params .el-button { + width: 100%; } @-moz-keyframes expandUp { 0% { diff --git a/web/src/assets/css/images-wall.styl b/web/src/assets/css/images-wall.styl index 0b56ca91..f1d3e3c3 100644 --- a/web/src/assets/css/images-wall.styl +++ b/web/src/assets/css/images-wall.styl @@ -53,6 +53,7 @@ .el-image { transition: transform 0.3s; + cursor pointer } } @@ -97,45 +98,20 @@ } } + } - .footer { - display flex - padding 20px - align-items center - justify-content center - .iconfont { - margin-left 6px - } + .footer { + display flex + padding 20px + align-items center + justify-content center + + .iconfont { + margin-left 6px } } - } - .custom-scroll { - /* 修改滚动条的颜色 */ - - ::-webkit-scrollbar { - width: 10px; /* 滚动条宽度 */ - } - - /* 修改滚动条轨道的背景颜色 */ - - ::-webkit-scrollbar-track { - background-color: #282C34; - } - - /* 修改滚动条的滑块颜色 */ - - ::-webkit-scrollbar-thumb { - background-color: #444444; - border-radius 10px - } - - /* 修改滚动条的滑块的悬停颜色 */ - - ::-webkit-scrollbar-thumb:hover { - background-color: #666666; - } - } + @import "sd-task-dialog.styl" } \ No newline at end of file diff --git a/web/src/assets/css/sd-task-dialog.css b/web/src/assets/css/sd-task-dialog.css new file mode 100644 index 00000000..f80c920c --- /dev/null +++ b/web/src/assets/css/sd-task-dialog.css @@ -0,0 +1,63 @@ +.el-overlay-dialog .el-dialog { + background-color: #1a1b1e; +} +.el-overlay-dialog .el-dialog .el-dialog__header .el-dialog__title { + color: #f5f5f5; +} +.el-overlay-dialog .el-dialog .el-dialog__body { + padding: 0 0 0 15px !important; + display: flex; + height: 100%; +} +.el-overlay-dialog .el-dialog .el-dialog__body .el-row { + width: 100%; +} +.el-overlay-dialog .el-dialog .el-dialog__body .el-row .img-container { + display: flex; + justify-content: center; +} +.el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info { + background-color: #25262b; + padding: 1rem 1.5rem; +} +.el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .info-line { + width: 100%; +} +.el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .info-line .prompt { + background-color: #35363b; + padding: 10px; + color: #999; + overflow: auto; + max-height: 100px; + min-height: 50px; + position: relative; +} +.el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .info-line .prompt .el-icon { + position: absolute; + right: 10px; + bottom: 10px; + cursor: pointer; +} +.el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .info-line .wrapper { + margin-top: 10px; + display: flex; +} +.el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .info-line .wrapper label { + display: flex; + width: 100px; + color: #a5a5a5; +} +.el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .info-line .wrapper .item-value { + display: flex; + width: 100%; + background-color: #35363b; + padding: 2px 5px; + border-radius: 5px; + color: #f5f5f5; +} +.el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .copy-params { + padding: 20px 0 10px 0; +} +.el-overlay-dialog .el-dialog .el-dialog__body .el-row .task-info .copy-params .el-button { + width: 100%; +} diff --git a/web/src/assets/css/sd-task-dialog.styl b/web/src/assets/css/sd-task-dialog.styl new file mode 100644 index 00000000..cb76c422 --- /dev/null +++ b/web/src/assets/css/sd-task-dialog.styl @@ -0,0 +1,85 @@ +.el-overlay-dialog { + .el-dialog { + background-color #1a1b1e + + .el-dialog__header { + .el-dialog__title { + color #F5F5F5 + } + } + + .el-dialog__body { + padding 0 0 0 15px !important + display flex + height 100% + + .el-row { + width 100% + + .img-container { + display flex + justify-content center + } + + .task-info { + background-color #25262b + padding 1rem 1.5rem + + .info-line { + width 100% + + .prompt { + background-color #35363b + padding 10px + color #999999 + overflow auto + max-height 100px + min-height 50px + + position relative + + .el-icon { + position absolute + right 10px + bottom 10px + cursor pointer + } + } + + .wrapper { + margin-top 10px + display flex + + label { + display flex + width 100px + color #a5a5a5 + } + + .item-value { + display flex + width 100% + background-color #35363b + padding 2px 5px + border-radius 5px + color #F5F5F5 + } + } + + } + + .copy-params { + padding 20px 0 10px 0 + + .el-button { + width 100% + } + } + } + } + + // end el-row + + } + } +} \ No newline at end of file diff --git a/web/src/assets/css/task-list.css b/web/src/assets/css/task-list.css new file mode 100644 index 00000000..108f04fc --- /dev/null +++ b/web/src/assets/css/task-list.css @@ -0,0 +1,96 @@ +.task-list-box { + width: 100%; + padding: 10px; + color: #fff; + overflow-x: hidden; +} +.task-list-box .running-job-list .job-item { + width: 100%; + padding: 2px; + background-color: #555; +} +.task-list-box .running-job-list .job-item .job-item-inner { + position: relative; + height: 100%; + overflow: hidden; +} +.task-list-box .running-job-list .job-item .job-item-inner .progress { + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + display: flex; + justify-content: center; + align-items: center; +} +.task-list-box .running-job-list .job-item .job-item-inner .progress span { + font-size: 20px; + color: #fff; +} +.task-list-box .finish-job-list .job-item { + width: 100%; + height: 100%; +} +.task-list-box .finish-job-list .job-item .opt .opt-line { + margin: 6px 0; +} +.task-list-box .finish-job-list .job-item .opt .opt-line ul { + display: flex; + flex-flow: row; +} +.task-list-box .finish-job-list .job-item .opt .opt-line ul li { + margin-right: 10px; +} +.task-list-box .finish-job-list .job-item .opt .opt-line ul li a { + padding: 3px 0; + width: 44px; + text-align: center; + border-radius: 5px; + display: block; + cursor: pointer; + background-color: #4e5058; + color: #fff; +} +.task-list-box .finish-job-list .job-item .opt .opt-line ul li a:hover { + background-color: #6d6f78; +} +.task-list-box .finish-job-list .job-item .opt .opt-line ul .show-prompt { + font-size: 20px; + cursor: pointer; +} +.task-list-box .el-image { + width: 100%; + height: 100%; + max-height: 240px; +} +.task-list-box .el-image img { + height: 240px; +} +.task-list-box .el-image .el-image-viewer__wrapper img { + width: auto; + height: auto; +} +.task-list-box .el-image .image-slot { + display: flex; + flex-flow: column; + justify-content: center; + align-items: center; + height: 100%; + min-height: 200px; + color: #fff; +} +.task-list-box .el-image .image-slot .iconfont { + font-size: 50px; + margin-bottom: 10px; +} +.task-list-box .el-image.upscale { + max-height: 304px; +} +.task-list-box .el-image.upscale img { + height: 304px; +} +.task-list-box .el-image.upscale .el-image-viewer__wrapper img { + width: auto; + height: auto; +} diff --git a/web/src/assets/css/task-list.styl b/web/src/assets/css/task-list.styl new file mode 100644 index 00000000..69689420 --- /dev/null +++ b/web/src/assets/css/task-list.styl @@ -0,0 +1,129 @@ +.task-list-box { + width 100% + padding 10px + color #ffffff + overflow-x hidden + + .running-job-list { + .job-item { + //border: 1px solid #454545; + width: 100%; + padding 2px + background-color #555555 + + .job-item-inner { + position relative + height 100% + overflow hidden + + .progress { + position absolute + width 100% + height 100% + top 0 + left 0 + display flex + justify-content center + align-items center + + span { + font-size 20px + color #ffffff + } + } + } + } + } + + + .finish-job-list { + .job-item { + width 100% + height 100% + + .opt { + .opt-line { + margin 6px 0 + + ul { + display flex + flex-flow row + + li { + margin-right 10px + + a { + padding 3px 0 + width 44px + text-align center + border-radius 5px + display block + cursor pointer + background-color #4E5058 + color #ffffff + + &:hover { + background-color #6D6F78 + } + } + } + + .show-prompt { + font-size 20px + cursor pointer + } + } + } + } + + } + + } + + .el-image { + width 100% + height 100% + max-height 240px + + img { + height 240px + } + + .el-image-viewer__wrapper { + img { + width auto + height auto + } + } + + .image-slot { + display flex + flex-flow column + justify-content center + align-items center + height 100% + min-height 200px + color #ffffff + + .iconfont { + font-size 50px + margin-bottom 10px + } + } + } + + .el-image.upscale { + max-height 304px + + img { + height 304px + } + + .el-image-viewer__wrapper { + img { + width auto + height auto + } + } + } +} \ No newline at end of file diff --git a/web/src/router.js b/web/src/router.js index 669dbf0d..b21f0129 100644 --- a/web/src/router.js +++ b/web/src/router.js @@ -22,7 +22,7 @@ const routes = [ }, { name: 'image-sd', - path: '/sd', + path: '/sd/', meta: {title: 'Stable Diffusion 绘画中心'}, component: () => import('@/views/ImageSd.vue'), }, diff --git a/web/src/views/ImageMj.vue b/web/src/views/ImageMj.vue index ccc198cc..b42c9654 100644 --- a/web/src/views/ImageMj.vue +++ b/web/src/views/ImageMj.vue @@ -1,6 +1,6 @@ -