diff --git a/.github/workflows/bun.yml b/.github/workflows/bun.yml index 8ee8a91..95f4b3f 100644 --- a/.github/workflows/bun.yml +++ b/.github/workflows/bun.yml @@ -1,13 +1,11 @@ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs -name: Node.js CI +name: Bun CI on: push: branches: [ "master" ] - pull_request: - branches: [ "master" ] jobs: build: @@ -17,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Use bun + - name: Use bun uses: oven-sh/setup-bun@v2 - name: 📥 Install dependencies diff --git a/src/api/api-models.ts b/src/api/api-models.ts index 9cd7f05..ce31e5f 100644 --- a/src/api/api-models.ts +++ b/src/api/api-models.ts @@ -1,3 +1,6 @@ +import { ExtendedDock24Filled } from "@vicons/fluent" +import { UserConsumptionSetting } from "./models/consumption" + export interface APIRoot { code: number message: string @@ -58,6 +61,7 @@ export interface AccountInfo extends UserInfo { biliVerifyCode?: string bindEmail?: string settings: UserSetting + consumptionSetting: UserConsumptionSetting token: string biliAuthCode?: string diff --git a/src/api/models/consumption.ts b/src/api/models/consumption.ts new file mode 100644 index 0000000..a32a3b0 --- /dev/null +++ b/src/api/models/consumption.ts @@ -0,0 +1,20 @@ +export enum ConsumptionTypes{ + DanmakuStorage, +} + +export interface IDeductionSetting { + isEnabled: boolean + } +export interface UserConsumptionSetting { + danmakuStorage: DanmakuStorageDeductionSetting +} +export enum DeductionStorageType { + Time, + Count +} +export interface DanmakuStorageDeductionSetting extends IDeductionSetting { + storageType: DeductionStorageType + isUnlimited: boolean + limitDays: number + limitCount: number +} diff --git a/src/store/usePaymentSettingStore.ts b/src/store/usePaymentSettingStore.ts new file mode 100644 index 0000000..43002b3 --- /dev/null +++ b/src/store/usePaymentSettingStore.ts @@ -0,0 +1,41 @@ +import { useAccount } from '@/api/account' +import { ConsumptionTypes, IDeductionSetting, UserConsumptionSetting } from '@/api/models/consumption' +import { QueryPostAPIWithParams } from '@/api/query' +import { ACCOUNT_API_URL } from '@/data/constants' +import { defineStore } from 'pinia' +import { computed } from 'vue' + +export const useConsumptionSettingStore = defineStore( + 'consumptionSetting', + () => { + const accountInfo = useAccount() + const consumptionSetting = computed(() => { + return accountInfo.value.consumptionSetting + }) + const consumptionTypeMap = { + [ConsumptionTypes.DanmakuStorage]: { + name: '弹幕存储', + key: 'danmakuStorage' + } + } + + async function UpdateConsumptionSetting( + type: ConsumptionTypes, + value: unknown + ) { + return await QueryPostAPIWithParams( + ACCOUNT_API_URL + 'update-consumption-setting', + { + type: type + }, + value + ) + } + function GetSetting(type: ConsumptionTypes) { + // @ts-expect-error 直接从对象获取key + return consumptionSetting.value[consumptionTypeMap[type].key] as IDeductionSetting + } + + return { consumptionSetting, consumptionTypeMap, UpdateConsumptionSetting, GetSetting } + } +) diff --git a/src/store/useQuestionBox.ts b/src/store/useQuestionBox.ts index f5cc7d1..89791b5 100644 --- a/src/store/useQuestionBox.ts +++ b/src/store/useQuestionBox.ts @@ -50,7 +50,7 @@ export const useQuestionBox = defineStore('QuestionBox', () => { let isRevieveGetted = false //const isSendGetted = false - const message = useMessage() + const message = window.$message async function GetRecieveQAInfo() { isLoading.value = true diff --git a/src/views/manage/DashboardView.vue b/src/views/manage/DashboardView.vue index 6abaefd..0d81f4b 100644 --- a/src/views/manage/DashboardView.vue +++ b/src/views/manage/DashboardView.vue @@ -287,19 +287,6 @@ onUnmounted(() => {