mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
point add guard limit
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -22,3 +22,4 @@ pnpm-debug.log*
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
env.d.ts
|
||||||
|
|||||||
4
env.d.ts
vendored
4
env.d.ts
vendored
@@ -1,6 +1,8 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
env: {
|
env: {
|
||||||
VITE_DEBUG_API?: string
|
VITE_DEBUG_DEV_API?: string
|
||||||
|
VITE_DEBUG_RELEASE_API?: string
|
||||||
|
VITE_API?: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,5 @@
|
|||||||
</noscript>
|
</noscript>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
|
||||||
<script>
|
|
||||||
document.body.clientWidth < 700
|
|
||||||
? (document.getElementById('afdian_leaflet_vtsuru').width = '100%')
|
|
||||||
: (document.getElementById('afdian_leaflet_vtsuru').width = '640')
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ export enum IndexTypes {
|
|||||||
export enum SongListTypes {
|
export enum SongListTypes {
|
||||||
Default,
|
Default,
|
||||||
}
|
}
|
||||||
|
export enum GuardLevel {
|
||||||
|
None = 0,
|
||||||
|
Zongdu = 1,
|
||||||
|
Tidu = 2,
|
||||||
|
Jianzhang = 3,
|
||||||
|
}
|
||||||
export interface UserBasicInfo {
|
export interface UserBasicInfo {
|
||||||
name: string
|
name: string
|
||||||
id: number
|
id: number
|
||||||
@@ -242,7 +248,7 @@ export enum QueueSortType {
|
|||||||
GuardFirst,
|
GuardFirst,
|
||||||
PaymentFist,
|
PaymentFist,
|
||||||
TimeFirst,
|
TimeFirst,
|
||||||
FansMedalFirst
|
FansMedalFirst,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum QueueGiftFilterType {
|
export enum QueueGiftFilterType {
|
||||||
@@ -604,6 +610,10 @@ export enum GoodsTypes {
|
|||||||
Physical,
|
Physical,
|
||||||
Virtual,
|
Virtual,
|
||||||
}
|
}
|
||||||
|
export interface PointGoodsSetting {
|
||||||
|
guardFree?: { year: number; month: number }
|
||||||
|
allowGuardLevel?: GuardLevel
|
||||||
|
}
|
||||||
export interface ResponsePointGoodModel {
|
export interface ResponsePointGoodModel {
|
||||||
id: number
|
id: number
|
||||||
name: string
|
name: string
|
||||||
@@ -620,6 +630,10 @@ export interface ResponsePointGoodModel {
|
|||||||
maxBuyCount?: number
|
maxBuyCount?: number
|
||||||
collectUrl?: string
|
collectUrl?: string
|
||||||
embedCollectUrl?: boolean
|
embedCollectUrl?: boolean
|
||||||
|
|
||||||
|
canFreeBuy: boolean
|
||||||
|
allowGuardLevel: GuardLevel
|
||||||
|
setting: PointGoodsSetting
|
||||||
}
|
}
|
||||||
export interface ImageUploadModel {
|
export interface ImageUploadModel {
|
||||||
existImages: string[]
|
existImages: string[]
|
||||||
@@ -640,6 +654,8 @@ export interface PointGoodsModel {
|
|||||||
content?: string
|
content?: string
|
||||||
isAllowRebuy: boolean
|
isAllowRebuy: boolean
|
||||||
maxBuyCount?: number
|
maxBuyCount?: number
|
||||||
|
|
||||||
|
setting: PointGoodsSetting
|
||||||
}
|
}
|
||||||
export interface AddressInfo {
|
export interface AddressInfo {
|
||||||
id?: string
|
id?: string
|
||||||
@@ -727,7 +743,7 @@ export enum PointFrom {
|
|||||||
Use,
|
Use,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ResponseUserIndexModel{
|
export interface ResponseUserIndexModel {
|
||||||
notification: string
|
notification: string
|
||||||
videos: VideoCollectVideo[]
|
videos: VideoCollectVideo[]
|
||||||
links: {
|
links: {
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { GoodsTypes, ResponsePointGoodModel } from '@/api/api-models'
|
import { GoodsTypes, ResponsePointGoodModel } from '@/api/api-models'
|
||||||
import { FILE_BASE_URL, IMGUR_URL } from '@/data/constants'
|
import { FILE_BASE_URL, IMGUR_URL } from '@/data/constants'
|
||||||
import { NCard, NEllipsis, NEmpty, NFlex, NImage, NTag, NText } from 'naive-ui'
|
import { NAlert, NCard, NEllipsis, NEmpty, NFlex, NIcon, NImage, NTag, NText } from 'naive-ui'
|
||||||
|
import { VehicleShip20Filled } from '@vicons/fluent'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
goods: ResponsePointGoodModel | undefined
|
goods: ResponsePointGoodModel | undefined
|
||||||
|
contentStyle?: string | undefined
|
||||||
}>()
|
}>()
|
||||||
const emptyCover = IMGUR_URL + 'None.png'
|
const emptyCover = IMGUR_URL + 'None.png'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NEmpty v-if="!goods" description="已失效" />
|
<NEmpty v-if="!goods" description="已失效" />
|
||||||
<NCard v-else embedded>
|
<NCard v-else embedded :style="props.contentStyle">
|
||||||
<template #cover>
|
<template #cover>
|
||||||
<NImage
|
<NImage
|
||||||
:src="goods.cover ? FILE_BASE_URL + goods.cover : emptyCover"
|
:src="goods.cover ? FILE_BASE_URL + goods.cover : emptyCover"
|
||||||
@@ -44,10 +46,18 @@ const emptyCover = IMGUR_URL + 'None.png'
|
|||||||
</NFlex>
|
</NFlex>
|
||||||
</template>
|
</template>
|
||||||
<NFlex vertical>
|
<NFlex vertical>
|
||||||
|
<NEllipsis :line-clamp="2">
|
||||||
<NText :depth="goods.description ? 1 : 3" :italic="!goods.description">
|
<NText :depth="goods.description ? 1 : 3" :italic="!goods.description">
|
||||||
{{ goods.description ? goods.description : '暂无描述' }}
|
{{ goods.description ? goods.description : '暂无描述' }}
|
||||||
</NText>
|
</NText>
|
||||||
|
</NEllipsis>
|
||||||
<NFlex>
|
<NFlex>
|
||||||
|
<NTag v-if="goods.allowGuardLevel > 0" size="tiny" :color="{ color: '#5f5f5f', textColor: 'gold' }">
|
||||||
|
<template #icon>
|
||||||
|
<NIcon :component="VehicleShip20Filled" />
|
||||||
|
</template>
|
||||||
|
仅限舰长
|
||||||
|
</NTag>
|
||||||
<NTag v-for="tag in goods.tags" :key="tag" :bordered="false" size="tiny">{{ tag }}</NTag>
|
<NTag v-for="tag in goods.tags" :key="tag" :bordered="false" size="tiny">{{ tag }}</NTag>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import DefaultIndexTemplateVue from '@/views/view/indexTemplate/DefaultIndexTemplate.vue'
|
import DefaultIndexTemplateVue from '@/views/view/indexTemplate/DefaultIndexTemplate.vue'
|
||||||
import { defineAsyncComponent, ref } from 'vue'
|
import { defineAsyncComponent, ref } from 'vue'
|
||||||
|
|
||||||
const debugAPI = import.meta.env.VITE_DEBUG_API
|
const debugAPI =
|
||||||
|
import.meta.env.VITE_API == 'dev' ? import.meta.env.VITE_DEBUG_DEV_API : import.meta.env.VITE_DEBUG_RELEASE_API
|
||||||
const releseAPI = `https://vtsuru.suki.club/`
|
const releseAPI = `https://vtsuru.suki.club/`
|
||||||
const failoverAPI = `https://failover-api.vtsuru.suki.club/`
|
const failoverAPI = `https://failover-api.vtsuru.suki.club/`
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ import { NButton, NCard, NDivider, NLayoutContent, NSpace, NText, NTimeline, NTi
|
|||||||
></iframe>
|
></iframe>
|
||||||
<NDivider title-placement="left"> 更新日志 </NDivider>
|
<NDivider title-placement="left"> 更新日志 </NDivider>
|
||||||
<NTimeline>
|
<NTimeline>
|
||||||
|
<NTimelineItem
|
||||||
|
type="info"
|
||||||
|
title="功能更新"
|
||||||
|
content="礼物兑换允许上舰用户免费兑换, 以及仅允许上舰用户兑换"
|
||||||
|
time="2024-4-23"
|
||||||
|
/>
|
||||||
<NTimelineItem
|
<NTimelineItem
|
||||||
type="info"
|
type="info"
|
||||||
title="功能更新"
|
title="功能更新"
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ const defaultGoodsModel = {
|
|||||||
status: GoodsStatus.Normal,
|
status: GoodsStatus.Normal,
|
||||||
maxBuyCount: 1,
|
maxBuyCount: 1,
|
||||||
isAllowRebuy: false,
|
isAllowRebuy: false,
|
||||||
|
setting: {},
|
||||||
} as PointGoodsModel,
|
} as PointGoodsModel,
|
||||||
fileList: [],
|
fileList: [],
|
||||||
} as { goods: PointGoodsModel; fileList: UploadFileInfo[] }
|
} as { goods: PointGoodsModel; fileList: UploadFileInfo[] }
|
||||||
@@ -82,6 +83,24 @@ const showAddGoodsModal = ref(false)
|
|||||||
const isAllowedPrivacyPolicy = ref(false)
|
const isAllowedPrivacyPolicy = ref(false)
|
||||||
const isUpdating = ref(false)
|
const isUpdating = ref(false)
|
||||||
|
|
||||||
|
const allowedYearOptions = computed(() => {
|
||||||
|
//从2024到现在的年份
|
||||||
|
return Array.from({ length: new Date().getFullYear() - 2024 + 1 }, (_, i) => 2024 + i).map((item) => {
|
||||||
|
return {
|
||||||
|
label: item.toString() + '年',
|
||||||
|
value: item,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
const allowedMonthOptions = computed(() => {
|
||||||
|
return Array.from({ length: 12 }, (_, i) => i + 1).map((item) => {
|
||||||
|
return {
|
||||||
|
label: item.toString() + '月',
|
||||||
|
value: item + 1,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const rules = {
|
const rules = {
|
||||||
name: {
|
name: {
|
||||||
required: true,
|
required: true,
|
||||||
@@ -197,13 +216,12 @@ async function updateGoods(e: MouseEvent) {
|
|||||||
if (currentGoodsModel.value.fileList.length > 0) {
|
if (currentGoodsModel.value.fileList.length > 0) {
|
||||||
currentGoodsModel.value.goods.cover = await getImageUploadModel(currentGoodsModel.value.fileList)
|
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)
|
await QueryPostAPI<ResponsePointGoodModel>(POINT_API_URL + 'update-goods', currentGoodsModel.value.goods)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (data.code == 200) {
|
if (data.code == 200) {
|
||||||
message.success('成功')
|
message.success('成功')
|
||||||
showAddGoodsModal.value = false
|
showAddGoodsModal.value = false
|
||||||
currentGoodsModel.value.goods = {} as PointGoodsModel
|
currentGoodsModel.value = JSON.parse(JSON.stringify(defaultGoodsModel))
|
||||||
if (goods.value.find((g) => g.id == data.data.id)) {
|
if (goods.value.find((g) => g.id == data.data.id)) {
|
||||||
goods.value[goods.value.findIndex((g) => g.id == data.data.id)] = data.data
|
goods.value[goods.value.findIndex((g) => g.id == data.data.id)] = data.data
|
||||||
} else {
|
} else {
|
||||||
@@ -495,6 +513,59 @@ onMounted(() => {})
|
|||||||
+ {{ currentGoodsModel.goods.cover ? '更换' : '上传' }}封面
|
+ {{ currentGoodsModel.goods.cover ? '更换' : '上传' }}封面
|
||||||
</NUpload>
|
</NUpload>
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
|
<NFormItem path="goods.guardFree" label="兑换规则">
|
||||||
|
<NFlex vertical>
|
||||||
|
<NCheckbox
|
||||||
|
:checked="currentGoodsModel.goods.setting?.guardFree != undefined"
|
||||||
|
@update:checked="
|
||||||
|
(v) => {
|
||||||
|
// @ts-ignore
|
||||||
|
currentGoodsModel.goods.setting.guardFree = v ? { year: undefined, month: undefined } : undefined
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>
|
||||||
|
允许舰长免费兑换
|
||||||
|
<NTooltip>
|
||||||
|
<template #trigger>
|
||||||
|
<NIcon :component="Info24Filled" />
|
||||||
|
</template>
|
||||||
|
仅当
|
||||||
|
<NButton type="info" text tag="a" href="/manage/event" target="_blank">舰长和SC</NButton>
|
||||||
|
中存在对应记录时才能生效
|
||||||
|
</NTooltip>
|
||||||
|
</NCheckbox>
|
||||||
|
<NFlex v-if="currentGoodsModel.goods.setting?.guardFree">
|
||||||
|
<NSelect
|
||||||
|
v-model:value="currentGoodsModel.goods.setting.guardFree.year"
|
||||||
|
:options="allowedYearOptions"
|
||||||
|
placeholder="请选择年份"
|
||||||
|
/>
|
||||||
|
<NSelect
|
||||||
|
v-model:value="currentGoodsModel.goods.setting.guardFree.month"
|
||||||
|
:options="allowedMonthOptions"
|
||||||
|
placeholder="请选择月份"
|
||||||
|
/>
|
||||||
|
</NFlex>
|
||||||
|
<NText>
|
||||||
|
最低兑换等级
|
||||||
|
<NTooltip>
|
||||||
|
<template #trigger>
|
||||||
|
<NIcon :component="Info24Filled" />
|
||||||
|
</template>
|
||||||
|
仅当
|
||||||
|
<NButton type="info" text tag="a" href="/manage/event" target="_blank">舰长和SC</NButton>
|
||||||
|
中存在对应记录时才能生效
|
||||||
|
</NTooltip>
|
||||||
|
</NText>
|
||||||
|
|
||||||
|
<NRadioGroup v-model:value="currentGoodsModel.goods.setting.allowGuardLevel">
|
||||||
|
<NRadioButton :value="0">不限</NRadioButton>
|
||||||
|
<NRadioButton :value="1">总督</NRadioButton>
|
||||||
|
<NRadioButton :value="2">提督</NRadioButton>
|
||||||
|
<NRadioButton :value="3">舰长</NRadioButton>
|
||||||
|
</NRadioGroup>
|
||||||
|
</NFlex>
|
||||||
|
</NFormItem>
|
||||||
<NFormItem path="goods.type" label="类型">
|
<NFormItem path="goods.type" label="类型">
|
||||||
<NRadioGroup v-model:value="currentGoodsModel.goods.type">
|
<NRadioGroup v-model:value="currentGoodsModel.goods.type">
|
||||||
<NRadioButton :value="GoodsTypes.Virtual">虚拟礼物</NRadioButton>
|
<NRadioButton :value="GoodsTypes.Virtual">虚拟礼物</NRadioButton>
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ onMounted(async () => {
|
|||||||
<NModal
|
<NModal
|
||||||
v-model:show="showModal"
|
v-model:show="showModal"
|
||||||
preset="card"
|
preset="card"
|
||||||
style="max-width: 1800px; min-width: 400px"
|
style="max-width: 90vw; min-width: 400px; width: 1600px;"
|
||||||
title="用户详情"
|
title="用户详情"
|
||||||
content-style="padding: 0"
|
content-style="padding: 0"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ onMounted(async () => {
|
|||||||
立即认证
|
立即认证
|
||||||
</NButton>
|
</NButton>
|
||||||
</NAlert>
|
</NAlert>
|
||||||
<NCard v-else style="max-width: 600px" embedded hoverable>
|
<NCard v-else style="max-width: 600px; margin: 0 auto;" embedded hoverable>
|
||||||
<template #header> 你好, {{ useAuth.biliAuth.name }} </template>
|
<template #header> 你好, {{ useAuth.biliAuth.name }} </template>
|
||||||
<template #header-extra>
|
<template #header-extra>
|
||||||
<NFlex>
|
<NFlex>
|
||||||
@@ -209,9 +209,8 @@ onMounted(async () => {
|
|||||||
<NDivider />
|
<NDivider />
|
||||||
<NSpin :show="isLoading">
|
<NSpin :show="isLoading">
|
||||||
<NEmpty v-if="goods.length == 0"> 暂无礼物 </NEmpty>
|
<NEmpty v-if="goods.length == 0"> 暂无礼物 </NEmpty>
|
||||||
<NGrid v-else cols="1 500:2 700:3 1000:4 1200:5" x-gap="12" y-gap="8">
|
<NFlex justify="center">
|
||||||
<NGridItem v-for="item in goods" :key="item.id">
|
<PointGoodsItem v-for="item in goods" :key="item.id" :goods="item" content-style="max-width: 300px;height: 365px">
|
||||||
<PointGoodsItem :goods="item">
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<NFlex justify="space-between" align="center">
|
<NFlex justify="space-between" align="center">
|
||||||
<NTooltip>
|
<NTooltip>
|
||||||
@@ -227,23 +226,27 @@ onMounted(async () => {
|
|||||||
{{ getTooltip(item) }}
|
{{ getTooltip(item) }}
|
||||||
</NTooltip>
|
</NTooltip>
|
||||||
<NFlex style="flex: 1" justify="end">
|
<NFlex style="flex: 1" justify="end">
|
||||||
<NText style="size: 34px">
|
<NTooltip>
|
||||||
|
<template #trigger>
|
||||||
|
<NText style="size: 34px" :delete="item.canFreeBuy">
|
||||||
🪙
|
🪙
|
||||||
{{ item.price }}
|
{{ item.price }}
|
||||||
</NText>
|
</NText>
|
||||||
|
</template>
|
||||||
|
{{ item.canFreeBuy ? '你可以免费兑换此礼物' : '付费' }}
|
||||||
|
</NTooltip>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
</template>
|
</template>
|
||||||
</PointGoodsItem>
|
</PointGoodsItem>
|
||||||
</NGridItem>
|
</NFlex>
|
||||||
</NGrid>
|
|
||||||
</NSpin>
|
</NSpin>
|
||||||
<NModal
|
<NModal
|
||||||
v-model:show="showBuyModal"
|
v-model:show="showBuyModal"
|
||||||
v-if="currentGoods"
|
v-if="currentGoods"
|
||||||
preset="card"
|
preset="card"
|
||||||
title="确认兑换"
|
title="确认兑换"
|
||||||
style="width: 400px; max-width: 90vw; height: auto"
|
style="width: 500px; max-width: 90vw; height: auto"
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<NFlex align="baseline">
|
<NFlex align="baseline">
|
||||||
@@ -295,6 +298,7 @@ onMounted(async () => {
|
|||||||
</NDivider>
|
</NDivider>
|
||||||
<NButton type="primary" :disabled="!canDoBuy" @click="buyGoods" :loading="isLoading"> 确认兑换 </NButton>
|
<NButton type="primary" :disabled="!canDoBuy" @click="buyGoods" :loading="isLoading"> 确认兑换 </NButton>
|
||||||
<NText>
|
<NText>
|
||||||
|
<NDivider vertical />
|
||||||
所需积分: {{ currentGoods.price * buyCount }}
|
所需积分: {{ currentGoods.price * buyCount }}
|
||||||
<NDivider vertical />
|
<NDivider vertical />
|
||||||
当前积分: {{ currentPoint }}
|
当前积分: {{ currentPoint }}
|
||||||
|
|||||||
Reference in New Issue
Block a user