mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-08 11:26:56 +08:00
fix message provider get
This commit is contained in:
41
src/store/usePaymentSettingStore.ts
Normal file
41
src/store/usePaymentSettingStore.ts
Normal file
@@ -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<UserConsumptionSetting>(() => {
|
||||
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 }
|
||||
}
|
||||
)
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user