lyc-dev #223
|
@ -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) {
|
||||
return request({
|
||||
|
|
|
@ -2,34 +2,44 @@
|
|||
<el-dialog v-model="isDialog" :show-close="false" width="900" append-to-body destroy-on-close>
|
||||
<template #header>
|
||||
<div class="custom-header flex">
|
||||
<span>选择{{ title }}</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">
|
||||
<div class="content-list">
|
||||
<ul>
|
||||
<li v-for="(item, index) in fileList" :class="activeIndex == index ? 'li-active' : ''"
|
||||
@click="clickItem(index, item)">
|
||||
<el-image class="img" :src="url" />
|
||||
<el-button type="primary" class="prev-btn" @click.stop="onPrevItem(item)">预览</el-button>
|
||||
<el-text truncated>{{ item.fileName }}</el-text>
|
||||
</li>
|
||||
</ul>
|
||||
<el-radio-group v-model="curFileId">
|
||||
<el-row>
|
||||
<el-col :span="12" v-for="item in fileList" :key="item.id">
|
||||
<el-radio :value="item.id">
|
||||
<el-text class="w-50" truncated>{{ item.fileName }}</el-text>
|
||||
<div class="flex items-center">
|
||||
<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>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-upload class="upload-demo" :action="uploadFileUrl" :limit="1" :show-file-list="false" :headers="headers"
|
||||
:on-success="onSuccess">
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
:action="uploadFileUrl"
|
||||
:limit="1"
|
||||
:show-file-list="false"
|
||||
:headers="headers"
|
||||
:on-success="onSuccess"
|
||||
>
|
||||
<el-button type="primary">上传</el-button>
|
||||
</el-upload>
|
||||
<div>
|
||||
<el-button @click="isDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="isDialog = false">
|
||||
确定
|
||||
</el-button>
|
||||
<el-button type="primary" @click="handleDialog"> 确定 </el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -41,21 +51,18 @@
|
|||
<i class="iconfont icon-guanbi" @click="prevVisible = false"></i>
|
||||
</div>
|
||||
</template>
|
||||
<div style="height: calc(100vh - 120px);">
|
||||
<div style="height: calc(100vh - 120px)">
|
||||
<template v-if="getFileSuffix(prevItem.fileUrl) == 'pdf'">
|
||||
<iframe :src="prevItem.fileUrl"
|
||||
frameborder="0" width="100%" height="100%"></iframe>
|
||||
<iframe :src="prevItem.fileUrl" frameborder="0" width="100%" height="100%"></iframe>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-image :src="prevItem.fileUrl" style="height:100%"/>
|
||||
<el-image :src="prevItem.fileUrl" style="height: 100%" />
|
||||
</template>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<div></div>
|
||||
<el-button type="primary" @click="prevVisible = false">
|
||||
关闭
|
||||
</el-button>
|
||||
<el-button type="primary" @click="prevVisible = false"> 关闭 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
@ -63,20 +70,19 @@
|
|||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, reactive } from 'vue'
|
||||
import { completion, addDoc, docList } from '@/api/mode/index.js'
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { completion, addDoc, docList, removeDoc } from '@/api/mode/index.js'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { dataSetJson } from '@/utils/comm.js'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
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 uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload");
|
||||
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 uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + '/common/upload')
|
||||
const headers = ref({ Authorization: 'Bearer ' + getToken() })
|
||||
|
||||
const isDialog = defineModel()
|
||||
const prevVisible = ref(false)
|
||||
|
@ -88,36 +94,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 radioList = ref([
|
||||
{ label: '浏览研读', value: 1 },
|
||||
{ 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 isPrev = (item) => {
|
||||
return computed(() => {
|
||||
return ['pdf', 'png', 'jpg', 'jpeg', 'gif'].includes(getFileSuffix(item.fileUrl))
|
||||
})
|
||||
}
|
||||
}
|
||||
const activeIndex = ref(0)
|
||||
|
||||
const curFileId = ref(0)
|
||||
|
||||
const dataset_id = ref('')
|
||||
|
||||
|
@ -143,43 +127,77 @@ const onSuccess = async (response) => {
|
|||
const { msg } = await addDoc(docData)
|
||||
ElMessage.success(msg)
|
||||
getList()
|
||||
|
||||
}
|
||||
const curNode = reactive({})
|
||||
|
||||
// 获取doc ai 文档列表
|
||||
const fileList = ref([])
|
||||
const curFile = reactive({})
|
||||
const getList = () => {
|
||||
docList({
|
||||
userId: userInfo.userId,
|
||||
dataset_id: dataset_id.value
|
||||
}).then(res => {
|
||||
}).then((res) => {
|
||||
fileList.value = [...res.rows]
|
||||
Object.assign(curFile, fileList.value[0])
|
||||
curFileId.value = fileList.value[0].id
|
||||
})
|
||||
}
|
||||
|
||||
const clickItem = (index, item) => {
|
||||
activeIndex.value = index
|
||||
Object.assign(curFile, item)
|
||||
emitter.emit('changeCurFile', item)
|
||||
|
||||
// 删除
|
||||
const loading = ref(false)
|
||||
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 onPrevItem = (item) => {
|
||||
Object.assign(prevItem, item)
|
||||
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(() => {
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, data);
|
||||
Object.assign(curNode, data)
|
||||
// 暂时写死"考试-" 目前只有考试分析才会弹出来
|
||||
let jsonKey = `考试-${curNode.edustage}-${curNode.edusubject}`
|
||||
dataset_id.value = dataSetJson[jsonKey]
|
||||
getList()
|
||||
})
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.custom-header {
|
||||
|
@ -198,45 +216,6 @@ onMounted(() => {
|
|||
.content-list {
|
||||
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 +225,7 @@ onMounted(() => {
|
|||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.prev-btn {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) translateY(-110px);
|
||||
/* 按钮初始位置在容器外 */
|
||||
transition: transform 0.3s ease-in-out;
|
||||
/* 设置过渡效果 */
|
||||
:deep(.el-radio__label) {
|
||||
display: flex;
|
||||
}
|
||||
</style>
|
|
@ -2,8 +2,9 @@
|
|||
<div class="container-left-page flex">
|
||||
<div class="container-left-header flex">
|
||||
<el-button link @click="onClick">
|
||||
{{ curNode.edustage }}{{ curNode.edusubject }}{{ type == 1 ? '课标研读' : type == 2 ? '教材分析' : '考试分析' }}<i
|
||||
class="iconfont icon-xiangxia"></i>
|
||||
{{ curNode.edustage }}{{ curNode.edusubject
|
||||
}}{{ type == 1 ? '课标研读' : type == 2 ? '教材分析' : '考试分析'
|
||||
}}<i v-if="type == 3" class="iconfont icon-xiangxia"></i>
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="container-left-pdf">
|
||||
|
@ -20,6 +21,7 @@ import { ref, onMounted, nextTick, reactive } from 'vue'
|
|||
import { sessionStore } from '@/utils/store'
|
||||
import PDF from '@/components/PdfJs/index.vue'
|
||||
import LeftDialog from './left-dialog.vue'
|
||||
import emitter from '@/utils/mitt'
|
||||
|
||||
const props = defineProps(['type'])
|
||||
|
||||
|
@ -29,6 +31,12 @@ const onClick = () => {
|
|||
showDialog.value = true
|
||||
}
|
||||
|
||||
emitter.on('changePdfUrl', async (data) => {
|
||||
pdfUrl.value = ''
|
||||
await nextTick()
|
||||
pdfUrl.value = data.fileUrl
|
||||
})
|
||||
|
||||
// 加载PDF
|
||||
const pdfUrl = ref('')
|
||||
const curNode = reactive({})
|
||||
|
@ -36,16 +44,15 @@ onMounted(async () => {
|
|||
await nextTick()
|
||||
// 当前节点
|
||||
let nodeData = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, nodeData);
|
||||
Object.assign(curNode, nodeData)
|
||||
|
||||
let data = sessionStore.get('subject.curBook')
|
||||
let fileurl = data.fileurl
|
||||
if(props.type == 1){
|
||||
if (props.type == 1) {
|
||||
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')
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -53,6 +60,7 @@ onMounted(async () => {
|
|||
.container-left-page {
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
|
||||
.container-left-header {
|
||||
height: 45px;
|
||||
background: #fff;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</el-dropdown>
|
||||
<div class="flex">
|
||||
<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-button type="danger" link :disabled="!(templateList.length)" @click="removeItem(curTemplate, false)">
|
||||
删除
|
||||
|
@ -104,6 +104,12 @@ import { cloneDeep } from 'lodash'
|
|||
const props = defineProps(['type'])
|
||||
const { user } = useUserStore()
|
||||
|
||||
const params = reactive(
|
||||
{
|
||||
prompt: '',
|
||||
dataset_id: ''
|
||||
}
|
||||
)
|
||||
const curMode = ref(2)
|
||||
const modeOptions = ref([
|
||||
{
|
||||
|
@ -112,7 +118,8 @@ const modeOptions = ref([
|
|||
},
|
||||
{
|
||||
label: '知识库模型',
|
||||
value: 2
|
||||
value: 2,
|
||||
disabled: false
|
||||
}
|
||||
])
|
||||
|
||||
|
@ -288,12 +295,7 @@ const onEdit = (index, item) => {
|
|||
}
|
||||
|
||||
// 重新研读
|
||||
const params = reactive(
|
||||
{
|
||||
prompt: '',
|
||||
dataset_id: ''
|
||||
}
|
||||
)
|
||||
|
||||
const prompt = ref('')
|
||||
|
||||
// 重新研读
|
||||
|
@ -483,7 +485,18 @@ onMounted(() => {
|
|||
|
||||
getTemplateList()
|
||||
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
||||
|
||||
|
||||
params.dataset_id = dataSetJson[jsonKey]
|
||||
if(!params.dataset_id){
|
||||
curMode.value = 1
|
||||
modeOptions.value.forEach(item => {
|
||||
if(item.value == 2){
|
||||
item.disabled = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 获取百度千帆会话ID
|
||||
conversation_id.value = localStorage.getItem('conversation_id')
|
||||
if (!conversation_id.value) {
|
||||
|
|
|
@ -22,24 +22,22 @@
|
|||
<el-empty v-else description="请选择符合您需要的教学模式,生成教学大纲" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- <EditDialog v-model="isEdit" :item="editItem" :index="editIndex" /> -->
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, onUnmounted } from 'vue'
|
||||
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, 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 useUserStore from '@/store/modules/user'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
const curMode = ref(2)
|
||||
const isEdit = ref(false)
|
||||
|
||||
const { user } = useUserStore()
|
||||
|
||||
|
@ -50,7 +48,8 @@ const modeOptions = ref([
|
|||
},
|
||||
{
|
||||
label: '知识库模型',
|
||||
value: 2
|
||||
value: 2,
|
||||
disabled: false
|
||||
}
|
||||
])
|
||||
|
||||
|
@ -134,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) => {
|
||||
let modelIds = selectedData.value.map(item => item.id).join(',')
|
||||
|
@ -209,8 +167,6 @@ const delAnswer = () => {
|
|||
markeDownAnswer.value = ''
|
||||
|
||||
emitter.emit('resetSelect')
|
||||
|
||||
// window.location.reload();
|
||||
})
|
||||
.catch(() => {})
|
||||
|
||||
|
@ -252,6 +208,14 @@ onMounted(() => {
|
|||
// 框架设计 用课标的dataset_id
|
||||
let jsonKey = `课标-${data.edustage}-${data.edusubject}`
|
||||
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
|
||||
conversation_id.value = localStorage.getItem('conversation_id')
|
||||
|
|
Loading…
Reference in New Issue