diff --git a/components/PollMarks.vue b/components/PollMarks.vue new file mode 100644 index 0000000..c87e285 --- /dev/null +++ b/components/PollMarks.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/components/do/review/Card.vue b/components/do/review/Card.vue index a44dace..1452f1d 100644 --- a/components/do/review/Card.vue +++ b/components/do/review/Card.vue @@ -2,6 +2,7 @@ import xss from 'xss' import dayjs from 'dayjs' import type { PollMethod } from '@/enums/poll' +import type { HitokotoType } from '~/enums/hitokoto' // Props 定义 export type CardPropsPoll = { @@ -15,7 +16,7 @@ export type CardPropsPoll = { export type CardPropsSentence = { uuid: string hitokoto: string - type: string + type: HitokotoType fromWho?: string from: string creator: string diff --git a/components/review/records/Card.vue b/components/review/records/Card.vue new file mode 100644 index 0000000..e7e4517 --- /dev/null +++ b/components/review/records/Card.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/components/review/records/CardSentence.vue b/components/review/records/CardSentence.vue new file mode 100644 index 0000000..c966e8d --- /dev/null +++ b/components/review/records/CardSentence.vue @@ -0,0 +1,48 @@ + + + + + diff --git a/components/review/records/PollDetailModal.vue b/components/review/records/PollDetailModal.vue new file mode 100644 index 0000000..658b3c7 --- /dev/null +++ b/components/review/records/PollDetailModal.vue @@ -0,0 +1,103 @@ + + + + + diff --git a/components/review/records/PollPointsPieChart.client.vue b/components/review/records/PollPointsPieChart.client.vue new file mode 100644 index 0000000..11e3960 --- /dev/null +++ b/components/review/records/PollPointsPieChart.client.vue @@ -0,0 +1,70 @@ + + + diff --git a/composables/api/reviewer/poll.ts b/composables/api/reviewer/poll.ts index ff45e91..608c220 100644 --- a/composables/api/reviewer/poll.ts +++ b/composables/api/reviewer/poll.ts @@ -149,9 +149,13 @@ export type PollDetailReq = { export type PollDetailRes = PollListCollectionElement export function usePollDetail( - pollID: number, + pollID: number | Ref, req: PollDetailReq = {}, options: HTTPOption = {} ) { - return useHTTP.get(`/poll/${pollID}`, req, options) + return useHTTP.get( + () => `/poll/${typeof pollID === 'number' ? pollID : pollID.value}`, + req, + options + ) } diff --git a/composables/api/reviewer/user.ts b/composables/api/reviewer/user.ts index 7fbe152..18bd174 100644 --- a/composables/api/reviewer/user.ts +++ b/composables/api/reviewer/user.ts @@ -64,3 +64,46 @@ export function useUserUnreviewedCount( options ) } + +export type UserPollLogsReq = { + page?: number + page_size?: number + order: 'acs' | 'desc' +} + +export type UserPollLogsRes = { + collection: Array<{ + poll_id: number + point: number + sentence_uuid: string + type: PollMethod + comment: string + created_at: string + updated_at: string + sentence: { + id: number + uuid: string + hitokoto: string + type: HitokotoType + from: string + from_who?: string + creator: string + creator_uid: number + reviewer: number + status: HitokotoStatus + poll_status: PollStatus + created_at: string + } + user_marks: number[] + }> + total: number + page: number + page_size: number +} + +export function useUserPollLogs( + params: UserPollLogsReq | Ref, + options: HTTPOption = {} +) { + return useHTTP.get(`/user/poll/logs`, params, options) +} diff --git a/layouts/default.vue b/layouts/default.vue index ceaf989..8bd99b6 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -25,7 +25,7 @@ } .main { - @apply mt-3 md:mt-15 mx-auto w-full md:w-80% lg:w-70% bg-white md:rounded-t-4 border-2 shadow-sm shadow-slate-100; + @apply mt-3 md:mt-15 mx-auto w-full md:w-90% lg:w-80% xl:w-70% bg-white md:rounded-t-4 border-2 shadow-sm shadow-slate-100; @apply flex-1 flex shrink-0; .sidebar { diff --git a/nuxt.config.ts b/nuxt.config.ts index d7c2cdc..952eceb 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -17,7 +17,7 @@ export default defineNuxtConfig({ { // Google Fonts rel: 'stylesheet', - href: 'https://fonts.googleapis.com/css?family=Noto+Serif+SC:600&display=swap' + href: 'https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700;900&family=Noto+Serif+TC:wght@400;600;700;900&display=swap' } // { // rel: 'stylesheet', @@ -57,6 +57,9 @@ export default defineNuxtConfig({ gtag: { id: 'G-86GDBEXXNZ' }, + build: { + transpile: [/echarts/] + }, imports: { dirs: ['./stores'] @@ -73,7 +76,9 @@ export default defineNuxtConfig({ enabled: true } }, - components: true, + components: { + dirs: ['~/components'] + }, runtimeConfig: { public: { endpoint: { diff --git a/package.json b/package.json index f5b93d7..d2dea5c 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "animate.css": "^4.1.1", "ant-design-vue": "~4.0.1", "dayjs": "^1.11.9", + "echarts": "^5.4.3", "eslint": "^8.48.0", "eslint-config-prettier": "^9.0.0", "eslint-config-standard": "^17.1.0", @@ -79,6 +80,7 @@ "validator": "^13.11.0", "vant": "^4.6.6", "vite": "^4.4.9", + "vue-echarts": "^6.6.1", "vue-masonry": "^0.16.0", "xss": "^1.0.14" }, diff --git a/pages/dashboard.vue b/pages/dashboard.vue index cc3b825..80fab56 100644 --- a/pages/dashboard.vue +++ b/pages/dashboard.vue @@ -2,6 +2,21 @@ definePageMeta({ middleware: ['auth'] }) +// 刷新 Mark 列表 +const marksStore = useMarksStore() +const { error: fetchMarksError, data: marksData } = usePollMarks({ + lazy: true +}) +watch( + () => [fetchMarksError.value, marksData.value], + (val) => { + if (val[0] != null) { + message.error('刷新 Mark 列表失败') + return + } + marksStore.$setMarks(marksData.value?.data || []) + } +)