diff --git a/backend/app/http/v1/common.go b/backend/app/http/v1/common.go index 44fe5ee..7c28744 100644 --- a/backend/app/http/v1/common.go +++ b/backend/app/http/v1/common.go @@ -39,3 +39,16 @@ func (c *Common) Upload( } return services.Common.Upload(ctx.Context(), user.ID, file, val) } + +// Get options (enums) +// +// @Router /v1/common/options [get] +// @Summary Get options +// @Description Get global options (enums) +// @Tags Common +// @Accept json +// @Produce json +// @Success 200 {object} dto.OptionsResponse +func (c *Common) GetOptions(ctx fiber.Ctx) (*dto.OptionsResponse, error) { + return services.Common.Options(ctx.Context()) +} diff --git a/backend/app/http/v1/dto/common.go b/backend/app/http/v1/dto/common.go index 6bf9ada..528eca1 100644 --- a/backend/app/http/v1/dto/common.go +++ b/backend/app/http/v1/dto/common.go @@ -1,5 +1,7 @@ package dto +import "quyun/v2/app/requests" + type UploadResult struct { ID string `json:"id"` URL string `json:"url"` @@ -7,3 +9,8 @@ type UploadResult struct { Size int64 `json:"size"` MimeType string `json:"mime_type"` } + +type OptionsResponse struct { + ContentStatus []requests.KV `json:"content_status"` + ContentGenre []requests.KV `json:"content_genre"` +} diff --git a/backend/app/http/v1/routes.gen.go b/backend/app/http/v1/routes.gen.go index 50228f8..6bbadd3 100644 --- a/backend/app/http/v1/routes.gen.go +++ b/backend/app/http/v1/routes.gen.go @@ -50,6 +50,10 @@ func (r *Routes) Name() string { // Each route is registered with its corresponding controller action and parameter bindings. func (r *Routes) Register(router fiber.Router) { // Register routes for controller: Common + r.log.Debugf("Registering route: Get /v1/common/options -> common.GetOptions") + router.Get("/v1/common/options"[len(r.Path()):], DataFunc0( + r.common.GetOptions, + )) r.log.Debugf("Registering route: Post /v1/upload -> common.Upload") router.Post("/v1/upload"[len(r.Path()):], DataFunc3( r.common.Upload, diff --git a/backend/app/services/common.go b/backend/app/services/common.go index e726633..3660b85 100644 --- a/backend/app/services/common.go +++ b/backend/app/services/common.go @@ -7,6 +7,7 @@ import ( "quyun/v2/app/errorx" common_dto "quyun/v2/app/http/v1/dto" + "quyun/v2/app/requests" "quyun/v2/database/fields" "quyun/v2/database/models" "quyun/v2/pkg/consts" @@ -22,6 +23,21 @@ type common struct { storage *storage.Storage } +func (s *common) Options(ctx context.Context) (*common_dto.OptionsResponse, error) { + return &common_dto.OptionsResponse{ + ContentStatus: consts.ContentStatusItems(), + ContentGenre: []requests.KV{ + requests.NewKV("Jingju", "京剧"), + requests.NewKV("Kunqu", "昆曲"), + requests.NewKV("Yueju", "越剧"), + requests.NewKV("Yuju", "豫剧"), + requests.NewKV("Huangmeixi", "黄梅戏"), + requests.NewKV("Pingju", "评剧"), + requests.NewKV("Qinqiang", "秦腔"), + }, + }, nil +} + func (s *common) Upload(ctx context.Context, userID int64, file *multipart.FileHeader, typeArg string) (*common_dto.UploadResult, error) { // Mock Upload to S3/MinIO (Here we just generate key, actual upload handling via direct upload or stream is better) // But this Upload endpoint accepts file. So we save it. diff --git a/frontend/portal/src/api/common.js b/frontend/portal/src/api/common.js index 24dd004..cd29fe7 100644 --- a/frontend/portal/src/api/common.js +++ b/frontend/portal/src/api/common.js @@ -1,6 +1,7 @@ import { request } from '../utils/request'; export const commonApi = { + getOptions: () => request('/common/options'), upload: (file, type) => { const formData = new FormData(); formData.append('file', file); diff --git a/frontend/portal/src/views/creator/ContentsView.vue b/frontend/portal/src/views/creator/ContentsView.vue index 804b0fa..5e7d82d 100644 --- a/frontend/portal/src/views/creator/ContentsView.vue +++ b/frontend/portal/src/views/creator/ContentsView.vue @@ -13,42 +13,37 @@
状态:
曲种:
-
-
- +
- 编辑
@@ -58,16 +53,17 @@
- [{{ item.genre }}] + [{{ item.genre }}]

+ class="font-bold text-slate-900 text-lg truncate hover:text-primary-600 cursor-pointer transition-colors" + @click="$router.push(`/creator/contents/${item.id}`)"> {{ item.title }}

- - {{ item.rejectReason }} + + 封禁 @@ -81,21 +77,21 @@ 免费 {{ item.views }} {{ item.likes }} - {{ item.date }} +
- - -
@@ -105,74 +101,83 @@ \ No newline at end of file