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