Merge remote-tracking branch 'origin/main'

This commit is contained in:
朱浩 2025-01-15 16:16:55 +08:00
commit f8f0646bde
10 changed files with 324 additions and 201 deletions

View File

@ -244,6 +244,13 @@ app.on('ready', () => {
loginWindow.show() loginWindow.show()
loginWindow.focus() loginWindow.focus()
}) })
// 打印窗口
ipcMain.on('printPage', (event, printOptions) => {
//console.log("ipcMain-print-page")
mainWindow.webContents.print(printOptions, (success, failureReason) => {
if (!success) console.error(failureReason);
});
});
//打开作业窗口 //打开作业窗口
ipcMain.on('openWindow', (e, data) => { ipcMain.on('openWindow', (e, data) => {

View File

@ -118,6 +118,14 @@ export function docList(params) {
}) })
} }
// 删除 doc ai文档
export function removeDoc(id) {
return request({
url: '/education/doc/' + id,
method: 'delete',
})
}
// 保存教学大纲 // 保存教学大纲
export function addSyllabus(data) { export function addSyllabus(data) {
return request({ return request({

View File

@ -2,34 +2,45 @@
<el-dialog v-model="isDialog" :show-close="false" width="900" append-to-body destroy-on-close> <el-dialog v-model="isDialog" :show-close="false" width="900" append-to-body destroy-on-close>
<template #header> <template #header>
<div class="custom-header flex"> <div class="custom-header flex">
<span>选择{{ title }}</span> <span>选择</span>
<i class="iconfont icon-guanbi" @click="isDialog = false"></i> <i class="iconfont icon-guanbi" @click="isDialog = false"></i>
</div> </div>
</template> </template>
<div class="dialog-content"> <div class="dialog-content" v-loading="loading">
<div class="content-list"> <div class="content-list">
<ul> <el-empty description="暂无数据" v-if="!fileList.length" />
<li v-for="(item, index) in fileList" :class="activeIndex == index ? 'li-active' : ''" <el-radio-group v-model="curFileId">
@click="clickItem(index, item)"> <el-row>
<el-image class="img" :src="url" /> <el-col :span="12" v-for="item in fileList" :key="item.id">
<el-button type="primary" class="prev-btn" @click.stop="onPrevItem(item)">预览</el-button> <el-radio :value="item.id">
<el-text truncated>{{ item.fileName }}</el-text> <el-text class="w-50" truncated>{{ item.fileName }}</el-text>
</li> <div class="flex items-center">
</ul> <el-button type="primary" link v-if="isPrev(item).value" @click="onPrevItem(item)"
>预览</el-button
>
<el-button type="danger" link @click="removeItem(item)">删除</el-button>
</div>
</el-radio>
</el-col>
</el-row>
</el-radio-group>
</div> </div>
</div> </div>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-upload class="upload-demo" :action="uploadFileUrl" :limit="1" :show-file-list="false" :headers="headers" <el-upload
:on-success="onSuccess"> class="upload-demo"
:action="uploadFileUrl"
:limit="1"
:show-file-list="false"
:headers="headers"
:on-success="onSuccess"
>
<el-button type="primary">上传</el-button> <el-button type="primary">上传</el-button>
</el-upload> </el-upload>
<div> <div>
<el-button @click="isDialog = false">取消</el-button> <el-button @click="isDialog = false">取消</el-button>
<el-button type="primary" @click="isDialog = false"> <el-button type="primary" @click="handleDialog"> 确定 </el-button>
确定
</el-button>
</div> </div>
</div> </div>
</template> </template>
@ -41,21 +52,18 @@
<i class="iconfont icon-guanbi" @click="prevVisible = false"></i> <i class="iconfont icon-guanbi" @click="prevVisible = false"></i>
</div> </div>
</template> </template>
<div style="height: calc(100vh - 120px);"> <div style="height: calc(100vh - 120px); text-align: center;">
<template v-if="getFileSuffix(prevItem.fileUrl) == 'pdf'"> <template v-if="getFileSuffix(prevItem.fileUrl) == 'pdf'">
<iframe :src="prevItem.fileUrl" <iframe :src="prevItem.fileUrl" frameborder="0" width="100%" height="100%"></iframe>
frameborder="0" width="100%" height="100%"></iframe>
</template> </template>
<template v-else> <template v-else>
<el-image :src="prevItem.fileUrl" style="height:100%"/> <el-image :src="prevItem.fileUrl" style="height: 100%" />
</template> </template>
</div> </div>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<div></div> <div></div>
<el-button type="primary" @click="prevVisible = false"> <el-button type="primary" @click="prevVisible = false"> 关闭 </el-button>
关闭
</el-button>
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
@ -63,20 +71,19 @@
<script setup> <script setup>
import { ref, computed, onMounted, reactive } from 'vue' import { ref, computed, onMounted, reactive } from 'vue'
import { completion, addDoc, docList } from '@/api/mode/index.js' import { completion, addDoc, docList, removeDoc } from '@/api/mode/index.js'
import { getToken } from "@/utils/auth"; import { getToken } from '@/utils/auth'
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import { dataSetJson } from '@/utils/comm.js' import { dataSetJson } from '@/utils/comm.js'
import { ElMessage } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { getFileSuffix } from '@/utils/ruoyi.js' import { getFileSuffix } from '@/utils/ruoyi.js'
import emitter from '@/utils/mitt'; import emitter from '@/utils/mitt'
import { cloneDeep } from 'lodash'
const userInfo = useUserStore().user const userInfo = useUserStore().user
const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + '/common/upload')
const headers = ref({ Authorization: "Bearer " + getToken() }); const headers = ref({ Authorization: 'Bearer ' + getToken() })
const url = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F11044b08-04c1-41a0-a453-1fd20b58a614%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1732953359&t=7ab1d1b3a903db85b1149914407aea35'
const isDialog = defineModel() const isDialog = defineModel()
const prevVisible = ref(false) const prevVisible = ref(false)
@ -88,36 +95,14 @@ const props = defineProps({
} }
}) })
const title = computed(() => {
if (props.modeType == 1) return '课标';
if (props.modeType == 2) return '教材';
if (props.modeType == 3) return '考试';
})
const radio = ref(1) const isPrev = (item) => {
const radioList = ref([ return computed(() => {
{ label: '浏览研读', value: 1 }, return ['pdf', 'png', 'jpg', 'jpeg', 'gif', 'webp'].includes(getFileSuffix(item.fileUrl))
{ label: '跨学科研读', value: 2 },
{ label: '跨学段研读', value: 3 },
{ label: '课标修订研读', value: 4 },
{ label: '自由研读', value: 5 },
])
const list = ref([
{
name: '高中语文课程标准',
url
}
])
const changeRadio = () => {
list.value = []
for (let i = 0; i < Math.floor(Math.random() * 5) + 1; i++) {
list.value.push({
name: '高中语文课程标准',
url
}) })
}
} }
const activeIndex = ref(0)
const curFileId = ref(0)
const dataset_id = ref('') const dataset_id = ref('')
@ -143,43 +128,79 @@ const onSuccess = async (response) => {
const { msg } = await addDoc(docData) const { msg } = await addDoc(docData)
ElMessage.success(msg) ElMessage.success(msg)
getList() getList()
} }
const curNode = reactive({}) const curNode = reactive({})
// doc ai
const fileList = ref([]) const fileList = ref([])
const curFile = reactive({}) const curFile = reactive({})
const getList = () => { const getList = () => {
docList({ docList({
userId: userInfo.userId, createUser: userInfo.userId,
dataset_id: dataset_id.value datasetId: dataset_id.value
}).then(res => { }).then((res) => {
fileList.value = [...res.rows] fileList.value = [...res.rows]
if(res.rows.length){
Object.assign(curFile, fileList.value[0]) Object.assign(curFile, fileList.value[0])
curFileId.value = fileList.value[0].id
}
}) })
} }
const clickItem = (index, item) => {
activeIndex.value = index //
Object.assign(curFile, item) const loading = ref(false)
emitter.emit('changeCurFile', item) const removeItem = (item) => {
ElMessageBox.confirm('确定要删除?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
loading.value = true
removeDoc(item.id)
.then(() => {
ElMessage.success('操作成功')
getList()
})
.finally(() => {
loading.value = false
})
})
.catch(() => {})
} }
//
const prevItem = reactive({}) const prevItem = reactive({})
const onPrevItem = (item) => { const onPrevItem = (item) => {
Object.assign(prevItem, item) Object.assign(prevItem, item)
prevVisible.value = true prevVisible.value = true
} }
//
const handleDialog = () => {
isDialog.value = false
const item = fileList.value.find((item) => item.id == curFileId.value)
Object.assign(curFile, item)
emitter.emit('changeCurFile', item)
// pdf
if (getFileSuffix(curFile.fileUrl) == 'pdf') {
let data = cloneDeep(curFile)
emitter.emit('changePdfUrl', data)
}
}
onMounted(() => { onMounted(() => {
let data = sessionStore.get('subject.curNode') let data = sessionStore.get('subject.curNode')
Object.assign(curNode, data); Object.assign(curNode, data)
// "-" // "-"
let jsonKey = `考试-${curNode.edustage}-${curNode.edusubject}` let jsonKey = `考试-${curNode.edustage}-${curNode.edusubject}`
dataset_id.value = dataSetJson[jsonKey] dataset_id.value = dataSetJson[jsonKey]
getList() getList()
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.custom-header { .custom-header {
@ -198,45 +219,6 @@ onMounted(() => {
.content-list { .content-list {
padding-top: 10px; padding-top: 10px;
ul {
display: flex;
flex-wrap: wrap;
li {
width: 130px;
display: flex;
flex-direction: column;
font-size: 13px;
padding: 10px;
cursor: pointer;
border-radius: 5px;
overflow: hidden;
margin-right: 20px;
margin-bottom: 10px;
position: relative;
overflow: hidden;
.img {
width: 100%;
height: 130px;
border: solid #ccc 1px;
margin-bottom: 10px;
}
&:hover {
background: #E0EAFF;
}
&:hover .prev-btn {
transform: translate(-50%, -40px)
}
}
.li-active {
background: #E0EAFF;
}
}
} }
} }
@ -246,13 +228,7 @@ onMounted(() => {
justify-content: space-between; justify-content: space-between;
} }
.prev-btn { :deep(.el-radio__label) {
position: absolute; display: flex;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) translateY(-110px);
/* 按钮初始位置在容器外 */
transition: transform 0.3s ease-in-out;
/* 设置过渡效果 */
} }
</style> </style>

View File

@ -2,8 +2,9 @@
<div class="container-left-page flex"> <div class="container-left-page flex">
<div class="container-left-header flex"> <div class="container-left-header flex">
<el-button link @click="onClick"> <el-button link @click="onClick">
{{ curNode.edustage }}{{ curNode.edusubject }}{{ type == 1 ? '课标研读' : type == 2 ? '教材分析' : '考试分析' }}<i {{ curNode.edustage }}{{ curNode.edusubject
class="iconfont icon-xiangxia"></i> }}{{ type == 1 ? '课标研读' : type == 2 ? '教材分析' : '考试分析'
}}<i v-if="type == 3" class="iconfont icon-xiangxia"></i>
</el-button> </el-button>
</div> </div>
<div class="container-left-pdf"> <div class="container-left-pdf">
@ -20,6 +21,7 @@ import { ref, onMounted, nextTick, reactive } from 'vue'
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import PDF from '@/components/PdfJs/index.vue' import PDF from '@/components/PdfJs/index.vue'
import LeftDialog from './left-dialog.vue' import LeftDialog from './left-dialog.vue'
import emitter from '@/utils/mitt'
const props = defineProps(['type']) const props = defineProps(['type'])
@ -29,6 +31,12 @@ const onClick = () => {
showDialog.value = true showDialog.value = true
} }
emitter.on('changePdfUrl', async (data) => {
pdfUrl.value = ''
await nextTick()
pdfUrl.value = data.fileUrl
})
// PDF // PDF
const pdfUrl = ref('') const pdfUrl = ref('')
const curNode = reactive({}) const curNode = reactive({})
@ -36,16 +44,15 @@ onMounted(async () => {
await nextTick() await nextTick()
// //
let nodeData = sessionStore.get('subject.curNode') let nodeData = sessionStore.get('subject.curNode')
Object.assign(curNode, nodeData); Object.assign(curNode, nodeData)
let data = sessionStore.get('subject.curBook') let data = sessionStore.get('subject.curBook')
let fileurl = data.fileurl let fileurl = data.fileurl
if(props.type == 1){ if (props.type == 1) {
fileurl = `${data.edustage}-${data.edusubject}-课标.txt` fileurl = `${data.edustage}-${data.edusubject}-课标.txt`
} }
if(fileurl == '') return if (fileurl == '') return
pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + fileurl.replace('.txt', '.pdf') pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + fileurl.replace('.txt', '.pdf')
}) })
</script> </script>
@ -53,6 +60,7 @@ onMounted(async () => {
.container-left-page { .container-left-page {
height: 100%; height: 100%;
flex-direction: column; flex-direction: column;
.container-left-header { .container-left-header {
height: 45px; height: 45px;
background: #fff; background: #fff;

View File

@ -16,7 +16,7 @@
</el-dropdown> </el-dropdown>
<div class="flex"> <div class="flex">
<el-select v-model="curMode" placeholder="Select" class="mr-4 w-30"> <el-select v-model="curMode" placeholder="Select" class="mr-4 w-30">
<el-option v-for="item in modeOptions" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in modeOptions" :key="item.value" :disabled="item.disabled" :label="item.label" :value="item.value" />
</el-select> </el-select>
<el-button type="danger" link :disabled="!(templateList.length)" @click="removeItem(curTemplate, false)"> <el-button type="danger" link :disabled="!(templateList.length)" @click="removeItem(curTemplate, false)">
删除 删除
@ -104,6 +104,12 @@ import { cloneDeep } from 'lodash'
const props = defineProps(['type']) const props = defineProps(['type'])
const { user } = useUserStore() const { user } = useUserStore()
const params = reactive(
{
prompt: '',
dataset_id: ''
}
)
const curMode = ref(2) const curMode = ref(2)
const modeOptions = ref([ const modeOptions = ref([
{ {
@ -112,7 +118,8 @@ const modeOptions = ref([
}, },
{ {
label: '知识库模型', label: '知识库模型',
value: 2 value: 2,
disabled: false
} }
]) ])
@ -288,12 +295,7 @@ const onEdit = (index, item) => {
} }
// //
const params = reactive(
{
prompt: '',
dataset_id: ''
}
)
const prompt = ref('') const prompt = ref('')
// //
@ -483,7 +485,18 @@ onMounted(() => {
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]
if(!params.dataset_id){
curMode.value = 1
modeOptions.value.forEach(item => {
if(item.value == 2){
item.disabled = true
}
})
}
// ID // ID
conversation_id.value = localStorage.getItem('conversation_id') conversation_id.value = localStorage.getItem('conversation_id')
if (!conversation_id.value) { if (!conversation_id.value) {

View File

@ -9,11 +9,8 @@
<div style="font-size: 16px;font-weight: bold;color: #000;text-align: left;margin-bottom: 5px">可用分组</div> <div style="font-size: 16px;font-weight: bold;color: #000;text-align: left;margin-bottom: 5px">可用分组</div>
<div class="groupList"> <div class="groupList">
<template v-for="(item,index) in groupList" :key="index"> <template v-for="(item,index) in groupList" :key="index">
<el-card style="width: 20%; <el-card
margin-right: 10px; class="card_div"
margin-bottom: 10px;
cursor: pointer;
position: relative;"
v-if="item.parentid === 0" v-if="item.parentid === 0"
@mouseenter="cardEnter(item,index)" @mouseenter="cardEnter(item,index)"
@mouseleave="cardLeave(item,index)" @mouseleave="cardLeave(item,index)"
@ -391,6 +388,7 @@ watch(()=> props.classId,()=> {
.groupList{ .groupList{
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap:10px;
} }
.card-row { .card-row {
font-size: 12px; font-size: 12px;
@ -415,4 +413,10 @@ watch(()=> props.classId,()=> {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.card_div{
width: calc(20% - 10px);
margin-bottom: 10px;
cursor: pointer;
position: relative;
}
</style> </style>

View File

@ -1,14 +1,69 @@
<template> <template>
<el-card style="width: 100%;height: 100%"> <el-card style="width: 100%;height: 100%">
<el-descriptions :column="1"> <el-descriptions
<el-descriptions-item label="班级名称">{{ classInfo.caption }}</el-descriptions-item> class="margin-top"
<el-descriptions-item label="教师"> :column="6"
:size="size"
border
>
<el-descriptions-item :span="2" :width="120">
<template #label>
<div class="cell-item">
<el-icon :style="iconStyle">
<user />
</el-icon>
班级名称
</div>
</template>
{{ classInfo.caption }}
</el-descriptions-item>
<el-descriptions-item :span="2" :width="120">
<template #label>
<div class="cell-item">
<el-icon :style="iconStyle">
<tickets />
</el-icon>
学段
</div>
</template>
{{ currentGrade }}
</el-descriptions-item>
<el-descriptions-item :span="2" :width="120">
<template #label>
<div class="cell-item">
<el-icon :style="iconStyle">
<location />
</el-icon>
年级
</div>
</template>
{{ currentGradeName }}
</el-descriptions-item>
<el-descriptions-item :span="2" :width="120">
<template #label>
<div class="cell-item">
<el-icon :style="iconStyle">
<iphone />
</el-icon>
学生人数
</div>
</template>
{{ classInfo.classstudentcount || 0 }}
</el-descriptions-item>
<el-descriptions-item :span="4" :width="120">
<template #label>
<div class="cell-item">
<el-icon :style="iconStyle">
<office-building />
</el-icon>
教师
</div>
</template>
<template v-if="classInfo.teacher.length > 0"> <template v-if="classInfo.teacher.length > 0">
<el-tag style="margin-right: 5px;margin-bottom: 5px;" type="primary" v-for="(item, index) in classInfo.teacher" :key="index">{{item.name}}</el-tag> <el-tag style="margin-right: 5px;margin-bottom: 5px;" type="primary" v-for="(item, index) in classInfo.teacher" :key="index">{{item.name}}</el-tag>
</template> </template>
<template v-else>{{ classInfo.teachername }}</template> <template v-else>{{ classInfo.teachername }}</template>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="学生人数">{{ classInfo.classstudentcount || 0 }}</el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-card> </el-card>
</template> </template>
@ -17,7 +72,7 @@
import {ElMessage, ElMessageBox} from "element-plus"; import {ElMessage, ElMessageBox} from "element-plus";
import { getClassmain,listClassuser,leaveClass} from '@/api/classManage/index' import { getClassmain,listClassuser,leaveClass} from '@/api/classManage/index'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import {reactive,onMounted,nextTick,watch} from 'vue' import {reactive,onMounted,nextTick,watch,ref} from 'vue'
import delClassDemo from '@/store/modules/delClass' import delClassDemo from '@/store/modules/delClass'
const props = defineProps({ const props = defineProps({
classId: { classId: {
@ -31,6 +86,36 @@
}) })
const isDelClass = delClassDemo() const isDelClass = delClassDemo()
const userStore = useUserStore().user const userStore = useUserStore().user
//
const currentGradeName = ref('')
//
const currentGrade = ref('')
//
const gradeDataList = reactive([
[
{ label: '一年级', agekey: 1, checked: false, current: 1 },
{ label: '二年级', agekey: 2, checked: false, current: 1 },
{ label: '三年级', agekey: 3, checked: false, current: 1 },
{ label: '四年级', agekey: 4, checked: false, current: 1 },
{ label: '五年级', agekey: 5, checked: false, current: 1 },
{ label: '六年级', agekey: 6, checked: false, current: 1 },
],
[
{ label: '初一', agekey: 7, checked: false, current: 2 },
{ label: '初二', agekey: 8, checked: false, current: 2 },
{ label: '初三', agekey: 9, checked: false, current: 2 },
],
[
{ label: '高一', agekey: 10, checked: false, current: 3 },
{ label: '高二', agekey: 11, checked: false, current: 3 },
{ label: '高三', agekey: 12, checked: false, current: 3 },
],
])
const gradeData = reactive([
{current:1, label:'小学',},
{current:2, label:'初中',},
{current:3, label:'高中',},
])
// //
const deleteClassRoom = () => { const deleteClassRoom = () => {
ElMessageBox.alert('确认删除该班级?', { ElMessageBox.alert('确认删除该班级?', {
@ -53,6 +138,14 @@
if(props.classId){ if(props.classId){
getClassmain(props.classId).then(response => { getClassmain(props.classId).then(response => {
Object.assign(classInfo,response.data) Object.assign(classInfo,response.data)
//
const flatGradeDataList = gradeDataList.flat();
//
const currentIndex = flatGradeDataList.findIndex(item => item.agekey === Number(response.data.agekey));
currentGradeName.value = flatGradeDataList[currentIndex].label
const current = flatGradeDataList[currentIndex].current
currentGrade.value = gradeData.find(item => item.current === current).label
console.log(classInfo,'classInfo');
listClassuser({classid:props.classId,pageSize:100}).then(res => { listClassuser({classid:props.classId,pageSize:100}).then(res => {
classInfo.teacher = res.rows.filter(item => item.inrole === 'teacher') classInfo.teacher = res.rows.filter(item => item.inrole === 'teacher')
classInfo.student = res.rows.filter(item => item.inrole === 'student') classInfo.student = res.rows.filter(item => item.inrole === 'student')
@ -71,5 +164,14 @@
</script> </script>
<style scoped> <style scoped>
.el-descriptions {
margin-top: 20px;
}
.cell-item {
display: flex;
align-items: center;
}
.margin-top {
margin-top: 20px;
}
</style> </style>

View File

@ -161,6 +161,7 @@ const route = useRoute();
const router = useRouter() const router = useRouter()
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const useClassTaskStores = useClassTaskStore(); const useClassTaskStores = useClassTaskStore();
const { ipcRenderer } = require('electron')
const props = defineProps({ const props = defineProps({
currentCourse: Object, currentCourse: Object,
@ -841,6 +842,22 @@ const editWork = async (cform) =>{
} }
} }
// ,
const handlePrint = () => {
const printOptions = {
silent: false, //
printBackground: true, //
color: false, //
marginsType: 0, // 0: 1: 2:
pageSize: 'A4', //
//
};
console.log("print-page-click");
ipcRenderer.send('printPage', printOptions);
};
//---- //----
@ -977,5 +994,8 @@ const editWork = async (cform) =>{
} }
} }
} }
::v-deep img {
display: inline-block !important;
}
</style> </style>

View File

@ -22,13 +22,11 @@
<!-- 裁剪按钮--> <!-- 裁剪按钮-->
<div class="btn"> <div class="btn">
<el-button style="margin-right: 20px">选择</el-button> <label for="submit">
<input <div class="lBut"><span>选择</span></div>
class="upload" </label>
type="file" <input class="upload" id="submit" accept=".png, .jpg, .jpeg" type="file" style="display: none;" @change="uploadImg" />
accept=".png, .jpg, .jpeg" <!-- <el-button style="margin-right: 20px;cursor:pointer">选择</el-button> -->
@change="uploadImg"
/>
<el-button @click="cancle">取消</el-button> <el-button @click="cancle">取消</el-button>
<el-button @click="sureSava">提交</el-button> <el-button @click="sureSava">提交</el-button>
@ -216,6 +214,7 @@ export default {
position: relative; position: relative;
display: flex; display: flex;
margin-top: 30px; margin-top: 30px;
cursor: pointer;
> .upload { > .upload {
display: block; display: block;
width: 60px; width: 60px;
@ -224,6 +223,7 @@ export default {
top: 0; top: 0;
left: 0; left: 0;
opacity: 0; opacity: 0;
cursor: pointer;
} }
} }
} }
@ -265,4 +265,22 @@ export default {
background-color: rgba(43, 43, 43, 0.7215686275); background-color: rgba(43, 43, 43, 0.7215686275);
} }
} }
.lBut{
width: 87px;
height: 32px;
font-size: 14px;
line-height: 1.15;
display: flex;
justify-content: center;
align-items: center;
border-radius: 4px;
padding: 8px 10px;
margin-right: 10px;
transition: all 0.5s;
white-space: nowrap;
background-color: #409eff;
color: white;
border: 1px solid #409eff;
cursor: pointer;
}
</style> </style>

View File

@ -22,24 +22,22 @@
<el-empty v-else description="请选择符合您需要的教学模式,生成教学大纲" /> <el-empty v-else description="请选择符合您需要的教学模式,生成教学大纲" />
</div> </div>
</div> </div>
<!-- <EditDialog v-model="isEdit" :item="editItem" :index="editIndex" /> -->
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted, onUnmounted } from 'vue' import { ref, reactive, onMounted, onUnmounted } 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 EditDialog from './edit-dialog.vue'
import emitter from '@/utils/mitt' import emitter from '@/utils/mitt'
import * as commUtils from '@/utils/comm.js' import * as commUtils from '@/utils/comm.js'
import { createChart, sendChart } from '@/api/ai/index' import { createChart, sendChart } from '@/api/ai/index'
import { completion, addSyllabus, removeSyllabus, editSyllabus, modelList } from '@/api/mode/index.js' import { completion, addSyllabus, removeSyllabus, modelList } from '@/api/mode/index.js'
import { createOutlineV2 } from '@/utils/ppt-request.js' import { createOutlineV2 } from '@/utils/ppt-request.js'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
const curMode = ref(2) const curMode = ref(2)
const isEdit = ref(false)
const { user } = useUserStore() const { user } = useUserStore()
@ -50,7 +48,8 @@ const modeOptions = ref([
}, },
{ {
label: '知识库模型', label: '知识库模型',
value: 2 value: 2,
disabled: false
} }
]) ])
@ -114,14 +113,17 @@ const createAi = async () => {
data = res.data data = res.data
} }
markeDownAnswer.value = data.answer
const res = await createOutlineV2({ query: data.answer }) const res = await createOutlineV2({ query: data.answer })
markeDownAnswer.value = data.answer
let outline = JSON.stringify({ let outline = JSON.stringify({
json: res.outline, json: res.outline,
markdown: data.answer markdown: data.answer
}) })
Object.assign(curItem, {...curItem, outline}) Object.assign(curItem, {...curItem, outline})
emitter.emit('onResult', curItem) emitter.emit('onResult', curItem)
@ -131,47 +133,6 @@ const createAi = async () => {
} }
} }
//
// const editItem = reactive({})
// const editIndex = ref(0)
// const onEdit = (item, index)=>{
// let obj = null
// if(index == -1){
// obj = {
// title: answer.title,
// subTitle: answer.subTitle
// }
// }
// else{
// obj = cloneDeep(item)
// }
// editIndex.value = index
// isEdit.value = true
// Object.assign(editItem, obj)
// }
// emitter.on('editItem', (item) =>{
// if(editIndex.value == -1){
// answer.title = item.title
// answer.subTitle = item.subTitle
// }else{
// answer.chapters[editIndex.value] = item
// }
// let data = cloneDeep(curItem)
// data.outline = JSON.stringify(cloneDeep(answer))
// loading.value = true
// editSyllabus(data).then( res =>{
// curItem.outline = answer
// emitter.emit('onResult', curItem)
// ElMessage.success('')
// }).finally( ()=>{
// loading.value = false
// })
// })
// //
const onSaveTemp = async (outline) => { const onSaveTemp = async (outline) => {
let modelIds = selectedData.value.map(item => item.id).join(',') let modelIds = selectedData.value.map(item => item.id).join(',')
@ -206,8 +167,6 @@ const delAnswer = () => {
markeDownAnswer.value = '' markeDownAnswer.value = ''
emitter.emit('resetSelect') emitter.emit('resetSelect')
// window.location.reload();
}) })
.catch(() => {}) .catch(() => {})
@ -249,6 +208,14 @@ onMounted(() => {
// dataset_id // dataset_id
let jsonKey = `课标-${data.edustage}-${data.edusubject}` let jsonKey = `课标-${data.edustage}-${data.edusubject}`
params.dataset_id = commUtils.dataSetJson[jsonKey] params.dataset_id = commUtils.dataSetJson[jsonKey]
if(!params.dataset_id){
curMode.value = 1
modeOptions.value.forEach(item => {
if(item.value == 2){
item.disabled = true
}
})
}
// ID // ID
conversation_id.value = localStorage.getItem('conversation_id') conversation_id.value = localStorage.getItem('conversation_id')