lyc-dev #199
|
@ -119,3 +119,12 @@ export function docList(params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 保存教学大纲
|
||||||
|
export function addSyllabus(data) {
|
||||||
|
return request({
|
||||||
|
url: '/education/generate',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -395,7 +395,11 @@ export const dataSetJson = {
|
||||||
"课标-高中-英语": "e889fcac9fd011efb22a0242ac140006",
|
"课标-高中-英语": "e889fcac9fd011efb22a0242ac140006",
|
||||||
"课标-高中-数学": "e03aa4fe9fd011ef91270242ac140006",
|
"课标-高中-数学": "e03aa4fe9fd011ef91270242ac140006",
|
||||||
"课标-高中-地理": "270516829fd111efb13c0242ac140006",
|
"课标-高中-地理": "270516829fd111efb13c0242ac140006",
|
||||||
|
"课标-高中-物理": "3865b5afc68211ef90890242ac140002",
|
||||||
|
"课标-高中-化学": "013d0c52c68311ef84220242ac140002",
|
||||||
"课标-高中-政治": "a2f0b247b85d11ef84290242ac140005",
|
"课标-高中-政治": "a2f0b247b85d11ef84290242ac140005",
|
||||||
|
"教材-高中-物理": "3865b5afc68211ef90890242ac140002",
|
||||||
|
"教材-高中-化学": "013d0c52c68311ef84220242ac140002",
|
||||||
"教材-高中-语文": "cee3062a9fcf11efa6910242ac140006",
|
"教材-高中-语文": "cee3062a9fcf11efa6910242ac140006",
|
||||||
"教材-高中-生物": "fb5d01d59fd011ef9bb90242ac140006",
|
"教材-高中-生物": "fb5d01d59fd011ef9bb90242ac140006",
|
||||||
"教材-高中-历史": "f2f6c1fb9fd011ef98740242ac140006",
|
"教材-高中-历史": "f2f6c1fb9fd011ef98740242ac140006",
|
||||||
|
|
|
@ -25,10 +25,14 @@ import { sessionStore } from '@/utils/store'
|
||||||
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, tempResult, tempSave, removeChildTemp, editTempResult, modelList } from '@/api/mode/index.js'
|
import { completion, addSyllabus } from '@/api/mode/index.js'
|
||||||
import TypingEffect from '@/components/typing-effect/index.vue'
|
import TypingEffect from '@/components/typing-effect/index.vue'
|
||||||
|
import useUserStore from '@/store/modules/user'
|
||||||
|
|
||||||
const curMode = ref(2)
|
const curMode = ref(2)
|
||||||
|
|
||||||
|
const { user } = useUserStore()
|
||||||
|
|
||||||
const modeOptions = ref([
|
const modeOptions = ref([
|
||||||
{
|
{
|
||||||
label: '教学大模型',
|
label: '教学大模型',
|
||||||
|
@ -59,10 +63,13 @@ const params = reactive(
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const answer = ref('')
|
const answer = ref('')
|
||||||
const createAi = async ()=>{
|
const createAi = async ()=>{
|
||||||
|
console.log(selectedData.value)
|
||||||
if(selectedData.value.length == 0){
|
if(selectedData.value.length == 0){
|
||||||
ElMessage.warning('请先选择教学环节后再生成教学大纲')
|
ElMessage.warning('请先选择教学环节后再生成教学大纲')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
onSaveTemp()
|
||||||
|
return
|
||||||
let str = selectedData.value.map( item => item.name).join('、')
|
let str = selectedData.value.map( item => item.name).join('、')
|
||||||
let bookV = curNode.roottitle.split('-')[1] + '版'
|
let bookV = curNode.roottitle.split('-')[1] + '版'
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
@ -97,6 +104,30 @@ const createAi = async ()=>{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 保存模板
|
||||||
|
const onSaveTemp = async (data) => {
|
||||||
|
if (data == '') return
|
||||||
|
console.log(selectedData)
|
||||||
|
let modelIds = selectedData.value.map( item => item.id).join(',')
|
||||||
|
console.log(modelIds)
|
||||||
|
console.log(user)
|
||||||
|
const data1 = {
|
||||||
|
eduId: curNode.id,
|
||||||
|
outline: data,
|
||||||
|
outlineType: curMode.value == 1 ? 0 : 1,
|
||||||
|
modelIds,
|
||||||
|
sourceType: 1,
|
||||||
|
createUserId: 1
|
||||||
|
}
|
||||||
|
// const res = await addSyllabus(data)
|
||||||
|
|
||||||
|
if(!item.resultId){
|
||||||
|
item.resultId = res.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 去掉字符串中的 ### **
|
// 去掉字符串中的 ### **
|
||||||
let getResult = (str) => {
|
let getResult = (str) => {
|
||||||
let newStr = str.replace(/#+|(\*\*)/g, '');
|
let newStr = str.replace(/#+|(\*\*)/g, '');
|
||||||
|
|
|
@ -1,30 +1,39 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="container-left flex">
|
<div class="container-left flex" v-loading="loading">
|
||||||
<div class="left-header flex">
|
<div class="left-header flex">
|
||||||
<span>教学模式</span>
|
<span>教学模式</span>
|
||||||
<el-button type="primary" link @click="addVisible = true; addChild = false"><i class="iconfont icon-jiahao"
|
<div>
|
||||||
|
<el-button type="primary" link @click="resetSelect">重置</el-button>
|
||||||
|
<el-button type="primary" link @click="addVisible = true; addChild = false; isEdit = false"><i class="iconfont icon-jiahao"
|
||||||
></i>新增</el-button>
|
></i>新增</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="left-list">
|
<div class="left-list">
|
||||||
<div class="item" v-for="item in templateList" :key="item.id">
|
<div class="item" v-for="item in templateList" :key="item.id">
|
||||||
<div class="item-name flex" @mouseenter="item.isAdd = true" @mouseleave="item.isAdd = false"
|
<div class="item-name flex" @mouseenter="item.isAdd = true" @mouseleave="item.isAdd = false"
|
||||||
@click="handleItem(item)">
|
@click="handleItem(item)">
|
||||||
|
<div class="flex">
|
||||||
<span>{{ item.name }}</span>
|
<span>{{ item.name }}</span>
|
||||||
<i v-show="item.isAdd && !item.isSelect && !item.newMode" class="iconfont icon-jiahao"></i>
|
<!--个人教学模式才会有添加、编辑-->
|
||||||
<i v-show="item.isSelect" class="iconfont icon-zuixiaohua"></i>
|
<div v-if="!item.ex3" class="ml-3">
|
||||||
<!--新增的教学模式才会有添加、编辑-->
|
<el-button type="primary" link @click.stop="addModeChild(item)">添加</el-button>
|
||||||
<template v-if="item.newMode">
|
<el-button type="primary" link @click.stop="editMode(item)">编辑</el-button>
|
||||||
<div>
|
|
||||||
<el-button type="primary" link @click="addModeChild">添加</el-button>
|
|
||||||
<el-button type="primary" link @click="editMode(item)">编辑</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</div>
|
||||||
|
<!--加号 数鼠标悬浮 显示-->
|
||||||
|
<i v-show="item.isAdd && !item.isSelect" class="iconfont icon-jiahao"></i>
|
||||||
|
<!--减号 选中之后显示-->
|
||||||
|
<i v-show="item.isSelect" class="iconfont icon-zuixiaohua"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-child flex" :class="el.isSelect ? 'act-child' : ''" v-for="el in item.child" :key="el.id"
|
<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)">
|
@mouseenter="el.isAdd = true" @mouseleave="el.isAdd = false" @click="handleItemChild(el)">
|
||||||
|
<div>
|
||||||
<span>{{ el.name }}</span>
|
<span>{{ el.name }}</span>
|
||||||
|
<!--个人教学模式才会有编辑-->
|
||||||
|
<el-button v-if="!el.ex3" class="ml-3" type="primary" link @click.stop="editMode(el)">编辑</el-button>
|
||||||
|
</div>
|
||||||
<i v-show="el.isAdd && !el.isSelect" class="iconfont icon-jiahao"></i>
|
<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="el.isSelect" class="iconfont icon-zuixiaohua "></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -40,10 +49,13 @@
|
||||||
<el-form ref="ruleFormRef" style="max-width: 600px" :model="ruleForm" :rules="rules" label-width="auto"
|
<el-form ref="ruleFormRef" style="max-width: 600px" :model="ruleForm" :rules="rules" label-width="auto"
|
||||||
class="demo-ruleForm">
|
class="demo-ruleForm">
|
||||||
<el-form-item :label="`教学${ addChild ? '环节' : '模式'}名称`" prop="name">
|
<el-form-item :label="`教学${ addChild ? '环节' : '模式'}名称`" prop="name">
|
||||||
|
<div class="flex" style="width: 100%;">
|
||||||
<el-input v-model="ruleForm.name" />
|
<el-input v-model="ruleForm.name" />
|
||||||
|
<el-button v-if="isEdit" link type="danger" class="ml-5 mr-3" @click="onDel">删除</el-button>
|
||||||
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="说明" v-if="addChild">
|
<el-form-item label="说明" v-if="addChild" prop="prompt">
|
||||||
<el-input v-model="ruleForm.desc" type="textarea" />
|
<el-input v-model="ruleForm.prompt" type="textarea" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div class="mt-10 form-btn">
|
<div class="mt-10 form-btn">
|
||||||
|
@ -60,7 +72,11 @@ import { ref, reactive, onMounted } from 'vue'
|
||||||
import { modelList } from '@/api/mode/index'
|
import { modelList } from '@/api/mode/index'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import { sessionStore } from '@/utils/store'
|
import { sessionStore } from '@/utils/store'
|
||||||
import emitter from '@/utils/mitt';
|
import emitter from '@/utils/mitt'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import { addChildTemp, editChildTemp, removeChildTemp } from '@/api/mode'
|
||||||
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
|
|
||||||
const { user } = useUserStore()
|
const { user } = useUserStore()
|
||||||
|
|
||||||
|
@ -80,15 +96,14 @@ const getTemplate = async (id) => {
|
||||||
// 获取子模板
|
// 获取子模板
|
||||||
const templateList = ref([])
|
const templateList = ref([])
|
||||||
const getChildTemp = async () => {
|
const getChildTemp = async () => {
|
||||||
templateList.length = 0
|
templateList.value = []
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
||||||
for (let item of list.value) {
|
for (let item of list.value) {
|
||||||
try {
|
try {
|
||||||
let { rows } = await modelList({ model: 4, type: 2, parentId: item.id })
|
let { rows } = await modelList({ model: 4, type: 2, parentId: item.id })
|
||||||
templateList.value.push({
|
templateList.value.push({
|
||||||
name: item.name,
|
...item,
|
||||||
id: item.id,
|
|
||||||
child: rows
|
child: rows
|
||||||
})
|
})
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -97,6 +112,16 @@ const getChildTemp = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重置选中
|
||||||
|
const resetSelect = () =>{
|
||||||
|
templateList.value.forEach(item =>{
|
||||||
|
item.isSelect = false
|
||||||
|
item.child.forEach( el=>{
|
||||||
|
el.isSelect = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const handleItem = (item) => {
|
const handleItem = (item) => {
|
||||||
if(item.newMode) return
|
if(item.newMode) return
|
||||||
item.isSelect = !item.isSelect
|
item.isSelect = !item.isSelect
|
||||||
|
@ -110,7 +135,6 @@ const handleItem = (item) => {
|
||||||
|
|
||||||
const handleItemChild = (el) =>{
|
const handleItemChild = (el) =>{
|
||||||
el.isSelect = !el.isSelect
|
el.isSelect = !el.isSelect
|
||||||
console.log(templateList.value)
|
|
||||||
|
|
||||||
let data = collectSelectedItems(templateList.value)
|
let data = collectSelectedItems(templateList.value)
|
||||||
emitter.emit('selected', data)
|
emitter.emit('selected', data)
|
||||||
|
@ -152,40 +176,94 @@ const rules = reactive({
|
||||||
})
|
})
|
||||||
const ruleForm = reactive({
|
const ruleForm = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
desc: ''
|
prompt: ''
|
||||||
})
|
})
|
||||||
|
// 提交
|
||||||
const onSubmit = async (formEl) =>{
|
const onSubmit = async (formEl) =>{
|
||||||
if (!formEl) return
|
if (!formEl) return
|
||||||
await formEl.validate((valid, fields) => {
|
await formEl.validate(async (valid, fields) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
templateList.value.push({
|
|
||||||
id: + new Date(),
|
// 修改
|
||||||
|
if(isEdit.value){
|
||||||
|
let data = cloneDeep(curEditItem)
|
||||||
|
data.name = ruleForm.name
|
||||||
|
await editChildTemp(data)
|
||||||
|
}
|
||||||
|
// 新增
|
||||||
|
else{
|
||||||
|
let obj = {
|
||||||
|
ex1: curNode.edustage,
|
||||||
|
ex2: curNode.edusubject,
|
||||||
|
model: 4,
|
||||||
name: ruleForm.name,
|
name: ruleForm.name,
|
||||||
newMode: true
|
sortNum: 1,
|
||||||
})
|
type: 1
|
||||||
|
}
|
||||||
|
// 新增教学环节
|
||||||
|
if(addChild.value){
|
||||||
|
obj.parentId = curEditItem.id
|
||||||
|
obj.prompt = ruleForm.prompt
|
||||||
|
obj.type = 2
|
||||||
|
}
|
||||||
|
await addChildTemp(obj)
|
||||||
|
|
||||||
|
}
|
||||||
|
ElMessage.success('操作成功')
|
||||||
resetForm()
|
resetForm()
|
||||||
addVisible.value = false
|
addVisible.value = false
|
||||||
|
getTemplate()
|
||||||
} else {
|
} else {
|
||||||
console.log('error submit!', fields)
|
console.log('error submit!', fields)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 是否编辑
|
||||||
|
const isEdit = ref(false)
|
||||||
|
// 区分是新增教学模式false 还是现在教学环节true
|
||||||
const addChild = ref(false)
|
const addChild = ref(false)
|
||||||
const addModeChild = () =>{
|
|
||||||
|
const curEditItem = reactive({})
|
||||||
|
const addModeChild = (item) =>{
|
||||||
|
isEdit.value = false
|
||||||
|
Object.assign(curEditItem, item)
|
||||||
addChild.value = true
|
addChild.value = true
|
||||||
addVisible.value = true
|
addVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
const editMode = (item)=>{
|
const editMode = (item)=>{
|
||||||
|
isEdit.value = true
|
||||||
addChild.value = false
|
addChild.value = false
|
||||||
|
Object.assign(curEditItem, item)
|
||||||
ruleForm.name = item.name
|
ruleForm.name = item.name
|
||||||
addVisible.value = true
|
addVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除 教学模式 教学环节
|
||||||
|
const onDel = () =>{
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'确定要删除模板吗?',
|
||||||
|
'温馨提示',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(async () => {
|
||||||
|
await removeChildTemp(curEditItem.id)
|
||||||
|
ElMessage.success('操作成功')
|
||||||
|
resetForm()
|
||||||
|
addVisible.value = false
|
||||||
|
getTemplate()
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const closeDialog = () =>{
|
const closeDialog = () =>{
|
||||||
handleBeforeClose(() => addVisible.value = false);
|
handleBeforeClose(() => addVisible.value = false);
|
||||||
}
|
}
|
||||||
|
@ -245,7 +323,7 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-child {
|
.item-child {
|
||||||
text-indent: 3em;
|
padding-left: 3em;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="page-design">
|
<div class="page-design flex">
|
||||||
<!-- <div class="page-left">
|
<div class="page-left">
|
||||||
|
|
||||||
<left />
|
<left />
|
||||||
</div>
|
</div>
|
||||||
<div class="page-right">
|
<div class="page-right">
|
||||||
|
|
||||||
<right />
|
<right />
|
||||||
</div> -->
|
</div>
|
||||||
<el-row :gutter="20">
|
<!-- <el-row :gutter="20">
|
||||||
<el-col :span="5">
|
<el-col :span="5">
|
||||||
<!-- <div style="background:#ccc">1</div> -->
|
|
||||||
<Left/>
|
<Left/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="13">
|
<el-col :span="13">
|
||||||
|
@ -19,27 +18,37 @@
|
||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
<Right/>
|
<Right/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row> -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
// import left from './container/left.vue';
|
import left from './container/left.vue';
|
||||||
// import right from './container/right.vue';
|
import right from './container/right.vue';
|
||||||
import Left from './container/left2.vue'
|
// import Left from './container/left2.vue'
|
||||||
import Center from './container/center.vue'
|
// import Center from './container/center.vue'
|
||||||
import Right from './container/right2.vue'
|
// import Right from './container/right2.vue'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
// .page-design {
|
||||||
|
// height: 100%;
|
||||||
|
// .el-row{
|
||||||
|
// height: 100%;
|
||||||
|
// .el-col{
|
||||||
|
// height: 100%;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
.page-design {
|
.page-design {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
.el-row{
|
.page-left{
|
||||||
height: 100%;
|
width: 50%;
|
||||||
.el-col{
|
|
||||||
height: 100%;
|
|
||||||
}
|
}
|
||||||
|
.page-right{
|
||||||
|
width: 50%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue