diff --git a/src/renderer/src/components/choose-textbook/index.vue b/src/renderer/src/components/choose-textbook/index.vue
index 781b86b..afa567f 100644
--- a/src/renderer/src/components/choose-textbook/index.vue
+++ b/src/renderer/src/components/choose-textbook/index.vue
@@ -143,8 +143,9 @@ const handleNodeClick = (data) => {
//增加一个label 之前取的label
nodeData.label = nodeData.itemtitle
let parentNode
- // 父级id == rootid 说明当前节点为一级节点
- if(nodeData.parentid == nodeData.rootid){
+ // 存在children 则为一级节点
+ if(nodeData.children){
+ // 为一级节点
parentNode = null
}
else{
diff --git a/src/renderer/src/components/template-study/container/right.vue b/src/renderer/src/components/template-study/container/right.vue
index ffcb56c..d62793a 100644
--- a/src/renderer/src/components/template-study/container/right.vue
+++ b/src/renderer/src/components/template-study/container/right.vue
@@ -52,7 +52,7 @@
@@ -178,27 +178,22 @@ const getTempResult = () => {
const scrollToBottom = (height,index) =>{
if (listRef.value) {
-
+ let sum = 0
let listDom = listRef.value.children
- for(let i = 0; i < index; i++){
- sum += listDom[i].clientHeight
+ 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
}
-
- 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) => {
- let sTop = isStarted.value[index]
+ isAgain.value = true
isStarted.value[index] = false
childTempList.value[index].answer = ''
-
- console.log(listRef.value.scrollTop,listRef.value.children[index].clientHeight);
-
-
if(index == 0){
listRef.value.scrollTop = 0
}else{
- console.log( listRef.value.scrollTop - (listRef.value.children[index].clientHeight),'index')
- listRef.value.scrollTop =listRef.value.scrollTop - listRef.value.children[index].clientHeight - 50
-
+ scrollToBottom(50, index)
}
+
try {
await nextTick()
childTempList.value[index].loading = true
item.aiShow = true
- //params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
- //const { data } = await completion(params)
- //childTempList.value[index].answer = getResult(data.answer);
- childTempList.value[index].answer = '根据知识库的内容,核心素\n\n综上所述,在大足石刻研学课程中应充分考虑语文学科核心素养的要求,通过实践活动提高学生语言运用能力、思维品质及文化认同'
+ params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
+ const { data } = await completion(params)
+ childTempList.value[index].answer = getResult(data.answer);
isStarted.value[index] = true
-
- // onEditSave(item)
+
} finally {
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) {
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])
})
-
-
// 保存 重新研读后的结果
const onEditSave = async (item) => {
const { res } = await editTempResult({ id: item.resultId, content: item.answer })
diff --git a/src/renderer/src/components/typing-effect/index.vue b/src/renderer/src/components/typing-effect/index.vue
index 8a771d4..b8c8a3c 100644
--- a/src/renderer/src/components/typing-effect/index.vue
+++ b/src/renderer/src/components/typing-effect/index.vue
@@ -45,11 +45,11 @@ const type = async () => {
index.value++;
setTimeout(() => {
type();
- emit('updateScroll', typingEffectRef.value.offsetHeight); // 每次添加新字符后滚动到底部
+ emit('updateScroll', typingEffectRef.value.clientHeight); // 每次添加新字符后滚动到底部
}, props.delay);
} else {
// 当所有字符都显示完毕时,触发 complete 事件
- emit('complete');
+ emit('complete',displayedText.value);
}
};
diff --git a/src/renderer/src/views/profile/index.vue b/src/renderer/src/views/profile/index.vue
index 0526cc3..93fc043 100644
--- a/src/renderer/src/views/profile/index.vue
+++ b/src/renderer/src/views/profile/index.vue
@@ -5,7 +5,7 @@
{{ state.user.nickName }}
-
+
@@ -46,8 +46,10 @@ const state = reactive({
postGroup: {}
})
+const isSubject = ref(false)
async function getUser() {
getUserProfile().then((response) => {
+ isSubject.value = response.roleGroup.indexOf('场馆管理员') != -1
// response.data.avatar = import.meta.env.VITE_APP_BASE_API + response.data.avatar
Object.assign(state.user,response.data)
state.roleGroup = response.roleGroup