Merge pull request 'edit' (#71) from lyc-dev into main
This commit is contained in:
commit
fae380f9c6
|
@ -16,6 +16,7 @@
|
|||
|
||||
<script setup>
|
||||
import { ref, onMounted, nextTick } from 'vue'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import PDF from '@/components/PdfJs/index.vue'
|
||||
import LeftDialog from './left-dialog.vue'
|
||||
|
||||
|
@ -31,8 +32,8 @@ const onClick = () => {
|
|||
const pdfUrl = ref('')
|
||||
onMounted(async () => {
|
||||
await nextTick()
|
||||
const { fileurl } = props.curNode
|
||||
pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + fileurl.replace('.txt', '.pdf')
|
||||
let data = sessionStore.get('subject.curBook')
|
||||
pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + data.fileurl.replace('.txt', '.pdf')
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -82,9 +82,10 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, computed, onUnmounted } from 'vue'
|
||||
import { ref, reactive, onMounted, watch, onUnmounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { tempSave, completion, modelList, removeChildTemp, tempResult } from '@/api/mode/index'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import keywordDialog from './keyword-dialog.vue';
|
||||
import AdjustDialog from './adjust-dialog.vue'
|
||||
import EditDialog from './edit-dialog.vue'
|
||||
|
@ -187,7 +188,7 @@ const changeTemplate = (val) => {
|
|||
const removeItem = async (item, isChild) => {
|
||||
/**
|
||||
* item: 当前操作的模板
|
||||
* isChild: 子模板中的移除为 true 否则为false
|
||||
* isChild: 子模板中的移除为 true
|
||||
*/
|
||||
if (item.ex3 != '1') {
|
||||
ElMessageBox.confirm(
|
||||
|
@ -213,15 +214,11 @@ const removeItem = async (item, isChild) => {
|
|||
})
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
editKeyWord(item,!isChild)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Ai对话调整
|
||||
const curIndex = ref(-1)
|
||||
const isAdjust = ref(false)
|
||||
|
@ -240,11 +237,21 @@ const onEdit = (index, item) => {
|
|||
}
|
||||
|
||||
|
||||
const modeType = computed(() => {
|
||||
if (props.type == 1) return '课标';
|
||||
if (props.type == 2) return '教材';
|
||||
if (props.type == 3) return '考试';
|
||||
})
|
||||
const modeType = ref('课标')
|
||||
watch(() => props.type, (newVal) => {
|
||||
if (newVal == 1){
|
||||
modeType.value = '课标'
|
||||
}
|
||||
if (newVal == 2){
|
||||
modeType.value = '教材'
|
||||
}
|
||||
if (newVal == 2){
|
||||
modeType.value = '考试'
|
||||
}
|
||||
|
||||
}, { immediate: false })
|
||||
|
||||
|
||||
// 重新研读
|
||||
const params = reactive(
|
||||
{
|
||||
|
@ -256,7 +263,7 @@ const params = reactive(
|
|||
const againResult = async (index, item) => {
|
||||
try {
|
||||
childTempList.value[index].loading = true
|
||||
params.prompt = `按照${item.name}的要求,针对${props.curNode.edustage}${props.curNode.edusubject}${modeType} 对${props.curNode.itemtitle}进行教学分析`
|
||||
params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
||||
const { data } = await completion(params)
|
||||
let answer = data.answer
|
||||
childTempList.value[index].oldAnswer = answer
|
||||
|
@ -271,7 +278,7 @@ const getCompletion = async () => {
|
|||
for (let item of childTempList.value) {
|
||||
try {
|
||||
item.loading = true
|
||||
params.prompt = `按照${item.name}的要求,针对${props.curNode.edustage}${props.curNode.edusubject}${modeType} 对${props.curNode.itemtitle}进行教学分析`
|
||||
params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
||||
const { data } = await completion(params)
|
||||
let answer = data.answer
|
||||
item.oldAnswer = answer
|
||||
|
@ -286,7 +293,7 @@ const getCompletion = async () => {
|
|||
// 保存模板
|
||||
const onSaveTemp = (item) => {
|
||||
const data = {
|
||||
mainModelId: props.tempId,
|
||||
mainModelId: curTemplate.id,
|
||||
modelId: item.id,
|
||||
examDocld: '',
|
||||
content: item.oldAnswer
|
||||
|
@ -324,10 +331,12 @@ emitter.on('onGetMain', () => {
|
|||
})
|
||||
|
||||
|
||||
|
||||
const curNode = reactive({})
|
||||
onMounted(() => {
|
||||
getTemplateList()
|
||||
let jsonKey = `${modeType}-${props.curNode.edustage}-${props.curNode.edusubject}`
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, data);
|
||||
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
||||
params.dataset_id = dataSetJson[jsonKey]
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue