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

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

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