This commit is contained in:
白了个白 2025-01-07 10:53:17 +08:00
commit 912d32bc9c
11 changed files with 224 additions and 107 deletions

View File

@ -1,10 +1,10 @@
appId: com.electron.app.yc
productName: 文枢课堂
productName: 永川中小学AI教学系统
directories:
output: dist
buildResources: build
win:
executableName: 文枢课堂
executableName: 永川中小学AI教学系统
icon: resources/yc-logo.png
files:
- '!**/.vscode/*'

View File

@ -1,6 +1,6 @@
{
"name": "aix-win-ws",
"version": "2.5.11",
"version": "2.5.14",
"description": "",
"main": "./out/main/index.js",
"author": "上海交大重庆人工智能研究院",

View File

@ -118,7 +118,6 @@ export function docList(params) {
})
}
// 保存教学大纲
export function addSyllabus(data) {
return request({
@ -128,3 +127,35 @@ export function addSyllabus(data) {
})
}
// 获取保存的大纲列表
export function syllabusList(params) {
return request({
url: '/education/generate/list',
method: 'get',
params
})
}
// 大纲详情
export function syllabuss(id) {
return request({
url: '/education/generate/' + id,
method: 'get',
})
}
// 删除大纲
export function removeSyllabus(id) {
return request({
url: '/education/generate/' + id,
method: 'delete',
})
}
export function editSyllabus(data) {
return request({
url: '/education/generate',
method: 'put',
data
})
}

View File

@ -344,6 +344,8 @@ const againResult = async (index, item) => {
}
}
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
//
const getCompletion = async () => {
isStarted.value = new Array(childTempList.length).fill(false)
@ -372,6 +374,7 @@ const getCompletion = async () => {
conversationId: conversation_id.value,
stream: false
})
await delay(1000); // 1
data = res.data
}
//

View File

@ -123,7 +123,7 @@
<!-- 边框样式 -->
<div class="blockBox">
<el-dropdown @command="updateStyle('lineDash', $event)" placement="top">
<el-button><el-image src="../../../src/assets/images/borderstyle.png"
<el-button><el-image :src="borderStyleImg"
style="width: 14px; height: 14px"></el-image></el-button>
<template #dropdown>
<el-dropdown-menu>
@ -303,6 +303,7 @@ import {
import Contextmenu from './components/Contextmenu.vue'
import { fontFamilyList, fontSizeList } from './constants'
const borderStyleImg = new URL('../../../src/assets/images/borderstyle.png', import.meta.url).href
const borderImg = new URL('../../../src/assets/images/borderwidth.png', import.meta.url).href
const pointerImg = new URL('../../../src/assets/images/mouse-pointer.png', import.meta.url).href
const { proxy } = getCurrentInstance()

View File

@ -328,7 +328,7 @@ export const processList = (row, aloneOption=false) => {
// 处理[答案显示] - 1-正常 0-错误
const answer = workAnswerArr
.map((item) => {
return item === '1' ? '正确' : '错误'
return DICT_TRUE_OR_FALSE.TRUE.includes(item) ? '正确' : DICT_TRUE_OR_FALSE.FALSE.includes(item)?'错误':item;
})
.join('、')
row[i].workanswerFormat = answer
@ -341,3 +341,8 @@ export const processList = (row, aloneOption=false) => {
}
}
}
const DICT_TRUE_OR_FALSE = {
TRUE: ['正确', '对', '√', '1'],
FALSE: ['错误', '错', '×', '0'],
};

View File

@ -106,6 +106,18 @@ const getBackGroundV2 = async () => {
throw error;
}
};
const createOutlineV2 = async (data) => {
try {
const response = await req("/api/aipptV2/createOutlineV2", "POST", data);
console.log("createOutline response:", response);
return response.data;
} catch (error) {
console.error("请求失败:", error);
throw error;
}
};
const createPPTV2 = async (data) => {
try {
const response = await req("/api/aipptV2/createV2", "POST", data);
@ -127,4 +139,4 @@ const getProgressV2 = async (id) => {
}
};
export { createOutline, getBackGround, createPPT, getProgress, getBackGroundV2, createPPTV2, getProgressV2, createByOutline };
export { createOutline, getBackGround, createPPT, getProgress, getBackGroundV2, createOutlineV2, createPPTV2, getProgressV2, createByOutline };

View File

@ -9,29 +9,41 @@
<el-button type="primary" @click="createAi">
<i class="iconfont icon-chuangzuo"></i>生成教学大纲
</el-button>
<el-button type="danger" :disabled="curItem.parentId" @click="delAnswer">
<i class="iconfont icon-shanchu"></i>
删除大纲
</el-button>
<el-button type="primary" @click="isEdit = true">
<i class="iconfont icon-bianji"></i>编辑大纲
</el-button>
</div>
</div>
<div class="center-con" v-loading="loading">
<TypingEffect v-if="answer" :text="answer" :delay="10" aiShow/>
<TypingEffect v-if="answer" :text="answer" :delay="10" :aiShow="aiShow"/>
<el-empty v-if="!answer" description="请选择符合您需要的教学模式,生成教学大纲" />
</div>
</div>
<EditDialog v-model="isEdit" :item="curItem" />
</template>
<script setup>
import { ref, reactive, onMounted, onUnmounted } from 'vue'
import { ElMessage } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
import { sessionStore } from '@/utils/store'
import EditDialog from './edit-dialog.vue'
import emitter from '@/utils/mitt'
import * as commUtils from '@/utils/comm.js'
import { createChart, sendChart } from '@/api/ai/index'
import { completion, addSyllabus } from '@/api/mode/index.js'
import { completion, addSyllabus, syllabuss, removeSyllabus } from '@/api/mode/index.js'
import TypingEffect from '@/components/typing-effect/index.vue'
import useUserStore from '@/store/modules/user'
const curMode = ref(2)
const isEdit = ref(false)
const { user } = useUserStore()
const aiShow = ref(false)
const modeOptions = ref([
{
@ -49,7 +61,22 @@ const selectedData = ref([])
emitter.on('selected', (data)=>{
selectedData.value = data
})
//
const curItem = reactive({})
emitter.on('onShow', (data)=>{
aiShow.value = false
answer.value = getResult(data.outline)
Object.assign(curItem, data)
curItem.answer = curItem.outline
getDetails(data.id)
})
const getDetails = (id) =>{
syllabuss(id).then( res =>{
Object.assign(curItem, res.data)
emitter.emit('onResult', res.data)
})
}
const params = reactive(
{
@ -62,17 +89,18 @@ const params = reactive(
//
const loading = ref(false)
const answer = ref('')
const createAi = async ()=>{
console.log(selectedData.value)
if(selectedData.value.length == 0){
ElMessage.warning('请先选择教学环节后再生成教学大纲')
return
}
onSaveTemp()
return
let str = selectedData.value.map( item => item.name).join('、')
let bookV = curNode.roottitle.split('-')[1] + '版'
loading.value = true
aiShow.value = true
try {
params.prompt = `针对${curNode.edustage}${curNode.edusubject}${bookV}${curNode.itemtitle}这一课,根据以下教学环节:${str}进行课件教学PPT内容设计`
@ -94,10 +122,10 @@ const createAi = async ()=>{
data = res.data
}
console.log(data)
emitter('onResult', data.answer)
emitter.emit('onResult', data.answer)
answer.value = getResult(data.answer)
// onSaveTemp(item)
onSaveTemp(data.answer)
} finally {
loading.value = false
}
@ -106,27 +134,41 @@ const createAi = async ()=>{
//
const onSaveTemp = async (data) => {
if (data == '') return
console.log(selectedData)
const onSaveTemp = async (answer) => {
if (answer == '') return
let modelIds = selectedData.value.map( item => item.id).join(',')
console.log(modelIds)
console.log(user)
const data1 = {
const data = {
eduId: curNode.id,
outline: data,
outline: answer,
outlineType: curMode.value == 1 ? 0 : 1,
modelIds,
sourceType: 1,
createUserId: 1
}
// const res = await addSyllabus(data)
if(!item.resultId){
item.resultId = res.data
createUserId: user.userId,
createUserName: user.nickName
}
await addSyllabus(data)
}
//
const delAnswer = () =>{
ElMessageBox.confirm(
'确定要删除大纲吗?',
'温馨提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(async () => {
await removeSyllabus(curItem.id)
ElMessage.success('操作成功')
answer.value = ''
emitter.emit('resetSelect')
})
.catch(() => {})
}
// ### **
let getResult = (str) => {
@ -145,6 +187,8 @@ const getChartId = () => {
onUnmounted(()=>{
emitter.off('selected')
emitter.off('onShow')
})
const curNode = reactive({})

View File

@ -2,11 +2,11 @@
<el-dialog v-model="isDialog" :show-close="false" width="900" destroy-on-close>
<template #header>
<div class="custom-header flex">
<span>{{ item.name }}</span>
<span>编辑大纲</span>
<i class="iconfont icon-guanbi" @click="isDialog = false"></i>
</div>
</template>
<div class="dialog-content">
<div class="dialog-content" v-loading="loading">
<el-row>
<el-col :span="24">
<el-input v-model="textarea" :autosize="{ minRows: 5, maxRows: 15 }" type="textarea" />
@ -28,11 +28,14 @@
<script setup>
import { ref, watch} from 'vue'
import { ElMessage } from 'element-plus'
import { editSyllabus } from '@/api/mode/index.js'
import { cloneDeep } from 'lodash';
import emitter from '@/utils/mitt';
const textarea = ref('')
const isDialog = defineModel()
const loading = ref(false)
const props = defineProps({
item: {
@ -51,9 +54,17 @@ watch(() => props.item.answer, (newVal) => {
const emit = defineEmits(['saveEdit'])
const onSave = () =>{
emitter.emit('changeResult', textarea.value)
isDialog.value = false
ElMessage.success('操作成功')
loading.value = true
let data = cloneDeep(props.item)
data.outline = textarea.value
editSyllabus(data).then( res =>{
isDialog.value = false
ElMessage.success('操作成功')
emitter.emit('onShow', data)
}).finally( ()=>{
loading.value = false
})
}

View File

@ -11,7 +11,7 @@
<div class="left-list">
<div class="item" v-for="item in templateList" :key="item.id">
<div class="item-name flex" @mouseenter="item.isAdd = true" @mouseleave="item.isAdd = false"
@click="handleItem(item)">
@click="toggleParent(item)">
<div class="flex">
<span>{{ item.name }}</span>
<!--个人教学模式才会有添加编辑-->
@ -21,19 +21,19 @@
</div>
</div>
<!--加号 数鼠标悬浮 显示-->
<i v-show="item.isAdd && !item.isSelect" class="iconfont icon-jiahao"></i>
<i v-show="item.isAdd && !item.selected" class="iconfont icon-jiahao"></i>
<!--减号 选中之后显示-->
<i v-show="item.isSelect" class="iconfont icon-zuixiaohua"></i>
<i v-show="item.selected" class="iconfont icon-zuixiaohua"></i>
</div>
<div class="item-child flex" :class="el.isSelect ? 'act-child' : ''" v-for="el in item.child" :key="el.id"
@mouseenter="el.isAdd = true" @mouseleave="el.isAdd = false" @click="handleItemChild(el)">
<div class="item-child flex" :class="child.selected ? 'act-child' : ''" v-for="child in item.children" :key="child.id"
@mouseenter="child.isAdd = true" @mouseleave="child.isAdd = false" @click="toggleChild(item,child)">
<div>
<span>{{ el.name }}</span>
<span>{{ child.name }}</span>
<!--个人教学模式才会有编辑-->
<el-button v-if="!el.ex3" class="ml-3" type="primary" link @click.stop="editMode(el)">编辑</el-button>
<el-button v-if="!child.ex3" class="ml-3" type="primary" link @click.stop="editMode(child)">编辑</el-button>
</div>
<i v-show="el.isAdd && !el.isSelect" class="iconfont icon-jiahao"></i>
<i v-show="el.isSelect" class="iconfont icon-zuixiaohua "></i>
<i v-show="child.isAdd && !child.selected" class="iconfont icon-jiahao"></i>
<i v-show="child.selected" class="iconfont icon-zuixiaohua "></i>
</div>
</div>
</div>
@ -68,13 +68,13 @@
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue'
import { ref, reactive, onMounted, onUnmounted } from 'vue'
import { modelList } from '@/api/mode/index'
import useUserStore from '@/store/modules/user'
import { sessionStore } from '@/utils/store'
import emitter from '@/utils/mitt'
import { ElMessage, ElMessageBox } from 'element-plus'
import { addChildTemp, editChildTemp, removeChildTemp } from '@/api/mode'
import { addChildTemp, editChildTemp, removeChildTemp, syllabusList } from '@/api/mode'
import { cloneDeep } from 'lodash'
@ -104,65 +104,71 @@ const getChildTemp = async () => {
let { rows } = await modelList({ model: 4, type: 2, parentId: item.id })
templateList.value.push({
...item,
child: rows
children: rows
})
} finally {
loading.value = false
}
}
getSyllabus()
}
//
const getSyllabus = async () =>{
const { rows } = await syllabusList()
if(rows && rows.length){
const idsAry = rows.at(-1).modelIds.split(',').map(item => Number(item));
//
templateList.value.forEach((parent) => {
parent.children.forEach((child) => {
child.selected = idsAry.includes(child.id);
});
// selected
parent.selected = parent.children.every((child) => child.selected);
});
//
emitter.emit('onShow', rows.at(-1))
}
}
//
const resetSelect = () =>{
templateList.value.forEach(item =>{
item.isSelect = false
item.child.forEach( el=>{
el.isSelect = false
item.selected = false
item.children.forEach( el=>{
el.selected = false
})
})
emitter.emit('selected', [])
}
const handleItem = (item) => {
if(item.newMode) return
item.isSelect = !item.isSelect
item.child.forEach(el => {
el.isSelect = !el.isSelect
})
emitter.on('resetSelect', () =>{
resetSelect()
})
let data = collectSelectedItems(templateList.value)
emitter.emit('selected', data)
}
const handleItemChild = (el) =>{
el.isSelect = !el.isSelect
let data = collectSelectedItems(templateList.value)
emitter.emit('selected', data)
}
// children isSelect true
const collectSelectedItems = (data) => {
let result = [];
//
data.forEach(parent => {
if (Array.isArray(parent.child)) {
// 使 filter children isSelect true
const selectedChildren = parent.child.filter(child => child.isSelect === true);
//
result = result.concat(selectedChildren.map(child => ({
...child
})));
}
//
const toggleParent = (parent) => {
parent.selected = !parent.selected;
parent.children.forEach(child => {
child.selected = parent.selected;
});
return result;
const selectedData = templateList.value.map((item) => item.children.filter((child) => child.selected)).flat()
// .flat()
emitter.emit('selected', selectedData)
}
//
const toggleChild = (parent,child) =>{
child.selected = !child.selected;
updateParentSelection(parent)
const selectedData = templateList.value.map((item) => item.children.filter((child) => child.selected)).flat()
emitter.emit('selected', selectedData)
}
// ()()
const updateParentSelection = (parent) => {
parent.selected = parent.children.every((child) => child.selected);
}
//
@ -286,6 +292,10 @@ onMounted(() => {
})
onUnmounted(()=>{
emitter.off('resetSelect')
})
</script>
<style lang="scss" scoped>

View File

@ -1,14 +1,14 @@
<template>
<div class="page-design flex">
<div class="page-left">
<div class="page-design">
<!-- <div class="page-left">
<left />
</div>
<div class="page-right">
<right />
</div>
<!-- <el-row :gutter="20">
</div> -->
<el-row :gutter="20">
<el-col :span="5">
<Left/>
</el-col>
@ -18,37 +18,37 @@
<el-col :span="6">
<Right/>
</el-col>
</el-row> -->
</el-row>
</div>
</template>
<script setup>
import left from './container/left.vue';
import right from './container/right.vue';
// import Left from './container/left2.vue'
// import Center from './container/center.vue'
// import Right from './container/right2.vue'
// import left from './container/left.vue';
// import right from './container/right.vue';
import Left from './container/left2.vue'
import Center from './container/center.vue'
import Right from './container/right2.vue'
</script>
<style lang="scss" scoped>
// .page-design {
// height: 100%;
// .el-row{
// height: 100%;
// .el-col{
// height: 100%;
// }
// }
// }
.page-design {
height: 100%;
.page-left{
width: 50%;
}
.page-right{
width: 50%;
.el-row{
height: 100%;
.el-col{
height: 100%;
}
}
}
// .page-design {
// height: 100%;
// .page-left{
// width: 50%;
// }
// .page-right{
// width: 50%;
// }
// }
</style>