|
@@ -99,6 +99,25 @@
|
|
|
<template #last_login_type="{ record }">
|
|
<template #last_login_type="{ record }">
|
|
|
<span>{{ formatLastLoginType(record.last_login_type) }}</span>
|
|
<span>{{ formatLastLoginType(record.last_login_type) }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+ <template #send_count_auto_approve="{ record }">
|
|
|
|
|
+ <a-switch
|
|
|
|
|
+ :model-value="isSendCountAutoApprove(record)"
|
|
|
|
|
+ :loading="whitelistLoadingUuid === record.uuid"
|
|
|
|
|
+ @change="(checked) => onSendCountAutoApproveChange(record, checked)"
|
|
|
|
|
+ />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #is_banned_status="{ record }">
|
|
|
|
|
+ <a-tag v-if="isBanned(record)" color="red">已封禁</a-tag>
|
|
|
|
|
+ <a-tag v-else color="green">正常</a-tag>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #is_banned="{ record }">
|
|
|
|
|
+ <a-switch
|
|
|
|
|
+ :model-value="isBanned(record)"
|
|
|
|
|
+ :loading="banLoadingUuid === record.uuid"
|
|
|
|
|
+ checked-color="rgb(var(--red-6))"
|
|
|
|
|
+ @change="(checked) => onBanChange(record, checked)"
|
|
|
|
|
+ />
|
|
|
|
|
+ </template>
|
|
|
<template #optional="{ record }">
|
|
<template #optional="{ record }">
|
|
|
<a-button @click="changeCount(record)">更改次数</a-button>
|
|
<a-button @click="changeCount(record)">更改次数</a-button>
|
|
|
</template>
|
|
</template>
|
|
@@ -125,8 +144,8 @@
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { ref, reactive, onMounted } from 'vue'
|
|
import { ref, reactive, onMounted } from 'vue'
|
|
|
-import { adminGetUserList, adminChangeLepaoCount } from '@/api/user'
|
|
|
|
|
-import { Notification, Message } from '@arco-design/web-vue'
|
|
|
|
|
|
|
+import { adminGetUserList, adminChangeLepaoCount, adminSetSendCountAutoApprove, adminSetUserBan } from '@/api/user'
|
|
|
|
|
+import { Notification, Message, Modal } from '@arco-design/web-vue'
|
|
|
|
|
|
|
|
const visible = ref(false)
|
|
const visible = ref(false)
|
|
|
const ok_loading = ref(false)
|
|
const ok_loading = ref(false)
|
|
@@ -151,6 +170,81 @@ const pagination = reactive({
|
|
|
|
|
|
|
|
const loading = ref(false)
|
|
const loading = ref(false)
|
|
|
const data = ref([])
|
|
const data = ref([])
|
|
|
|
|
+const whitelistLoadingUuid = ref('')
|
|
|
|
|
+const banLoadingUuid = ref('')
|
|
|
|
|
+
|
|
|
|
|
+const isSendCountAutoApprove = (record) => Number(record?.send_count_auto_approve) === 1
|
|
|
|
|
+const isBanned = (record) => Number(record?.is_banned) === 1
|
|
|
|
|
+
|
|
|
|
|
+const onSendCountAutoApproveChange = async (record, checked) => {
|
|
|
|
|
+ if (!record?.uuid || whitelistLoadingUuid.value) return
|
|
|
|
|
+ const next = checked === true ? 1 : 0
|
|
|
|
|
+ whitelistLoadingUuid.value = record.uuid
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await adminSetSendCountAutoApprove({
|
|
|
|
|
+ userid: record.uuid,
|
|
|
|
|
+ send_count_auto_approve: next
|
|
|
|
|
+ })
|
|
|
|
|
+ if (!res || res.code !== 0) {
|
|
|
|
|
+ Notification.error({
|
|
|
|
|
+ title: '保存失败',
|
|
|
|
|
+ content: res?.msg ?? '请稍后再试'
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ record.send_count_auto_approve = next
|
|
|
|
|
+ Message.success(next ? '已加入赠送免审白名单' : '已关闭赠送免审')
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ Notification.error({
|
|
|
|
|
+ title: '保存失败',
|
|
|
|
|
+ content: error.message || '请稍后再试'
|
|
|
|
|
+ })
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ whitelistLoadingUuid.value = ''
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const setUserBan = async (record, next) => {
|
|
|
|
|
+ banLoadingUuid.value = record.uuid
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await adminSetUserBan({
|
|
|
|
|
+ userid: record.uuid,
|
|
|
|
|
+ is_banned: next
|
|
|
|
|
+ })
|
|
|
|
|
+ if (!res || res.code !== 0) {
|
|
|
|
|
+ Notification.error({
|
|
|
|
|
+ title: '操作失败',
|
|
|
|
|
+ content: res?.msg ?? '请稍后再试'
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ record.is_banned = next
|
|
|
|
|
+ Message.success(next ? '已封禁该用户' : '已解除封禁')
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ Notification.error({
|
|
|
|
|
+ title: '操作失败',
|
|
|
|
|
+ content: error.message || '请稍后再试'
|
|
|
|
|
+ })
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ banLoadingUuid.value = ''
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const onBanChange = async (record, checked) => {
|
|
|
|
|
+ if (!record?.uuid || banLoadingUuid.value) return
|
|
|
|
|
+ const next = checked === true ? 1 : 0
|
|
|
|
|
+ if (next === 1) {
|
|
|
|
|
+ Modal.confirm({
|
|
|
|
|
+ title: '确认封禁',
|
|
|
|
|
+ content: `确定封禁用户「${record.username || record.uuid}」?封禁后该用户将立即下线且无法登录。`,
|
|
|
|
|
+ onOk: async () => {
|
|
|
|
|
+ await setUserBan(record, next)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ await setUserBan(record, 0)
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
const columns = [
|
|
const columns = [
|
|
|
|
|
|
|
@@ -193,6 +287,18 @@ const columns = [
|
|
|
title: '剩余乐跑次数',
|
|
title: '剩余乐跑次数',
|
|
|
dataIndex: 'lepao_count',
|
|
dataIndex: 'lepao_count',
|
|
|
width: 120,
|
|
width: 120,
|
|
|
|
|
+ }, {
|
|
|
|
|
+ title: '赠送免审',
|
|
|
|
|
+ slotName: 'send_count_auto_approve',
|
|
|
|
|
+ width: 110,
|
|
|
|
|
+ }, {
|
|
|
|
|
+ title: '账号状态',
|
|
|
|
|
+ slotName: 'is_banned_status',
|
|
|
|
|
+ width: 100,
|
|
|
|
|
+ }, {
|
|
|
|
|
+ title: '封禁',
|
|
|
|
|
+ slotName: 'is_banned',
|
|
|
|
|
+ width: 80,
|
|
|
}, {
|
|
}, {
|
|
|
title: '操作',
|
|
title: '操作',
|
|
|
slotName: 'optional',
|
|
slotName: 'optional',
|