mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
重构多个组件以优化代码格式和可读性,删除不必要的文件,更新类型定义,添加数据分析路由
This commit is contained in:
@@ -111,24 +111,45 @@ async function updateGift() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NAlert v-if="!accountInfo.eventFetcherState.online" type="warning">
|
||||
<NAlert
|
||||
v-if="!accountInfo.eventFetcherState.online"
|
||||
type="warning"
|
||||
>
|
||||
由于你尚未部署
|
||||
<NButton text type="primary" tag="a" href="https://www.wolai.com/fje5wLtcrDoZcb9rk2zrFs" target="_blank">
|
||||
<NButton
|
||||
text
|
||||
type="primary"
|
||||
tag="a"
|
||||
href="https://www.wolai.com/fje5wLtcrDoZcb9rk2zrFs"
|
||||
target="_blank"
|
||||
>
|
||||
VtsuruEventFetcher
|
||||
</NButton>
|
||||
, 以下选项设置了也没用
|
||||
</NAlert>
|
||||
<br />
|
||||
<NAlert type="info"> 积分总是最多保留两位小数, 四舍五入 </NAlert>
|
||||
<br>
|
||||
<NAlert type="info">
|
||||
积分总是最多保留两位小数, 四舍五入
|
||||
</NAlert>
|
||||
<NDivider> 常用 </NDivider>
|
||||
<NSpin :show="isLoading">
|
||||
<NFlex vertical>
|
||||
<NFlex>
|
||||
允许的积分来源
|
||||
<NCheckboxGroup v-model:value="setting.allowType" @update:value="updateSettings" :disabled="!canEdit">
|
||||
<NCheckbox :value="EventDataTypes.Guard"> 上舰 </NCheckbox>
|
||||
<NCheckbox :value="EventDataTypes.SC"> Superchat </NCheckbox>
|
||||
<NCheckbox :value="EventDataTypes.Gift"> 礼物 </NCheckbox>
|
||||
<NCheckboxGroup
|
||||
v-model:value="setting.allowType"
|
||||
:disabled="!canEdit"
|
||||
@update:value="updateSettings"
|
||||
>
|
||||
<NCheckbox :value="EventDataTypes.Guard">
|
||||
上舰
|
||||
</NCheckbox>
|
||||
<NCheckbox :value="EventDataTypes.SC">
|
||||
Superchat
|
||||
</NCheckbox>
|
||||
<NCheckbox :value="EventDataTypes.Gift">
|
||||
礼物
|
||||
</NCheckbox>
|
||||
</NCheckboxGroup>
|
||||
</NFlex>
|
||||
<template v-if="setting.allowType.includes(EventDataTypes.Guard)">
|
||||
@@ -136,20 +157,59 @@ async function updateGift() {
|
||||
<NFlex align="center">
|
||||
上舰所给予的积分
|
||||
<NFlex>
|
||||
<NInputGroup style="width: 230px" :disabled="!canEdit">
|
||||
<NInputGroup
|
||||
style="width: 230px"
|
||||
:disabled="!canEdit"
|
||||
>
|
||||
<NInputGroupLabel> 舰长 </NInputGroupLabel>
|
||||
<NInputNumber v-model:value="setting.jianzhangPoint" :disabled="!canEdit" min="0" />
|
||||
<NButton @click="updateSettings" type="info" :disabled="!canEdit">确定</NButton>
|
||||
<NInputNumber
|
||||
v-model:value="setting.jianzhangPoint"
|
||||
:disabled="!canEdit"
|
||||
min="0"
|
||||
/>
|
||||
<NButton
|
||||
type="info"
|
||||
:disabled="!canEdit"
|
||||
@click="updateSettings"
|
||||
>
|
||||
确定
|
||||
</NButton>
|
||||
</NInputGroup>
|
||||
<NInputGroup style="width: 230px" :disabled="!canEdit">
|
||||
<NInputGroup
|
||||
style="width: 230px"
|
||||
:disabled="!canEdit"
|
||||
>
|
||||
<NInputGroupLabel> 提督 </NInputGroupLabel>
|
||||
<NInputNumber v-model:value="setting.tiduPoint" :disabled="!canEdit" min="0" />
|
||||
<NButton @click="updateSettings" type="info" :disabled="!canEdit">确定</NButton>
|
||||
<NInputNumber
|
||||
v-model:value="setting.tiduPoint"
|
||||
:disabled="!canEdit"
|
||||
min="0"
|
||||
/>
|
||||
<NButton
|
||||
type="info"
|
||||
:disabled="!canEdit"
|
||||
@click="updateSettings"
|
||||
>
|
||||
确定
|
||||
</NButton>
|
||||
</NInputGroup>
|
||||
<NInputGroup style="width: 230px" :disabled="!canEdit">
|
||||
<NInputGroup
|
||||
style="width: 230px"
|
||||
:disabled="!canEdit"
|
||||
>
|
||||
<NInputGroupLabel> 总督 </NInputGroupLabel>
|
||||
<NInputNumber v-model:value="setting.zongduPoint" :disabled="!canEdit" min="0" />
|
||||
<NButton @click="updateSettings" type="info" :disabled="!canEdit">确定</NButton>
|
||||
<NInputNumber
|
||||
v-model:value="setting.zongduPoint"
|
||||
:disabled="!canEdit"
|
||||
min="0"
|
||||
/>
|
||||
<NButton
|
||||
type="info"
|
||||
:disabled="!canEdit"
|
||||
@click="updateSettings"
|
||||
>
|
||||
确定
|
||||
</NButton>
|
||||
</NInputGroup>
|
||||
</NFlex>
|
||||
</NFlex>
|
||||
@@ -157,10 +217,24 @@ async function updateGift() {
|
||||
<template v-if="setting.allowType.includes(EventDataTypes.SC)">
|
||||
<NDivider>SC设置</NDivider>
|
||||
<NFlex>
|
||||
<NInputGroup style="width: 280px" :disabled="!canEdit">
|
||||
<NInputGroup
|
||||
style="width: 280px"
|
||||
:disabled="!canEdit"
|
||||
>
|
||||
<NInputGroupLabel> SC转换倍率 </NInputGroupLabel>
|
||||
<NInputNumber v-model:value="setting.scPointPercent" :disabled="!canEdit" min="0" step="0.01" max="1" />
|
||||
<NButton @click="updateSettings" type="info" :disabled="!canEdit">确定
|
||||
<NInputNumber
|
||||
v-model:value="setting.scPointPercent"
|
||||
:disabled="!canEdit"
|
||||
min="0"
|
||||
step="0.01"
|
||||
max="1"
|
||||
/>
|
||||
<NButton
|
||||
type="info"
|
||||
:disabled="!canEdit"
|
||||
@click="updateSettings"
|
||||
>
|
||||
确定
|
||||
<NTooltip>
|
||||
<template #trigger>
|
||||
<NIcon :component="Info24Filled" />
|
||||
@@ -174,15 +248,35 @@ async function updateGift() {
|
||||
<template v-if="setting.allowType.includes(EventDataTypes.Gift)">
|
||||
<NDivider>礼物设置</NDivider>
|
||||
<NFlex vertical>
|
||||
<NRadioGroup v-model:value="setting.giftAllowType" @update:value="updateSettings">
|
||||
<NRadioButton :value="SettingPointGiftAllowType.WhiteList"> 只包含下方的礼物 </NRadioButton>
|
||||
<NRadioButton :value="SettingPointGiftAllowType.All"> 包含所有礼物 </NRadioButton>
|
||||
<NRadioGroup
|
||||
v-model:value="setting.giftAllowType"
|
||||
@update:value="updateSettings"
|
||||
>
|
||||
<NRadioButton :value="SettingPointGiftAllowType.WhiteList">
|
||||
只包含下方的礼物
|
||||
</NRadioButton>
|
||||
<NRadioButton :value="SettingPointGiftAllowType.All">
|
||||
包含所有礼物
|
||||
</NRadioButton>
|
||||
</NRadioGroup>
|
||||
<template v-if="setting.giftAllowType === SettingPointGiftAllowType.All">
|
||||
<NInputGroup style="width: 280px" :disabled="!canEdit">
|
||||
<NInputGroup
|
||||
style="width: 280px"
|
||||
:disabled="!canEdit"
|
||||
>
|
||||
<NInputGroupLabel> 礼物转换倍率 </NInputGroupLabel>
|
||||
<NInputNumber v-model:value="setting.giftPointPercent" :disabled="!canEdit" min="0" step="0.01" max="1" />
|
||||
<NButton @click="updateSettings" type="info" :disabled="!canEdit">
|
||||
<NInputNumber
|
||||
v-model:value="setting.giftPointPercent"
|
||||
:disabled="!canEdit"
|
||||
min="0"
|
||||
step="0.01"
|
||||
max="1"
|
||||
/>
|
||||
<NButton
|
||||
type="info"
|
||||
:disabled="!canEdit"
|
||||
@click="updateSettings"
|
||||
>
|
||||
确定
|
||||
<NTooltip>
|
||||
<template #trigger>
|
||||
@@ -195,22 +289,52 @@ async function updateGift() {
|
||||
</template>
|
||||
<NCard>
|
||||
<NFlex vertical>
|
||||
<NButton @click="showAddGiftModal = true" type="primary" :disabled="!canEdit" style="max-width: 200px">
|
||||
<NButton
|
||||
type="primary"
|
||||
:disabled="!canEdit"
|
||||
style="max-width: 200px"
|
||||
@click="showAddGiftModal = true"
|
||||
>
|
||||
添加礼物
|
||||
</NButton>
|
||||
<NList bordered>
|
||||
<NListItem v-for="item in Object.entries(setting.giftPercentMap)" :key="item[0]">
|
||||
<NListItem
|
||||
v-for="item in Object.entries(setting.giftPercentMap)"
|
||||
:key="item[0]"
|
||||
>
|
||||
<NFlex align="center">
|
||||
<NTag :bordered="false" size="small" type="success"> {{ item[0] }} </NTag>
|
||||
<NInputGroup style="width: 200px" :disabled="!canEdit">
|
||||
<NInputNumber :value="setting.giftPercentMap[item[0]]"
|
||||
@update:value="(v) => (setting.giftPercentMap[item[0]] = v ?? 0)" :disabled="!canEdit"
|
||||
min="0" />
|
||||
<NButton @click="updateSettings" type="info" :disabled="!canEdit">确定</NButton>
|
||||
<NTag
|
||||
:bordered="false"
|
||||
size="small"
|
||||
type="success"
|
||||
>
|
||||
{{ item[0] }}
|
||||
</NTag>
|
||||
<NInputGroup
|
||||
style="width: 200px"
|
||||
:disabled="!canEdit"
|
||||
>
|
||||
<NInputNumber
|
||||
:value="setting.giftPercentMap[item[0]]"
|
||||
:disabled="!canEdit"
|
||||
min="0"
|
||||
@update:value="(v) => (setting.giftPercentMap[item[0]] = v ?? 0)"
|
||||
/>
|
||||
<NButton
|
||||
type="info"
|
||||
:disabled="!canEdit"
|
||||
@click="updateSettings"
|
||||
>
|
||||
确定
|
||||
</NButton>
|
||||
</NInputGroup>
|
||||
<NPopconfirm @positive-click="deleteGift(item[0])">
|
||||
<template #trigger>
|
||||
<NButton type="error" text :disabled="!canEdit">
|
||||
<NButton
|
||||
type="error"
|
||||
text
|
||||
:disabled="!canEdit"
|
||||
>
|
||||
<template #icon>
|
||||
<NIcon :component="Delete24Regular" />
|
||||
</template>
|
||||
@@ -224,18 +348,44 @@ async function updateGift() {
|
||||
</NFlex>
|
||||
</NCard>
|
||||
</NFlex>
|
||||
<NModal v-model:show="showAddGiftModal" preset="card" title="添加礼物" style="max-width: 400px">
|
||||
<NFlex align="center" vertical>
|
||||
<NAlert title="注意" type="warning"> 这里填写的积分是指这个礼物直接对应多少积分, 而不是兑换比例 </NAlert>
|
||||
<NModal
|
||||
v-model:show="showAddGiftModal"
|
||||
preset="card"
|
||||
title="添加礼物"
|
||||
style="max-width: 400px"
|
||||
>
|
||||
<NFlex
|
||||
align="center"
|
||||
vertical
|
||||
>
|
||||
<NAlert
|
||||
title="注意"
|
||||
type="warning"
|
||||
>
|
||||
这里填写的积分是指这个礼物直接对应多少积分, 而不是兑换比例
|
||||
</NAlert>
|
||||
<NInputGroup>
|
||||
<NInputGroupLabel> 礼物名称 </NInputGroupLabel>
|
||||
<NInput v-model:value="addGiftModel.name" placeholder="礼物名称" />
|
||||
<NInput
|
||||
v-model:value="addGiftModel.name"
|
||||
placeholder="礼物名称"
|
||||
/>
|
||||
</NInputGroup>
|
||||
<NInputGroup>
|
||||
<NInputGroupLabel> 给予积分 </NInputGroupLabel>
|
||||
<NInputNumber v-model:value="addGiftModel.point" placeholder="积分数量" min="0" />
|
||||
<NInputNumber
|
||||
v-model:value="addGiftModel.point"
|
||||
placeholder="积分数量"
|
||||
min="0"
|
||||
/>
|
||||
</NInputGroup>
|
||||
<NButton @click="addGift" type="info" :loading="isLoading">确定</NButton>
|
||||
<NButton
|
||||
type="info"
|
||||
:loading="isLoading"
|
||||
@click="addGift"
|
||||
>
|
||||
确定
|
||||
</NButton>
|
||||
</NFlex>
|
||||
</NModal>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user