edit 框架设计
This commit is contained in:
parent
38e17585f2
commit
96e71ff45e
|
@ -83,10 +83,10 @@ emitter.on('selected', (data) => {
|
||||||
// 回显大纲
|
// 回显大纲
|
||||||
const curItem = reactive({})
|
const curItem = reactive({})
|
||||||
emitter.on('onShow', (data) => {
|
emitter.on('onShow', (data) => {
|
||||||
|
|
||||||
let outline = JSON.parse(data.outline)
|
let outline = cloneDeep(JSON.parse(data.outline))
|
||||||
markeDownAnswer.value = outline.markdown
|
markeDownAnswer.value = outline.markdown
|
||||||
emitter.emit('onResult',data)
|
emitter.emit('onResult', cloneDeep(data))
|
||||||
Object.assign(curItem, data)
|
Object.assign(curItem, data)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -138,10 +138,12 @@ const createAi = async () => {
|
||||||
markeDownAnswer.value = data.answer
|
markeDownAnswer.value = data.answer
|
||||||
const res = await createOutlineV2({ query: data.answer })
|
const res = await createOutlineV2({ query: data.answer })
|
||||||
|
|
||||||
curItem.outline = JSON.stringify({
|
let outline = JSON.stringify({
|
||||||
json: res.outline,
|
json: res.outline,
|
||||||
markdown: data.answer
|
markdown: data.answer
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Object.assign(curItem, {...curItem, outline})
|
||||||
emitter.emit('onResult', curItem)
|
emitter.emit('onResult', curItem)
|
||||||
onSaveTemp()
|
onSaveTemp()
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -207,10 +209,12 @@ const onSaveTemp = async () => {
|
||||||
createUserName: user.nickName
|
createUserName: user.nickName
|
||||||
}
|
}
|
||||||
await addSyllabus(data)
|
await addSyllabus(data)
|
||||||
|
emitter.emit('getLastInfo')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除大纲
|
// 删除大纲
|
||||||
const delAnswer = () => {
|
const delAnswer = () => {
|
||||||
|
if(!curItem.id) return
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm(
|
||||||
'确定要删除大纲吗?',
|
'确定要删除大纲吗?',
|
||||||
'温馨提示',
|
'温馨提示',
|
||||||
|
@ -223,8 +227,11 @@ const delAnswer = () => {
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await removeSyllabus(curItem.id)
|
await removeSyllabus(curItem.id)
|
||||||
ElMessage.success('操作成功')
|
ElMessage.success('操作成功')
|
||||||
answer.value = ''
|
markeDownAnswer.value = ''
|
||||||
|
|
||||||
emitter.emit('resetSelect')
|
emitter.emit('resetSelect')
|
||||||
|
|
||||||
|
// window.location.reload();
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,10 @@ const resetSelect = () => {
|
||||||
|
|
||||||
emitter.on('resetSelect', () => {
|
emitter.on('resetSelect', () => {
|
||||||
resetSelect()
|
resetSelect()
|
||||||
|
getSyllabus()
|
||||||
|
})
|
||||||
|
emitter.on('getLastInfo',() =>{
|
||||||
|
getSyllabus()
|
||||||
})
|
})
|
||||||
|
|
||||||
// 点击教学模式
|
// 点击教学模式
|
||||||
|
|
Loading…
Reference in New Issue