edit
This commit is contained in:
parent
3ad4391e10
commit
8b429a4174
|
@ -143,8 +143,9 @@ const handleNodeClick = (data) => {
|
||||||
//增加一个label 之前取的label
|
//增加一个label 之前取的label
|
||||||
nodeData.label = nodeData.itemtitle
|
nodeData.label = nodeData.itemtitle
|
||||||
let parentNode
|
let parentNode
|
||||||
// 父级id == rootid 说明当前节点为一级节点
|
// 存在children 则为一级节点
|
||||||
if(nodeData.parentid == nodeData.rootid){
|
if(nodeData.children){
|
||||||
|
// 为一级节点
|
||||||
parentNode = null
|
parentNode = null
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<i class="iconfont icon-ai"></i>
|
<i class="iconfont icon-ai"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-answer">
|
<div class="item-answer">
|
||||||
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow" @complete="handleCompleteText(index)" @updateScroll="scrollToBottom($event,index)" />
|
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow" @complete="handleCompleteText($event,index)" @updateScroll="scrollToBottom($event,index)" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ai-btn" v-if="item.answer">
|
<div class="ai-btn" v-if="item.answer">
|
||||||
|
@ -178,27 +178,22 @@ const getTempResult = () => {
|
||||||
const scrollToBottom = (height,index) =>{
|
const scrollToBottom = (height,index) =>{
|
||||||
|
|
||||||
if (listRef.value) {
|
if (listRef.value) {
|
||||||
|
let sum = 0
|
||||||
let listDom = listRef.value.children
|
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++){
|
for(let i = 0; i < index; i++){
|
||||||
sum += listDom[i].clientHeight
|
sum += listDom[i].clientHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
listRef.value.scrollTop = sum + height
|
listRef.value.scrollTop = sum + height
|
||||||
|
}
|
||||||
// isStarted.value[index] = height
|
|
||||||
|
|
||||||
// const sum = isStarted.value.reduce((accumulator, currentValue) => {
|
|
||||||
// // 检查当前值是否为数字
|
|
||||||
// if (typeof currentValue === 'number') {
|
|
||||||
// return accumulator + currentValue;
|
|
||||||
// }
|
|
||||||
// // 如果不是数字,则返回累加器的当前值
|
|
||||||
// return accumulator;
|
|
||||||
// }, 0);
|
|
||||||
// listRef.value.scrollTop = sum - 150;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,34 +289,28 @@ const params = reactive(
|
||||||
)
|
)
|
||||||
|
|
||||||
// 重新研读
|
// 重新研读
|
||||||
|
const isAgain = ref(false)
|
||||||
const againResult = async (index, item) => {
|
const againResult = async (index, item) => {
|
||||||
let sTop = isStarted.value[index]
|
isAgain.value = true
|
||||||
isStarted.value[index] = false
|
isStarted.value[index] = false
|
||||||
childTempList.value[index].answer = ''
|
childTempList.value[index].answer = ''
|
||||||
|
|
||||||
|
|
||||||
console.log(listRef.value.scrollTop,listRef.value.children[index].clientHeight);
|
|
||||||
|
|
||||||
|
|
||||||
if(index == 0){
|
if(index == 0){
|
||||||
listRef.value.scrollTop = 0
|
listRef.value.scrollTop = 0
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
console.log( listRef.value.scrollTop - (listRef.value.children[index].clientHeight),'index')
|
scrollToBottom(50, index)
|
||||||
listRef.value.scrollTop =listRef.value.scrollTop - listRef.value.children[index].clientHeight - 50
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await nextTick()
|
await nextTick()
|
||||||
childTempList.value[index].loading = true
|
childTempList.value[index].loading = true
|
||||||
item.aiShow = true
|
item.aiShow = true
|
||||||
//params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
||||||
//const { data } = await completion(params)
|
const { data } = await completion(params)
|
||||||
//childTempList.value[index].answer = getResult(data.answer);
|
childTempList.value[index].answer = getResult(data.answer);
|
||||||
childTempList.value[index].answer = '根据知识库的内容,核心素\n\n综上所述,在大足石刻研学课程中应充分考虑语文学科核心素养的要求,通过实践活动提高学生语言运用能力、思维品质及文化认同'
|
|
||||||
isStarted.value[index] = true
|
isStarted.value[index] = true
|
||||||
|
|
||||||
// onEditSave(item)
|
|
||||||
} finally {
|
} finally {
|
||||||
childTempList.value[index].loading = false
|
childTempList.value[index].loading = false
|
||||||
}
|
}
|
||||||
|
@ -351,10 +340,17 @@ const getCompletion = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCompleteText = (index) =>{
|
const handleCompleteText = async (answer, index) =>{
|
||||||
if (index < childTempList.value.length - 1) {
|
if (index < childTempList.value.length - 1) {
|
||||||
isStarted.value[index + 1] = true; // 开始显示下一个文本
|
isStarted.value[index + 1] = true; // 开始显示下一个文本
|
||||||
}
|
}
|
||||||
|
if(isAgain.value){
|
||||||
|
try{
|
||||||
|
await editTempResult({ id: childTempList.value[index].resultId, content: answer })
|
||||||
|
}finally{
|
||||||
|
isAgain.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 替换分析结果
|
// 替换分析结果
|
||||||
|
@ -363,8 +359,6 @@ emitter.on('onSaveAdjust', (item) => {
|
||||||
onEditSave(childTempList.value[curIndex.value])
|
onEditSave(childTempList.value[curIndex.value])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 保存 重新研读后的结果
|
// 保存 重新研读后的结果
|
||||||
const onEditSave = async (item) => {
|
const onEditSave = async (item) => {
|
||||||
const { res } = await editTempResult({ id: item.resultId, content: item.answer })
|
const { res } = await editTempResult({ id: item.resultId, content: item.answer })
|
||||||
|
|
|
@ -45,11 +45,11 @@ const type = async () => {
|
||||||
index.value++;
|
index.value++;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
type();
|
type();
|
||||||
emit('updateScroll', typingEffectRef.value.offsetHeight); // 每次添加新字符后滚动到底部
|
emit('updateScroll', typingEffectRef.value.clientHeight); // 每次添加新字符后滚动到底部
|
||||||
}, props.delay);
|
}, props.delay);
|
||||||
} else {
|
} else {
|
||||||
// 当所有字符都显示完毕时,触发 complete 事件
|
// 当所有字符都显示完毕时,触发 complete 事件
|
||||||
emit('complete');
|
emit('complete',displayedText.value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<div class="info-name">{{ state.user.nickName }}</div>
|
<div class="info-name">{{ state.user.nickName }}</div>
|
||||||
<div class="infomation">
|
<div class="infomation">
|
||||||
<selectClass/>
|
<selectClass v-if="!isSubject"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -46,8 +46,10 @@ const state = reactive({
|
||||||
postGroup: {}
|
postGroup: {}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const isSubject = ref(false)
|
||||||
async function getUser() {
|
async function getUser() {
|
||||||
getUserProfile().then((response) => {
|
getUserProfile().then((response) => {
|
||||||
|
isSubject.value = response.roleGroup.indexOf('场馆管理员') != -1
|
||||||
// response.data.avatar = import.meta.env.VITE_APP_BASE_API + response.data.avatar
|
// response.data.avatar = import.meta.env.VITE_APP_BASE_API + response.data.avatar
|
||||||
Object.assign(state.user,response.data)
|
Object.assign(state.user,response.data)
|
||||||
state.roleGroup = response.roleGroup
|
state.roleGroup = response.roleGroup
|
||||||
|
|
Loading…
Reference in New Issue