mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
allow deduct point
This commit is contained in:
@@ -41,8 +41,8 @@ const historyColumn: DataTableColumns<ResponsePointHisrotyModel> = [
|
|||||||
render: (row: ResponsePointHisrotyModel) => {
|
render: (row: ResponsePointHisrotyModel) => {
|
||||||
return h(
|
return h(
|
||||||
NText,
|
NText,
|
||||||
{ style: { color: row.from === PointFrom.Use ? 'red' : 'green' } },
|
{ style: { color: row.point < 0 ? 'red' : 'green' } },
|
||||||
() => (row.from === PointFrom.Use ? '' : '+') + row.point,
|
() => (row.point < 0 ? '' : '+') + row.point,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -58,7 +58,7 @@ const historyColumn: DataTableColumns<ResponsePointHisrotyModel> = [
|
|||||||
value: PointFrom.Danmaku,
|
value: PointFrom.Danmaku,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '主播赠予',
|
label: '主播操作',
|
||||||
value: PointFrom.Manual,
|
value: PointFrom.Manual,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -72,7 +72,11 @@ const historyColumn: DataTableColumns<ResponsePointHisrotyModel> = [
|
|||||||
case PointFrom.Danmaku:
|
case PointFrom.Danmaku:
|
||||||
return h(NTag, { type: 'info', bordered: false, size: 'small' }, () => '直播间')
|
return h(NTag, { type: 'info', bordered: false, size: 'small' }, () => '直播间')
|
||||||
case PointFrom.Manual:
|
case PointFrom.Manual:
|
||||||
return h(NTag, { type: 'success', bordered: false, size: 'small' }, () => '主播赠予')
|
return h(
|
||||||
|
NTag,
|
||||||
|
{ type: 'success', bordered: false, size: 'small' },
|
||||||
|
() => '主播' + (row.point > 0 ? '赠予' : '扣除'),
|
||||||
|
)
|
||||||
case PointFrom.Use:
|
case PointFrom.Use:
|
||||||
return h(NTag, { type: 'warning', bordered: false, size: 'small' }, () => '使用')
|
return h(NTag, { type: 'warning', bordered: false, size: 'small' }, () => '使用')
|
||||||
}
|
}
|
||||||
@@ -90,7 +94,7 @@ const historyColumn: DataTableColumns<ResponsePointHisrotyModel> = [
|
|||||||
switch (row.type) {
|
switch (row.type) {
|
||||||
case EventDataTypes.Guard:
|
case EventDataTypes.Guard:
|
||||||
return h(NFlex, { justify: 'center', align: 'center' }, () => [
|
return h(NFlex, { justify: 'center', align: 'center' }, () => [
|
||||||
h(NTag, { type: 'info', size: 'small' }, () => '上舰'),
|
h(NTag, { type: 'error', size: 'small' }, () => '上舰'),
|
||||||
row.extra?.msg,
|
row.extra?.msg,
|
||||||
])
|
])
|
||||||
case EventDataTypes.Gift:
|
case EventDataTypes.Gift:
|
||||||
@@ -100,7 +104,7 @@ const historyColumn: DataTableColumns<ResponsePointHisrotyModel> = [
|
|||||||
])
|
])
|
||||||
case EventDataTypes.SC:
|
case EventDataTypes.SC:
|
||||||
return h(NFlex, { justify: 'center' }, () => [
|
return h(NFlex, { justify: 'center' }, () => [
|
||||||
h(NTag, { type: 'info', size: 'small', style: { margin: '0' } }, () => 'SC'),
|
h(NTag, { type: 'warning', size: 'small', style: { margin: '0' } }, () => 'SC'),
|
||||||
row.extra?.price,
|
row.extra?.price,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
@@ -111,7 +115,7 @@ const historyColumn: DataTableColumns<ResponsePointHisrotyModel> = [
|
|||||||
NButton,
|
NButton,
|
||||||
{
|
{
|
||||||
tag: 'a',
|
tag: 'a',
|
||||||
href: '/user/' + row.extra.user?.name,
|
href: '/@' + row.extra.user?.name,
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
text: true,
|
text: true,
|
||||||
type: 'info',
|
type: 'info',
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ async function getPointHistory() {
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
async function givePoint() {
|
async function givePoint() {
|
||||||
if (addPointCount.value <= 0) {
|
if (addPointCount.value == 0) {
|
||||||
message.error('积分数量必须大于0')
|
message.error('积分数量不能为 0')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
@@ -164,7 +164,7 @@ onMounted(async () => {
|
|||||||
<NDescriptionsItem v-if="user.info.userId > 0" label="UId">
|
<NDescriptionsItem v-if="user.info.userId > 0" label="UId">
|
||||||
{{ user.info.userId }}
|
{{ user.info.userId }}
|
||||||
</NDescriptionsItem>
|
</NDescriptionsItem>
|
||||||
<NDescriptionsItem v-else label="OpenId">
|
<NDescriptionsItem v-if="user.info.openId != '00000000-0000-0000-0000-000000000000'" label="OpenId">
|
||||||
{{ user.info.openId }}
|
{{ user.info.openId }}
|
||||||
</NDescriptionsItem>
|
</NDescriptionsItem>
|
||||||
<NDescriptionsItem label="积分">
|
<NDescriptionsItem label="积分">
|
||||||
@@ -176,7 +176,7 @@ onMounted(async () => {
|
|||||||
</NDescriptions>
|
</NDescriptions>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<NFlex>
|
<NFlex>
|
||||||
<NButton type="primary" @click="showAddPointModal = true" size="small"> 给予积分 </NButton>
|
<NButton type="primary" @click="showAddPointModal = true" size="small"> 给予/扣除积分 </NButton>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
</template>
|
</template>
|
||||||
</NCard>
|
</NCard>
|
||||||
@@ -192,17 +192,22 @@ onMounted(async () => {
|
|||||||
<PointHistoryCard :histories="pointHistory" />
|
<PointHistoryCard :histories="pointHistory" />
|
||||||
</NSpin>
|
</NSpin>
|
||||||
<NModal v-model:show="showAddPointModal" preset="card" style="width: 500px; max-width: 90vw; height: auto">
|
<NModal v-model:show="showAddPointModal" preset="card" style="width: 500px; max-width: 90vw; height: auto">
|
||||||
<template #header> 给予积分 </template>
|
<template #header> 给予/扣除积分 </template>
|
||||||
<NFlex vertical>
|
<NFlex vertical>
|
||||||
<NInputNumber
|
<NFlex align="center" :wrap="false">
|
||||||
v-model:value="addPointCount"
|
<NInputNumber v-model:value="addPointCount" type="number" placeholder="负数为扣除" style="max-width: 120px" />
|
||||||
type="number"
|
|
||||||
placeholder="请输入积分数量"
|
<NTooltip>
|
||||||
min="0"
|
<template #trigger>
|
||||||
style="max-width: 120px"
|
<NIcon :component="Info24Filled" />
|
||||||
/>
|
</template>
|
||||||
|
负数为扣除
|
||||||
|
</NTooltip>
|
||||||
|
</NFlex>
|
||||||
<NInput placeholder="请输入备注" v-model:value="addPointReason" :maxlength="100" show-count clearable />
|
<NInput placeholder="请输入备注" v-model:value="addPointReason" :maxlength="100" show-count clearable />
|
||||||
<NButton type="primary" @click="givePoint" :loading="isLoading"> 给予 </NButton>
|
<NButton type="primary" @click="givePoint" :loading="isLoading">
|
||||||
|
{{ addPointCount > 0 ? '给予' : '扣除' }}
|
||||||
|
</NButton>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
</NModal>
|
</NModal>
|
||||||
</NCard>
|
</NCard>
|
||||||
|
|||||||
@@ -159,8 +159,8 @@ async function refresh() {
|
|||||||
users.value = await getUsers()
|
users.value = await getUsers()
|
||||||
}
|
}
|
||||||
async function givePoint() {
|
async function givePoint() {
|
||||||
if (addPointCount.value <= 0) {
|
if (addPointCount.value == 0) {
|
||||||
message.error('积分数量必须大于0')
|
message.error('积分数量不能为 0')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!addPointTarget.value) {
|
if (!addPointTarget.value) {
|
||||||
@@ -208,7 +208,7 @@ onMounted(async () => {
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<NFlex>
|
<NFlex>
|
||||||
<NButton type="primary" @click="refresh">刷新</NButton>
|
<NButton type="primary" @click="refresh">刷新</NButton>
|
||||||
<NButton type="info" @click="showGivePointModal = true">给予积分</NButton>
|
<NButton type="info" @click="showGivePointModal = true">给予/扣除积分</NButton>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
</template>
|
</template>
|
||||||
<NFlex>
|
<NFlex>
|
||||||
@@ -238,10 +238,10 @@ onMounted(async () => {
|
|||||||
<PointUserDetailCard v-if="currentUser" :user="currentUser" :authInfo="currentUser.info" :goods="goods" />
|
<PointUserDetailCard v-if="currentUser" :user="currentUser" :authInfo="currentUser.info" :goods="goods" />
|
||||||
</NScrollbar>
|
</NScrollbar>
|
||||||
</NModal>
|
</NModal>
|
||||||
<NModal v-model:show="showGivePointModal" preset="card" style="max-width: 500px" title="给予积分">
|
<NModal v-model:show="showGivePointModal" preset="card" style="max-width: 500px" title="给予/扣除积分">
|
||||||
<NFlex vertical>
|
<NFlex vertical>
|
||||||
<NFlex :wrap="false" align="center">
|
<NFlex :wrap="false" align="center" :size="0">
|
||||||
<NInputGroup style="max-width: 200px">
|
<NInputGroup style="max-width: 300px">
|
||||||
<NInputGroupLabel> 目标用户 </NInputGroupLabel>
|
<NInputGroupLabel> 目标用户 </NInputGroupLabel>
|
||||||
<NInputNumber v-model:value="addPointTarget" type="number" placeholder="请输入目标用户UId" min="0" />
|
<NInputNumber v-model:value="addPointTarget" type="number" placeholder="请输入目标用户UId" min="0" />
|
||||||
</NInputGroup>
|
</NInputGroup>
|
||||||
@@ -250,20 +250,26 @@ onMounted(async () => {
|
|||||||
<NIcon :component="Info24Filled" />
|
<NIcon :component="Info24Filled" />
|
||||||
</template>
|
</template>
|
||||||
如果目标用户没在直播间发言过则无法显示用户名, 不过不影响使用
|
如果目标用户没在直播间发言过则无法显示用户名, 不过不影响使用
|
||||||
|
<br />
|
||||||
|
因为uid和b站提供的openid不兼容, 未认证用户可能会出现两个记录, 不过在认证完成后会合并成一个
|
||||||
|
</NTooltip>
|
||||||
|
</NFlex>
|
||||||
|
<NFlex :wrap="false" align="center" :size="5">
|
||||||
|
<NInputGroup style="max-width: 220px">
|
||||||
|
<NInputGroupLabel> 积分数量 </NInputGroupLabel>
|
||||||
|
<NInputNumber v-model:value="addPointCount" type="number" placeholder="输入要给予的积分" />
|
||||||
|
</NInputGroup>
|
||||||
|
<NTooltip>
|
||||||
|
<template #trigger>
|
||||||
|
<NIcon :component="Info24Filled" />
|
||||||
|
</template>
|
||||||
|
负数为扣除
|
||||||
</NTooltip>
|
</NTooltip>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
<NInputGroup>
|
|
||||||
<NInputGroupLabel> 积分数量 </NInputGroupLabel>
|
|
||||||
<NInputNumber
|
|
||||||
v-model:value="addPointCount"
|
|
||||||
type="number"
|
|
||||||
placeholder="请输入积分数量"
|
|
||||||
min="0"
|
|
||||||
style="max-width: 120px"
|
|
||||||
/>
|
|
||||||
</NInputGroup>
|
|
||||||
<NInput placeholder="(选填) 请输入备注" v-model:value="addPointReason" :maxlength="100" show-count clearable />
|
<NInput placeholder="(选填) 请输入备注" v-model:value="addPointReason" :maxlength="100" show-count clearable />
|
||||||
<NButton type="primary" @click="givePoint" :loading="isLoading"> 给予 </NButton>
|
<NButton type="primary" @click="givePoint" :loading="isLoading">
|
||||||
|
{{ addPointCount > 0 ? '给予' : '扣除' }}
|
||||||
|
</NButton>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
</NModal>
|
</NModal>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ const songs = computed(() => {
|
|||||||
})
|
})
|
||||||
.slice(0, index.value)
|
.slice(0, index.value)
|
||||||
}
|
}
|
||||||
|
return []
|
||||||
})
|
})
|
||||||
const onScroll = throttle((e: Event) => {
|
const onScroll = throttle((e: Event) => {
|
||||||
const container = e.target as HTMLDivElement
|
const container = e.target as HTMLDivElement
|
||||||
@@ -121,6 +122,7 @@ function loadMore() {
|
|||||||
<NSpace>
|
<NSpace>
|
||||||
<NButton
|
<NButton
|
||||||
v-for="tag in tags"
|
v-for="tag in tags"
|
||||||
|
:key="tag"
|
||||||
size="small"
|
size="small"
|
||||||
secondary
|
secondary
|
||||||
:type="selectedTag == tag ? 'primary' : 'default'"
|
:type="selectedTag == tag ? 'primary' : 'default'"
|
||||||
|
|||||||
Reference in New Issue
Block a user