Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
3b67c34ccb
|
@ -158,11 +158,13 @@ export class PPTApi {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 更新幻灯片
|
// 更新幻灯片 isThum 是否更新缩略图
|
||||||
static updateSlide(data: object): Promise<Boolean> {
|
static updateSlide(data: object, isThum = true): Promise<Boolean> {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
|
if (isThum) { // 更新缩略图
|
||||||
const thumUrl = await this.getSlideThumUrl()
|
const thumUrl = await this.getSlideThumUrl()
|
||||||
data.base64Code = thumUrl // 更新缩略图
|
data.base64Code = thumUrl // 更新缩略图
|
||||||
|
}
|
||||||
const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data)
|
const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data)
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
resolve(true)
|
resolve(true)
|
||||||
|
@ -222,7 +224,6 @@ export class PPTApi {
|
||||||
// const workIds = res?.data?.activityContent||''
|
// const workIds = res?.data?.activityContent||''
|
||||||
// workItem-获取作业id
|
// workItem-获取作业id
|
||||||
const workIds = workItem.find(o => o.id == slideId)?.activityContent
|
const workIds = workItem.find(o => o.id == slideId)?.activityContent
|
||||||
console.log('更新-活动列表', workItem, currentSlide, slideId, workIds)
|
|
||||||
if (!workIds) return resolveData(resolve)
|
if (!workIds) return resolveData(resolve)
|
||||||
// 获取作业列表
|
// 获取作业列表
|
||||||
const resW = await API_classwork.homeworklist({ ids: workIds, pageSize: 1000 })
|
const resW = await API_classwork.homeworklist({ ids: workIds, pageSize: 1000 })
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<el-tooltip :content="item.uniquekey" placement="top">
|
<el-tooltip :content="item.uniquekey" placement="top">
|
||||||
<div class="tt">{{item.uniquekey}}</div>
|
<div class="tt">{{item.uniquekey}}</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-button class="btn-del" type="danger" link @click="handleRemoveDemoActivityClassWork(item)">删除</el-button>
|
<el-button class="btn-del" type="danger" link @click="removeWork(item, index)">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -94,7 +94,6 @@ import {useSlidesStore} from '../../../../../store'
|
||||||
import { updateEntpcoursefileNew } from '@/api/education/entpcoursefile'
|
import { updateEntpcoursefileNew } from '@/api/education/entpcoursefile'
|
||||||
const slidesStore = useSlidesStore()
|
const slidesStore = useSlidesStore()
|
||||||
const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore)
|
const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore)
|
||||||
console.log('slidesStore',slidesStore.workList)
|
|
||||||
interface CourseNode {
|
interface CourseNode {
|
||||||
rootid: number;
|
rootid: number;
|
||||||
parentNode: { id: number };
|
parentNode: { id: number };
|
||||||
|
@ -174,61 +173,25 @@ const type = ref<WorkType[]>([
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
const objItem = ref<any>({})
|
|
||||||
// 作业列表
|
|
||||||
const workList = ref<WorkItem[]>([])
|
|
||||||
|
|
||||||
// 获取所选择的作业列表
|
// 获取所选择的作业列表
|
||||||
const selectedWorkList = ref<WorkItem[]>([])
|
const selectedWorkList = ref<WorkItem[]>([])
|
||||||
// 活动页面的loading框
|
// 活动页面的loading框
|
||||||
const loadingActive = ref<boolean>(false)
|
const loadingActive = ref<boolean>(false)
|
||||||
|
|
||||||
|
// 选择活动列表
|
||||||
const paramData = ref<{ id: number, activityContent: string }>({} as { id: number, activityContent: string })
|
|
||||||
|
|
||||||
const selectable = (row: WorkItem, index: number): boolean => {
|
const selectable = (row: WorkItem, index: number): boolean => {
|
||||||
return row.status === '10';
|
return row.status === '10';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 删除作业
|
||||||
const formatClassWorkFile = async (postData: WorkItem[]): Promise<void> => {
|
const removeWork = (item: WorkItem, index: number) => {
|
||||||
for (let i = 0; i < postData.length; i++) {
|
|
||||||
let item = postData[i];
|
|
||||||
switch (item.worktype) {
|
|
||||||
case '框架梳理': {
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case '习题训练': {
|
|
||||||
// let workIds = item.quizlist!.map(items => items.id).join(',');
|
|
||||||
// let ress = await listEntpcoursework({ ids: workIds });
|
|
||||||
// const arr = ress.rows.map((item:{id:number}) => {
|
|
||||||
// return item.id
|
|
||||||
// })
|
|
||||||
|
|
||||||
// processList(ress.rows);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case '课堂展示': {
|
|
||||||
// item.base64 = JSON.parse(item.workcodes).base64;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case '常规作业': {
|
|
||||||
// item.prevData = JSON.parse(item.workcodes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
workList.value.push(item)
|
|
||||||
loadingActive.value = false
|
|
||||||
}
|
|
||||||
await nextTick();
|
|
||||||
}// 删除作业
|
|
||||||
const handleRemoveDemoActivityClassWork = (item: WorkItem) => {
|
|
||||||
ElMessageBox.confirm('是否确认删除?')
|
ElMessageBox.confirm('是否确认删除?')
|
||||||
.then(() => {
|
.then(async() => {
|
||||||
workList.value = []
|
// 从workList中删除
|
||||||
const arr = paramData.value.activityContent.split(',')
|
// slidesStore.workList.splice(index, 1)
|
||||||
const filterArr = arr.filter(itemId => itemId!== item.id.toString())
|
console.log('删除作业', item)
|
||||||
paramData.value.activityContent = filterArr.join(',')
|
await upDateData('del', [item.id])
|
||||||
upDateData()
|
ElMessage.success('删除成功')
|
||||||
})
|
})
|
||||||
.catch(() => { });
|
.catch(() => { });
|
||||||
}
|
}
|
||||||
|
@ -257,6 +220,7 @@ const showDialog = (item: string) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 打开活动引用列表
|
||||||
const openList = () => {
|
const openList = () => {
|
||||||
activeVisible.value = true
|
activeVisible.value = true
|
||||||
initHomeWork()
|
initHomeWork()
|
||||||
|
@ -264,65 +228,44 @@ const openList = () => {
|
||||||
|
|
||||||
// 添加活动引用列表作业
|
// 添加活动引用列表作业
|
||||||
const savePPtData = async () => {
|
const savePPtData = async () => {
|
||||||
if (selectedWorkList.value.length === 0) {
|
if (!selectedWorkList.value.length) {
|
||||||
ElMessage.warning('请选择活动')
|
ElMessage.warning('请选择活动')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
workList.value = []
|
|
||||||
const arr = selectedWorkList.value.map(item => item.id)
|
const arr = selectedWorkList.value.map(item => item.id)
|
||||||
// 应该是新加而不是覆盖
|
await upDateData('add', arr)
|
||||||
const existingIds = paramData.value.activityContent ? paramData.value.activityContent.split(',') : []
|
|
||||||
paramData.value.activityContent = Array.from(new Set([...existingIds, ...arr])).join(',')
|
|
||||||
upDateData()
|
|
||||||
activeVisible.value = false
|
activeVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取当前ppt页的数据
|
|
||||||
const getCurrentPPtData = async () => {
|
|
||||||
workList.value = []
|
|
||||||
objItem.value = workItem.value[slideIndex.value]
|
|
||||||
paramData.value.id = objItem.value.id
|
|
||||||
|
|
||||||
paramData.value.activityContent = objItem.value?.activityContent
|
|
||||||
if (objItem.value?.activityContent) {
|
|
||||||
loadingActive.value = true
|
|
||||||
const res = await homeworklist({ ids: objItem.value?.activityContent, pageSize: 100 })
|
|
||||||
await formatClassWorkFile(res.rows)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 接收习题训练的值
|
// 接收习题训练的值
|
||||||
const getData = async (data: WorkItem) => {
|
const getData = async (data: WorkItem) => {
|
||||||
workList.value = []
|
await upDateData('add', [data.id])
|
||||||
if(paramData.value.activityContent){
|
|
||||||
const arr = paramData.value.activityContent.split(',')
|
|
||||||
arr.push(data.id.toString())
|
|
||||||
const unitArr = Array.from(new Set(arr))
|
|
||||||
paramData.value.activityContent = unitArr.join(',')
|
|
||||||
}else{
|
|
||||||
paramData.value.activityContent = data.id.toString()
|
|
||||||
}
|
|
||||||
upDateData()
|
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
const upDateData = async () => {
|
// 更新数据-活动 type add/增加 | del/删除 ids 作业id
|
||||||
|
const upDateData = (type: string, ids: number[]): Promise<any> => {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
loadingActive.value = true
|
loadingActive.value = true
|
||||||
await PPTApi.updateSlide(paramData.value)
|
// 更新本地数据
|
||||||
// await updateEntpcoursefileNew(paramData.value)
|
let workIds = slidesStore.workList.map((o:any) => o.id)
|
||||||
const resource = sessionStore.get('curr.resource')
|
const id = slidesStore.currentSlide.id
|
||||||
await PPTApi.getSlideList(resource.id)
|
if (type === 'del') { // 删除
|
||||||
const res = await homeworklist({ ids: paramData.value.activityContent, pageSize: 100 })
|
workIds = workIds.filter(id => !ids.includes(id))
|
||||||
await formatClassWorkFile(res.rows)
|
} else { // 增加
|
||||||
|
workIds = Array.from(new Set([...workIds, ...ids]))
|
||||||
}
|
}
|
||||||
// 判断是否做操作
|
// 保存到本地
|
||||||
const objectsAreEqual = (obj1: Record<string, any>, obj2: Record<string, any>) => {
|
const wItem:any = slidesStore.workItem.find((o:any) => o.id === id)
|
||||||
const keys1 = Object.keys(obj1);
|
const workIdsStr = workIds.join(',') // 作业id->字符串
|
||||||
const keys2 = Object.keys(obj2);
|
if (!!wItem) wItem.activityContent = workIdsStr
|
||||||
if (keys1.length !== keys2.length) return false;
|
const data = { id, activityContent: workIdsStr }
|
||||||
for (const key of keys1) {
|
// 修改数据库
|
||||||
if (obj1[key] !== obj2[key]) return false;
|
await PPTApi.updateSlide(data, false)
|
||||||
}
|
// 刷新活动列表
|
||||||
return true;
|
await PPTApi.updateWorkList()
|
||||||
|
loadingActive.value = false
|
||||||
|
resolve(true)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -332,17 +275,8 @@ onMounted(() => {
|
||||||
currentCourse.levelSecondId = curNode.id
|
currentCourse.levelSecondId = curNode.id
|
||||||
currentCourse.coursetitle = curNode.itemtitle
|
currentCourse.coursetitle = curNode.itemtitle
|
||||||
currentCourse.node = curNode
|
currentCourse.node = curNode
|
||||||
// objItem.value = workItem.value[slideIndex.value]
|
|
||||||
// getCurrentPPtData()
|
|
||||||
})
|
})
|
||||||
watch(() => [workItem.value.length,workItem.value[slideIndex.value]?.id], (newVal,oldVal) => {
|
|
||||||
if(!objectsAreEqual(newVal,oldVal))
|
|
||||||
if(workItem.value[slideIndex.value])
|
|
||||||
getCurrentPPtData()
|
|
||||||
})
|
|
||||||
// watch(() => workItem.value.length, () => {
|
|
||||||
// getCurrentPPtData()
|
|
||||||
// })
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.buttonDiv{
|
.buttonDiv{
|
||||||
|
|
|
@ -392,9 +392,9 @@ onMounted(() => {
|
||||||
let data = sessionStore.get('subject.curNode')
|
let data = sessionStore.get('subject.curNode')
|
||||||
Object.assign(curNode, data);
|
Object.assign(curNode, data);
|
||||||
modeType.value = props.type == 1 ? '课标' : props.type == 2 ? '教材' : '考试'
|
modeType.value = props.type == 1 ? '课标' : props.type == 2 ? '教材' : '考试'
|
||||||
|
|
||||||
getTemplateList()
|
getTemplateList()
|
||||||
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
||||||
|
|
||||||
params.dataset_id = dataSetJson[jsonKey]
|
params.dataset_id = dataSetJson[jsonKey]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@ import defaultUserImg from '@/assets/images/img-avatar.png'
|
||||||
const { ipcRenderer } = window.electron || {}
|
const { ipcRenderer } = window.electron || {}
|
||||||
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
|
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
console.log(userStore)
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const currentRoute = ref('')
|
const currentRoute = ref('')
|
||||||
const activeId = ref('/home')
|
const activeId = ref('/home')
|
||||||
|
|
|
@ -396,5 +396,12 @@ export const dataSetJson = {
|
||||||
"课标-高中-数学": "e03aa4fe9fd011ef91270242ac140006",
|
"课标-高中-数学": "e03aa4fe9fd011ef91270242ac140006",
|
||||||
"课标-高中-地理": "270516829fd111efb13c0242ac140006",
|
"课标-高中-地理": "270516829fd111efb13c0242ac140006",
|
||||||
"课标-高中-政治": "a2f0b247b85d11ef84290242ac140005",
|
"课标-高中-政治": "a2f0b247b85d11ef84290242ac140005",
|
||||||
|
"教材-高中-语文": "cee3062a9fcf11efa6910242ac140006",
|
||||||
|
"教材-高中-生物": "fb5d01d59fd011ef9bb90242ac140006",
|
||||||
|
"教材-高中-历史": "f2f6c1fb9fd011ef98740242ac140006",
|
||||||
|
"教材-高中-英语": "e889fcac9fd011efb22a0242ac140006",
|
||||||
|
"教材-高中-数学": "e03aa4fe9fd011ef91270242ac140006",
|
||||||
|
"教材-高中-地理": "270516829fd111efb13c0242ac140006",
|
||||||
|
"教材-高中-政治": "a2f0b247b85d11ef84290242ac140005",
|
||||||
"鉴权": "ragflow-IwMDI1MGU2YTU3NjExZWZiNWEzMDI0Mm"
|
"鉴权": "ragflow-IwMDI1MGU2YTU3NjExZWZiNWEzMDI0Mm"
|
||||||
}
|
}
|
|
@ -85,7 +85,7 @@ const saveAdd = async () => {
|
||||||
try {
|
try {
|
||||||
// 系统预设模板 copy一份
|
// 系统预设模板 copy一份
|
||||||
const { msg } = await addKeyWords({ name: form.name, id })
|
const { msg } = await addKeyWords({ name: form.name, id })
|
||||||
emitter.emit('onGetMain')
|
emitter.emit('onGetMain', props.item)
|
||||||
ElMessage.success(msg)
|
ElMessage.success(msg)
|
||||||
mode.value = false
|
mode.value = false
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="left-header flex">教学模式</div>
|
<div class="left-header flex">教学模式</div>
|
||||||
<div class="left-con" v-loading="loading">
|
<div class="left-con" v-loading="loading">
|
||||||
<el-empty v-if="!(tempList.length)" description="暂无数据" />
|
<el-empty v-if="!(tempList.length)" description="暂无数据" />
|
||||||
<div class="con-item" v-for="item in tempList" :key="item.id">
|
<div class="con-item" v-for="item in tempList" :key="item.id" :class=" actId == item.id ? 'item-act' : ''">
|
||||||
<div class="item-header flex">
|
<div class="item-header flex">
|
||||||
<span>{{ item.name }}</span>
|
<span>{{ item.name }}</span>
|
||||||
<el-button type="primary" link @click="onSelect(item)">选择模式</el-button>
|
<el-button type="primary" link @click="onSelect(item)">选择模式</el-button>
|
||||||
|
@ -49,6 +49,7 @@ const getTemplate = async (id) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取子模板
|
// 获取子模板
|
||||||
|
const actId = ref('')
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const tempList = ref([])
|
const tempList = ref([])
|
||||||
const getChildTemp = async (parentId) => {
|
const getChildTemp = async (parentId) => {
|
||||||
|
@ -65,6 +66,7 @@ const getChildTemp = async (parentId) => {
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
actId.value = tempList.value[0].id
|
||||||
}
|
}
|
||||||
if(parentId){
|
if(parentId){
|
||||||
const item = tempList.value.find(item => item.id == parentId)
|
const item = tempList.value.find(item => item.id == parentId)
|
||||||
|
@ -90,6 +92,7 @@ emitter.on('onGetMain', (item) => {
|
||||||
// 选择模板
|
// 选择模板
|
||||||
const emit = defineEmits([''])
|
const emit = defineEmits([''])
|
||||||
const onSelect = (item) =>{
|
const onSelect = (item) =>{
|
||||||
|
actId.value = item.id
|
||||||
emitter.emit('changeMode', item)
|
emitter.emit('changeMode', item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,8 +101,6 @@ const curNode = reactive({})
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
let data = sessionStore.get('subject.curNode')
|
let data = sessionStore.get('subject.curNode')
|
||||||
Object.assign(curNode, data);
|
Object.assign(curNode, data);
|
||||||
|
|
||||||
|
|
||||||
getTemplate()
|
getTemplate()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -143,10 +144,16 @@ onUnmounted(() => {
|
||||||
.con-item {
|
.con-item {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column
|
flex-direction: column;
|
||||||
|
padding: 10px;
|
||||||
}
|
}
|
||||||
.item-list{
|
.item-list{
|
||||||
margin-bottom: 10px;
|
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.item-act{
|
||||||
|
border: solid 1px #409eff;
|
||||||
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
.item-card {
|
.item-card {
|
||||||
width: 130px;
|
width: 130px;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<el-button type="danger" @click="pptDialog = true">生成PPT</el-button>
|
<el-button type="danger" @click="pptDialog = true">生成PPT</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-con flex">
|
<div class="right-con flex" ref="listRef">
|
||||||
<el-empty v-if="!(resultList.length)" description="暂无数据" />
|
<el-empty v-if="!(resultList.length)" description="暂无数据" />
|
||||||
<div class="con-item flex" v-for="(item, index) in resultList" :key="item.id" v-loading="item.loading">
|
<div class="con-item flex" v-for="(item, index) in resultList" :key="item.id" v-loading="item.loading">
|
||||||
<div class="item-top flex">
|
<div class="item-top flex">
|
||||||
|
@ -30,14 +30,12 @@
|
||||||
<el-button type="primary" link @click="removeItem(item, true)">移除</el-button>
|
<el-button type="primary" link @click="removeItem(item, true)">移除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
<!-- <el-button type="info" link>
|
|
||||||
<i class="iconfont icon-xiazai9"></i>
|
|
||||||
</el-button> -->
|
|
||||||
</div>
|
</div>
|
||||||
<div class="item-bom">
|
<div class="item-bom">
|
||||||
<div class="item-prompt">{{ item.prompt }}</div>
|
<div class="item-prompt">{{ item.prompt }}</div>
|
||||||
<div class="item-answer" v-if="item.answer">
|
<div class="item-answer" v-if="item.answer">
|
||||||
<div class="answer-text" v-html="item.answer">
|
<div class="answer-text">
|
||||||
|
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow" @complete="handleCompleteText($event,index)" @updateScroll="scrollToBottom($event,index)" />
|
||||||
</div>
|
</div>
|
||||||
<div class="item-btn flex">
|
<div class="item-btn flex">
|
||||||
<el-button type="primary" link @click="againResult(index, item)">
|
<el-button type="primary" link @click="againResult(index, item)">
|
||||||
|
@ -68,18 +66,19 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onUnmounted, reactive } from 'vue'
|
import { ref, onMounted, onUnmounted, reactive, nextTick } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { sessionStore } from '@/utils/store'
|
import { sessionStore } from '@/utils/store'
|
||||||
import emitter from '@/utils/mitt'
|
import emitter from '@/utils/mitt'
|
||||||
import EditDialog from './edit-dialog.vue'
|
import EditDialog from './edit-dialog.vue'
|
||||||
import AdjustDialog from './adjust-dialog.vue'
|
import AdjustDialog from './adjust-dialog.vue'
|
||||||
import progressDialog from './progress-dialog.vue'
|
import progressDialog from './progress-dialog.vue'
|
||||||
import { completion, tempResult, tempSave, removeChildTemp } from '@/api/mode/index.js'
|
import { completion, tempResult, tempSave, removeChildTemp, editTempResult } from '@/api/mode/index.js'
|
||||||
// import { dataSetJson } from '@/utils/comm.js'
|
// import { dataSetJson } from '@/utils/comm.js'
|
||||||
import * as commUtils from '@/utils/comm.js'
|
import * as commUtils from '@/utils/comm.js'
|
||||||
import PptDialog from '@/views/prepare/container/pptist-dialog.vue'
|
import PptDialog from '@/views/prepare/container/pptist-dialog.vue'
|
||||||
import keywordDialog from './keyword-dialog.vue'
|
import keywordDialog from './keyword-dialog.vue'
|
||||||
|
import TypingEffect from '@/components/typing-effect/index.vue'
|
||||||
|
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import {PPTXFileToJson} from '@/AixPPTist/src/hooks/useImport' // ppt转json
|
import {PPTXFileToJson} from '@/AixPPTist/src/hooks/useImport' // ppt转json
|
||||||
|
@ -119,11 +118,19 @@ emitter.on('changeMode', (item) => {
|
||||||
|
|
||||||
// 一键研读
|
// 一键研读
|
||||||
const getCompletion = async () => {
|
const getCompletion = async () => {
|
||||||
|
isStarted.value = new Array(resultList.length).fill(false)
|
||||||
|
isStarted.value[0] = true
|
||||||
|
|
||||||
|
resultList.value.forEach(item =>{
|
||||||
|
if(item.answer){
|
||||||
|
item.answer = ''
|
||||||
|
}
|
||||||
|
})
|
||||||
for (let item of resultList.value) {
|
for (let item of resultList.value) {
|
||||||
console.log(item)
|
|
||||||
try {
|
try {
|
||||||
item.loading = true
|
item.loading = true
|
||||||
|
item.aiShow = true
|
||||||
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject} 对${curNode.itemtitle}进行教学分析`
|
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject} 对${curNode.itemtitle}进行教学分析`
|
||||||
const { data } = await completion(params)
|
const { data } = await completion(params)
|
||||||
item.answer = getResult(data.answer)
|
item.answer = getResult(data.answer)
|
||||||
|
@ -134,6 +141,19 @@ const getCompletion = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleCompleteText = async (answer, index) =>{
|
||||||
|
if (index < resultList.value.length - 1) {
|
||||||
|
isStarted.value[index + 1] = true; // 开始显示下一个文本
|
||||||
|
}
|
||||||
|
if(isAgain.value){
|
||||||
|
try{
|
||||||
|
await editTempResult({ id: resultList.value[index].resultId, content: answer })
|
||||||
|
}finally{
|
||||||
|
isAgain.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 保存模板
|
// 保存模板
|
||||||
const onSaveTemp = (item) => {
|
const onSaveTemp = (item) => {
|
||||||
if (item.answer == '') return
|
if (item.answer == '') return
|
||||||
|
@ -193,24 +213,49 @@ const removeItem = async (item, isChild) => {
|
||||||
// editKeyWord(item, !isChild)
|
// editKeyWord(item, !isChild)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const listRef = ref()
|
||||||
// 查询模板结果
|
// 查询模板结果
|
||||||
|
const isStarted = ref([]);
|
||||||
const getTempResult = (id) => {
|
const getTempResult = (id) => {
|
||||||
tempResult({ mainModelId: id }).then(res => {
|
tempResult({ mainModelId: id }).then(res => {
|
||||||
let rows = res.rows
|
let rows = res.rows
|
||||||
if (rows.length > 0) {
|
if (rows.length > 0) {
|
||||||
|
isStarted.value = new Array(rows.length).fill(true)
|
||||||
resultList.value.forEach(item => {
|
resultList.value.forEach(item => {
|
||||||
rows.forEach(el => {
|
rows.forEach(el => {
|
||||||
if (item.id == el.modelId) {
|
if (item.id == el.modelId) {
|
||||||
item.answer = el.content
|
item.answer = getResult(el.content)
|
||||||
item.reultId = el.id
|
item.resultId = el.id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const scrollToBottom = (height,index) =>{
|
||||||
|
|
||||||
|
if (listRef.value) {
|
||||||
|
let sum = 0
|
||||||
|
let listDom = listRef.value.children
|
||||||
|
|
||||||
|
if(index == 0){
|
||||||
|
// 220 去掉头部
|
||||||
|
let screenHeight = window.innerHeight - 220
|
||||||
|
if(height > screenHeight){
|
||||||
|
listRef.value.scrollTop = (height - screenHeight + 50)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
for(let i = 0; i < index; i++){
|
||||||
|
sum += listDom[i].clientHeight
|
||||||
|
}
|
||||||
|
listRef.value.scrollTop = sum + height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 去掉字符串中的 ### **
|
// 去掉字符串中的 ### **
|
||||||
let getResult = (str) => {
|
let getResult = (str) => {
|
||||||
let newStr = str.replace(/#+|(\*\*)/g, '');
|
let newStr = str.replace(/#+|(\*\*)/g, '');
|
||||||
|
@ -282,17 +327,32 @@ const curIndex = ref(-1)
|
||||||
const curItem = reactive({})
|
const curItem = reactive({})
|
||||||
|
|
||||||
// 重新生成
|
// 重新生成
|
||||||
|
const isAgain = ref(false)
|
||||||
const againResult = async (index, item) => {
|
const againResult = async (index, item) => {
|
||||||
|
isAgain.value = true
|
||||||
|
isStarted.value[index] = false
|
||||||
|
resultList.value[index].answer = ''
|
||||||
|
if(index == 0){
|
||||||
|
listRef.value.scrollTop = 0
|
||||||
|
|
||||||
|
}else{
|
||||||
|
scrollToBottom(50, index)
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await nextTick()
|
||||||
resultList.value[index].loading = true
|
resultList.value[index].loading = true
|
||||||
|
item.aiShow = true
|
||||||
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}课标对${curNode.itemtitle}进行教学分析`
|
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}课标对${curNode.itemtitle}进行教学分析`
|
||||||
const { data } = await completion(params)
|
const { data } = await completion(params)
|
||||||
resultList.value[index].answer = data.answer
|
resultList.value[index].answer = getResult(data.answer)
|
||||||
|
isStarted.value[index] = true
|
||||||
} finally {
|
} finally {
|
||||||
resultList.value[index].loading = false
|
resultList.value[index].loading = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 对话调整
|
// 对话调整
|
||||||
const isAdjust = ref(false)
|
const isAdjust = ref(false)
|
||||||
const onAdjust = (index, item) => {
|
const onAdjust = (index, item) => {
|
||||||
|
@ -507,6 +567,12 @@ onUnmounted(() => {
|
||||||
left: -1px;
|
left: -1px;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
}
|
}
|
||||||
|
&:last-child{
|
||||||
|
&::before{
|
||||||
|
content: '';
|
||||||
|
width: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
.item-top {
|
.item-top {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
Loading…
Reference in New Issue