From 83fec2617c5e5770b85b1f3048a43be843f47851 Mon Sep 17 00:00:00 2001 From: cbb <1055026847@qq.com> Date: Fri, 9 Jan 2026 17:46:57 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E8=A6=81=E6=B7=BB=E5=8A=A0=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E7=9B=B4=E6=92=AD=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live-stream/apply.vue | 15 +- .../live-stream/index.vue | 36 +++- api/tui-kit.js | 21 +++ components/nav-bar/nav-bar.vue | 11 +- pages/my-index/wallet/real-id.vue | 155 +++++++++++++----- 5 files changed, 191 insertions(+), 47 deletions(-) diff --git a/TUIKit/components/TUIChat/message-input-toolbar/live-stream/apply.vue b/TUIKit/components/TUIChat/message-input-toolbar/live-stream/apply.vue index c4ce112..e531117 100644 --- a/TUIKit/components/TUIChat/message-input-toolbar/live-stream/apply.vue +++ b/TUIKit/components/TUIChat/message-input-toolbar/live-stream/apply.vue @@ -1,10 +1,19 @@ - + diff --git a/TUIKit/components/TUIChat/message-input-toolbar/live-stream/index.vue b/TUIKit/components/TUIChat/message-input-toolbar/live-stream/index.vue index ed85732..01145dc 100644 --- a/TUIKit/components/TUIChat/message-input-toolbar/live-stream/index.vue +++ b/TUIKit/components/TUIChat/message-input-toolbar/live-stream/index.vue @@ -4,15 +4,43 @@ import ToolbarItemContainer from '../toolbar-item-container/index.vue' import { isUniFrameWork } from '../../../../utils/env' import { navigateTo } from '../../../../../utils/router' + import { getAnchorDetail } from '../../../../../api/tui-kit' + import { useUI } from '../../../../../utils/use-ui' + const { showDialog } = useUI() const evaluateIcon = custom const container = ref() - const onDialogShow = () => { - navigateTo( - '/TUIKit/components/TUIChat/message-input-toolbar/live-stream/apply' - ) + /** + * 主播申请状态 + * 0 待审核 1 审核通过 2 审核拒绝 3 已封禁 9 新增 + */ + const stateData = ref(0) + const onDialogShow = async () => { + const res = await getAnchorDetail() + if (res?.data) { + stateData.value = res.data.status + } else { + stateData.value = 9 + } + container?.value?.toggleDialogDisplay(false) + if ([0, 2, 9].includes(stateData.value)) { + navigateTo( + '/TUIKit/components/TUIChat/message-input-toolbar/live-stream/apply', + { type: stateData.value } + ) + + return + } + if (stateData.value === 1) { + console.log('去直播间') + return + } + if (stateData.value === 3) { + showDialog('提示', '您已被封禁,请联系管理员解封', false) + return + } } diff --git a/api/tui-kit.js b/api/tui-kit.js index 00dc0ef..9b6d643 100644 --- a/api/tui-kit.js +++ b/api/tui-kit.js @@ -59,3 +59,24 @@ export const receiveRedEnvelope = data => { }) } +/** + * 新增/修改主播 + * @param {*} data + * @param {*} method post 新增 put 修改 + * @returns + */ +export const addAnchor = (data, method = 'post') => { + return http({ + url: '/api/service/liveAnchor', + method, + data + }) +} + +/** 主播详情 */ +export const getAnchorDetail = () => { + return http({ + url: `/api/service/liveAnchor/details`, + method: 'get' + }) +} diff --git a/components/nav-bar/nav-bar.vue b/components/nav-bar/nav-bar.vue index bb9cb91..9893842 100644 --- a/components/nav-bar/nav-bar.vue +++ b/components/nav-bar/nav-bar.vue @@ -124,13 +124,18 @@ - - + > --> + + diff --git a/pages/my-index/wallet/real-id.vue b/pages/my-index/wallet/real-id.vue index da3e7e3..be3ea50 100644 --- a/pages/my-index/wallet/real-id.vue +++ b/pages/my-index/wallet/real-id.vue @@ -5,10 +5,28 @@ import { useUI } from '@/utils/use-ui' import { navigateBack } from '@/utils/router' import { getUserIdCard, addUserIdCard } from '@/api/my-index' - import { validateIdCard } from '@/utils/validate' + import { validateIdCard, validatePhone } from '@/utils/validate' + import { addAnchor, getAnchorDetail } from '@/api/tui-kit' const { showToast } = useUI() + const props = defineProps({ + // 主播申请模式 + isLiveStream: { + type: Boolean, + default: false + } + }) + + /** + * 主播申请状态 + * 0 待审核 1 审核通过 2 审核拒绝 3 已封禁 9 新增 + */ + const stateLiveAnchor = defineModel({ + type: Number, + default: 9 + }) + const loading = ref(true) /** 身份证状态:0 新增 1 等待审核 2 编辑 3 不可以修改和新增 */ const stateData = ref(0) @@ -23,6 +41,8 @@ realName: '', // 身份证号码 idCard: '', + // 联系电话 + phone: '', frontList: [], backList: [] }) @@ -72,10 +92,40 @@ realName: formData.realName, idCardNumber: formData.idCard } - await addUserIdCard(data, stateData.value === 0 ? 'post' : 'put') - await showToast(`添加成功`, 'success') - navigateBack() + + if (props.isLiveStream) { + await getData() + await showToast(`添加成功`, 'success') + } else { + await showToast(`添加成功`, 'success') + navigateBack() + } + } + + /** 主播申请 */ + const onAddStreamer = async () => { + const phoneData = validatePhone(formData.phone) + if (!phoneData.valid) { + showToast(phoneData.message) + return + } + + const id = await getAnchorDetail() + + const data = { + id: id.data.id, + idCardFront: formData.front, + idCardBack: formData.back, + realName: formData.realName, + idCard: formData.idCard, + phone: formData.phone + } + const res = await addAnchor( + data, + stateLiveAnchor.value === 9 ? 'post' : 'put' + ) + stateLiveAnchor.value = res.data.status } onLoad(() => { @@ -86,47 +136,78 @@