Compare commits
No commits in common. "23e59531ea84c346537eb19cba6d3dfb0eaab7e3" and "8d03c927b91f2951d17358896ff1780a0411b7a2" have entirely different histories.
23e59531ea
...
8d03c927b9
|
@ -16,9 +16,4 @@ VITE_APP_RES_FILE_PATH = 'https://file.ysaix.com:7868/src/assets/textbook/booktx
|
|||
|
||||
VITE_APP_BUILD_BASE_PATH = 'https://file.ysaix.com:7868/'
|
||||
|
||||
# websocket 地址
|
||||
# VITE_APP_WS_URL = 'wss://file.ysaix.com:7868'
|
||||
VITE_APP_WS_URL = 'ws://192.168.2.16:7865'
|
||||
|
||||
# 是否显示开发工具
|
||||
VITE_SHOW_DEV_TOOLS = 'true'
|
||||
|
|
|
@ -18,8 +18,4 @@ VITE_APP_RES_FILE_PATH = 'https://prev.ysaix.com:7868/src/assets/textbook/booktx
|
|||
|
||||
VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/'
|
||||
|
||||
# websocket 地址
|
||||
VITE_APP_WS_URL = 'wss://file.ysaix.com:7868'
|
||||
|
||||
# 是否显示开发工具
|
||||
VITE_SHOW_DEV_TOOLS = 'false'
|
||||
|
|
|
@ -34,7 +34,7 @@ export default defineConfig({
|
|||
'/dev-api': {
|
||||
target: 'http://27.128.240.72:7865',
|
||||
// target: 'http://36.134.181.164:7863',
|
||||
// target: 'http://192.168.0.102:7865',
|
||||
// target: 'http://192.168.2.52:7863',
|
||||
changeOrigin: true,
|
||||
rewrite: (p) => p.replace(/^\/dev-api/, '')
|
||||
},
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
declare module '*.vue' {
|
||||
import { ComponentOptions } from 'vue'
|
||||
const componentOptions: ComponentOptions
|
||||
export default componentOptions
|
||||
}
|
|
@ -57,7 +57,6 @@
|
|||
"file-saver": "^2.0.5",
|
||||
"hfmath": "^0.0.2",
|
||||
"html-to-image": "^1.11.11",
|
||||
"html2canvas": "^1.4.1",
|
||||
"im_electron_sdk": "^8.0.5904",
|
||||
"js-cookie": "^3.0.5",
|
||||
"jsencrypt": "^3.3.2",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
|
||||
/> -->
|
||||
<meta http-equiv="Content-Security-Policy" content="connect-src * blob: data:; default-src 'self' https://wzyzoss.eos-chongqing-3.cmecloud.cn/; script-src 'self' 'unsafe-eval' http://www.wiris.net 'unsafe-inline'; style-src 'self' 'unsafe-inline' http://www.wiris.net; media-src * blob:;img-src * 'self' data: blob:;font-src 'self' http://www.wiris.net;" />
|
||||
<meta http-equiv="Content-Security-Policy" content="connect-src * blob: data:; default-src 'self'; script-src 'self' 'unsafe-eval' http://www.wiris.net 'unsafe-inline'; style-src 'self' 'unsafe-inline' http://www.wiris.net; media-src * blob:;img-src * 'self' data: blob:;font-src 'self' http://www.wiris.net;" />
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关ap
|
|||
import { PPTApi } from './api'
|
||||
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
||||
import './api/watcher' // 监听
|
||||
import './api/classcourse' // 课程相关
|
||||
|
||||
const loading = ref(true)
|
||||
const _isPC = isPC()
|
||||
|
@ -61,6 +60,14 @@ window.addEventListener('unload', () => {
|
|||
const newDiscardedDB = JSON.stringify(discardedDBList)
|
||||
localStorage.setItem(LOCALSTORAGE_KEY_DISCARDED_DB, newDiscardedDB)
|
||||
})
|
||||
/** 接口类型 */
|
||||
interface Result {
|
||||
code?: number,
|
||||
msg?: string,
|
||||
data?: any
|
||||
rows?: Array<any>,
|
||||
total?: number
|
||||
}
|
||||
// 获取参数
|
||||
const initLoad: Function = () => {
|
||||
// 获取缓存的ppt 资源数据
|
||||
|
@ -82,8 +89,5 @@ const initLoad: Function = () => {
|
|||
<style lang="scss">
|
||||
#app {
|
||||
height: 100%;
|
||||
svg, canvas, img, audio, video, iframe {
|
||||
display: unset;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
* @author zdg
|
||||
* @description 上课相关内容
|
||||
*/
|
||||
import type { Classcourse } from './types'
|
||||
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
||||
import * as useStore from '../store' // pptist-状态管理
|
||||
import { ChatWs } from '@/plugins/socket' // 聊天socket
|
||||
const screenStore = useStore.useScreenStore() // 全屏-状态管理
|
||||
const classcourseStore = useStore.useClasscourseStore() // 课堂信息-状态管理
|
||||
const classcourse: Classcourse = sessionStore.get('curr.classcourse') // 课堂信息
|
||||
|
||||
// 如果课堂信息有值,则连接socket
|
||||
if (!!classcourse) {
|
||||
// 连接socket
|
||||
const ws = new ChatWs()
|
||||
console.log('ws- ',ws)
|
||||
// ChatWs.connect(classcourse.id)
|
||||
classcourseStore.setClasscourse(classcourse)
|
||||
}
|
||||
// 打开全屏
|
||||
screenStore.setScreening(!!classcourse)
|
|
@ -4,7 +4,6 @@
|
|||
* @date 2024-11-26
|
||||
*/
|
||||
import { toRaw } from 'vue'
|
||||
import type { Result } from './types' // 接口类型
|
||||
import msgUtils from '@/plugins/modal' // 消息工具
|
||||
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
||||
import * as API_smarttalk from '@/api/file' // 相关api
|
||||
|
@ -136,15 +135,13 @@ export class PPTApi {
|
|||
id: currentSlide.id,
|
||||
datacontent: JSON.stringify(currentSlide),
|
||||
}
|
||||
Utils.mxThrottle(() => {this.updateSlide(params)}, 200, 2)
|
||||
Utils.mxThrottle(() => {this.updateSlide(params)}, 1000, 2)
|
||||
}
|
||||
}
|
||||
// 更新幻灯片
|
||||
static updateSlide(data: object): Promise<Boolean> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data)
|
||||
console.log(data,'data');
|
||||
console.log(res,'dresata');
|
||||
if (res.code === 200) {
|
||||
resolve(true)
|
||||
} else msgUtils.msgError(res.msg || '更新失败');resolve(false)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* @description api 无store循环引用
|
||||
* @author zdg
|
||||
*/
|
||||
import type { Result } from './types' // 接口类型
|
||||
import msgUtils from '@/plugins/modal' // 消息工具
|
||||
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
||||
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/** 返回-接口类型 */
|
||||
export interface Result {
|
||||
code?: number,
|
||||
msg?: string,
|
||||
data?: any
|
||||
rows?: Array<any>,
|
||||
total?: number
|
||||
}
|
||||
|
||||
/** 课程信息 */
|
||||
export interface Classcourse {
|
||||
id?: number|string, // 课程id
|
||||
coursetitle?: string, // 课程名称
|
||||
coursetype?: string, // 课程类型
|
||||
courseverid?: string, // 课程版本id
|
||||
coursedesc?: string, // 课程描述
|
||||
status?: number, // 课程状态
|
||||
teacherid?: number|string, // 教师id
|
||||
entpcoursefileid?: number|string, // 课程文件id
|
||||
classid?: number|string, // 班级id
|
||||
entpcourseid?: number|string, // 章节中间表id
|
||||
plandate?: string, // 计划时间
|
||||
opendate?: string, // 开课时间
|
||||
}
|
|
@ -1,10 +1,9 @@
|
|||
import { useScreenStore, useSlidesStore, useClasscourseStore } from '../store'
|
||||
import { useScreenStore, useSlidesStore } from '../store'
|
||||
import { enterFullscreen, exitFullscreen, isFullscreen } from '../utils/fullscreen'
|
||||
|
||||
export default () => {
|
||||
const screenStore = useScreenStore()
|
||||
const slidesStore = useSlidesStore()
|
||||
const classcourseStore = useClasscourseStore() // 课堂信息
|
||||
|
||||
// 进入放映状态(从当前页开始)
|
||||
const enterScreening = () => {
|
||||
|
@ -20,11 +19,7 @@ export default () => {
|
|||
|
||||
// 退出放映状态
|
||||
const exitScreening = () => {
|
||||
const classcourse = classcourseStore.classcourse
|
||||
if (!!classcourse) { //DOTO 有课堂,执行退相关操作
|
||||
console.log('退出放映状态')
|
||||
window.close()
|
||||
} else screenStore.setScreening(false)
|
||||
screenStore.setScreening(false)
|
||||
if (isFullscreen()) exitFullscreen()
|
||||
}
|
||||
|
||||
|
|
|
@ -125,8 +125,6 @@ import {
|
|||
User,
|
||||
Switch,
|
||||
More,
|
||||
Material,
|
||||
AddPicture
|
||||
} from '@icon-park/vue-next'
|
||||
|
||||
export interface Icons {
|
||||
|
@ -257,8 +255,6 @@ export const icons: Icons = {
|
|||
IconUser: User,
|
||||
IconSwitch: Switch,
|
||||
IconMore: More,
|
||||
IconMaterial: Material,
|
||||
IconAddPicture: AddPicture
|
||||
}
|
||||
|
||||
export default {
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import type { Classcourse } from '../api/types'
|
||||
|
||||
export interface ClasscourseState {
|
||||
classcourse: Classcourse
|
||||
}
|
||||
|
||||
export const useClasscourseStore = defineStore('classcourse', {
|
||||
state: (): ClasscourseState => ({
|
||||
classcourse: null, // 课堂信息
|
||||
}),
|
||||
|
||||
actions: {
|
||||
setClasscourse(classcourse: Classcourse) {
|
||||
this.classcourse = classcourse
|
||||
},
|
||||
},
|
||||
})
|
|
@ -3,7 +3,6 @@ import { useSlidesStore } from './slides'
|
|||
import { useSnapshotStore } from './snapshot'
|
||||
import { useKeyboardStore } from './keyboard'
|
||||
import { useScreenStore } from './screen'
|
||||
import { useClasscourseStore } from './classcourse'
|
||||
|
||||
export {
|
||||
useMainStore,
|
||||
|
@ -11,5 +10,4 @@ export {
|
|||
useSnapshotStore,
|
||||
useKeyboardStore,
|
||||
useScreenStore,
|
||||
useClasscourseStore,
|
||||
}
|
|
@ -1,172 +0,0 @@
|
|||
<template>
|
||||
<header class="flex material-header">
|
||||
<span>选择素材</span>
|
||||
<i class="iconfont icon-guanbi" @click="onClose"></i>
|
||||
</header>
|
||||
<div class="flex material-list" v-loading="loading">
|
||||
<div class="flex material-item" v-for="item in list" :key="item.id" >
|
||||
<div class="flex">
|
||||
<el-image :src="fileUrl(item)" class="img" />
|
||||
<el-text truncated>{{ item.fileShowName }}</el-text>
|
||||
</div>
|
||||
<el-button type="primary" @click="onInsert(item)">插入</el-button>
|
||||
</div>
|
||||
<el-empty description="暂无素材" v-if="!list.length" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, computed } from 'vue';
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { getSmarttalkPage } from '@/api/file'
|
||||
import { getFileSuffix, urlToBase64 } from '@/utils/ruoyi.js'
|
||||
|
||||
const emit = defineEmits(['insertMaterial', 'close'])
|
||||
|
||||
const curNode = reactive({})
|
||||
let params = {
|
||||
textbookId: '',
|
||||
levelFirstId: '',
|
||||
levelSecondId: null,
|
||||
fileSource: '个人',
|
||||
fileRoot: '备课',
|
||||
orderByColumn: 'uploadTime',
|
||||
isAsc: 'desc',
|
||||
pageSize: 500
|
||||
}
|
||||
|
||||
const suffixAry = [ 'jpeg','jpg','png','gif','mp3','mp4','avi','mov']
|
||||
const videoSuffix = ['mp3','mp4','avi','mov']
|
||||
const list = ref([])
|
||||
const loading = ref(false)
|
||||
const init = () => {
|
||||
loading.value = true
|
||||
getSmarttalkPage(params).then(res => {
|
||||
loading.value = false
|
||||
if(res.rows && res.rows.length){
|
||||
// 过滤出图片和视频
|
||||
list.value = res.rows.filter( item => suffixAry.indexOf(getFileSuffix(item.fileShowName)) != -1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const fileUrl = computed(() => (item) =>{
|
||||
if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){
|
||||
return item.coverPic
|
||||
}
|
||||
else{
|
||||
return item.fileFullPath
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// 插入
|
||||
const onInsert = async (item) =>{
|
||||
if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){
|
||||
emit('insertMaterial',{ type: 'video', data: item.fileFullPath })
|
||||
}
|
||||
else{
|
||||
const base64 = await urlToBase64(item.fileFullPath)
|
||||
emit('insertMaterial',{ type: 'img', data: base64 })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const GetUrlParameters = (parameters) => {
|
||||
let resData = "";
|
||||
|
||||
let url = document.location.toString();
|
||||
let arrUrl = url.split("?");
|
||||
// 判断是否有参数
|
||||
if (arrUrl.length > 1) {
|
||||
// 拆分参数字符串
|
||||
let parametersArr = arrUrl[1].split("&");
|
||||
// 循环查找参数
|
||||
for (let i = 0; i <= parametersArr.length; i++) {
|
||||
if (parametersArr[i]) {
|
||||
// 拆分参数的键和值
|
||||
let parameterStr = parametersArr[i].split("=");
|
||||
if (parameters == parameterStr[0]) {
|
||||
resData = parameterStr[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return resData;
|
||||
}
|
||||
|
||||
const proxyToBase64 = (url)=> {
|
||||
const dourl = GetUrlParameters(url)
|
||||
console.log(dourl,'dourl')
|
||||
return
|
||||
axios({
|
||||
url: "/api/logo.png",
|
||||
method: "get",
|
||||
responseType: "blob",
|
||||
}).then((res) => {
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(res.data);
|
||||
reader.onload = () => {
|
||||
console.log(reader.result);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 关闭
|
||||
const onClose = () =>{
|
||||
emit('close')
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, data);
|
||||
params.textbookId = curNode.rootid
|
||||
if (curNode.parentNode) {
|
||||
params.levelFirstId = curNode.parentNode.id
|
||||
params.levelSecondId = curNode.id
|
||||
}
|
||||
else {
|
||||
params.levelFirstId = curNode.id
|
||||
}
|
||||
init()
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.material-header {
|
||||
font-size: 17px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 20px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.icon-guanbi{
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.material-list{
|
||||
flex-direction: column;
|
||||
min-height: 150px;
|
||||
max-height: 500px;
|
||||
overflow-y: auto
|
||||
}
|
||||
|
||||
.material-item {
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
font-size: 14px;
|
||||
justify-content: space-between;
|
||||
.img{
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -81,9 +81,6 @@
|
|||
</template>
|
||||
<IconVideoTwo class="handler-item" v-tooltip="'插入音视频'" />
|
||||
</Popover>
|
||||
<IconPreviewOpen class="handler-item" v-tooltip="'插入试题'" @click="classWorkTaskVisible = true" />
|
||||
<IconMaterial class="handler-item" v-tooltip="'插入素材'" @click="materiaVisible = true"/>
|
||||
<IconAddPicture class="handler-item" v-tooltip="'文生图'" @click="imgVisible = true" />
|
||||
</div>
|
||||
|
||||
<div class="right-handler">
|
||||
|
@ -113,27 +110,6 @@
|
|||
@update="data => { createLatexElement(data); latexEditorVisible = false }"
|
||||
/>
|
||||
</Modal>
|
||||
|
||||
|
||||
<el-dialog v-model="classWorkTaskVisible" append-to-body :show-close="false" width="70%">
|
||||
<QuestToPPTist
|
||||
class="class-work-task-modal"
|
||||
@close="classWorkTaskVisible = false"
|
||||
@update="data => { onhtml2canvas(data); classWorkTaskVisible = false }"
|
||||
/>
|
||||
</el-dialog>
|
||||
<!--插入素材-->
|
||||
<Modal
|
||||
v-model:visible="materiaVisible"
|
||||
:width="880">
|
||||
<MaterialDialog @close="materiaVisible = false" @insertMaterial="insertMaterial"/>
|
||||
</Modal>
|
||||
<!--文生图-->
|
||||
<Modal
|
||||
v-model:visible="imgVisible"
|
||||
:width="1300">
|
||||
<TextCreateImg hasPPt @insertImg="(url: string) => { createImageElement(url); imgVisible = false }" />
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -159,9 +135,6 @@ import Modal from '../../../components/Modal.vue'
|
|||
import Divider from '../../../components/Divider.vue'
|
||||
import Popover from '../../../components/Popover.vue'
|
||||
import PopoverMenuItem from '../../../components/PopoverMenuItem.vue'
|
||||
import QuestToPPTist from '@/views/classTask/newClassTaskAssign/questToPPTist/index.vue'
|
||||
import MaterialDialog from './MaterialDialog.vue'
|
||||
import TextCreateImg from '@/components/ai-kolors/index.vue'
|
||||
|
||||
const mainStore = useMainStore()
|
||||
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
|
||||
|
@ -199,21 +172,15 @@ const insertImageElement = (files: FileList) => {
|
|||
getImageDataURL(imageFile).then(dataURL => createImageElement(dataURL))
|
||||
}
|
||||
|
||||
const onhtml2canvas = (imgbs64: string) => {
|
||||
createImageElement(imgbs64)
|
||||
}
|
||||
|
||||
const shapePoolVisible = ref(false)
|
||||
const linePoolVisible = ref(false)
|
||||
const chartPoolVisible = ref(false)
|
||||
const tableGeneratorVisible = ref(false)
|
||||
const mediaInputVisible = ref(false)
|
||||
const latexEditorVisible = ref(false)
|
||||
const classWorkTaskVisible = ref(false)
|
||||
const textTypeSelectVisible = ref(false)
|
||||
const shapeMenuVisible = ref(false)
|
||||
const moreVisible = ref(false)
|
||||
const materiaVisible = ref(false)
|
||||
|
||||
// 绘制文字范围
|
||||
const drawText = (vertical = false) => {
|
||||
|
@ -260,25 +227,6 @@ const toggleSraechPanel = () => {
|
|||
const toggleNotesPanel = () => {
|
||||
mainStore.setNotesPanelState(!showNotesPanel.value)
|
||||
}
|
||||
|
||||
// 插入素材
|
||||
interface MaterialParams {
|
||||
type: string,
|
||||
data: string
|
||||
}
|
||||
const insertMaterial = (item: MaterialParams) =>{
|
||||
const { type, data } = item
|
||||
if(type == 'video'){
|
||||
createVideoElement(data)
|
||||
}
|
||||
else{
|
||||
createImageElement(data)
|
||||
}
|
||||
materiaVisible.value = false
|
||||
}
|
||||
|
||||
// 文生图
|
||||
const imgVisible = ref(false)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -395,9 +343,6 @@ const imgVisible = ref(false)
|
|||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
.class-work-task-modal{
|
||||
height: 70vh;
|
||||
}
|
||||
|
||||
@media screen and (width <= 1200px) {
|
||||
.right-handler .text {
|
||||
|
|
|
@ -162,10 +162,6 @@ const setDialogForExport = (type: DialogForExportTypes) => {
|
|||
.icon {
|
||||
font-size: 18px;
|
||||
color: #666;
|
||||
|
||||
:deep(svg) {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
|
|
|
@ -67,6 +67,8 @@
|
|||
|
||||
<div class="page-number">幻灯片 {{slideIndex + 1}} / {{slides.length}}</div>
|
||||
|
||||
<!-- 引入活动的列表页面 -->
|
||||
<Active ref="activeRef" v-show="false"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -86,6 +88,7 @@ import ThumbnailSlide from '../../../views/components/ThumbnailSlide/index.vue'
|
|||
import LayoutPool from './LayoutPool.vue'
|
||||
import Popover from '../../../components/Popover.vue'
|
||||
import Draggable from 'vuedraggable'
|
||||
import Active from '../Toolbar/ElementStylePanel/Active/index.vue'
|
||||
|
||||
const mainStore = useMainStore()
|
||||
const slidesStore = useSlidesStore()
|
||||
|
@ -124,6 +127,7 @@ const {
|
|||
updateSectionTitle,
|
||||
} = useSectionHandler()
|
||||
|
||||
const activeRef = ref()
|
||||
|
||||
// 页面被切换时
|
||||
const thumbnailsRef = ref<InstanceType<typeof Draggable>>()
|
||||
|
@ -147,6 +151,8 @@ watch(() => slideIndex.value, () => {
|
|||
|
||||
// 切换页面
|
||||
const changeSlideIndex = (index: number) => {
|
||||
console.log(workItem.value[index],'hasSection');
|
||||
activeRef.value.clickPPTList(workItem.value[index])
|
||||
|
||||
mainStore.setActiveElementIdList([])
|
||||
|
||||
|
@ -396,17 +402,12 @@ const contextmenusThumbnailItem = (): ContextmenuItem[] => {
|
|||
.icon {
|
||||
margin-right: 3px;
|
||||
font-size: 14px;
|
||||
|
||||
:deep(svg) {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.thumbnail-list {
|
||||
padding: 5px 0;
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
border-bottom: 1px solid $borderColor;
|
||||
}
|
||||
.thumbnail-item {
|
||||
display: flex;
|
||||
|
@ -485,6 +486,7 @@ const contextmenusThumbnailItem = (): ContextmenuItem[] => {
|
|||
.page-number {
|
||||
height: 40px;
|
||||
font-size: 12px;
|
||||
border-top: 1px solid $borderColor;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
color: #666;
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
<!-- 作业列表 -->
|
||||
<div class="c-apt-r">
|
||||
<!-- 显示-作业内容 -->
|
||||
<template v-for="(item, index) in workList" :key="index">
|
||||
<template v-for="(item, index) in workList">
|
||||
<div class="item">
|
||||
<div class="item-title">
|
||||
<el-tag :type="getTagType(item.worktype) || 'primary'">{{item.worktype}}</el-tag>
|
||||
<el-tooltip :content="item.evaltitle" placement="top">
|
||||
<div class="tt">{{item.evaltitle}}</div>
|
||||
<el-tooltip :content="item.title||item.uniquekey" placement="top">
|
||||
<div class="tt">{{item.title||item.uniquekey}}</div>
|
||||
</el-tooltip>
|
||||
<el-button class="btn-del" type="danger" link @click="handleRemoveDemoActivityClassWork(item)">删除</el-button>
|
||||
</div>
|
||||
|
@ -45,10 +45,8 @@
|
|||
</template>
|
||||
</div>
|
||||
<!-- // 推送作业 -->
|
||||
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="80%" height="500">
|
||||
<el-scrollbar height="500">
|
||||
<NewClassTsakAssign :currentCourse='currentCourse' @getData="getData" />
|
||||
</el-scrollbar>
|
||||
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="80%">
|
||||
<NewClassTsakAssign :currentCourse='currentCourse'/>
|
||||
</el-dialog>
|
||||
<!-- 活动引用 -->
|
||||
<el-dialog
|
||||
|
@ -57,9 +55,9 @@
|
|||
append-to-body
|
||||
:show-close="false"
|
||||
width="40%"
|
||||
>
|
||||
<el-table :data="taskList" style="width: 100%" height="500" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" :selectable="selectable"/>
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table :data="taskList" style="width: 100%" height="500">
|
||||
<el-table-column type="selection" :selectable="selectable" width="55" />
|
||||
<el-table-column prop="evaltitle" label="活动名称" width="150" />
|
||||
<el-table-column prop="worktype" label="活动类型" width="120" sortable>
|
||||
<template #default="scope">
|
||||
|
@ -70,246 +68,160 @@
|
|||
</el-table>
|
||||
<template #footer>
|
||||
<el-button @click="activeVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="savePPtData">确 定</el-button>
|
||||
<el-button type="primary" @click="save">确 定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, nextTick, watch } from 'vue'
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, onBeforeMount, defineExpose } from 'vue'
|
||||
import Divider from '../../../../../components/Divider.vue'
|
||||
import { listEntpcoursefile } from '@/api/education/entpcoursefile'
|
||||
import { homeworklist } from '@/api/teaching/classwork'
|
||||
import {listEntpcoursefile} from '@/api/education/entpcoursefile'
|
||||
import {homeworklist} from '@/api/teaching/classwork'
|
||||
import { processList } from "@/hooks/useProcessList";
|
||||
import { listEntpcoursework } from "@/api/classTask/index";
|
||||
import { ElMessageBox,ElMessage } from 'element-plus'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import NewClassTsakAssign from '@/views/classTask/newClassTaskAssign/index.vue'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { PPTApi } from '../../../../../api/index'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import {useSlidesStore} from '../../../../../store'
|
||||
const slidesStore = useSlidesStore()
|
||||
const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore)
|
||||
|
||||
interface CourseNode {
|
||||
rootid: number;
|
||||
parentNode: { id: number };
|
||||
id: number;
|
||||
itemtitle: string;
|
||||
}
|
||||
|
||||
interface CurrentCourse {
|
||||
textbookId: number;
|
||||
levelFirstId: number;
|
||||
levelSecondId: number;
|
||||
coursetitle: string;
|
||||
node: CourseNode;
|
||||
id: number;
|
||||
worktype: string;
|
||||
}
|
||||
|
||||
interface Params {
|
||||
parentid: number;
|
||||
pageSize: number;
|
||||
orderby: string;
|
||||
}
|
||||
|
||||
interface WorkType {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface WorkItem {
|
||||
status: string;
|
||||
activityContent?: string;
|
||||
worktype: string;
|
||||
quizlist?: { id: number }[];
|
||||
workcodes: string;
|
||||
base64?: string;
|
||||
prevData?: any;
|
||||
id: number;
|
||||
evaltitle?: string; // 添加 evaltitle 属性
|
||||
}
|
||||
|
||||
const currentCourse = reactive<CurrentCourse>({
|
||||
textbookId: 0,
|
||||
levelFirstId: 0,
|
||||
levelSecondId: 0,
|
||||
coursetitle: '',
|
||||
node: {} as CourseNode,
|
||||
id: 1,
|
||||
worktype: '',
|
||||
const currentCourse = reactive({
|
||||
textbookId:0,
|
||||
levelFirstId:0,
|
||||
levelSecondId:0,
|
||||
coursetitle:'',
|
||||
node:{},
|
||||
id:1,
|
||||
worktype:'',
|
||||
})
|
||||
|
||||
const dataList = ref<WorkItem[]>([])
|
||||
const dialogVisible = ref<boolean>(false)
|
||||
const tasklist_loading = ref<boolean>(false)
|
||||
|
||||
const dataList = ref([])
|
||||
const dialogVisible = ref(false)
|
||||
const tasklist_loading = ref(false)
|
||||
// 活动列表
|
||||
const taskList = ref<WorkItem[]>([])
|
||||
|
||||
const taskList = ref([])
|
||||
// 活动引用的弹窗
|
||||
const activeVisible = ref<boolean>(false)
|
||||
|
||||
const params = reactive<Params>({
|
||||
parentid: 14766,
|
||||
pageSize: 500,
|
||||
orderby: 'fileidx'
|
||||
const activeVisible = ref(false)
|
||||
const params = reactive({
|
||||
parentid:14766,
|
||||
pageSize:500,
|
||||
orderby:'fileidx'
|
||||
})
|
||||
|
||||
const type = ref<WorkType[]>([
|
||||
const type = ref([
|
||||
{
|
||||
label: '习题训练',
|
||||
value: 'danger'
|
||||
label:'习题训练',
|
||||
value:'danger'
|
||||
},
|
||||
{
|
||||
label: '课堂展示',
|
||||
value: 'success'
|
||||
label:'课堂展示',
|
||||
value:'success'
|
||||
},
|
||||
{
|
||||
label: '常规作业',
|
||||
value: 'primary'
|
||||
label:'常规作业',
|
||||
value:'primary'
|
||||
},
|
||||
])
|
||||
|
||||
const objItem = ref<any>({})
|
||||
// 作业列表
|
||||
const workList = ref<WorkItem[]>([])
|
||||
|
||||
// 获取所选择的作业列表
|
||||
const selectedWorkList = ref<WorkItem[]>([])
|
||||
|
||||
|
||||
const paramData = ref<{ id: number, activityContent: string }>({} as { id: number, activityContent: string })
|
||||
|
||||
const selectable = (row: WorkItem, index: number): boolean => {
|
||||
return row.status === '10';
|
||||
};
|
||||
|
||||
|
||||
const formatClassWorkFile = async (postData: WorkItem[]): Promise<void> => {
|
||||
for (let i = 0; i < postData.length; i++) {
|
||||
let item = postData[i];
|
||||
switch (item.worktype) {
|
||||
case '框架梳理': {
|
||||
}
|
||||
break;
|
||||
case '习题训练': {
|
||||
console.log(item,'item');
|
||||
// let workIds = item.quizlist!.map(items => items.id).join(',');
|
||||
// let ress = await listEntpcoursework({ ids: workIds });
|
||||
// const arr = ress.rows.map((item:{id:number}) => {
|
||||
// return item.id
|
||||
// })
|
||||
|
||||
// processList(ress.rows);
|
||||
}
|
||||
break;
|
||||
case '课堂展示': {
|
||||
// item.base64 = JSON.parse(item.workcodes).base64;
|
||||
}
|
||||
break;
|
||||
case '常规作业': {
|
||||
// item.prevData = JSON.parse(item.workcodes);
|
||||
}
|
||||
}
|
||||
const arr = paramData.value.activityContent.split(',')
|
||||
arr.push(item.id.toString())
|
||||
await PPTApi.updateSlide(paramData.value)
|
||||
addWorkList(item)
|
||||
}
|
||||
await nextTick();
|
||||
const workList = ref([])
|
||||
const selectable = (row,index) => {
|
||||
console.log(row,index,'row,index');
|
||||
return true
|
||||
}
|
||||
// 添加的活动回显到页面上面去
|
||||
const addWorkList = (item: WorkItem) => {
|
||||
workList.value.push(item)
|
||||
|
||||
const clickPPTList = (item) => {
|
||||
console.log(item,'点击了')
|
||||
workList.value = []
|
||||
let datacontent = item.datacontent;
|
||||
let pptJson = "";
|
||||
if(typeof datacontent === 'string') pptJson = JSON.parse(datacontent)
|
||||
if(pptJson&&pptJson[0]&&pptJson[0].classworkList) {
|
||||
homeworklist({ids:pptJson[0].classworkList, pageSize: 100}).then( async res => {
|
||||
await formatClassWorkFile(res.rows)
|
||||
})
|
||||
}
|
||||
}
|
||||
const formatClassWorkFile = async (postData) => {
|
||||
return new Promise(async (resolve, reject)=>{
|
||||
for (let i = 0; i < postData.length; i++) {
|
||||
let item = postData[i];
|
||||
switch (item.worktype) {
|
||||
case '框架梳理': {
|
||||
}
|
||||
break;
|
||||
case '习题训练': {
|
||||
item.entpcourseworklistarray = item.entpcourseworklist?JSON.parse('['+item.entpcourseworklist+']'):[];
|
||||
let workIds = item.entpcourseworklistarray.map(items=>items.id).join(',')
|
||||
let ress = await listEntpcoursework({ids:workIds})
|
||||
processList(ress.rows)
|
||||
item.workShowList = ress.rows
|
||||
}
|
||||
break;
|
||||
case '课堂展示': {
|
||||
item.base64 = JSON.parse(item.workcodes).base64
|
||||
}
|
||||
break;
|
||||
case '常规作业': {
|
||||
item.prevData = JSON.parse(item.workcodes)
|
||||
}
|
||||
}
|
||||
workList.value.push(item)
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
// 删除作业
|
||||
const handleRemoveDemoActivityClassWork = (item: WorkItem) => {
|
||||
const handleRemoveDemoActivityClassWork = (item) => {
|
||||
ElMessageBox.confirm('是否确认删除?')
|
||||
.then(() => {
|
||||
workList.value.splice(workList.value.indexOf(item), 1);
|
||||
})
|
||||
.catch(() => { });
|
||||
.then(function () {
|
||||
workList.value.splice(workList.value.indexOf(item), 1);
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
// 获取tag的样式
|
||||
const getTagType = (worktype: string): string => {
|
||||
return type.value.find(item => item.label === worktype)!.value
|
||||
const getTagType = (worktype) => {
|
||||
return type.value.find(item => item.label == worktype).value
|
||||
}
|
||||
|
||||
// 获取活动引用的列表数据
|
||||
const initHomeWork = async () => {
|
||||
tasklist_loading.value = true;
|
||||
const { res, chapterId } = await useGetHomework(sessionStore.get('subject.curNode'));
|
||||
taskList.value = res;
|
||||
tasklist_loading.value = false;
|
||||
const initHomeWork = async()=> {
|
||||
tasklist_loading.value = true;
|
||||
const { res, chapterId } = await useGetHomework(sessionStore.get('subject.curNode'));
|
||||
taskList.value = res;
|
||||
tasklist_loading.value = false;
|
||||
}
|
||||
|
||||
// 多选活动引用
|
||||
const handleSelectionChange = (val: WorkItem[]) => {
|
||||
selectedWorkList.value = [...val]
|
||||
const handleSelectionChange = (val) => {
|
||||
console.log(val,'多选')
|
||||
}
|
||||
|
||||
// 打开添加作业活动
|
||||
const showDialog = (item: string) => {
|
||||
const showDialog = (item) => {
|
||||
currentCourse.worktype = item
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const openList = () => {
|
||||
activeVisible.value = true
|
||||
initHomeWork()
|
||||
}
|
||||
|
||||
// 添加活动引用列表作业
|
||||
const savePPtData = async () => {
|
||||
if (selectedWorkList.value.length === 0) {
|
||||
ElMessage.warning('请选择活动')
|
||||
return
|
||||
}
|
||||
const arr = selectedWorkList.value.map(item => item.id)
|
||||
// 应该是新加而不是覆盖
|
||||
paramData.value.activityContent = arr.join(',')
|
||||
await PPTApi.updateSlide(paramData.value)
|
||||
const save = () => {
|
||||
console.log('添加了')
|
||||
activeVisible.value = false
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const curNode = sessionStore.get('subject.curNode') as CourseNode
|
||||
// console.log(sessionStore.get('subject.curBook'),'curBook');
|
||||
// console.log(sessionStore.get('subject.subjectTree'),'subjectTree');
|
||||
// console.log(sessionStore.get('subject.bookList'),'bookList');
|
||||
console.log(sessionStore.get('subject.curNode'),'curNode');
|
||||
const curNode = sessionStore.get('subject.curNode')
|
||||
currentCourse.textbookId = curNode.rootid
|
||||
currentCourse.levelFirstId = curNode.parentNode.id
|
||||
currentCourse.levelSecondId = curNode.id
|
||||
currentCourse.coursetitle = curNode.itemtitle
|
||||
currentCourse.coursetitle = curNode.itemtitle,
|
||||
currentCourse.node = curNode
|
||||
listEntpcoursefile(params).then((res: { rows: WorkItem[] }) => {
|
||||
listEntpcoursefile(params).then((res) => {
|
||||
dataList.value = [...res.rows]
|
||||
})
|
||||
objItem.value = workItem.value[slideIndex.value]
|
||||
getCurrentPPtData()
|
||||
})
|
||||
watch(() => slideIndex.value, () => {
|
||||
getCurrentPPtData()
|
||||
defineExpose({
|
||||
clickPPTList
|
||||
})
|
||||
// 获取当前ppt页的数据
|
||||
const getCurrentPPtData = async () => {
|
||||
workList.value = []
|
||||
objItem.value = workItem.value[slideIndex.value]
|
||||
paramData.value.id = objItem.value.id
|
||||
if (objItem.value?.activityContent) {
|
||||
paramData.value.activityContent = objItem.value?.activityContent
|
||||
const res = await homeworklist({ ids: objItem.value?.activityContent, pageSize: 100 })
|
||||
await formatClassWorkFile(res.rows)
|
||||
}
|
||||
}
|
||||
|
||||
// 接收习题训练的值
|
||||
const getData = async (data: WorkItem) => {
|
||||
console.log(data, 'data')
|
||||
await formatClassWorkFile([data])
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.buttonDiv{
|
||||
|
|
|
@ -160,7 +160,7 @@ const topImgPositionStyle = computed(() => {
|
|||
return {
|
||||
left: -left * (100 / width) + '%',
|
||||
top: -top * (100 / height) + '%',
|
||||
width: bottomWidth / width * 100 + '%' ,
|
||||
width: bottomWidth / width * 100 + '%',
|
||||
height: bottomHeight / height * 100 + '%',
|
||||
}
|
||||
})
|
||||
|
@ -228,7 +228,6 @@ const updateRange = () => {
|
|||
width: parseInt(topImgPositionStyle.value.width),
|
||||
height: parseInt(topImgPositionStyle.value.height),
|
||||
}
|
||||
console.log('retPosition', retPosition)
|
||||
|
||||
const widthScale = 100 / retPosition.width
|
||||
const heightScale = 100 / retPosition.height
|
||||
|
@ -476,7 +475,7 @@ const scaleClipRange = (e: MouseEvent, type: OperateResizeHandlers) => {
|
|||
isMouseDown = false
|
||||
document.onmousemove = null
|
||||
document.onmouseup = null
|
||||
console.log('----------------------------------')
|
||||
|
||||
updateRange()
|
||||
|
||||
setTimeout(() => isSettingClipRange.value = false, 0)
|
||||
|
@ -538,7 +537,6 @@ const edgePoints = [
|
|||
|
||||
img {
|
||||
position: absolute;
|
||||
max-width: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,7 +183,6 @@ const handleClip = (data: ImageClipedEmitData | null) => {
|
|||
}
|
||||
img {
|
||||
position: absolute;
|
||||
max-width: none !important; // 防止图片被压缩
|
||||
}
|
||||
}
|
||||
.color-mask {
|
||||
|
|
|
@ -144,14 +144,8 @@ import { convertTextToPicture, getQueue, getPromptId, getPicture, chattoprompt,
|
|||
import CryptoJS from 'crypto-js'
|
||||
import { useRoute } from 'vue-router'
|
||||
export default {
|
||||
props: {
|
||||
hasPPt: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
|
||||
return {
|
||||
form: {
|
||||
ratio: "512",
|
||||
|
@ -390,7 +384,7 @@ export default {
|
|||
urls.push(url0)
|
||||
buttonState.push({
|
||||
disabled: false,
|
||||
text: this.hasPPt ? '插入' : "插入本课素材资源库",
|
||||
text: "插入本课素材资源库",
|
||||
})
|
||||
}
|
||||
this.skeletonNumber = 0
|
||||
|
@ -482,10 +476,6 @@ export default {
|
|||
|
||||
//保存图片到素材库
|
||||
async saveImage(resultIndex, index, url, resultItem) {
|
||||
if(this.hasPPt){
|
||||
this.$emit('insertImg', url)
|
||||
return
|
||||
}
|
||||
this.buttonStates[resultIndex][index].disabled = true;
|
||||
this.buttonStates[resultIndex][index].text = "正在保存...";
|
||||
const numberIndex = url.indexOf('filename=');
|
||||
|
|
|
@ -142,19 +142,13 @@ const handleNodeClick = (data) => {
|
|||
|
||||
//增加一个label 之前取的label
|
||||
nodeData.label = nodeData.itemtitle
|
||||
let parentNode
|
||||
// 存在children 则为一级节点
|
||||
if(nodeData.children){
|
||||
// 为一级节点
|
||||
parentNode = null
|
||||
}
|
||||
else{
|
||||
parentNode = {
|
||||
id: nodeData.parentid,
|
||||
label: nodeData.parenttitle,
|
||||
itemtitle: nodeData.parenttitle
|
||||
}
|
||||
}
|
||||
// 父级节点 如果当前是一级节点 父级则为null
|
||||
let parent = {
|
||||
id: nodeData.parentid,
|
||||
label: nodeData.parenttitle,
|
||||
itemtitle: nodeData.parenttitle
|
||||
}
|
||||
const parentNode = nodeData.parentid ? parent : null
|
||||
nodeData.parentNode = parentNode
|
||||
let curData = {
|
||||
textBook: {
|
||||
|
|
|
@ -35,7 +35,7 @@ const getFileTypeIcon = () => {
|
|||
txt: 'icon-txt',
|
||||
rar: 'icon-rar',
|
||||
apt: 'icon-A',
|
||||
aippt: 'icon-A',
|
||||
aptist: 'icon-A',
|
||||
}
|
||||
if (iconObj[name]) {
|
||||
return '#' + iconObj[name]
|
||||
|
|
|
@ -26,52 +26,52 @@
|
|||
</div>
|
||||
</div>
|
||||
<!--List-->
|
||||
<div class="container-right-list" ref="listRef">
|
||||
<template v-for="(item, index) in childTempList">
|
||||
<div class="template-item" v-loading="item.loading">
|
||||
<div class="item-header">
|
||||
<div>
|
||||
<span class="blue">#</span>{{ item.name }}
|
||||
</div>
|
||||
<el-popover placement="bottom-end" trigger="hover" popper-class="template-custom-popover">
|
||||
<template #reference>
|
||||
<el-button link type="primary">
|
||||
<i class="iconfont icon-shenglvehao"></i></el-button>
|
||||
</template>
|
||||
<template #default>
|
||||
<el-button type="primary" link @click="editKeyWord(item)">编辑</el-button>
|
||||
<el-button type="primary" link @click="removeItem(item, true)">移除</el-button>
|
||||
</template>
|
||||
</el-popover>
|
||||
</div>
|
||||
<div class="item-text">
|
||||
{{ item.prompt }}
|
||||
</div>
|
||||
<div class="item-text text-answer" v-if="item.answer">
|
||||
<div class="item-icon">
|
||||
<i class="iconfont icon-ai"></i>
|
||||
</div>
|
||||
<div class="item-answer">
|
||||
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow" @complete="handleCompleteText($event,index)" @updateScroll="scrollToBottom($event,index)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="ai-btn" v-if="item.answer">
|
||||
<el-button type="primary" link @click="againResult(index, item)">
|
||||
<i class="iconfont icon-ai1"></i>
|
||||
重新研读
|
||||
</el-button>
|
||||
<el-button type="primary" link @click="onAdjust(index, item)">
|
||||
<i class="iconfont icon-duihua"></i>
|
||||
AI对话调整
|
||||
</el-button>
|
||||
<el-button type="primary" link @click="onEdit(index, item)">
|
||||
<i class="iconfont icon-bianji1"></i>
|
||||
手动编辑结果
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-empty v-if="!childTempList.length" description="暂无模板数据" />
|
||||
<div class="container-right-list">
|
||||
<template v-for="(item, index) in childTempList">
|
||||
<div class="template-item" v-loading="item.loading">
|
||||
<div class="item-header">
|
||||
<div>
|
||||
<span class="blue">#</span>{{ item.name }}
|
||||
</div>
|
||||
<el-popover placement="bottom-end" trigger="hover" popper-class="template-custom-popover">
|
||||
<template #reference>
|
||||
<el-button link type="primary">
|
||||
<i class="iconfont icon-shenglvehao"></i></el-button>
|
||||
</template>
|
||||
<template #default>
|
||||
<el-button type="primary" link @click="editKeyWord(item)">编辑</el-button>
|
||||
<el-button type="primary" link @click="removeItem(item, true)">移除</el-button>
|
||||
</template>
|
||||
</el-popover>
|
||||
</div>
|
||||
<div class="item-text">
|
||||
{{ item.prompt }}
|
||||
</div>
|
||||
<div class="item-text text-answer" v-if="item.answer">
|
||||
<div class="item-icon">
|
||||
<i class="iconfont icon-ai"></i>
|
||||
</div>
|
||||
<div class="item-answer">
|
||||
<TypingEffect :text="item.oldAnswer" :delay="10" :aiShow="item.aiShow" @complete="onSaveTemp(item)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="ai-btn" v-if="item.answer">
|
||||
<el-button type="primary" link @click="againResult(index, item)">
|
||||
<i class="iconfont icon-ai1"></i>
|
||||
重新研读
|
||||
</el-button>
|
||||
<el-button type="primary" link @click="onAdjust(index, item)">
|
||||
<i class="iconfont icon-duihua"></i>
|
||||
AI对话调整
|
||||
</el-button>
|
||||
<el-button type="primary" link @click="onEdit(index, item)">
|
||||
<i class="iconfont icon-bianji1"></i>
|
||||
手动编辑结果
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-empty v-if="!childTempList.length" description="暂无模板数据" />
|
||||
</div>
|
||||
</div>
|
||||
<!--编辑结果-->
|
||||
|
@ -83,7 +83,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, watch, onUnmounted, nextTick } from 'vue'
|
||||
import { ref, reactive, onMounted, watch, onUnmounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { tempSave, completion, modelList, removeChildTemp, tempResult, editTempResult } from '@/api/mode/index'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
|
@ -146,16 +146,14 @@ const getChildTemplate = () => {
|
|||
tempLoading.value = true
|
||||
modelList({ model: props.type, type: 2, parentId: curTemplate.id }).then(res => {
|
||||
childTempList.value = res.rows
|
||||
if(childTempList.value.length){
|
||||
childTempList.value.forEach(item => item.answer = '')
|
||||
}
|
||||
|
||||
getTempResult()
|
||||
}).finally(() => {
|
||||
tempLoading.value = false
|
||||
})
|
||||
}
|
||||
const isStarted = ref([]);
|
||||
const listRef = ref()
|
||||
|
||||
|
||||
// 查询模板结果
|
||||
const getTempResult = () => {
|
||||
tempResult({ mainModelId: curTemplate.id, pageNum: 1, pageSize: 10000 }).then(res => {
|
||||
|
@ -163,40 +161,14 @@ const getTempResult = () => {
|
|||
childTempList.value.forEach(item => {
|
||||
rows.forEach(el => {
|
||||
if (item.id == el.modelId) {
|
||||
item.answer = getResult(el.content)
|
||||
item.answer = el.content
|
||||
item.resultId = el.id
|
||||
}
|
||||
})
|
||||
})
|
||||
if(rows.length > 0){
|
||||
isStarted.value = new Array(rows.length).fill(true)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
const scrollToBottom = (height,index) =>{
|
||||
|
||||
if (listRef.value) {
|
||||
let sum = 0
|
||||
let listDom = listRef.value.children
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 模板切换
|
||||
const changeTemplate = (val) => {
|
||||
ElMessageBox.confirm(
|
||||
|
@ -231,11 +203,11 @@ const removeItem = async (item, isChild) => {
|
|||
).then(() => {
|
||||
removeChildTemp(item.id).then(res => {
|
||||
ElMessage.success('操作成功')
|
||||
if (isChild) {
|
||||
if(isChild){
|
||||
// 获取子模板
|
||||
getChildTemplate()
|
||||
}
|
||||
else {
|
||||
else{
|
||||
// 获取主模板
|
||||
getTemplateList()
|
||||
}
|
||||
|
@ -243,7 +215,7 @@ const removeItem = async (item, isChild) => {
|
|||
})
|
||||
}
|
||||
else {
|
||||
editKeyWord(item, !isChild)
|
||||
editKeyWord(item,!isChild)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,18 +240,19 @@ const onEdit = (index, item) => {
|
|||
|
||||
const modeType = ref('课标')
|
||||
watch(() => props.type, (newVal) => {
|
||||
if (newVal == 1) {
|
||||
if (newVal == 1){
|
||||
modeType.value = '课标'
|
||||
}
|
||||
if (newVal == 2) {
|
||||
if (newVal == 2){
|
||||
modeType.value = '教材'
|
||||
}
|
||||
if (newVal == 3) {
|
||||
if (newVal == 2){
|
||||
modeType.value = '考试'
|
||||
}
|
||||
|
||||
}, { immediate: false })
|
||||
|
||||
|
||||
// 重新研读
|
||||
const params = reactive(
|
||||
{
|
||||
|
@ -287,102 +260,76 @@ const params = reactive(
|
|||
dataset_id: ''
|
||||
}
|
||||
)
|
||||
|
||||
// 重新研读
|
||||
const isAgain = ref(false)
|
||||
const againResult = async (index, item) => {
|
||||
isAgain.value = true
|
||||
isStarted.value[index] = false
|
||||
childTempList.value[index].answer = ''
|
||||
|
||||
if(index == 0){
|
||||
listRef.value.scrollTop = 0
|
||||
|
||||
}else{
|
||||
scrollToBottom(50, index)
|
||||
}
|
||||
|
||||
try {
|
||||
await nextTick()
|
||||
childTempList.value[index].loading = true
|
||||
item.aiShow = true
|
||||
childTempList.value[index].oldAnswer = ''
|
||||
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
|
||||
|
||||
let answer = data.answer
|
||||
childTempList.value[index].oldAnswer = answer
|
||||
childTempList.value[index].answer = getResult(answer);
|
||||
// onEditSave(item)
|
||||
} finally {
|
||||
childTempList.value[index].loading = false
|
||||
}
|
||||
}
|
||||
// 一键研读
|
||||
const getCompletion = async () => {
|
||||
isStarted.value = new Array(childTempList.length).fill(false)
|
||||
isStarted.value[0] = true
|
||||
|
||||
childTempList.value.forEach(item =>{
|
||||
if(item.answer){
|
||||
item.answer = ''
|
||||
}
|
||||
})
|
||||
|
||||
for (let item of childTempList.value) {
|
||||
try {
|
||||
item.loading = true
|
||||
item.aiShow = true
|
||||
params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
||||
const { data } = await completion(params)
|
||||
item.answer = getResult(data.answer)
|
||||
onSaveTemp(item)
|
||||
let answer = data.answer
|
||||
item.oldAnswer = answer
|
||||
item.answer = getResult(answer);
|
||||
|
||||
} finally {
|
||||
item.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 替换分析结果
|
||||
emitter.on('onSaveAdjust', (item) => {
|
||||
childTempList.value[curIndex.value].answer = item
|
||||
childTempList.value[curIndex.value].oldAnswer = item
|
||||
let answer = getResult(item);
|
||||
childTempList.value[curIndex.value].oldAnswer = item
|
||||
childTempList.value[curIndex.value].answer = answer
|
||||
onEditSave(childTempList.value[curIndex.value])
|
||||
})
|
||||
|
||||
|
||||
// 保存 重新研读后的结果
|
||||
const onEditSave = async (item) => {
|
||||
const { res } = await editTempResult({ id: item.resultId, content: item.answer })
|
||||
const onEditSave = async (item) =>{
|
||||
const { res } = await editTempResult({id: item.resultId, content: item.oldAnswer})
|
||||
ElMessage.success(res)
|
||||
getChildTemplate()
|
||||
}
|
||||
|
||||
// 保存模板
|
||||
const onSaveTemp = (item) => {
|
||||
if (item.answer == '') return
|
||||
|
||||
if(item.oldAnswer == '') return
|
||||
const data = {
|
||||
mainModelId: curTemplate.id,
|
||||
modelId: item.id,
|
||||
examDocld: '',
|
||||
content: item.answer
|
||||
content: item.oldAnswer
|
||||
}
|
||||
tempSave(data).then(res => { })
|
||||
tempSave(data).then(res => {})
|
||||
}
|
||||
|
||||
// 去掉字符串中的 ### **
|
||||
let getResult = (str) => {
|
||||
let newStr = str.replace(/#+|(\*\*)/g, '');
|
||||
return newStr
|
||||
// 分析获取课标对话结果
|
||||
let getResult = (text) => {
|
||||
text = text.replace(/^\n\n(.*?)\n\n$/s, '<div>$1</div>');
|
||||
text = text.replace(/^\n(.*?)\n$/s, '<p>$1</p>');
|
||||
text = text.replace(/\*\*(.*?)\*\*/g, "<div class='text-tit'>$1</div>");
|
||||
text = text.replace(/(\d+\..*?)\n/g, "<div class='text-num'>$1</div>\n");
|
||||
return text
|
||||
}
|
||||
|
||||
// 操作之后获取字模板
|
||||
|
@ -434,85 +381,87 @@ onUnmounted(() => {
|
|||
padding: 5px 15px;
|
||||
box-sizing: border-box;
|
||||
|
||||
.template-item {
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
margin-top: 10px;
|
||||
border-radius: 5px;
|
||||
|
||||
|
||||
.item-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
justify-content: space-between;
|
||||
.template-item {
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
margin-top: 10px;
|
||||
border-radius: 5px;
|
||||
|
||||
.blue {
|
||||
font-size: 22px;
|
||||
.item-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
justify-content: space-between;
|
||||
|
||||
.blue {
|
||||
font-size: 22px;
|
||||
color: #409eff;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-text {
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
color: #606266;
|
||||
|
||||
.item-icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
background: #F6F6F6;
|
||||
border-radius: 50%;
|
||||
margin-right: 10px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.item-answer {
|
||||
flex-direction: column;
|
||||
padding-top: 5px;
|
||||
width: 100%;
|
||||
|
||||
:deep(.text-tit) {
|
||||
font-weight: bold;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
:deep(.text-num) {
|
||||
padding-left: 2em;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.text-answer {
|
||||
color: #409eff;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-text {
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
color: #606266;
|
||||
|
||||
.item-icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
background: #F6F6F6;
|
||||
border-radius: 50%;
|
||||
margin-right: 10px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.item-answer {
|
||||
flex-direction: column;
|
||||
padding-top: 5px;
|
||||
width: 100%;
|
||||
.ai-btn {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
:deep(.text-tit) {
|
||||
font-weight: bold;
|
||||
margin: 10px 0;
|
||||
.iconfont {
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
:deep(.text-num) {
|
||||
padding-left: 2em;
|
||||
:deep(.el-button) {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.icon-ai1 {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.text-answer {
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.ai-btn {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
.iconfont {
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
:deep(.el-button) {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.icon-ai1 {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="typing-effect" ref="typingEffectRef">
|
||||
<div class="typing-effect">
|
||||
<!-- <span v-html="displayedText"></span> -->
|
||||
<el-input
|
||||
v-model="displayedText"
|
||||
|
@ -14,11 +14,11 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch, nextTick } from 'vue';
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
text: {
|
||||
type: [String, Object],
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
delay: {
|
||||
|
@ -26,48 +26,35 @@ const props = defineProps({
|
|||
default: 100 // 默认每个字符出现的延迟时间,单位是毫秒
|
||||
},
|
||||
aiShow: {
|
||||
type: [Boolean] // 为true 只展示
|
||||
type: [Boolean]
|
||||
}
|
||||
});
|
||||
const typingEffectRef = ref(null);
|
||||
const emit = defineEmits(['complete', 'updateScroll']);
|
||||
const emit = defineEmits(['complete']);
|
||||
const displayedText = ref('');
|
||||
const index = ref(0);
|
||||
|
||||
const type = async () => {
|
||||
await nextTick()
|
||||
if(!props.aiShow) {
|
||||
displayedText.value = props.text
|
||||
return
|
||||
}
|
||||
const type = () => {
|
||||
if(!props.aiShow) return
|
||||
if (index.value <= props.text.length) {
|
||||
displayedText.value += props.text.charAt(index.value);
|
||||
index.value++;
|
||||
setTimeout(() => {
|
||||
type();
|
||||
emit('updateScroll', typingEffectRef.value.clientHeight); // 每次添加新字符后滚动到底部
|
||||
}, props.delay);
|
||||
setTimeout(() => type(), props.delay);
|
||||
} else {
|
||||
// 当所有字符都显示完毕时,触发 complete 事件
|
||||
emit('complete',displayedText.value);
|
||||
emit('complete');
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
resetAndType();
|
||||
type();
|
||||
});
|
||||
|
||||
const resetAndType = () =>{
|
||||
// 监听 props 的变化,以便当传入的 text 或 delay 发生改变时重新开始打字机效果
|
||||
watch([() => props.text, () => props.delay], () => {
|
||||
displayedText.value = '';
|
||||
index.value = 0;
|
||||
type();
|
||||
}
|
||||
|
||||
// 监听 props 的变化,以便当传入的 text 或 delay 发生改变时重新开始打字机效果
|
||||
watch([() => props.text, () => props.delay], resetAndType);
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -36,13 +36,13 @@ export const processList = (row, aloneOption=false) => {
|
|||
row[i].method = jjj.method
|
||||
row[i].discuss = jjj.discuss
|
||||
//row[i].discusscollapse = false;
|
||||
if (row[i].examdate && row[i].examdate != "") {
|
||||
if (row[i].examdate !== null && row[i].examdate !== undefined) {
|
||||
row[i].examdate = row[i].examdate.substring(0, 10)
|
||||
}
|
||||
|
||||
// 具体题型数据结构处理
|
||||
if (row[i].worktype == '复合题') {
|
||||
// 复合题 - 旧格式
|
||||
// 旧类型
|
||||
if (row[i].title.indexOf('!@#$%') !== -1) {
|
||||
// 1.选项解析替换
|
||||
const options = JSON.parse(row[i].workdesc)
|
||||
|
@ -129,9 +129,7 @@ export const processList = (row, aloneOption=false) => {
|
|||
|
||||
row[i].workanswerFormat = answer
|
||||
} else {
|
||||
// 复合题 - 现格式
|
||||
|
||||
// 处理[题干显示] - 不再需要处理(头部已处理)
|
||||
// 处理[题干显示] - 不再需要处理
|
||||
// row[i].titleFormat = row[i].title; // 仅占位提示
|
||||
|
||||
/**
|
||||
|
@ -224,7 +222,6 @@ export const processList = (row, aloneOption=false) => {
|
|||
row[i].workanswerFormat = workAnswerHtml
|
||||
}
|
||||
} else if (
|
||||
/** 主观题/非基础题(其中主要为第三方的各类解答题) */
|
||||
row[i].worktype == '主观题' ||
|
||||
(row[i].worktype !== '单选题' &&
|
||||
row[i].worktype !== '多选题' &&
|
||||
|
@ -239,7 +236,7 @@ export const processList = (row, aloneOption=false) => {
|
|||
row[i].workanswerFormat = JSON.parse(row[i].workanswer)
|
||||
}
|
||||
} else {
|
||||
// 基础题: 单选题|多选题|填空题|判断题|主观题?(待确认是否归在这里)
|
||||
// 单选题|多选题|填空题|判断题|主观题?(待确认是否归在这里)
|
||||
// 通用选项结构 ['ABC123','ABC123'] | ['ABC123','ABC123'] | [](填空题无选项) | [](判断题无选项)
|
||||
let workDescArr = []
|
||||
if (
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
</div>
|
||||
<div class="verson">V{{ version }}</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -87,12 +87,6 @@ const headerMenus = [
|
|||
icon: 'icon-gongzuotai',
|
||||
path: '/desktop'
|
||||
},
|
||||
{
|
||||
name: '教学实践',
|
||||
id: 4,
|
||||
icon: 'icon-jiaoxueshijian',
|
||||
path: '/prepare'
|
||||
},
|
||||
{
|
||||
name: '资源中心',
|
||||
id: 3,
|
||||
|
@ -132,12 +126,12 @@ const computedregistertype = computed(() => {
|
|||
if(type==3 && userStore.DeptInfo.register.auditStatus==0){
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
// 创建学校 待审核
|
||||
if(type==4 && userStore.DeptInfo.register.auditStatus==0){
|
||||
return 3
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
const clickMenu = ({ id, disabled, path }) => {
|
||||
if (disabled) return
|
||||
|
@ -199,7 +193,7 @@ onMounted(() => {
|
|||
}
|
||||
.popoverStyle .head-aside{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
@ -252,7 +246,7 @@ onMounted(() => {
|
|||
align-items: center;
|
||||
font-size: 12px;
|
||||
.user-img{
|
||||
width: 56px;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
|
@ -318,4 +312,4 @@ onMounted(() => {
|
|||
font-size: 18px;
|
||||
font-weight: 800;
|
||||
}
|
||||
</style>
|
||||
</style>
|
|
@ -1,164 +0,0 @@
|
|||
/**
|
||||
* websocket 工具类(im 自己实现)
|
||||
* 单例模式: 保证一个类仅有一个实例,并提供一个访问它的全局访问点。
|
||||
* 实现的方法为先判断实例存在与否,如果存在则直接返回,不存在就创建了再返回,这就确保了一个类只有一个实例对象。
|
||||
*/
|
||||
import useUserStore from '@/store/modules/user' // 用户信息
|
||||
|
||||
export class ChatWs {
|
||||
instance = null; // 实例
|
||||
id = null; // 群聊id || 单聊id-用户id(userId)
|
||||
closed = false; // 关闭状态
|
||||
onmessage = null; // 自定义处理
|
||||
errCount = 5; // 重连次数 (ms) 暂时不使用
|
||||
errTime = null; // 重连时间 (ms) 1秒内zhi间内不重连
|
||||
// 类型定义
|
||||
TYPES = {
|
||||
group: 'group', // 群发
|
||||
single: 'single', // 单发
|
||||
beat: 'heart_beat', // 心跳
|
||||
}
|
||||
static base = 'wss://file.ysaix.com:7868'
|
||||
constructor() {
|
||||
if (!ChatWs.instance) {
|
||||
const userStore = useUserStore() // 用户信息
|
||||
const wsBase = import.meta.env.VITE_APP_WS_URL; // ws地址
|
||||
const url = `${wsBase||ChatWs.base}/ws/websocket/${userStore.id}`;
|
||||
this.init(url);
|
||||
ChatWs.instance = this;
|
||||
}
|
||||
return ChatWs.instance;
|
||||
}
|
||||
|
||||
// 初始化
|
||||
init(url) {
|
||||
this.url = url;
|
||||
this.ws = null;
|
||||
const _this = this
|
||||
this.heartCheck = {
|
||||
timeout: 1000 * 10, // 60s
|
||||
timeoutObj: null,
|
||||
serverTimeoutObj: null,
|
||||
reset() {
|
||||
clearTimeout(this.timeoutObj);
|
||||
clearTimeout(this.serverTimeoutObj);
|
||||
return this;
|
||||
},
|
||||
start() {
|
||||
const self = this;
|
||||
this.timeoutObj = setTimeout(function () {
|
||||
// 这里发送一个心跳,后端收到后,返回一个心跳消息,
|
||||
// onmessage拿到返回的心跳就说明连接正常
|
||||
console.log("websocket-发送心跳")
|
||||
_this.sendMsgBeat();
|
||||
self.serverTimeoutObj = setTimeout(function () {
|
||||
console.log("websocket-心跳响应超时")
|
||||
// 如果超过一定时间还没重置,说明后端主动断开了
|
||||
_this.ws.close(); // 如果onclose会执行reconnect,我们执行ws.close()就行了.如果直接执行reconnect 会触发onclose导致重连两次
|
||||
}, self.timeout);
|
||||
}, this.timeout);
|
||||
},
|
||||
};
|
||||
this.reconnect();
|
||||
}
|
||||
// 重连
|
||||
reconnect() {
|
||||
const self = this;
|
||||
if (!!this.ws) { // 关闭之前的链接
|
||||
this.ws.close()
|
||||
this.ws = null
|
||||
}
|
||||
this.ws = new WebSocket(this.url);
|
||||
this.ws.onopen = function () {
|
||||
console.log("websocket-连接成功")
|
||||
self.heartCheck.reset().start();
|
||||
};
|
||||
this.ws.onmessage = function (e) {
|
||||
// console.log("websocket-收到消息", e)
|
||||
// 拿到任何消息都说明当前连接是正常的
|
||||
const isBeat = e.data == 'pong'
|
||||
isBeat && self.heartCheck.reset().start();
|
||||
const exts = ['sessionId', 'pong'] // 不处理的消息头
|
||||
const isEmpty = !e.data
|
||||
const isExts = exts.some(item => e.data.includes(item))
|
||||
if (isEmpty && isExts) return;
|
||||
// 自定义处理
|
||||
self.onmessage && self.onmessage(e.data, e);
|
||||
};
|
||||
this.ws.onerror = function (e) {
|
||||
console.log("websocket-连接异常", e)
|
||||
self.connectSocket() // 重连
|
||||
};
|
||||
this.ws.onclose = function (e) {
|
||||
console.log("websocket-连接断开", e)
|
||||
self.connectSocket() // 重连
|
||||
};
|
||||
}
|
||||
connectSocket() {
|
||||
this.heartCheck.reset() // 重置心跳
|
||||
if (self.closed) return; // 关闭状态不重连
|
||||
// if(self.errCount <= 0) return; // 超过重连次数
|
||||
// self.errCount--; // 重连次数减1
|
||||
if (this.errTime) {
|
||||
const nowTime = Date.now();
|
||||
const bool = nowTime - this.errTime < 1000 // 1s内zhi间内不重连
|
||||
if (bool) return; // 1s内不重连
|
||||
}
|
||||
this.errTime = Date.now();
|
||||
// 延时5s 后重连
|
||||
console.log('重连中...')
|
||||
this.sleep(5000).then(_ => {this.reconnect()})
|
||||
}
|
||||
// 发送消息
|
||||
send(msg) {
|
||||
if (!msg) throw new Error("msg is not null")
|
||||
if (!this.ws) throw new Error("ws is not null")
|
||||
if (typeof msg === "object") msg = JSON.stringify(msg)
|
||||
if (!msg.includes('"msg":')) throw new Error("msg 格式错误请重试")
|
||||
this.ws.send(msg)
|
||||
}
|
||||
// 发送消息-带消息头(key)
|
||||
sendMsg(head, content, option = {}) {
|
||||
if (!head) throw new Error("head is not null")
|
||||
if (!content) throw new Error("content is not null")
|
||||
let msg = { head, content, ...option }
|
||||
// 发送消息
|
||||
this.send(this.getMsgObj(msg))
|
||||
}
|
||||
// 发送心跳
|
||||
sendMsgBeat() {
|
||||
// this.send(this.getMsgObj('ping', this.TYPES.beat))
|
||||
this.ws.send('ping')
|
||||
}
|
||||
/**
|
||||
* @description 获取消息对象
|
||||
* @param {*} msg 消息内容
|
||||
* @param {*} chatType 群发 group| 单发 single| 心态 heart_beat
|
||||
* @param {*} id 群聊id || 单聊id-用户id(userId)
|
||||
*/
|
||||
getMsgObj(msg, chatType = 'group', id) {
|
||||
if (typeof msg === "object") msg = JSON.stringify(msg)
|
||||
const res = {msg, chatType}
|
||||
// if (!id) throw new Error(`${type=='group'?'群ID':'用户ID'} is not null`)
|
||||
if (chatType == 'group') res.groupId = id || this.id || ''
|
||||
else if (chatType == 'single') res.to = id || this.id || ''
|
||||
return res
|
||||
}
|
||||
// 监听
|
||||
watch(callback) {
|
||||
callback && (this.onmessage = callback);
|
||||
}
|
||||
// 关闭链接
|
||||
close() {
|
||||
this.closed = true;
|
||||
this.ws.close();
|
||||
}
|
||||
// 延时 ms 毫秒
|
||||
sleep(ms){
|
||||
return new Promise(resolve => setTimeout(resolve, ms))
|
||||
}
|
||||
}
|
||||
// 连接socket
|
||||
export const connect = () => new ChatWs()
|
||||
// 默认实例
|
||||
export default new ChatWs()
|
|
@ -258,45 +258,16 @@ export const getFileName = (filename) => {
|
|||
return filename.replace(/\.[^/.]+$/, "");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据图片的url转换对应的base64值
|
||||
* @param { String } url 如:http://xxxx/xxx.png
|
||||
* @returns base64取值
|
||||
*/
|
||||
export const urlToBase64 = (url) => {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!url) {
|
||||
reject('请传入url内容')
|
||||
}
|
||||
if (/\.(png|jpe?g|gif|svg)(\?.*)?$/.test(url)) {
|
||||
// 图片地址
|
||||
let image = new Image()
|
||||
// 设置跨域问题
|
||||
image.setAttribute('crossOrigin', 'anonymous')
|
||||
// 图片地址
|
||||
image.src = url +"?v=" + Math.random(); // 处理缓存,fix缓存bug,有缓存,浏览器会报错;
|
||||
image.onload = () => {
|
||||
let canvas = document.createElement('canvas')
|
||||
const ctx = canvas.getContext('2d')
|
||||
canvas.width = image.width
|
||||
canvas.height = image.height
|
||||
ctx.drawImage(image, 0, 0, image.width, image.height)
|
||||
|
||||
// 获取图片后缀
|
||||
const ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase()
|
||||
// 转base64
|
||||
const dataUrl = canvas.toDataURL(`image/${ext}`)
|
||||
resolve(dataUrl || '')
|
||||
canvas = null // 清除canvas元素
|
||||
image = null // 清除img元素
|
||||
}
|
||||
} else {
|
||||
// 非图片地址
|
||||
reject('非(png/jpe?g/gif/svg等)图片地址');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// 清除当前选中的教材 章节 相关信息
|
||||
export const clearBookInfo = () =>{
|
||||
//当前选中的教材
|
||||
localStorage.removeItem('curBook')
|
||||
// 当前选中的节点
|
||||
localStorage.removeItem('curNode')
|
||||
// 所有章节单元数据
|
||||
localStorage.removeItem('unitList')
|
||||
// 所有教材数据
|
||||
localStorage.removeItem('subjectList')
|
||||
// 展开的节点
|
||||
localStorage.removeItem('defaultExpandedKeys')
|
||||
}
|
|
@ -208,10 +208,6 @@ export const createWindow = async (type, data) => {
|
|||
autoHideMenuBar: true,
|
||||
maximizable: false,
|
||||
}
|
||||
// pptlist的时候可以选择最大化
|
||||
if (data.url == '/pptist'){
|
||||
defOption.maximizable = true;
|
||||
}
|
||||
data.isConsole = true // 是否开启控制台
|
||||
data.option = {...defOption, ...option}
|
||||
const win = await toolWindow(type, data)
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, ref, watch, reactive, getCurrentInstance, nextTick, defineEmits } from 'vue'
|
||||
import { onMounted, ref, watch, reactive, getCurrentInstance, nextTick } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { Plus, Delete } from '@element-plus/icons-vue'
|
||||
|
@ -156,7 +156,6 @@ const { proxy } = getCurrentInstance()
|
|||
const props = defineProps({
|
||||
currentCourse: Object,
|
||||
})
|
||||
const emits = defineEmits(['getData'])
|
||||
const isShow = ref(false)
|
||||
|
||||
const propsQueryCourseObj = route.query.courseObj;//作业布置的内容对象
|
||||
|
@ -461,8 +460,10 @@ const handleClassWorkFormQuizRemove = (index) =>{
|
|||
await nextTick(); // 确保DOM更新完成
|
||||
proxy.$refs["classWorkFormRef"].validate(async valid => {
|
||||
if (valid) {
|
||||
//
|
||||
// const { chapterId } = await useGetHomework(courseObj.node)
|
||||
// this.entpcourseid = chapterId
|
||||
|
||||
const cform = {
|
||||
id: 0,
|
||||
workdate: classWorkForm.workdate, // //作业类型?web端这里貌似没有这个时间
|
||||
|
@ -506,7 +507,7 @@ const handleClassWorkFormQuizRemove = (index) =>{
|
|||
cform.workcodes = JSON.stringify({json: canvasJson, base64: canvasBase64});
|
||||
cform.entpcourseworklist = JSON.stringify([{'id':-1, 'score': '10'}]);
|
||||
try {
|
||||
addClassworkReturnId(cform).then((res) => {
|
||||
addClassworkReturnId(cform).then(() => {
|
||||
ElMessage({ type: 'success', message: '作业设计成功!'});
|
||||
// 重置提交表单
|
||||
classWorkForm.worktype = "课堂展示";
|
||||
|
@ -518,8 +519,7 @@ const handleClassWorkFormQuizRemove = (index) =>{
|
|||
// 情况选择的资源缓存
|
||||
classWorkForm.chooseWorkLists = []; // 框架梳理list
|
||||
classWorkForm.whiteboardObj = ''; // ? // 清空白板
|
||||
classWorkForm.id = res
|
||||
emits('getData',classWorkForm)
|
||||
|
||||
boardLoading.value = false
|
||||
})
|
||||
} finally {
|
||||
|
@ -531,7 +531,7 @@ const handleClassWorkFormQuizRemove = (index) =>{
|
|||
cform.workcodes = JSON.stringify(classWorkForm.fileHomeworkList);
|
||||
cform.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]);
|
||||
try {
|
||||
addClassworkReturnId(cform).then((res) => {
|
||||
addClassworkReturnId(cform).then(() => {
|
||||
ElMessage({ type: 'success', message: '作业设计成功!'});
|
||||
// 重置提交表单
|
||||
classWorkForm.worktype = "常规作业";
|
||||
|
@ -543,8 +543,7 @@ const handleClassWorkFormQuizRemove = (index) =>{
|
|||
classWorkForm.chooseWorkLists = []; // 框架梳理list
|
||||
classWorkForm.whiteboardObj = ''; // ? // 清空白板
|
||||
classWorkForm.fileHomeworkList = []; // 常规作业list
|
||||
classWorkForm.id = res
|
||||
emits('getData',classWorkForm)
|
||||
|
||||
fileLoading.value = false
|
||||
})
|
||||
} finally {
|
||||
|
@ -575,7 +574,7 @@ const handleClassWorkFormQuizRemove = (index) =>{
|
|||
console.log(cform,'提交的数据');
|
||||
if(cform.entpcourseworklist == '') return ElMessage({ type: 'warning', message: '请先添加作业资源!'});
|
||||
|
||||
addClassworkReturnId(cform).then(res => {
|
||||
addClassworkReturnId(cform).then(workres => {
|
||||
ElMessage({ type: 'success', message: '作业设计成功!'});
|
||||
// 重置提交表单
|
||||
classWorkForm.worktype = "习题训练";
|
||||
|
@ -586,8 +585,6 @@ const handleClassWorkFormQuizRemove = (index) =>{
|
|||
// 情况选择的资源缓存
|
||||
classWorkForm.chooseWorkLists = [];
|
||||
classWorkForm.whiteboardObj = ''; // ? // 清空白板
|
||||
classWorkForm.id = res
|
||||
emits('getData',classWorkForm)
|
||||
// refresh the list
|
||||
//这里分离了,所以不需要更新表单数据了
|
||||
// this.getClassWorkAllList();
|
||||
|
@ -607,7 +604,6 @@ const handleClassWorkFormQuizRemove = (index) =>{
|
|||
// // 首页进入的,跳转到作业布置页面
|
||||
// router.push({ path: '/classTaskAssign' });
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="年份" label-width="70">
|
||||
<el-select v-model="entpCourseWorkQueryParams.yearStr" placeholder="请选择">
|
||||
<el-select v-model="entpCourseWorkQueryParams.yearStr" placeholder="请选择" >
|
||||
<el-option v-for="(item, index) in entpCourseWorkYearList" :key="index" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
@ -40,7 +40,7 @@
|
|||
<el-button @click="handleQueryParamFromEntpCourseWork(1)"><el-icon><Search /></el-icon> 查找</el-button>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-button v-if="!props.isHtml2canvas" type="primary" @click="goToQuestUpload()">添加习题</el-button>
|
||||
<el-button type="primary" @click="goToQuestUpload()">添加习题</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 习题表格 -->
|
||||
|
@ -58,9 +58,9 @@
|
|||
</div>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<div @click="showExamAnalyseDrawer(scope.row)" :id=" `screenshot-target-${scope.row.id}` " style="padding: 5px;">
|
||||
<div style="overflow: hidden; text-overflow: ellipsis; padding: 2px;" v-html="scope.row.titleFormat"></div>
|
||||
<div style="overflow: hidden; text-overflow: ellipsis; font-size: 0.9em; margin-top: 6px; padding: 2px;" v-html="scope.row.workdescFormat"></div>
|
||||
<div @click="showExamAnalyseDrawer(scope.row)">
|
||||
<div style="overflow: hidden; text-overflow: ellipsis" v-html="scope.row.titleFormat"></div>
|
||||
<div style="overflow: hidden; text-overflow: ellipsis; font-size: 0.9em; margin-top: 6px;" v-html="scope.row.workdescFormat"></div>
|
||||
<el-col :span="24" style="display: flex">
|
||||
<div style="font-size: 1em; color: silver; padding-top: 5px">{{ scope.row.entpname }} {{ scope.row.editusername }}</div>
|
||||
<div style="margin-left: 30px; font-size: 1em; color: silver; padding-top: 5px">{{ scope.row.worktag }}</div>
|
||||
|
@ -70,8 +70,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column width="100">
|
||||
<template #default="scope">
|
||||
<el-button v-if="props.isHtml2canvas" type="primary" @click="captureScreenshot(scope.row.id)">选取该题</el-button>
|
||||
<div v-else>
|
||||
<div>
|
||||
<el-button type="primary" @click="handleClassWorkQuizAdd('entpcourseworklist', scope.row.id)">添加</el-button>
|
||||
<div style="padding: 2px;"></div>
|
||||
<el-button type="warning" @click="handleImportSingleDlg(scope.row)">纠错</el-button>
|
||||
|
@ -118,7 +117,6 @@
|
|||
import { Search } from '@element-plus/icons-vue'
|
||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import html2canvas from 'html2canvas';
|
||||
|
||||
import { listEntpcoursework, listEntpcourseworkLocal } from '@/api/education/entpCourseWork'
|
||||
import { listEvaluationclue } from '@/api/classTask'
|
||||
|
@ -138,7 +136,7 @@ const router = useRouter()
|
|||
|
||||
|
||||
// 定义要发送的emit事件
|
||||
let emit = defineEmits(['addQuiz', 'addQuizImgBs64'])
|
||||
const emit = defineEmits(['addQuiz'])
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore().user
|
||||
const {
|
||||
|
@ -152,10 +150,6 @@ const props = defineProps({
|
|||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
isHtml2canvas: {// 是否截屏
|
||||
type: Boolean,
|
||||
default: () => false
|
||||
},
|
||||
})
|
||||
|
||||
const knowledgePointProps = ref({value: 'thirdId', label: 'title'});
|
||||
|
@ -446,22 +440,6 @@ const handleDelete = async(item, index) => {
|
|||
// ElMessage('试题已经存在')
|
||||
// }
|
||||
};
|
||||
|
||||
/**
|
||||
* 把该题区域id 获取为截屏区域
|
||||
* @param id 试题id
|
||||
*/
|
||||
const captureScreenshot = (id) => {
|
||||
const targetElement = document.getElementById('screenshot-target-' + id);
|
||||
html2canvas(targetElement).then(canvas => {
|
||||
// 将canvas转换为图像URL
|
||||
const screenshotUrl = canvas.toDataURL('image/png');
|
||||
// 在这里可以将截图保存到本地或上传到服务器
|
||||
// console.log(screenshotUrl);
|
||||
emit('addQuizImgBs64', screenshotUrl);
|
||||
});
|
||||
}
|
||||
|
||||
// 防抖
|
||||
const debounceQueryData = debounce(() => {
|
||||
console.log("防抖 加载数据中...")
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
<template>
|
||||
<div class="page">
|
||||
<div class="page-resource">
|
||||
<div class="page-center">
|
||||
<el-tabs v-model="activeAptTab" style="height: 100%;">
|
||||
<el-tab-pane label="自主搜题" name="自主搜题" class="prepare-center-zzst">
|
||||
<SearchQuestion :bookobj="courseObj" :isHtml2canvas="true" @addQuizImgBs64="handleaddQuizImgBs64" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="校本题库" name="校本题库" class="prepare-center-xbtk">
|
||||
<SchoolQuestion />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="个人题库" name="个人题库" class="prepare-center-grst">
|
||||
<MyQuestion :bookobj="courseObj" :isHtml2canvas="true" @addQuizImgBs64="handleaddQuizImgBs64"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, ref, watch, reactive, getCurrentInstance, nextTick } from 'vue'
|
||||
|
||||
import MyQuestion from '@/views/classTask/newClassTaskAssign/myQuestion/index.vue'
|
||||
import SchoolQuestion from '@/views/classTask/newClassTaskAssign/schoolQuestion/index.vue'
|
||||
import SearchQuestion from '@/views/classTask/newClassTaskAssign/searchQuestion/index.vue'
|
||||
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const userStore = useUserStore().user
|
||||
|
||||
|
||||
const emit = defineEmits(['update']);
|
||||
const courseObj = reactive({
|
||||
// 课程相关参数: 教材id,单元id,章节id,课程名称
|
||||
textbookId: '',
|
||||
levelFirstId: '',
|
||||
levelSecondId: '',
|
||||
coursetitle:'',
|
||||
node: null, // 选择的课程节点
|
||||
//
|
||||
})
|
||||
|
||||
const activeAptTab = ref("自主搜题");
|
||||
|
||||
onMounted(() => {
|
||||
const curNode = sessionStore.get('subject.curNode')
|
||||
courseObj.textbookId = curNode.rootid
|
||||
courseObj.levelFirstId = curNode.parentNode.id
|
||||
courseObj.levelSecondId = curNode.id
|
||||
courseObj.coursetitle = curNode.itemtitle,
|
||||
courseObj.node = curNode
|
||||
})
|
||||
|
||||
|
||||
const handleaddQuizImgBs64 = (quizbs64) => {
|
||||
emit('update', quizbs64)
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.page {
|
||||
height: 100%;
|
||||
|
||||
.page-resource {
|
||||
user-select: none;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
flex: 1;
|
||||
:deep(.el-tabs__nav) {
|
||||
.el-tabs__item{
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.page-center{
|
||||
flex: 1;
|
||||
//min-width: calc(100% - 675px);
|
||||
height: 100%;
|
||||
padding: 0 5px;
|
||||
margin: 0 5px;
|
||||
overflow: hidden;
|
||||
border-radius: 10px;
|
||||
background-color: white;
|
||||
|
||||
.prepare-center-zzst{
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
|
||||
}
|
||||
.prepare-center-xbtk{
|
||||
height: 100%;
|
||||
}
|
||||
.prepare-center-grst{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
.upload-homework{
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="page">
|
||||
<div class="page">
|
||||
<!-- 习题筛选1 -->
|
||||
<el-row style="width: 100%; height: 50px;">
|
||||
<el-col :span="7">
|
||||
|
@ -60,7 +60,7 @@
|
|||
<div class="page-table" >
|
||||
<el-table
|
||||
:data="workResource.entpCourseWorkList"
|
||||
style="width: 100%; height: calc(100% - 50px);"
|
||||
style="width: 100%; height: calc(100% - 55px);"
|
||||
v-loading="pageParams.loading"
|
||||
>
|
||||
<el-table-column type="index" width="60" />
|
||||
|
@ -71,9 +71,9 @@
|
|||
</div>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<div @click="showExamAnalyseDrawer(scope.row)" :id=" `screenshot-target-${scope.row.id}` " style="padding: 5px;">
|
||||
<div style="overflow: hidden; text-overflow: ellipsis; padding: 2px;" v-html="scope.row.titleFormat"></div>
|
||||
<div style="overflow: hidden; text-overflow: ellipsis; font-size: 0.9em; margin-top: 6px; padding: 2px;" v-html="scope.row.workdescFormat"></div>
|
||||
<div @click="showExamAnalyseDrawer(scope.row)">
|
||||
<div style="overflow: hidden; text-overflow: ellipsis" v-html="scope.row.titleFormat"></div>
|
||||
<div style="overflow: hidden; text-overflow: ellipsis; font-size: 0.9em; margin-top: 6px;" v-html="scope.row.workdescFormat"></div>
|
||||
<el-col :span="24" style="display: flex">
|
||||
<div style="font-size: 1em; color: silver; padding-top: 5px">{{ scope.row.entpname }} {{ scope.row.editusername }}</div>
|
||||
<div style="margin-left: 30px; font-size: 1em; color: silver; padding-top: 5px">{{ scope.row.worktag }}</div>
|
||||
|
@ -83,19 +83,18 @@
|
|||
</el-table-column>
|
||||
<el-table-column align="left" width="100">
|
||||
<template #default="scope">
|
||||
<el-button v-if="props.isHtml2canvas" type="primary" @click="captureScreenshot(scope.row.id)">选取该题</el-button>
|
||||
<el-button v-else type="primary" @click="handleClassWorkQuizAdd('entpcourseworklist', scope.row.id)">添加</el-button>
|
||||
<el-button type="primary" @click="handleClassWorkQuizAdd('entpcourseworklist', scope.row.id)">添加</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页-->
|
||||
<div style="height: 50px;">
|
||||
<div style="height: 55px;">
|
||||
<el-pagination
|
||||
v-show="pageParams.total > 0"
|
||||
v-model:page="paginationParams.pageNum"
|
||||
v-model:limit="paginationParams.pageSize"
|
||||
:total="pageParams.total"
|
||||
:style="{ position: 'relative', 'padding-top': '10px' }"
|
||||
:style="{ position: 'relative', 'margin-top': '5px' }"
|
||||
@change="getPaginationList" />
|
||||
</div>
|
||||
</div>
|
||||
|
@ -105,7 +104,7 @@
|
|||
</template>
|
||||
<script setup>
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
import html2canvas from 'html2canvas';
|
||||
|
||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||
|
||||
import {listEntpcoursework, listEntpcourseworkNew, getEntpcoursework} from '@/api/education/entpCourseWork'
|
||||
|
@ -123,7 +122,7 @@ import useUserStore from '@/store/modules/user'
|
|||
import useClassTaskStore from '@/store/modules/classTask'
|
||||
|
||||
// 定义要发送的emit事件
|
||||
let emit = defineEmits(['addQuiz', 'addQuizImgBs64'])
|
||||
const emit = defineEmits(['addQuiz'])
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore().user
|
||||
const {
|
||||
|
@ -137,10 +136,6 @@ const props = defineProps({
|
|||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
isHtml2canvas: {// 是否截屏
|
||||
type: Boolean,
|
||||
default: () => false
|
||||
},
|
||||
})
|
||||
|
||||
const entpCourseWorkPointList = ref([
|
||||
|
@ -188,7 +183,6 @@ const workResource = reactive({
|
|||
}); // 作业资源
|
||||
|
||||
onMounted(() => {
|
||||
console.log('entpCourseWorkTypeList', entpCourseWorkTypeList);
|
||||
debounceQueryData(); // 查询习题列表
|
||||
})
|
||||
|
||||
|
@ -433,20 +427,6 @@ const getPaginationList = ( page, limit ) => {
|
|||
// ElMessage('试题已经存在')
|
||||
// }
|
||||
};
|
||||
/**
|
||||
* 把该题区域id 获取为截屏区域
|
||||
* @param id 试题id
|
||||
*/
|
||||
const captureScreenshot = (id) => {
|
||||
const targetElement = document.getElementById('screenshot-target-' + id);
|
||||
html2canvas(targetElement).then(canvas => {
|
||||
// 将canvas转换为图像URL
|
||||
const screenshotUrl = canvas.toDataURL('image/png');
|
||||
// 在这里可以将截图保存到本地或上传到服务器
|
||||
// console.log(screenshotUrl);
|
||||
emit('addQuizImgBs64', screenshotUrl);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 防抖
|
||||
|
|
|
@ -16,16 +16,6 @@
|
|||
<el-table-column align="center" prop="worktype" width="100"></el-table-column>
|
||||
<el-table-column align="center" prop="worktag" width="120"></el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页-->
|
||||
<div style="height: 48px;">
|
||||
<el-pagination
|
||||
v-show="paginationParams.total > 0"
|
||||
v-model:page="paginationParams.pageNum"
|
||||
v-model:limit="paginationParams.pageSize"
|
||||
:total="paginationParams.total"
|
||||
:style="{ position: 'relative', 'padding': '8px 20px 0 0' }"
|
||||
@change="changePageNum" />
|
||||
</div>
|
||||
|
||||
<!-- 试题详细信息 -->
|
||||
<examDetailsDrawer ref="examDetailsDrawerRef"></examDetailsDrawer>
|
||||
|
@ -64,13 +54,11 @@ const { proxy } = getCurrentInstance()
|
|||
|
||||
const props = defineProps({
|
||||
listExamQuestion: {type: Array},
|
||||
loading: {type: Boolean},
|
||||
paginationParams: {type: Object},
|
||||
loading: {type: Boolean}
|
||||
})
|
||||
|
||||
const activeExamInfoDrawer = ref(false);
|
||||
const activeExam = ref({});
|
||||
const emit = defineEmits(['updatePageNum'])
|
||||
|
||||
const showExamAnalyseDrawer = (row) => {
|
||||
nextTick(() => {
|
||||
|
@ -81,17 +69,13 @@ const showExamAnalyseDrawer = (row) => {
|
|||
})
|
||||
}
|
||||
|
||||
const changePageNum = (pageNum) => {
|
||||
emit('updatePageNum', pageNum);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.table-main {
|
||||
width: 100%;
|
||||
height: calc(100% - 48px);
|
||||
height: 100%;
|
||||
text-align: left;
|
||||
|
||||
.main-title {
|
||||
|
|
|
@ -47,13 +47,10 @@
|
|||
</el-select>
|
||||
</div>
|
||||
|
||||
<!-- <div :style="{'width': (viewportWidth - 400) + 'px','height': (viewportHeight-38) + 'px','overflow-y': 'auto'}"> -->
|
||||
<div style="width: 100%; height: 100%; overflow-y: auto; border-radius: 10px;">
|
||||
<div :style="{'width': (viewportWidth - 400) + 'px','height': (viewportHeight-38) + 'px','overflow-y': 'auto'}">
|
||||
<examReview
|
||||
:loading="loading"
|
||||
:listExamQuestion="listExamQuestion"
|
||||
:paginationParams="paginationParams"
|
||||
@updatePageNum="updatePageNum"
|
||||
v-if="curTask.viewkey=='真题回顾' "
|
||||
/>
|
||||
|
||||
|
@ -80,15 +77,12 @@ import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
|||
import {listEntpcoursework, listEntpcourseworkNew} from '@/api/education/entpCourseWork'
|
||||
import { processList } from '@/hooks/useProcessList'
|
||||
import { JYApiListCT} from "@/utils/examQuestion/jyeoo"
|
||||
import useClassTaskStore from '@/store/modules/classTask'
|
||||
|
||||
import examReview from './container/examReview.vue'
|
||||
import pointAnalysis from './container/pointAnalysis.vue'
|
||||
import examMocks from './container/examMocks.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const classTaskStore = useClassTaskStore();
|
||||
|
||||
const {proxy} = getCurrentInstance();
|
||||
const sourceStore = useResoureStore();
|
||||
const viewportHeight = ref(0);
|
||||
|
@ -97,11 +91,6 @@ const viewportWidth = ref(0);
|
|||
const curNode = ref({});
|
||||
// 试题集合
|
||||
const listExamQuestion = ref([]);
|
||||
const paginationParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
const loading = ref(false);
|
||||
const curTask = reactive({
|
||||
viewkey: '真题回顾',
|
||||
|
@ -118,22 +107,6 @@ const listWorkType = ref([{
|
|||
value: 0,
|
||||
}]);
|
||||
|
||||
|
||||
/**
|
||||
* @desc: 翻页
|
||||
* @return: {*}
|
||||
* @param {*} pageNum
|
||||
*/
|
||||
const updatePageNum = (pageNum) => {
|
||||
paginationParams.pageNum = pageNum;
|
||||
queryExamQuestionByParams();
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc: 具体获取试题及格式化
|
||||
* @return: {*}
|
||||
* @param {*} params
|
||||
*/
|
||||
const getCourseWorkList = async (params) => {
|
||||
const res = await listEntpcourseworkNew(params);
|
||||
if(res.data == null) {
|
||||
|
@ -142,14 +115,7 @@ const getCourseWorkList = async (params) => {
|
|||
return;
|
||||
}
|
||||
listExamQuestion.value = res.data;
|
||||
// 判断获取到的总数
|
||||
const total = parseInt(res.msg)
|
||||
if (!isNaN(total)) {
|
||||
paginationParams.total = total;
|
||||
} else {
|
||||
console.error('无法将 res.msg 转换为数字');
|
||||
paginationParams.total = 0; // 重新设置默认值
|
||||
}
|
||||
// queryParams.total = res.total;
|
||||
// 格式化试题
|
||||
processList(listExamQuestion.value);
|
||||
}
|
||||
|
@ -166,8 +132,7 @@ const getData = async (data) => {
|
|||
loading.value = true;
|
||||
|
||||
// 1.获取题型
|
||||
//getWorkType(data.node);
|
||||
listWorkType.value = classTaskStore.entpCourseWorkTypeList;
|
||||
getWorkType(data.node);
|
||||
|
||||
// 2.获取试题集合
|
||||
curNode.value = data.node;
|
||||
|
@ -201,8 +166,6 @@ const getData = async (data) => {
|
|||
edusubject: curNode.value.edusubject,
|
||||
edustage: curNode.value.edustage,
|
||||
sectionName: curNode.value.itemtitle,
|
||||
currentPage: paginationParams.pageNum,
|
||||
pageSize: paginationParams.pageSize,
|
||||
}
|
||||
await getCourseWorkList(params);
|
||||
loading.value = false;
|
||||
|
@ -218,7 +181,6 @@ const changeTaskView = (item, key) => {
|
|||
curTask.viewkey = item;
|
||||
}
|
||||
|
||||
// 目前暂不使用, 题型已通过classTaskStore获取
|
||||
const getWorkType = async (data) => {
|
||||
const selName = `${data.edustage}${data.edusubject}`
|
||||
const curName = `${curNode.value.edustage}${curNode.value.edusubject}`
|
||||
|
@ -269,8 +231,6 @@ const queryExamQuestionByParams = async () => {
|
|||
edusubject: curNode.value.edusubject,
|
||||
edustage: curNode.value.edustage,
|
||||
sectionName: curNode.value.itemtitle,
|
||||
currentPage: paginationParams.pageNum,
|
||||
pageSize: paginationParams.pageSize,
|
||||
}
|
||||
await getCourseWorkList(params);
|
||||
loading.value = false;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<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" destroy-on-close>
|
||||
<template #header>
|
||||
<div class="custom-header flex">
|
||||
<span>选择{{ title }}</span>
|
||||
|
@ -15,10 +15,8 @@
|
|||
</div>
|
||||
<div class="content-list">
|
||||
<ul>
|
||||
<li v-for="(item, index) in fileList" :class="activeIndex == index ? 'li-active' : ''"
|
||||
@click="clickItem(index, item)">
|
||||
<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>
|
||||
|
@ -26,8 +24,8 @@
|
|||
</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>
|
||||
|
@ -39,31 +37,6 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog v-model="prevVisible" fullscreen :show-close="false" class="prev-dialog">
|
||||
<template #header>
|
||||
<div class="custom-header flex">
|
||||
<span>预览</span>
|
||||
<i class="iconfont icon-guanbi" @click="prevVisible = false"></i>
|
||||
</div>
|
||||
</template>
|
||||
<div style="height: calc(100vh - 120px);">
|
||||
<template v-if="getFileSuffix(prevItem.fileUrl) == 'pdf'">
|
||||
<iframe :src="prevItem.fileUrl"
|
||||
frameborder="0" width="100%" height="100%"></iframe>
|
||||
</template>
|
||||
<template v-else>
|
||||
<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>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -74,7 +47,6 @@ import { sessionStore } from '@/utils/store'
|
|||
import { dataSetJson } from '@/utils/comm.js'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { getFileSuffix } from '@/utils/ruoyi.js'
|
||||
import emitter from '@/utils/mitt';
|
||||
|
||||
const userInfo = useUserStore().user
|
||||
|
@ -84,7 +56,6 @@ 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 prevVisible = ref(false)
|
||||
|
||||
const props = defineProps({
|
||||
modeType: {
|
||||
|
@ -128,20 +99,21 @@ const activeIndex = ref(0)
|
|||
const dataset_id = ref('')
|
||||
|
||||
// 上传成功
|
||||
const onSuccess = async (response) => {
|
||||
const onSuccess = async (response) =>{
|
||||
console.log(response,'response')
|
||||
let data = {
|
||||
url: response.url,
|
||||
dataset_id: dataset_id.value
|
||||
}
|
||||
const res = await completion(data)
|
||||
|
||||
if (res.data.code != 200) return
|
||||
if(res.data.code != 200) return
|
||||
let docData = {
|
||||
fileUrl: response.url,
|
||||
fileId: response.file.id,
|
||||
fileName: response.file.fileName,
|
||||
filesize: response.file.fileSize,
|
||||
datasetId: dataset_id.value,
|
||||
datasetId: dataset_id.value,
|
||||
docId: res.data.document_id,
|
||||
edustage: curNode.edustage,
|
||||
edusubject: curNode.edusubject
|
||||
|
@ -155,29 +127,25 @@ const curNode = reactive({})
|
|||
|
||||
const fileList = ref([])
|
||||
const curFile = reactive({})
|
||||
const getList = () => {
|
||||
const getList = () =>{
|
||||
docList({
|
||||
userId: userInfo.userId,
|
||||
dataset_id: dataset_id.value
|
||||
}).then(res => {
|
||||
dataset_id: dataset_id.value
|
||||
}).then( res =>{
|
||||
fileList.value = [...res.rows]
|
||||
Object.assign(curFile, fileList.value[0])
|
||||
Object.assign(curFile, fileList.value[0])
|
||||
})
|
||||
}
|
||||
|
||||
const clickItem = (index, item) => {
|
||||
activeIndex.value = index
|
||||
Object.assign(curFile, item)
|
||||
emitter.emit('curFile', item)
|
||||
Object.assign(curFile, item)
|
||||
emitter.emit('curFile',item)
|
||||
}
|
||||
|
||||
const prevItem = reactive({})
|
||||
const onPrevItem = (item) => {
|
||||
Object.assign(prevItem, item)
|
||||
prevVisible.value = true
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
onMounted(() =>{
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
Object.assign(curNode, data);
|
||||
|
||||
|
@ -187,6 +155,7 @@ onMounted(() => {
|
|||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.custom-header {
|
||||
justify-content: space-between;
|
||||
|
@ -223,11 +192,9 @@ onMounted(() => {
|
|||
overflow: hidden;
|
||||
margin-right: 20px;
|
||||
margin-bottom: 10px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
.img {
|
||||
width: 100%;
|
||||
width: 100px;
|
||||
height: 130px;
|
||||
border: solid #ccc 1px;
|
||||
margin-bottom: 10px;
|
||||
|
@ -236,10 +203,6 @@ onMounted(() => {
|
|||
&:hover {
|
||||
background: #E0EAFF;
|
||||
}
|
||||
|
||||
&:hover .prev-btn {
|
||||
transform: translate(-50%, -50%)
|
||||
}
|
||||
}
|
||||
|
||||
.li-active {
|
||||
|
@ -249,20 +212,9 @@ onMounted(() => {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
.dialog-footer{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
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;
|
||||
/* 设置过渡效果 */
|
||||
}
|
||||
</style>
|
|
@ -14,14 +14,8 @@ const pdfUrl = ref('')
|
|||
|
||||
onMounted(async () =>{
|
||||
await nextTick()
|
||||
|
||||
let data = sessionStore.get('subject.curBook')
|
||||
let fileurl = data.fileurl
|
||||
|
||||
if(fileurl == ''){
|
||||
fileurl = `${data.edustage}-${data.edusubject}-课标.txt`
|
||||
}
|
||||
pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + fileurl.replace('.txt', '.pdf')
|
||||
const { fileurl } = sessionStore.get('subject.curBook')
|
||||
pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + fileurl.replace('.txt','.pdf')
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<el-button type="primary" @click="onchange('/model/newClassTaskAssign')">作业管理</el-button>
|
||||
<el-button type="success" @click="onchange('/model/teaching')">教材研读</el-button>
|
||||
<el-button type="info" @click="onchange('/model/design')">教学框架设计</el-button>
|
||||
<!-- <el-button type="success" @click="openPPTist">打开PPTist</el-button>-->
|
||||
<el-button type="success" @click="openPPTist">打开PPTist</el-button>
|
||||
<el-button type="info" @click="onchange('/model/examination')">考试分析</el-button>
|
||||
<el-button type="primary" v-menus="dt.menus">测试</el-button>
|
||||
<el-button type="success" @click="onchange('/model/aiKolors')">文生图片</el-button>
|
||||
|
@ -52,7 +52,7 @@ import { useRouter } from 'vue-router'
|
|||
import { Plus, Refresh, Upload, Files, UploadFilled } from '@element-plus/icons-vue'
|
||||
import useUserStore from '@/store/modules/user' // 用户信息
|
||||
import msgUtils from '@/plugins/modal' // 消息工具
|
||||
import { createWindow } from '@/utils/tool' // 相关工具
|
||||
import { createWindow, sessionStore } from '@/utils/tool' // 相关工具
|
||||
import * as API_smarttalk from '@/api/file' // 文件相关api
|
||||
import * as API_entpcourse from '@/api/education/entpcourse' // 相关api
|
||||
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
||||
|
@ -61,6 +61,7 @@ import { sessionStore } from '@/utils/store' // 学科名字文生图
|
|||
// 组件引入
|
||||
import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
||||
import { menusEvent } from '@/plugins/vue3-menus' // 右键菜单
|
||||
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore() // 用户信息
|
||||
|
||||
|
@ -242,7 +243,7 @@ const HTTP_SERVER_API = (type, params = {}) => {
|
|||
ppttype: 'file',
|
||||
title: enpt.coursetitle,
|
||||
fileurl: '',
|
||||
filetype: 'aippt',
|
||||
filetype: 'aptist',
|
||||
datacontent: '',
|
||||
filekey: '',
|
||||
filetag: '',
|
||||
|
@ -301,7 +302,7 @@ const handleAll = async(type, row) =>{
|
|||
break;
|
||||
}
|
||||
case 'open': { // 打开资源-pptist
|
||||
if (row.filetype != 'aippt') return msgUtils.msgWarning('暂不支持该类型文件操作!')
|
||||
if (row.filetype != 'aptist') return msgUtils.msgWarning('暂不支持该类型文件操作!')
|
||||
sessionStore.set('curr.resource', row) // 缓存当前资源信息
|
||||
createWindow('open-win', {
|
||||
url: '/pptist', // 窗口关闭时,清除缓存
|
||||
|
@ -326,7 +327,7 @@ const handleAll = async(type, row) =>{
|
|||
// icons 处理 type 代表传递svg
|
||||
const getIcon = (o, type) => {
|
||||
let icon = typeof o == 'string' ? o : o?.filetype
|
||||
if (['aippt'].includes(o?.filetype)) icon = 'pptx'
|
||||
if (['aptist'].includes(o?.filetype)) icon = 'pptx'
|
||||
if (!!type) { // 其他格式icon
|
||||
switch(type) {
|
||||
case 'svg': // 返回svg格式
|
||||
|
@ -371,7 +372,7 @@ const getIcon = (o, type) => {
|
|||
justify-content: flex-start;
|
||||
|
||||
.el-button {
|
||||
flex: 1 1 15%;
|
||||
flex: 1 1 15%;
|
||||
max-width: 15%;
|
||||
min-width: 15%;
|
||||
box-sizing: border-box;
|
||||
|
@ -386,4 +387,4 @@ const getIcon = (o, type) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
|
@ -57,11 +57,11 @@
|
|||
</el-row>
|
||||
<div>
|
||||
<el-button style="margin-bottom: 5px;" type="primary" @click="activeStep = 0">上一步</el-button>
|
||||
<el-button style="margin-bottom: 5px;" type="primary" v-loading="createPPTLoading" @click="outlineCreatePPT()">生成PPT</el-button>
|
||||
<el-button style="margin-bottom: 5px;" type="primary" @click="outlineCreatePPT()">生成PPT</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card v-if="activeStep === 2">
|
||||
<el-progress :percentage="percentage" type="circle"></el-progress>
|
||||
<el-progress :percentage="30" type="circle" v-if="percentage === 30"></el-progress>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -79,7 +79,6 @@ import {
|
|||
import CryptoJS from "crypto-js"
|
||||
|
||||
import { getSignature } from "@/utils/index.js";
|
||||
import {sessionStore} from "@/utils/store";
|
||||
|
||||
let appId = "01ec9aa3";
|
||||
let secret = "M2QxMDAxMjYyYTEzODMwMGRkZTQ4NmUy";
|
||||
|
@ -99,8 +98,8 @@ let secondArray = ref([]); //大纲的文字部分
|
|||
|
||||
|
||||
const backGroundList = ref([]);
|
||||
let subjectdata = sessionStore.get('subject.curNode')
|
||||
const inputTheme = ref(subjectdata.edustage + subjectdata.edusubject + "《" + subjectdata.itemtitle + "》的授课课件"); // 输入的主题
|
||||
|
||||
const inputTheme = ref("高中语文《沁园春雪》的授课课件"); // 输入的主题
|
||||
const inputRequire = ref("") // 输入的需求
|
||||
const activeStep = ref(0); // 上方进度条
|
||||
const combined = ref('') // 修改完毕的大纲数据,准备传入ppt生成模型
|
||||
|
@ -110,8 +109,6 @@ const status = ref("init");
|
|||
|
||||
const percentage = ref(0);
|
||||
|
||||
const createPPTLoading = ref(false);
|
||||
|
||||
const getBackgrounds = () => {
|
||||
treeData.value = [];
|
||||
getBackGroundV2().then((res) => {
|
||||
|
@ -129,8 +126,6 @@ const outlineData = ref({
|
|||
// templateId: 'auto', // ppt生成主题
|
||||
author: 'AIX平台',
|
||||
isFigure: false, // 是否自动配图
|
||||
search: true,
|
||||
language: "cn"
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -150,17 +145,20 @@ function updateStagingData(role, newData) {
|
|||
const outlineCreatePPT = () => {
|
||||
const newOutlineData = { ...outlineData.value, };
|
||||
newOutlineData.query = outputText.value;
|
||||
createPPTLoading.value = true;
|
||||
|
||||
createPPTV2(newOutlineData).then((res) => {
|
||||
console.log(res, "正在生成中");
|
||||
createPPTLoading.value = false;
|
||||
activeStep.value = 2
|
||||
|
||||
const checkProgress = () => {
|
||||
getProgressV2(res.sid).then(response => {
|
||||
percentage.value = Math.round(response?.donePages*100/response?.totalPages);
|
||||
if (response.pptStatus === "done") {
|
||||
emit('addSuccess',{...res,url:response.pptUrl})
|
||||
getProgressV2(res.sid).then((response) => {
|
||||
percentage.value = response.process;
|
||||
if (response && response.pptUrl && response.pptUrl.length > 4) {
|
||||
console.log('PPT',response)
|
||||
// window.location.href = response.data.pptUrl;
|
||||
//发消息到主进程,携带名称和URL,将URL下载下来后复制到文件列表并上传到服务
|
||||
// let url = "https://bjcdn.openstorage.cn/xinghuo-privatedata/%2Ftmp/apiTempFiledf28bf990a4c40ffb7477ed4b65392c27232357022409613439/%E3%80%8A%E9%9D%99%E5%A5%B3%E3%80%8B%E6%B7%B1%E5%BA%A6%E8%A7%A3%E8%AF%BB%E4%B8%8E%E7%A0%94%E7%A9%B6.pptx"
|
||||
emit('addSuccess',res)
|
||||
ElMessage.success("生成成功");
|
||||
} else {
|
||||
const sleepTime = 2000;
|
||||
|
@ -267,6 +265,7 @@ function webSocketSend(ws, data) {
|
|||
|
||||
function result1(resultData) {
|
||||
let jsonData = JSON.parse(resultData);
|
||||
console.log(jsonData)
|
||||
outputText.value += jsonData.payload.choices.text[0].content;
|
||||
const div = document.querySelector('.paragraphs');
|
||||
if (div) {
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
</div>
|
||||
</el-dialog>
|
||||
<!-- im-chat 聊天组件 -->
|
||||
<!-- <im-chat ref="imChatRef" v-if="visible" @change="chatChange" /> -->
|
||||
<im-chat ref="imChatRef" v-if="visible" @change="chatChange" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -90,7 +90,7 @@ import vueQr from 'vue-qr/src/packages/vue-qr.vue' // 插件: 二维码
|
|||
import imChat from '@/views/tool/components/imChat.vue' // im-chat-子组件
|
||||
import MsgEnum from '@/plugins/imChat/msgEnum' // 消息头-相关定义(nuem)
|
||||
import * as commUtil from '@/utils/comm' // 工具类-通用
|
||||
import { toLinkWeb, createWindow, getStaticUrl, sessionStore } from '@/utils/tool' // 工具类-主进程相关
|
||||
import { toLinkWeb, getStaticUrl } from '@/utils/tool' // 工具类-主进程相关
|
||||
|
||||
import * as Http_ClassManage from '@/api/classManage' // api接口
|
||||
import * as Http_Classcourse from '@/api/teaching/classcourse' // api接口
|
||||
|
@ -103,7 +103,7 @@ let baseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
|||
const userStore = useUserStore()
|
||||
const visible = ref(false) // 是否打开窗口
|
||||
const myClassActive = ref({}) // 我的课件:准备上课的APT课件
|
||||
// const imChatRef = ref(null) // im-chat ref
|
||||
const imChatRef = ref(null) // im-chat ref
|
||||
const emit = defineEmits(['close'])
|
||||
const classForm = reactive({ // 班级(左侧):表单数据 表单配置
|
||||
form: {}, itemOption: [], option: {}
|
||||
|
@ -177,7 +177,7 @@ const initData = () => {
|
|||
teacherForm.itemOption = [
|
||||
// { label: '班级', prop: 'classid' },
|
||||
// { label: '上课', prop: 'classcourseid' },
|
||||
// { label: '老师扫码', prop: 'qrUrl', show: false },
|
||||
{ label: '老师扫码', prop: 'qrUrl', show: false },
|
||||
{ label: '手机登录', prop: 'mobile', show: false },
|
||||
{ label: '故障备用', prop: 'backup', show: false },
|
||||
]
|
||||
|
@ -257,22 +257,18 @@ const createClasscourse = async () => {
|
|||
entpcourseid, evalid, coursetitle,
|
||||
plandate: curDate, opendate: curDate
|
||||
}
|
||||
// teacherForm.form.classcourseid = 100
|
||||
teacherForm.form.classcourseid = await Http_Classcourse.addClasscourseReturnId(params)
|
||||
dt.loading = false
|
||||
// getClasscourseList('update') // 更新列表
|
||||
let msgEl = ElMessage.success('创建课程-成功')
|
||||
ElMessage.success('创建课程-成功')
|
||||
// 新版-pptList 打开公屏
|
||||
if (myClassActive.value.filetype == 'aippt') {
|
||||
if (myClassActive.value.filetype == 'aptist') {
|
||||
const msgEl = ElMessage.warning({message:'正在打开公屏,请稍后...',duration: 0})
|
||||
setTimeout(() => {
|
||||
msgEl.close()
|
||||
msgEl = ElMessage.warning({message:'正在打开公屏,请稍后...',duration: 0})
|
||||
setTimeout(() => {
|
||||
msgEl.close()
|
||||
const classcourse = {...params, id: teacherForm.form.classcourseid}
|
||||
openPublicScreen(classcourse)
|
||||
}, 2000);
|
||||
}, 1000);
|
||||
const classcourse = {...params, id: teacherForm.form.classcourseid}
|
||||
openPublicScreen(classcourse)
|
||||
}, 1500);
|
||||
}
|
||||
}
|
||||
// 删除课程
|
||||
|
@ -300,23 +296,14 @@ const removeClasscourse = async () => {
|
|||
const classTeachingStart = async () => {
|
||||
const { classcourseid:id } = teacherForm.form
|
||||
if (id) { // 开始上课
|
||||
// 新版-pptList 打开公屏
|
||||
if (myClassActive.value.filetype == 'aptist') {
|
||||
const msgEl = ElMessage.warning({message:'正在打开公屏,请稍后...',duration: 0})
|
||||
setTimeout(() => {
|
||||
msgEl.close()
|
||||
openPublicScreen({id})
|
||||
}, 2000);
|
||||
}else {
|
||||
const url = `/teaching/classteaching?classcourseid=${id}&actor=classTeachingOnPublicScreen`
|
||||
toLinkWeb(url) // 跳转web-公屏
|
||||
visible.value = false // 关闭弹窗
|
||||
}
|
||||
const url = `/teaching/classteaching?classcourseid=${id}&actor=classTeachingOnPublicScreen`
|
||||
toLinkWeb(url) // 跳转web-公屏
|
||||
visible.value = false // 关闭弹窗
|
||||
handleClose() // 关闭im-chat
|
||||
}
|
||||
}
|
||||
// 获取二维码地址
|
||||
const getQrUrl = async() => {
|
||||
// console.log('获取二维码地址')
|
||||
const { classcourseid:id } = teacherForm.form
|
||||
const { userName, userId } = userStore.user
|
||||
if (!id||!userName) return
|
||||
|
@ -349,7 +336,6 @@ const getQrUrl = async() => {
|
|||
|
||||
// 打开公屏
|
||||
const openPublicScreen = (classcourse) => {
|
||||
console.log('打开公屏', classcourse)
|
||||
const resource = toRaw(myClassActive.value)
|
||||
sessionStore.set('curr.resource', resource) // 缓存当前资源信息
|
||||
sessionStore.set('curr.classcourse', classcourse) // 缓存当前当前上课
|
||||
|
@ -360,7 +346,6 @@ const openPublicScreen = (classcourse) => {
|
|||
sessionStore.set('curr.classcourse', null) // 清除缓存
|
||||
}
|
||||
})
|
||||
visible.value = false // 关闭弹窗
|
||||
}
|
||||
|
||||
// 定时器监听
|
||||
|
@ -401,14 +386,12 @@ watch(() => classForm.form.classid, (val)=> {
|
|||
// 监听-课程id
|
||||
watch(() => teacherForm.form.classcourseid, (val) => {
|
||||
const bool = !!val
|
||||
const isApt = myClassActive.filetype=='apt'
|
||||
// 获取选中课程-生成二维码地址
|
||||
isApt && bool && getQrUrl()
|
||||
bool && getQrUrl()
|
||||
// 监听课程id,是否显示功能
|
||||
teacherForm.itemOption.forEach(o => {
|
||||
// 有课程id,触发
|
||||
const arr = isApt ? ['qrUrl','backup'] : ['backup']
|
||||
if (arr.includes(o.prop)) o.show = bool
|
||||
if (['qrUrl','backup'].includes(o.prop)) o.show = bool
|
||||
// 课程id为空,触发
|
||||
if (['mobile'].includes(o.prop)) o.show = !bool
|
||||
})
|
||||
|
|
|
@ -332,6 +332,10 @@ export default {
|
|||
const { id, rootid } = sessionStore.get('subject.curNode')
|
||||
const path="/teaching/aptindex?id="+items.fileId + "&unitId=" + id + "&bookId=" + rootid;
|
||||
let configObj = outLink().getBaseData()
|
||||
configObj.fullPath = 'https://localhost:7860/'
|
||||
configObj.data.url = 'https://localhost:7860/'
|
||||
configObj.data.domain = 'localhost'
|
||||
console.log(configObj)
|
||||
let fullPath = configObj.fullPath + path
|
||||
fullPath = fullPath.replaceAll('//', '/')
|
||||
// 通知主进程
|
||||
|
@ -341,7 +345,7 @@ export default {
|
|||
cookieData: { ...configObj.data }
|
||||
})
|
||||
return
|
||||
} else if(items.fileFlag === 'aippt') { // aippt 被点击 打开PPT-List 课件
|
||||
} else if(items.fileFlag === 'aptist') { // aptist 被点击 打开PPT-List 课件
|
||||
return this.$emit('change', 'click', items)
|
||||
}
|
||||
if (!items||!items.fileSuffix) return;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import AiPptist from './ai-pptistV2.vue';
|
||||
import AiPptist from './ai-pptist.vue';
|
||||
const model = defineModel()
|
||||
const emit = defineEmits(['addSuccess'])
|
||||
const props = defineProps({
|
||||
|
|
|
@ -2,20 +2,8 @@
|
|||
<div v-loading="isLoading" class="page-resource flex">
|
||||
<ChooseTextbook @node-click="nodeClick" />
|
||||
<div class="page-center-wrap">
|
||||
<el-dropdown class="prepare-center-dropdown">
|
||||
<el-button type="primary">
|
||||
新建<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="createAptFile">新建文枢课件</el-dropdown-item>
|
||||
<el-dropdown-item>AI一键生成</el-dropdown-item>
|
||||
<el-dropdown-item>导入PPT</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-tabs v-model="activeAptTab" style="height: 100%;">
|
||||
<el-tab-pane label="文枢课件" name="教学课件" class="prepare-center-jxkj">
|
||||
<el-tab-pane label="教学课件" name="教学课件" class="prepare-center-jxkj">
|
||||
<div class="prepare-center-header">
|
||||
<div class="center-create-btn" style="background-color: rgb(64,158,255)" @click="createAptFile">
|
||||
<div class="create-btn-title"><el-icon><Plus /></el-icon><label>创建APT</label></div>
|
||||
|
@ -157,7 +145,7 @@
|
|||
<!-- <button @click="test">test</button> -->
|
||||
</template>
|
||||
<script setup>
|
||||
import {Check, Plus, Position} from '@element-plus/icons-vue'
|
||||
import { Check,Plus } from '@element-plus/icons-vue'
|
||||
import Reserv from '@/views/prepare/container/reserv.vue'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import PptDialog from '@/views/prepare/container/ppt-dialog.vue'
|
||||
|
@ -192,11 +180,8 @@ import ClassReserv from '@/views/classManage/classReserv.vue'
|
|||
import TreeLog from '@/views/prepare/components/treeLog.vue'
|
||||
import classStart from './container/class-start.vue' // 预备上课
|
||||
import MsgEnum from '@/plugins/imChat/msgEnum' // im 消息枚举
|
||||
// import Chat from '@/utils/chat' // im 登录初始化
|
||||
// if (!Chat.imChat) Chat.init()
|
||||
// import ChatWs from '@/plugins/socket'
|
||||
// console.log('xxxx',ChatWs)
|
||||
// ChatWs.watch((data,e) => console.log('ws', data, e))
|
||||
import Chat from '@/utils/chat' // im 登录初始化
|
||||
if (!Chat.imChat) Chat.init()
|
||||
|
||||
const toolStore = useToolState()
|
||||
const fs = require('fs')
|
||||
|
@ -268,11 +253,11 @@ export default {
|
|||
},
|
||||
currentKJFileList() {
|
||||
// return this.currentFileList.filter((item) => item.fileFlag === 'apt' || item.fileFlag === '课件')
|
||||
return this.currentFileList.filter((item) => ['apt','aippt','课件'].includes(item.fileFlag))
|
||||
return this.currentFileList.filter((item) => ['apt','aptist','课件'].includes(item.fileFlag))
|
||||
},
|
||||
currentSCFileList() {
|
||||
// return this.currentFileList.filter((item) => item.fileFlag !== 'apt' && item.fileFlag !== '课件')
|
||||
return this.currentFileList.filter((item) => !['apt','aippt','课件'].includes(item.fileFlag))
|
||||
return this.currentFileList.filter((item) => !['apt','aptist','课件'].includes(item.fileFlag))
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -336,7 +321,7 @@ export default {
|
|||
if(item.fileFlag === 'apt') {
|
||||
this.$refs.calssRef.open(item.fileId, classObj)
|
||||
}
|
||||
if(item.fileFlag === 'aippt') {
|
||||
if(item.fileFlag === 'aptist') {
|
||||
this.$refs.calssRef.open(item.fileId, classObj)
|
||||
}
|
||||
},
|
||||
|
@ -393,8 +378,8 @@ export default {
|
|||
}, 1000)
|
||||
break
|
||||
}
|
||||
case 'click': { // 点击-打开课件-aippt
|
||||
if (row.fileFlag === 'aippt' && !!row.fileId) {
|
||||
case 'click': { // 点击-打开课件-aptist
|
||||
if (row.fileFlag === 'aptist' && !!row.fileId) {
|
||||
const res = await getEntpcoursefile(row.fileId)
|
||||
if (res && res.code === 200) {
|
||||
sessionStore.set('curr.resource', res.data) // 缓存当前资源信息
|
||||
|
@ -476,93 +461,6 @@ export default {
|
|||
},500)
|
||||
})
|
||||
},
|
||||
createAIPPT() {
|
||||
listEntpcourse({
|
||||
evalid: this.currentNode.id,
|
||||
edituserid: this.userStore.userId,
|
||||
pageSize: 500
|
||||
}).then((response) => {
|
||||
if (response.rows.length <= 0) return
|
||||
let resCourse = response.rows[0]
|
||||
// 添加
|
||||
let form = {
|
||||
parentid: 0,
|
||||
entpid: this.userStore.deptId,
|
||||
entpcourseid: resCourse.id,
|
||||
ppttype: 'file',
|
||||
title: resCourse.coursetitle,
|
||||
fileurl: '',
|
||||
filetype: 'aippt',
|
||||
datacontent: '',
|
||||
filekey: '',
|
||||
filetag: '',
|
||||
fileidx: 0,
|
||||
dflag: 0,
|
||||
status: '',
|
||||
edituserid: this.userStore.userId
|
||||
}
|
||||
addEntpcoursefileReturnId(form).then((slideid) => {
|
||||
let pagearray = []
|
||||
// 公屏
|
||||
pagearray.push({
|
||||
key: '公屏',
|
||||
title: '公屏页',
|
||||
slidedata: {
|
||||
attrs: { width: 1333, height: 749.8125 },
|
||||
className: 'Stage',
|
||||
children: [
|
||||
{
|
||||
attrs: {},
|
||||
className: 'Layer',
|
||||
children: [
|
||||
{
|
||||
attrs: {
|
||||
width: 1333,
|
||||
height: 749.8125,
|
||||
fill: 'white',
|
||||
name: 'fixedbackground',
|
||||
listening: true
|
||||
},
|
||||
className: 'Rect'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
// 添加
|
||||
var form = {
|
||||
parentid: slideid,
|
||||
entpid: resCourse.entpid,
|
||||
entpcourseid: resCourse.id,
|
||||
ppttype: 'file',
|
||||
title: '第一页',
|
||||
fileurl: '',
|
||||
filetype: 'slide',
|
||||
datacontent: JSON.stringify(pagearray),
|
||||
filekey: '',
|
||||
filetag: '',
|
||||
fileidx: 0,
|
||||
dflag: 0,
|
||||
status: '',
|
||||
edituserid: this.userStore.userId
|
||||
}
|
||||
addEntpcoursefileReturnId(form).then((res) => {
|
||||
creatAPT({
|
||||
...this.uploadData,
|
||||
fileId: slideid,
|
||||
fileShowName: this.currentNode.itemtitle + '.apt'
|
||||
}).then((res) => {
|
||||
this.currentFileList.unshift(res.resData)
|
||||
setTimeout(()=>{
|
||||
this.$refs['kjItemRef'+res.resData.id][0].openFileWin(res.resData);
|
||||
},500)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
createAptFile() {
|
||||
listEntpcourse({
|
||||
evalid: this.currentNode.id,
|
||||
|
@ -755,7 +653,7 @@ export default {
|
|||
for (let i = 0; i < this.currentFileList.length; i++) {
|
||||
let item = this.currentFileList[i]
|
||||
if (item.fileFlag === 'apt') continue;
|
||||
if (item.fileFlag === 'aippt') continue;
|
||||
if (item.fileFlag === 'aptist') continue;
|
||||
await asyncLocalFile(item)
|
||||
}
|
||||
this.asyncAllFileVisiable = false
|
||||
|
@ -974,13 +872,6 @@ export default {
|
|||
margin: 0 5px;
|
||||
border-radius: 10px;
|
||||
background-color: white;
|
||||
position: relative;
|
||||
.prepare-center-dropdown{
|
||||
z-index: 9999;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 4px;
|
||||
}
|
||||
.prepare-center-jxkj{
|
||||
height: 100%;
|
||||
display: flex;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div class="info">
|
||||
<div class="info-name">{{ state.user.nickName }}</div>
|
||||
<div class="infomation">
|
||||
<selectClass v-if="!isSubject"/>
|
||||
<selectClass/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -46,10 +46,8 @@ 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
|
||||
|
|
|
@ -34,6 +34,7 @@ import {getDept } from '@/api/login'
|
|||
import { listEvaluation } from '@/api/subject/index'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import {ElMessage} from 'element-plus'
|
||||
import { clearBookInfo } from '@/utils/ruoyi'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import {listClassmain} from '@/api/classManage/index'
|
||||
//班级列表
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
|
||||
<template>
|
||||
<el-dialog v-model="open" v-bind="dAttrs">
|
||||
<el-progress type="dashboard" v-bind="$attrs.pg" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup>
|
||||
// 功能说明 弹窗进度条组件
|
||||
import { computed, useAttrs } from 'vue'
|
||||
const attrs = useAttrs()
|
||||
const props = defineProps({
|
||||
visible: { // 是否显示弹窗
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
})
|
||||
// 数据更新
|
||||
const emit = defineEmits(['update:visible'])
|
||||
// 弹窗显示-双向绑定
|
||||
const open = computed({
|
||||
get: () => props.visible,
|
||||
set: val => emit('update:visible', val)
|
||||
})
|
||||
// 弹窗属性
|
||||
const dAttrs = computed(() => {
|
||||
const attrsNew = { ...attrs }
|
||||
delete attrsNew.pg
|
||||
return attrsNew
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
|
@ -50,7 +50,6 @@
|
|||
<EditDialog v-model="isEdit" :item="curItem" />
|
||||
<AdjustDialog v-model="isAdjust" :item="curItem" />
|
||||
<PptDialog @add-success="addAiPPT" :dataList="resultList" v-model="pptDialog"/>
|
||||
<progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -59,7 +58,6 @@ import { sessionStore } from '@/utils/store'
|
|||
import emitter from '@/utils/mitt'
|
||||
import EditDialog from './edit-dialog.vue'
|
||||
import AdjustDialog from './adjust-dialog.vue'
|
||||
import progressDialog from './progress-dialog.vue'
|
||||
import { completion, tempResult } from '@/api/mode/index.js'
|
||||
// import { dataSetJson } from '@/utils/comm.js'
|
||||
import * as commUtils from '@/utils/comm.js'
|
||||
|
@ -70,7 +68,6 @@ import {PPTXFileToJson} from '@/AixPPTist/src/hooks/useImport' // ppt转json
|
|||
import * as API_entpcourse from '@/api/education/entpcourse' // 相关api
|
||||
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
||||
import * as Api_server from '@/api/apiService' // 相关api
|
||||
import * as API_smarttalk from '@/api/file' // 文件相关api
|
||||
import msgUtils from '@/plugins/modal' // 消息工具
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
@ -79,22 +76,7 @@ const resultList = ref([])
|
|||
const courseObj = reactive({
|
||||
node: null, // 选择的课程节点
|
||||
})
|
||||
const pgDialog = reactive({ // 弹窗-进度条
|
||||
visible: false,
|
||||
title: 'PPT解析中...',
|
||||
width: 300,
|
||||
showClose: false,
|
||||
draggable: true,
|
||||
beforeClose: done => {}, // 阻止-弹窗事件
|
||||
pg: { // 进度条-参数
|
||||
percentage: 0, // 百分比
|
||||
color: [
|
||||
{ color: '#1989fa', percentage: 50 }, // 蓝色
|
||||
{ color: '#e6a23c', percentage: 80 }, // 橙色
|
||||
{ color: '#5cb87a', percentage: 100 }, // 绿色
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
emitter.on('changeMode', (item) => {
|
||||
console.log(item, 'item')
|
||||
resultList.value = item.child
|
||||
|
@ -131,10 +113,7 @@ const params = reactive(
|
|||
|
||||
const addAiPPT = async(res) => {
|
||||
let node = courseObj.node
|
||||
pptDialog.value = false;
|
||||
if (!node) return msgUtils.msgWarning('请选择章节?')
|
||||
pgDialog.visible = true
|
||||
pgDialog.pg.percentage = 0
|
||||
//TODO res中有PPT地址
|
||||
const params = { evalid: node.id, edituserid: userStore.id, pageSize: 1 }
|
||||
const resEnpt = await HTTP_SERVER_API('getCourseList', params)
|
||||
|
@ -149,22 +128,14 @@ const addAiPPT = async(res) => {
|
|||
const resPptJson = await PPTXFileToJson(buffer)
|
||||
const { def, slides, ...content } = resPptJson
|
||||
// 转换图片|音频|视频 为线上地址
|
||||
let completed = 0
|
||||
const total = slides.length
|
||||
for( let o of slides ) {
|
||||
completed++
|
||||
await toRousrceUrl(o)
|
||||
// 设置进度条
|
||||
pgDialog.pg.percentage = Math.floor(completed / total * 100)
|
||||
}
|
||||
pgDialog.pg.percentage = 0
|
||||
pgDialog.visible = false
|
||||
// return
|
||||
// 生成ppt课件-父级
|
||||
const p_params = {parentContent: JSON.stringify(content)}
|
||||
const parentid = await HTTP_SERVER_API('addEntpcoursefile', p_params)
|
||||
if (!!parentid??null) { // 生成内容幻灯片
|
||||
// 生成备课资源-Smarttalk
|
||||
HTTP_SERVER_API('addSmarttalk',{fileId: parentid})
|
||||
if (slides.length > 0) {
|
||||
const resSlides = slides.map(({id, ...slide}) => JSON.stringify(slide))
|
||||
const params = {parentid, filetype: 'slide', title: '', slides: resSlides }
|
||||
|
@ -235,20 +206,6 @@ emitter.on('changeResult', (item) => {
|
|||
// 统一HTTP处理
|
||||
const HTTP_SERVER_API = (type, params = {}) => {
|
||||
switch (type) {
|
||||
case 'addSmarttalk': { // 获取课程
|
||||
const node = courseObj.node || {}
|
||||
const def = {
|
||||
fileId: '', // 文件id - Entpcoursefile 对应id
|
||||
fileFlag: 'aippt',
|
||||
fileShowName: node.itemtitle + '.aippt',
|
||||
textbookId: node.rootid,
|
||||
levelFirstId: node.parentid||node.id,
|
||||
levelSecondId: node.parentid && node.id,
|
||||
fileSource: '个人',
|
||||
fileRoot: '备课'
|
||||
}
|
||||
return API_smarttalk.creatAPT({...def, ...params})
|
||||
}
|
||||
case 'addEntpcourse': { // 添加课程
|
||||
const node = courseObj.node || {}
|
||||
if (!node) return msgUtils.msgWarning('请选择章节?')
|
||||
|
@ -299,7 +256,7 @@ const getDefParams = (params) => {
|
|||
ppttype: 'file',
|
||||
title: enpt.coursetitle,
|
||||
fileurl: '',
|
||||
filetype: 'aippt',
|
||||
filetype: 'aptist',
|
||||
datacontent: '',
|
||||
filekey: '',
|
||||
filetag: '',
|
||||
|
@ -341,7 +298,6 @@ const toRousrceUrl = async(o) => {
|
|||
const curNode = reactive({})
|
||||
onMounted(() => {
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
console.log('data', sessionStore)
|
||||
Object.assign(curNode, data);
|
||||
courseObj.node = data
|
||||
|
||||
|
|
Loading…
Reference in New Issue