update point views

This commit is contained in:
2024-02-18 19:57:28 +08:00
parent 144f24b004
commit 535c2d7516
13 changed files with 715 additions and 135 deletions

View File

@@ -266,10 +266,13 @@ onUnmounted(() => {
<template>
<NSpace justify="center" align="center" vertical style="width: 100%">
<NAlert type="info">
当前本站正在测试为粉丝数大于 1000 或至少拥有一位舰长的主播直接从服务端记录并储存弹幕数据, 不过并不清楚B站的风控策略, 此功能不一定会长期启用
当前本站正在测试为粉丝数大于 1000 或至少拥有一位舰长的主播直接从服务端记录并储存弹幕数据,
不过并不清楚B站的风控策略, 此功能不一定会长期启用
<br />
在我们被限制连接之前满足以上条件的主播无需部署
<NButton tag="a" href="https://www.yuque.com/megghy/dez70g/vfvcyv3024xvaa1p" target="_blank" type="primary" text> VtsuruEventFetcher </NButton>
<NButton tag="a" href="https://www.yuque.com/megghy/dez70g/vfvcyv3024xvaa1p" target="_blank" type="primary" text>
VtsuruEventFetcher
</NButton>
即可使用相关功能 (如记录上舰和SC, 直播场记录等) 😊
</NAlert>
<NCard embedded style="width: 100%">
@@ -296,7 +299,14 @@ onUnmounted(() => {
<template v-else>
<NTag type="error" size="small"> 未认证 </NTag>
</template>
<NButton v-if="accountInfo?.isEmailVerified" type="warning" size="tiny" @click="resetEmailModalVisiable = true"> 修改邮箱 </NButton>
<NButton
v-if="accountInfo?.isEmailVerified"
type="warning"
size="tiny"
@click="resetEmailModalVisiable = true"
>
修改邮箱
</NButton>
</NSpace>
</NCard>
<NCard size="small">
@@ -305,13 +315,28 @@ onUnmounted(() => {
<NText style="color: var(--primary-color)">
<NSpace :size="5" align="center">
已认证 | {{ accountInfo?.biliId }}
<NTag v-if="accountInfo.biliAuthCodeStatus == BiliAuthCodeStatusType.Active" type="success" size="small" :bordered="false">
<NTag
v-if="accountInfo.biliAuthCodeStatus == BiliAuthCodeStatusType.Active"
type="success"
size="small"
:bordered="false"
>
身份码: 有效
</NTag>
<NTag v-else-if="accountInfo.biliAuthCodeStatus == BiliAuthCodeStatusType.Inactive" type="error" size="small" :bordered="false">
<NTag
v-else-if="accountInfo.biliAuthCodeStatus == BiliAuthCodeStatusType.Inactive"
type="error"
size="small"
:bordered="false"
>
身份码: 需更新
</NTag>
<NTag v-else-if="accountInfo.biliAuthCodeStatus == BiliAuthCodeStatusType.Notfound" type="warning" size="small" :bordered="false">
<NTag
v-else-if="accountInfo.biliAuthCodeStatus == BiliAuthCodeStatusType.Notfound"
type="warning"
size="small"
:bordered="false"
>
身份码: 需绑定
<NTooltip>
<template #trigger>
@@ -332,7 +357,7 @@ onUnmounted(() => {
</NEllipsis>
<template v-else>
<NTag type="error" size="small">
认证
绑定
<NTooltip>
<template #trigger>
<NIcon :component="Info24Filled" />
@@ -344,7 +369,7 @@ onUnmounted(() => {
<NButton size="small" @click="bindBiliCodeModalVisiable = true" type="info"> 进行绑定 </NButton>
</template>
</NCard>
<NCard size="small" v-if="false">
<NCard size="small">
用户 Bilibili 账户:
<NEllipsis v-if="accountInfo?.biliUserAuthInfo" style="max-width: 100%">
<NText style="color: var(--primary-color)">
@@ -370,7 +395,7 @@ onUnmounted(() => {
</NTooltip>
</NTag>
<NDivider vertical />
<NButton size="small" @click="bindBiliAuthModalVisiable = true" type="info"> 进行绑定 </NButton>
<NButton size="small" @click="bindBiliAuthModalVisiable = true" type="info"> 进行认证 </NButton>
</template>
</NCard>
<EventFetcherStatusCard />
@@ -428,7 +453,12 @@ onUnmounted(() => {
<NButton @click="resetName" type="warning" :loading="isLoading"> 确定修改 </NButton>
</template>
</NModal>
<NModal v-model:show="bindBiliCodeModalVisiable" preset="card" title="绑定/更新身份码" style="width: 400px; max-width: 90%">
<NModal
v-model:show="bindBiliCodeModalVisiable"
preset="card"
title="绑定/更新身份码"
style="width: 400px; max-width: 90%"
>
<NSpace vertical>
<NInputGroup>
<NInput v-model:value="biliCode" placeholder="身份码" />
@@ -448,13 +478,25 @@ onUnmounted(() => {
</NInputGroup>
</NSpace>
<template #footer>
<NButton @click="accountInfo?.isBiliVerified ? ChangeBili() : BindBili()" type="success" :loading="!token || isLoading"> 确定 </NButton>
<NButton
@click="accountInfo?.isBiliVerified ? ChangeBili() : BindBili()"
type="success"
:loading="!token || isLoading"
>
确定
</NButton>
</template>
</NModal>
<NModal v-model:show="bindBiliAuthModalVisiable" preset="card" title="绑定用户账户" style="width: 700px; max-width: 90%">
<NModal
v-model:show="bindBiliAuthModalVisiable"
preset="card"
title="绑定用户账户"
style="width: 700px; max-width: 90%"
>
<NSpace vertical>
<NAlert title="获取认证链接" type="info">
因为部分功能如积分兑换等也需要对没有注册本站账户的用户开放, 所以需要现在另一个页面获取认证链接, 然后再回到这里绑定
因为部分功能如积分兑换等也需要对没有注册本站账户的用户开放, 所以需要现在另一个页面获取认证链接,
然后再回到这里绑定
</NAlert>
<NInputGroup>
<NInput v-model:value="biliAuthText" placeholder="认证链接, 或者 Token" />
@@ -466,7 +508,7 @@ onUnmounted(() => {
<Question24Regular />
</NIcon>
</template>
前往获取
前往认证
</NButton>
</template>
直接粘贴认证完成后给出的类似

View File

@@ -318,14 +318,12 @@ function getOptions() {
},
data: chartData.hourlyCounts,
itemStyle: {
normal: {
color: function (data: any) {
if (completeTimeSeries[data.dataIndex].change) {
return '#18a058'
} else {
return '#5470C6'
}
},
color: function (data: any) {
if (completeTimeSeries[data.dataIndex].change) {
return '#18a058'
} else {
return '#5470C6'
}
},
},
},

View File

@@ -1,7 +1,14 @@
<script setup lang="ts">
import { getBase64, getImageUploadModel } from '@/Utils'
import { DisableFunction, EnableFunction, useAccount } from '@/api/account'
import { ResponsePointGoodModel, FunctionTypes, PointGoodsModel, GoodsTypes, GoodsStatus, TagInfo } from '@/api/api-models'
import {
ResponsePointGoodModel,
FunctionTypes,
PointGoodsModel,
GoodsTypes,
GoodsStatus,
TagInfo,
} from '@/api/api-models'
import { QueryGetAPI, QueryPostAPI } from '@/api/query'
import PointGoodsItem from '@/components/manage/PointGoodsItem.vue'
import { FILE_BASE_URL, POINT_API_URL } from '@/data/constants'
@@ -49,6 +56,7 @@ import { cloneFnJSON } from '@vueuse/core'
import { useAuthStore } from '@/store/useAuthStore'
import PointSettings from './PointSettings.vue'
import { useRouteHash } from '@vueuse/router'
import EventFetcherStatusCard from '@/components/EventFetcherStatusCard.vue'
const message = useMessage()
const accountInfo = useAccount()
@@ -60,7 +68,7 @@ const realHash = useRouteHash('goods', {
})
const hash = computed({
get() {
return realHash.value?.slice(1) ?? ''
return realHash.value?.startsWith('#') ? realHash.value.slice(1) : realHash.value || 'goods'
},
set(val) {
realHash.value = '#' + val
@@ -77,7 +85,9 @@ const defaultGoodsModel = {
} as PointGoodsModel,
fileList: [],
} as { goods: PointGoodsModel; fileList: UploadFileInfo[] }
const currentGoodsModel = ref<{ goods: PointGoodsModel; fileList: UploadFileInfo[] }>(JSON.parse(JSON.stringify(defaultGoodsModel)))
const currentGoodsModel = ref<{ goods: PointGoodsModel; fileList: UploadFileInfo[] }>(
JSON.parse(JSON.stringify(defaultGoodsModel)),
)
const showAddGoodsModal = ref(false)
@@ -93,6 +103,10 @@ const rules = {
required: true,
message: '请输入礼物价格',
},
'goods.type': {
required: true,
message: '请选择是虚拟礼物或实物',
},
content: {
required: true,
message: '请输入虚拟礼物的具体内容',
@@ -102,10 +116,11 @@ const rules = {
},
privacy: {
required: true,
message: '需要阅读并同意本站隐私政策',
message: '需要阅读并同意本站隐私协议',
validator: (rule: FormItemRule, value: boolean) => {
return (
(currentGoodsModel.value.goods.type != GoodsTypes.Physical && currentGoodsModel.value.goods.collectUrl != undefined) ||
(currentGoodsModel.value.goods.type != GoodsTypes.Physical &&
currentGoodsModel.value.goods.collectUrl != undefined) ||
isAllowedPrivacyPolicy.value
)
},
@@ -114,7 +129,22 @@ const rules = {
required: true,
message: '需要输入最大购买数量',
validator: (rule: FormItemRule, value: number) => {
return currentGoodsModel.value.goods.type != GoodsTypes.Physical || (currentGoodsModel.value.goods.maxBuyCount ?? 0) > 0
return (
currentGoodsModel.value.goods.type != GoodsTypes.Physical ||
(currentGoodsModel.value.goods.maxBuyCount ?? 0) > 0
)
},
},
'goods.url': {
required: true,
message: '请输入收集收货地址的链接',
validator: (rule: FormItemRule, value: string) => {
try {
new URL(value)
return true
} catch (err) {
return false
}
},
},
}
@@ -179,6 +209,7 @@ async function updateGoods(e: MouseEvent) {
if (currentGoodsModel.value.fileList.length > 0) {
currentGoodsModel.value.goods.cover = await getImageUploadModel(currentGoodsModel.value.fileList)
}
console.log(currentGoodsModel.value.goods)
await QueryPostAPI<ResponsePointGoodModel>(POINT_API_URL + 'update-goods', currentGoodsModel.value.goods)
.then((data) => {
if (data.code == 200) {
@@ -220,7 +251,7 @@ function onUpdateClick(item: ResponsePointGoodModel) {
currentGoodsModel.value = {
goods: {
...item,
count: item.count ?? 0,
count: item.count,
cover: undefined,
},
fileList: item.cover
@@ -313,23 +344,40 @@ function resetGoods() {
}
function responseGoodsToModel(goods: ResponsePointGoodModel) {}
onMounted(() => {
if (!hash.value) {
hash.value = 'goods'
}
})
onMounted(() => {})
</script>
<template>
<NAlert type="info">
启用积分系统
<NSwitch :value="accountInfo?.settings.enableFunctions.includes(FunctionTypes.Point)" @update:value="setFunctionEnable" />
<br />
<NText depth="3">
此功能需要部署
<NButton text type="primary" tag="a" href="https://www.yuque.com/megghy/dez70g/vfvcyv3024xvaa1p" target="_blank"> VtsuruEventFetcher </NButton>
</NText>
</NAlert>
<NFlex style="width: 100%">
<NAlert type="info" style="min-width: 400px">
启用
<NButton text type="primary" tag="a" href="https://www.yuque.com/megghy/dez70g/ohulp2torghlqqn8" target="_blank">
积分系统
</NButton>
<NDivider vertical />
<NSwitch
:value="accountInfo?.settings.enableFunctions.includes(FunctionTypes.Point)"
@update:value="setFunctionEnable"
/>
<br />
<NText depth="3">
此功能需要部署
<NButton
text
type="primary"
tag="a"
href="https://www.yuque.com/megghy/dez70g/vfvcyv3024xvaa1p"
target="_blank"
>
VtsuruEventFetcher
</NButton>
, 否则将无法记录各种事件
</NText>
</NAlert>
<EventFetcherStatusCard style="flex: 1" />
</NFlex>
<br />
<NAlert type="success"> 此功能将于 3月11日 官方启用 OpenId 后正式上线 </NAlert>
<NDivider />
<NTabs animated v-model:value="hash">
<NTabPane name="goods" tab="礼物">
@@ -337,13 +385,17 @@ onMounted(() => {
<NButton type="primary" @click="onModalOpen"> 添加礼物 </NButton>
</NFlex>
<NDivider />
<NGrid cols="1 500:2 700:3 1000:4 1200:5" :x-gap="12" :y-gap="8">
<NEmpty v-if="goods.filter((g) => g.status != GoodsStatus.Discontinued).length == 0" description="暂无礼物" />
<NGrid v-else cols="1 500:2 700:3 1000:4 1200:5" :x-gap="12" :y-gap="8">
<NGridItem v-for="item in goods.filter((g) => g.status != GoodsStatus.Discontinued)" :key="item.id">
<PointGoodsItem :goods="item">
<template #footer>
<span> 价格: {{ item.price }} </span>
<NFlex>
<NButton type="info" size="small" @click="onUpdateClick(item)"> 修改 </NButton>
<NButton type="warning" size="small" @click="onSetShelfClick(item, GoodsStatus.Discontinued)"> 下架 </NButton>
<NButton type="warning" size="small" @click="onSetShelfClick(item, GoodsStatus.Discontinued)">
下架
</NButton>
<NButton type="error" size="small" @click="onDeleteClick(item)"> 删除 </NButton>
</NFlex>
</template>
@@ -351,11 +403,15 @@ onMounted(() => {
</NGridItem>
</NGrid>
<NDivider>已下架</NDivider>
<NEmpty v-if="goods.filter((g) => g.status == GoodsStatus.Discontinued).length == 0" description="暂无已下架的物品" />
<NEmpty
v-if="goods.filter((g) => g.status == GoodsStatus.Discontinued).length == 0"
description="暂无已下架的礼物"
/>
<NGrid v-else cols="1 500:2 700:3 1000:4 1200:5" :x-gap="12" :y-gap="8">
<NGridItem v-for="item in goods.filter((g) => g.status == GoodsStatus.Discontinued)" :key="item.id">
<PointGoodsItem :goods="item">
<template #footer>
<span> 价格: {{ item.price }} </span>
<NFlex>
<NButton type="info" size="small" @click="onUpdateClick(item)"> 修改 </NButton>
<NButton type="success" size="small" @click="onSetShelfClick(item, GoodsStatus.Normal)"> 上架 </NButton>
@@ -396,20 +452,25 @@ onMounted(() => {
</NFormItem>
<NFormItem path="goods.count" label="库存">
<NCheckbox
:checked="currentGoodsModel.goods.count && currentGoodsModel.goods.count < 0"
@update:checked="(v) => (currentGoodsModel.goods.count = v ? -1 : 100)"
:checked="!currentGoodsModel.goods.count"
@update:checked="(v) => (currentGoodsModel.goods.count = v ? undefined : 100)"
>
不限
</NCheckbox>
<NInputNumber
v-if="currentGoodsModel.goods.count > -1"
v-if="currentGoodsModel.goods.count"
v-model:value="currentGoodsModel.goods.count"
placeholder="可选, 礼物库存"
style="max-width: 120px"
/>
</NFormItem>
<NFormItem path="goods.description" label="描述">
<NInput v-model:value="currentGoodsModel.goods.description" placeholder="可选, 礼物描述" maxlength="500" type="textarea" />
<NInput
v-model:value="currentGoodsModel.goods.description"
placeholder="可选, 礼物描述"
maxlength="500"
type="textarea"
/>
</NFormItem>
<NFormItem path="goods.tags" label="标签">
<NSelect
@@ -446,12 +507,16 @@ onMounted(() => {
</NFormItem>
<template v-if="currentGoodsModel.goods.type == GoodsTypes.Physical">
<NFormItem path="settings" label="选项">
<NCheckbox v-model:checked="currentGoodsModel.goods.isAllowRebuy">允许重复购买</NCheckbox>
<NCheckbox v-model:checked="currentGoodsModel.goods.isAllowRebuy">允许重复兑换</NCheckbox>
</NFormItem>
<NFormItem path="goods.maxBuyCount" label="最大购买数量">
<NInputNumber v-model:value="currentGoodsModel.goods.maxBuyCount" placeholder="必填, 最大购买数量" min="1" />
<NFormItem path="goods.maxBuyCount" label="最大兑换数量">
<NInputNumber
v-model:value="currentGoodsModel.goods.maxBuyCount"
placeholder="必填, 最大兑换数量"
min="1"
/>
</NFormItem>
<NFormItem path="goods.collectUrl" label="收货地址">
<NFormItem path="address" label="收货地址">
<NFlex vertical>
<NRadioGroup
:value="currentGoodsModel.goods.collectUrl == undefined ? 0 : 1"
@@ -471,15 +536,21 @@ onMounted(() => {
</NFlex>
</NFormItem>
<template v-if="currentGoodsModel.goods.collectUrl != undefined">
<NFormItem path="goods.url" label="收集链接">
<NFormItem path="goods.collectUrl" label="收集链接">
<NFlex vertical style="width: 100%">
<NInput v-model:value="currentGoodsModel.goods.collectUrl" placeholder="用于给用户填写自己收货地址的表格的分享链接" maxlength="300" />
<NCheckbox v-model:checked="currentGoodsModel.goods.embedCollectUrl"> 尝试将收集链接嵌入到网页中 </NCheckbox>
<NInput
v-model:value="currentGoodsModel.goods.collectUrl"
placeholder="用于给用户填写自己收货地址的表格的分享链接"
maxlength="300"
/>
<NCheckbox v-model:checked="currentGoodsModel.goods.embedCollectUrl">
尝试将收集链接嵌入到网页中
</NCheckbox>
</NFlex>
</NFormItem>
</template>
<template v-else>
<NFormItem path="privacy" label="隐私策略" required>
<NFormItem path="privacy" label="隐私协议" required>
<NCheckbox v-model:checked="isAllowedPrivacyPolicy"> 同意本站隐私协议 </NCheckbox>
</NFormItem>
</template>
@@ -495,10 +566,19 @@ onMounted(() => {
虚拟礼物的具体内容, 网盘链接什么之类的
</NTooltip>
</template>
<NInput v-model:value="currentGoodsModel.goods.content" type="textarea" placeholder="写这里咯" maxlength="10000" show-count clearable />
<NInput
v-model:value="currentGoodsModel.goods.content"
type="textarea"
placeholder="写这里咯"
maxlength="10000"
show-count
clearable
/>
</NFormItem>
</template>
<NButton @click="updateGoods" type="primary" :loading="isUpdating"> {{ currentGoodsModel.goods.id ? '修改' : '创建' }} </NButton>
<NButton @click="updateGoods" type="primary" :loading="isUpdating">
{{ currentGoodsModel.goods.id ? '修改' : '创建' }}
</NButton>
</NForm>
</NScrollbar>
</NModal>