需要添加视频直播测试
This commit is contained in:
@@ -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>
|
||||
<view>
|
||||
<nav-bar isTopBg isPlaceholder title="申请主播"></nav-bar>
|
||||
申请直播TUIKit\components\TUIChat\message-input-toolbar\live-stream\apply.vue
|
||||
<view class="apply-box"></view>
|
||||
<realId v-model="stateData" isLiveStream></realId>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -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'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -124,13 +124,18 @@
|
||||
<view class="nav-bar-box">
|
||||
<!-- 左侧插槽 -->
|
||||
<view @click="props.showBack && onBack()">
|
||||
<!-- -->
|
||||
<image
|
||||
<!-- <image
|
||||
v-if="props.showBack && !hasBackSlot"
|
||||
src="/static/images/login/back.png"
|
||||
mode="heightFix"
|
||||
class="top_left-icon"
|
||||
></image>
|
||||
></image> -->
|
||||
<uni-icons
|
||||
v-if="props.showBack && !hasBackSlot"
|
||||
type="back"
|
||||
size="42rpx"
|
||||
></uni-icons>
|
||||
|
||||
<slot name="back"></slot>
|
||||
</view>
|
||||
|
||||
|
||||
@@ -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 @@
|
||||
<template>
|
||||
<view v-if="!loading" class="real-id">
|
||||
<view v-if="[0, 2, 3].includes(stateData)">
|
||||
<!-- 说明 -->
|
||||
<text 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>
|
||||
<!-- 主播申请输入 -->
|
||||
<view
|
||||
v-if="props?.isLiveStream && [9, 2].includes(stateLiveAnchor)"
|
||||
>
|
||||
<text v-if="stateLiveAnchor === 9" class="top-text">
|
||||
*添加手机号审核
|
||||
</text>
|
||||
<text v-else class="top-text">*信息填写有误</text>
|
||||
<CardInput
|
||||
v-model="formData.phone"
|
||||
title="联系电话"
|
||||
placeholder="请输入联系电话"
|
||||
></CardInput>
|
||||
</view>
|
||||
<view v-if="!props?.isLiveStream && [0, 2, 3].includes(stateData)">
|
||||
<!-- 实名认证输入 -->
|
||||
<!-- 说明 -->
|
||||
<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
|
||||
v-model="formData.realName"
|
||||
title="姓名"
|
||||
placeholder="请输入姓名"
|
||||
:disabled="stateData === 3"
|
||||
></CardInput>
|
||||
<CardInput
|
||||
v-model="formData.realName"
|
||||
title="姓名"
|
||||
placeholder="请输入姓名"
|
||||
:disabled="stateData === 3"
|
||||
></CardInput>
|
||||
|
||||
<CardInput
|
||||
v-model="formData.idCard"
|
||||
title="身份证号"
|
||||
placeholder="请输入身份证号"
|
||||
:disabled="stateData === 3"
|
||||
></CardInput>
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<CardInput
|
||||
v-model="formData.idCard"
|
||||
title="身份证号"
|
||||
placeholder="请输入身份证号"
|
||||
:disabled="stateData === 3"
|
||||
></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">
|
||||
<cb-button @click="onAddCode">
|
||||
确认{{ formData.id ? '修改' : '添加' }}
|
||||
</cb-button>
|
||||
</bottom-view>
|
||||
</view>
|
||||
<view v-else class="wait-view">
|
||||
<view v-if="stateData == 1 || stateLiveAnchor == 0" class="wait-view">
|
||||
<image
|
||||
src="/static/images/my-index/date-icon.png"
|
||||
mode="heightFix"
|
||||
|
||||
Reference in New Issue
Block a user