提交 8f51e42e authored 作者: matian's avatar matian

updates:修改直播弹框数据回显问题

上级 c54e9af7
......@@ -4,7 +4,6 @@ import { useQuestionList } from '@/composables/useQuestionList'
const appList = ref()
let { list: selectTree } = useQuestionList()
const tabValue = ref('1')
const multipleSelection: any = ref([])
const emit = defineEmits<Emits>()
const props = defineProps({
......
......@@ -17,11 +17,12 @@ interface IliveList {
let liveList = ref<IliveList[]>([])
// 封面状态
const form = reactive({
name: ''
let form = reactive({
name: '',
resource_id: ''
})
const rules = reactive<FormRules>({
name: [{ required: true, message: '请输入直播名称', trigger: 'change' }]
name: [{ required: true, message: '请输入章节名称', trigger: 'change' }]
})
const props = defineProps({
isShowLiveDialog: {
......@@ -60,21 +61,18 @@ const handleConfirm = () => {
{
course_id: props.course_id,
resource_type: props.btnInfo.resource_type,
parent_id: props.chapterID,
resource_id: lecturerValue.value
parent_id: props.chapterID
},
form
)
console.log(lecturerValue.value, 'lecturerValue')
createCharacter(params).then(() => {
emit('update:isShowLiveDialog', false)
emit('create')
})
}
const loading = ref(false)
// 直播选中的值
const lecturerValue = ref([])
// const lecturerValue = ref('')
// 所有被搜索出来的值
const allLecturers: any = ref([])
......@@ -95,19 +93,29 @@ const handleLiveList = (query: string) => {
liveList.value = []
}
}
const changeLive = (val: any) => {
if (val !== '') {
form.name = allLecturers.value?.filter((item: any) => item.id === val)[0].subject
} else {
form.name = ''
}
}
</script>
<template>
<el-dialog :model-value="isShowLiveDialog" draggable :before-close="handleCancel" width="30%" title="添加直播">
<el-form :model="form" :rules="rules" ref="ruleFormRef" label-width="120px">
<el-form-item props="lecturerValue" label="直播名称:">
{{ form.resource_id }}
<el-form-item props="form.resource_id" label="直播名称:">
<el-select
v-model="lecturerValue"
v-model="form.resource_id"
clearable
filterable
remote
reserve-keyword
placeholder="请输入直播名称"
placeholder="请输入直播名称或者直播id"
:remote-method="handleLiveList"
:loading="loading"
style="width: 200px"
@change="changeLive"
>
<el-option v-for="item in liveList" :key="item.id" :label="item.subject" :value="item.id" />
</el-select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论