需要添加视频直播测试
This commit is contained in:
@@ -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