|
|
@@ -10,40 +10,16 @@
|
|
|
<div v-if="itemObj.key == 2" style="height: 100%">
|
|
|
<handouts :itemObj="itemObj" :hourId="idsObj.hourId"></handouts>
|
|
|
</div>
|
|
|
+ <note v-if="itemObj.type == 2" :idsObj="idsObj" ref="noteRef" @edit="editForm"></note>
|
|
|
<div v-if="itemObj.key == 3" style="height: 100%">
|
|
|
<subtitleBox :url="itemObj.url" @videoSpeed="videoSpeed"></subtitleBox>
|
|
|
</div>
|
|
|
- <div v-if="itemObj.type == 2 || itemObj.type == 4">
|
|
|
- <a-card :bordered="false">
|
|
|
- <a-form ref="formRef" :model="formData" :rules="formRules" layout="vertical">
|
|
|
- <a-row :gutter="16">
|
|
|
- <a-col :span="24">
|
|
|
- <a-form-item name="noteContent" v-if="itemObj.type == 2">
|
|
|
- <a-textarea v-model:value="formData.noteContent" placeholder="请输入内容" :rows="4" />
|
|
|
- </a-form-item>
|
|
|
- <div v-if="itemObj.type == 4">
|
|
|
- <a-form-item name="info" label="问题">
|
|
|
- <a-textarea v-model:value="formData.info" placeholder="请输入问题" :rows="4" />
|
|
|
- </a-form-item>
|
|
|
- </div>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- </a-form>
|
|
|
- <div class="frc">
|
|
|
- <a-button type="primary" :loading="submitLoading" @click="onSubmit">保存</a-button>
|
|
|
- </div>
|
|
|
- <div class="noteBox">
|
|
|
- <note v-if="itemObj.type == 2" :idsObj="idsObj" ref="noteRef" @edit="editForm"></note>
|
|
|
- <askDiv v-if="itemObj.type == 4" :idsObj="idsObj" ref="noteRef" @edit="editForm"></askDiv>
|
|
|
- </div>
|
|
|
- </a-card>
|
|
|
- </div>
|
|
|
+ <askDiv v-if="itemObj.type == 4" :idsObj="idsObj" ref="noteRef" @edit="editForm"></askDiv>
|
|
|
</xn-form-container>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import classCentre from '@/api/student/classCentre'
|
|
|
- import { required } from '@/utils/formRules'
|
|
|
import note from './note.vue'
|
|
|
import askDiv from './ask.vue'
|
|
|
import handouts from './handouts.vue'
|
|
|
@@ -62,15 +38,12 @@
|
|
|
return props.rightItem
|
|
|
})
|
|
|
const noteRef = ref()
|
|
|
- const submitLoading = ref(false)
|
|
|
- // 表单数据,也就是默认给一些数据
|
|
|
- const formData = ref({})
|
|
|
- const formRef = ref()
|
|
|
+
|
|
|
//tabs
|
|
|
const activeKey = ref('1')
|
|
|
// 默认是关闭状态
|
|
|
const visible = ref(false)
|
|
|
- const emit = defineEmits({ successful: null, videoSpeed: null })
|
|
|
+ const emit = defineEmits({ videoSpeed: null })
|
|
|
// 打开抽屉
|
|
|
const onOpen = (edit) => {
|
|
|
visible.value = true
|
|
|
@@ -86,50 +59,8 @@
|
|
|
}
|
|
|
// 关闭抽屉
|
|
|
const onClose = () => {
|
|
|
- formRef.value?.resetFields()
|
|
|
- formData.value.id = null
|
|
|
- formData.value.noteId = null
|
|
|
visible.value = false
|
|
|
}
|
|
|
- // 默认要校验的
|
|
|
- const formRules = {
|
|
|
- noteContent: [required('请输入内容')],
|
|
|
- info: [required('请输入内容')]
|
|
|
- }
|
|
|
- // 提交数据
|
|
|
- const onSubmit = () => {
|
|
|
- formRef.value
|
|
|
- .validate()
|
|
|
- .then(() => {
|
|
|
- submitLoading.value = true
|
|
|
- classCentre[itemObj.value.type == 2 ? 'notesSubmitForm' : 'askSubmitForm'](
|
|
|
- {
|
|
|
- ...props.idsObj,
|
|
|
- ...formData.value
|
|
|
- },
|
|
|
- itemObj.value.type == 2 ? formData.value.noteId : formData.value.id
|
|
|
- ).then(() => {
|
|
|
- formData.value.noteId = ''
|
|
|
- formData.value.id = ''
|
|
|
- emit('successful')
|
|
|
- formRef.value.resetFields()
|
|
|
- noteRef.value.getList()
|
|
|
- })
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- submitLoading.value = false
|
|
|
- })
|
|
|
- }
|
|
|
- const editForm = (e) => {
|
|
|
- onOpen(e)
|
|
|
- if (itemObj.value.type == 2) {
|
|
|
- formData.value.noteId = e.noteId
|
|
|
- formData.value.noteContent = e.noteContent
|
|
|
- } else {
|
|
|
- formData.value.info = e.info
|
|
|
- formData.value.id = e.id
|
|
|
- }
|
|
|
- }
|
|
|
const videoSpeed = (e) => {
|
|
|
emit('videoSpeed', e)
|
|
|
}
|
|
|
@@ -143,18 +74,4 @@
|
|
|
onClose
|
|
|
})
|
|
|
</script>
|
|
|
-<style scoped lang="less">
|
|
|
- .frc {
|
|
|
- display: flex;
|
|
|
- justify-content: flex-end;
|
|
|
- align-items: center;
|
|
|
- }
|
|
|
- .noteBox {
|
|
|
- height: 750px;
|
|
|
- overflow-y: auto;
|
|
|
- }
|
|
|
- .subtitleBox {
|
|
|
- height: 100%;
|
|
|
- overflow-y: auto;
|
|
|
- }
|
|
|
-</style>
|
|
|
+<style scoped lang="less"></style>
|