需要添加视频直播测试

This commit is contained in:
cbb
2026-01-09 17:46:57 +08:00
parent 2e5a72c25e
commit 83fec2617c
5 changed files with 191 additions and 47 deletions

View File

@@ -1,10 +1,19 @@
<script setup></script> <script setup>
import realId from '../../../../../pages/my-index/wallet/real-id'
import { onLoad } from '@dcloudio/uni-app'
import { ref } from '../../../../adapter-vue'
const stateData = ref(0)
onLoad(e => {
stateData.value = Number(e?.type)
})
</script>
<template> <template>
<view> <view>
<nav-bar isTopBg isPlaceholder title="申请主播"></nav-bar> <nav-bar isTopBg isPlaceholder title="申请主播"></nav-bar>
申请直播TUIKit\components\TUIChat\message-input-toolbar\live-stream\apply.vue <realId v-model="stateData" isLiveStream></realId>
<view class="apply-box"></view>
</view> </view>
</template> </template>

View File

@@ -4,15 +4,43 @@
import ToolbarItemContainer from '../toolbar-item-container/index.vue' import ToolbarItemContainer from '../toolbar-item-container/index.vue'
import { isUniFrameWork } from '../../../../utils/env' import { isUniFrameWork } from '../../../../utils/env'
import { navigateTo } from '../../../../../utils/router' import { navigateTo } from '../../../../../utils/router'
import { getAnchorDetail } from '../../../../../api/tui-kit'
import { useUI } from '../../../../../utils/use-ui'
const { showDialog } = useUI()
const evaluateIcon = custom const evaluateIcon = custom
const container = ref() 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) 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
}
} }
</script> </script>

View File

@@ -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'
})
}

View File

@@ -124,13 +124,18 @@
<view class="nav-bar-box"> <view class="nav-bar-box">
<!-- 左侧插槽 --> <!-- 左侧插槽 -->
<view @click="props.showBack && onBack()"> <view @click="props.showBack && onBack()">
<!-- --> <!-- <image
<image
v-if="props.showBack && !hasBackSlot" v-if="props.showBack && !hasBackSlot"
src="/static/images/login/back.png" src="/static/images/login/back.png"
mode="heightFix" mode="heightFix"
class="top_left-icon" class="top_left-icon"
></image> ></image> -->
<uni-icons
v-if="props.showBack && !hasBackSlot"
type="back"
size="42rpx"
></uni-icons>
<slot name="back"></slot> <slot name="back"></slot>
</view> </view>

View File

@@ -5,10 +5,28 @@
import { useUI } from '@/utils/use-ui' import { useUI } from '@/utils/use-ui'
import { navigateBack } from '@/utils/router' import { navigateBack } from '@/utils/router'
import { getUserIdCard, addUserIdCard } from '@/api/my-index' 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 { 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) const loading = ref(true)
/** 身份证状态0 新增 1 等待审核 2 编辑 3 不可以修改和新增 */ /** 身份证状态0 新增 1 等待审核 2 编辑 3 不可以修改和新增 */
const stateData = ref(0) const stateData = ref(0)
@@ -23,6 +41,8 @@
realName: '', realName: '',
// 身份证号码 // 身份证号码
idCard: '', idCard: '',
// 联系电话
phone: '',
frontList: [], frontList: [],
backList: [] backList: []
}) })
@@ -72,10 +92,40 @@
realName: formData.realName, realName: formData.realName,
idCardNumber: formData.idCard idCardNumber: formData.idCard
} }
await addUserIdCard(data, stateData.value === 0 ? 'post' : 'put') 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(() => { onLoad(() => {
@@ -86,47 +136,78 @@
<template> <template>
<view v-if="!loading" class="real-id"> <view v-if="!loading" class="real-id">
<view v-if="[0, 2, 3].includes(stateData)"> <view v-if="[0, 2, 3].includes(stateData)">
<!-- 说明 --> <!-- 主播申请输入 -->
<text class="top-text">*为保证您的账户安全,请先完成实名认证</text> <view
<CardInput :is-input="false" title="收款码"> v-if="props?.isLiveStream && [9, 2].includes(stateLiveAnchor)"
<view class="qrcode-box"> >
<cb-file-picker <text v-if="stateLiveAnchor === 9" class="top-text">
v-model="formData.front" *添加手机号审核
v-model:list="formData.frontList" </text>
:readonly="stateData === 3" <text v-else class="top-text">*信息填写有误</text>
isFront <CardInput
></cb-file-picker> v-model="formData.phone"
<cb-file-picker title="联系电话"
v-model="formData.back" placeholder="请输入联系电话"
v-model:list="formData.backList" ></CardInput>
:readonly="stateData === 3" </view>
isBack <view v-if="!props?.isLiveStream && [0, 2, 3].includes(stateData)">
></cb-file-picker> <!-- 实名认证输入 -->
</view> <!-- 说明 -->
</CardInput> <text v-if="stateData === 2" class="top-text">
*审核未通过请重新上传
</text>
<text v-else-if="stateData === 0" class="top-text">
*为保证您的账户安全,请先完成实名认证
</text>
<text v-else class="top-text">*您已完成实名认证</text>
<CardInput :is-input="false" title="证件">
<view class="qrcode-box">
<cb-file-picker
v-model="formData.front"
v-model:list="formData.frontList"
:readonly="stateData === 3"
isFront
></cb-file-picker>
<cb-file-picker
v-model="formData.back"
v-model:list="formData.backList"
:readonly="stateData === 3"
isBack
></cb-file-picker>
</view>
</CardInput>
<CardInput <CardInput
v-model="formData.realName" v-model="formData.realName"
title="姓名" title="姓名"
placeholder="请输入姓名" placeholder="请输入姓名"
:disabled="stateData === 3" :disabled="stateData === 3"
></CardInput> ></CardInput>
<CardInput <CardInput
v-model="formData.idCard" v-model="formData.idCard"
title="身份证号" title="身份证号"
placeholder="请输入身份证号" placeholder="请输入身份证号"
:disabled="stateData === 3" :disabled="stateData === 3"
></CardInput> ></CardInput>
</view>
<!-- 底部按钮 --> <!-- 底部按钮 v-if="props?.isLiveStream && stateData === 3" -->
<bottom-view
v-if="
props?.isLiveStream &&
stateData === 3 &&
[9, 2].includes(stateLiveAnchor)
"
>
<cb-button @click="onAddStreamer">确认</cb-button>
</bottom-view>
<bottom-view v-if="stateData !== 3"> <bottom-view v-if="stateData !== 3">
<cb-button @click="onAddCode"> <cb-button @click="onAddCode">
确认{{ formData.id ? '修改' : '添加' }} 确认{{ formData.id ? '修改' : '添加' }}
</cb-button> </cb-button>
</bottom-view> </bottom-view>
</view> </view>
<view v-else class="wait-view"> <view v-if="stateData == 1 || stateLiveAnchor == 0" class="wait-view">
<image <image
src="/static/images/my-index/date-icon.png" src="/static/images/my-index/date-icon.png"
mode="heightFix" mode="heightFix"