zouyf_dev #322
|
@ -43,6 +43,11 @@ export default defineConfig({
|
|||
changeOrigin: true,
|
||||
rewrite: (p) => p.replace(/^\/baidubce/, '')
|
||||
},
|
||||
'/parth': {
|
||||
target: 'https://zwapi.xfyun.cn', // 第三方API的地址
|
||||
changeOrigin: true, // 改变请求的起源
|
||||
rewrite: (path) => path.replace(/^\/parth/, '') // 重写路径
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [vue(), WindiCSS()],
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2782,7 +2782,8 @@
|
|||
--editor-toolbar-base-offset:105px;
|
||||
|
||||
--main-color:rgb(12 12 13);
|
||||
--body-bg-color:rgb(255, 255, 255);
|
||||
/* --body-bg-color:rgb(255, 255, 255); */
|
||||
--body-bg-color:rgb(241, 241, 252);
|
||||
--progressBar-color:rgb(10 132 255);
|
||||
--progressBar-bg-color:rgb(221 221 222);
|
||||
--progressBar-blend-color:rgb(116 177 239);
|
||||
|
@ -3148,12 +3149,12 @@ body{
|
|||
}
|
||||
|
||||
#toolbarViewer{
|
||||
width: 300px;
|
||||
height: 32px;
|
||||
width: auto;
|
||||
height: 60px;
|
||||
position: fixed;
|
||||
z-index: 9999;
|
||||
bottom: 15px;
|
||||
left: 50%;
|
||||
right: 2%;
|
||||
background-color: #fff;
|
||||
border-radius: 4px;
|
||||
transform: translateX(-50%);
|
||||
|
@ -3477,8 +3478,9 @@ body{
|
|||
}
|
||||
|
||||
#toolbarViewerLeft{
|
||||
padding-inline-start:1px;
|
||||
/* padding-inline-start:1px; 修改样式*/
|
||||
}
|
||||
|
||||
#toolbarViewerRight{
|
||||
padding-inline-end:1px;
|
||||
}
|
||||
|
@ -3693,7 +3695,7 @@ body{
|
|||
mask-image:var(--findbarButton-next-icon);
|
||||
}
|
||||
|
||||
#previous::before{
|
||||
/* #previous::before{
|
||||
-webkit-mask-image:var(--toolbarButton-pageUp-icon);
|
||||
mask-image:var(--toolbarButton-pageUp-icon);
|
||||
}
|
||||
|
@ -3701,8 +3703,27 @@ body{
|
|||
#next::before{
|
||||
-webkit-mask-image:var(--toolbarButton-pageDown-icon);
|
||||
mask-image:var(--toolbarButton-pageDown-icon);
|
||||
} */
|
||||
/* 修改样式 */
|
||||
#toolbarViewerLeft .toolbarButton{
|
||||
width: 80px;
|
||||
height: 60px;
|
||||
margin: 0;
|
||||
}
|
||||
#toolbarViewerLeft .toolbarButton::before{
|
||||
opacity: 0;
|
||||
}
|
||||
#toolbarViewerLeft .toolbarButton span{
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
.toolpageBtn{
|
||||
height: 60px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#zoomOut::before{
|
||||
-webkit-mask-image:var(--toolbarButton-zoomOut-icon);
|
||||
mask-image:var(--toolbarButton-zoomOut-icon);
|
||||
|
|
|
@ -44,11 +44,11 @@ See https://github.com/adobe-type-tools/cmap-resources
|
|||
<div id="toolbarSidebar">
|
||||
<div id="toolbarSidebarLeft">
|
||||
<div id="sidebarViewButtons" class="splitToolbarButton toggled" role="radiogroup">
|
||||
<button id="viewThumbnail" class="toolbarButton toggled" title="Show Thumbnails" tabindex="2" data-l10n-id="pdfjs-thumbs-button" role="radio" aria-checked="true" aria-controls="thumbnailView">
|
||||
<span data-l10n-id="pdfjs-thumbs-button-label">Thumbnails</span>
|
||||
</button>
|
||||
<button id="viewOutline" class="toolbarButton" title="Show Document Outline (double-click to expand/collapse all items)" tabindex="3" data-l10n-id="pdfjs-document-outline-button" role="radio" aria-checked="false" aria-controls="outlineView">
|
||||
<span data-l10n-id="pdfjs-document-outline-button-label">Document Outline</span>
|
||||
</button>
|
||||
<button id="viewThumbnail" class="toolbarButton toggled" title="Show Thumbnails" tabindex="2" data-l10n-id="pdfjs-thumbs-button" role="radio" aria-checked="true" aria-controls="thumbnailView">
|
||||
<span data-l10n-id="pdfjs-thumbs-button-label">Thumbnails</span>
|
||||
</button>
|
||||
<button id="viewAttachments" class="toolbarButton" title="Show Attachments" tabindex="4" data-l10n-id="pdfjs-attachments-button" role="radio" aria-checked="false" aria-controls="attachmentsView">
|
||||
<span data-l10n-id="pdfjs-attachments-button-label">Attachments</span>
|
||||
|
@ -273,14 +273,17 @@ See https://github.com/adobe-type-tools/cmap-resources
|
|||
<div id="toolbarContainer">
|
||||
<div id="toolbarViewer">
|
||||
<div id="toolbarViewerLeft">
|
||||
<button id="sidebarToggle" class="toolbarButton" title="Toggle Sidebar" tabindex="11" data-l10n-id="pdfjs-toggle-sidebar-button" aria-expanded="false" aria-controls="sidebarContainer">
|
||||
<span data-l10n-id="pdfjs-toggle-sidebar-button-label">Toggle Sidebar</span>
|
||||
<button id="sidebarToggle" class="toolbarButton" tabindex="11" aria-expanded="false" aria-controls="sidebarContainer">
|
||||
<span>目录</span>
|
||||
</button>
|
||||
<div class="toolbarButtonSpacer"></div>
|
||||
<button id="viewFind" class="toolbarButton" title="Find in Document" tabindex="12" data-l10n-id="pdfjs-findbar-button" aria-expanded="false" aria-controls="findbar">
|
||||
<!-- <button id="sidebarToggle" class="toolbarButton" title="Toggle Sidebar" tabindex="11" data-l10n-id="pdfjs-toggle-sidebar-button" aria-expanded="false" aria-controls="sidebarContainer">
|
||||
<span data-l10n-id="pdfjs-toggle-sidebar-button-label">Toggle Sidebar</span>
|
||||
</button> -->
|
||||
<!-- <div class="toolbarButtonSpacer"></div> -->
|
||||
<button style="display: none;" id="viewFind" class="toolbarButton" title="Find in Document" tabindex="12" data-l10n-id="pdfjs-findbar-button" aria-expanded="false" aria-controls="findbar">
|
||||
<span data-l10n-id="pdfjs-findbar-button-label">Find</span>
|
||||
</button>
|
||||
<div class="splitToolbarButton hiddenSmallView">
|
||||
<div class="splitToolbarButton toolpageBtn">
|
||||
<button class="toolbarButton" title="Previous Page" id="previous" tabindex="13" data-l10n-id="pdfjs-previous-button">
|
||||
<span data-l10n-id="pdfjs-previous-button-label">Previous</span>
|
||||
</button>
|
||||
|
@ -289,12 +292,12 @@ See https://github.com/adobe-type-tools/cmap-resources
|
|||
<span data-l10n-id="pdfjs-next-button-label">Next</span>
|
||||
</button>
|
||||
</div>
|
||||
<span class="loadingInput start">
|
||||
<span class="loadingInput start" style="display: none;">
|
||||
<input type="number" id="pageNumber" class="toolbarField" title="Page" value="1" min="1" tabindex="15" data-l10n-id="pdfjs-page-input" autocomplete="off">
|
||||
</span>
|
||||
<span id="numPages" class="toolbarLabel"></span>
|
||||
<span id="numPages" class="toolbarLabel" style="display: none;"></span>
|
||||
</div>
|
||||
<div id="toolbarViewerRight">
|
||||
<div id="toolbarViewerRight" style="display: none;">
|
||||
<div id="editorModeButtons" class="splitToolbarButton toggled" role="radiogroup">
|
||||
<button id="editorHighlight" class="toolbarButton" hidden="true" disabled="disabled" title="Highlight" role="radio" aria-checked="false" aria-controls="editorHighlightParamsToolbar" tabindex="31" data-l10n-id="pdfjs-editor-highlight-button">
|
||||
<span data-l10n-id="pdfjs-editor-highlight-button-label">Highlight</span>
|
||||
|
|
|
@ -7407,7 +7407,8 @@ class PDFSidebar {
|
|||
this.isInitialViewSet = false;
|
||||
this.isInitialEventDispatched = false;
|
||||
this.#hideUINotification(true);
|
||||
this.switchView(SidebarView.THUMBS);
|
||||
// this.switchView(SidebarView.THUMBS);默认开启书签模式
|
||||
this.switchView(SidebarView.OUTLINE);
|
||||
this.outlineButton.disabled = false;
|
||||
this.attachmentsButton.disabled = false;
|
||||
this.layersButton.disabled = false;
|
||||
|
@ -13095,12 +13096,16 @@ const PDFViewerApplication = {
|
|||
this.pdfViewer.scrollMode = scroll;
|
||||
}
|
||||
if (isValidSpreadMode(spread)) {
|
||||
this.pdfViewer.spreadMode = spread;
|
||||
//默认双页
|
||||
// this.pdfViewer.spreadMode = spread;
|
||||
this.pdfViewer.spreadMode = 1;
|
||||
}
|
||||
};
|
||||
this.isInitialViewSet = true;
|
||||
this.pdfSidebar?.setInitialView(sidebarView);
|
||||
setViewerModes(scrollMode, spreadMode);
|
||||
//默认双页
|
||||
// setViewerModes(scrollMode, spreadMode);
|
||||
setViewerModes(scrollMode, 1);
|
||||
if (this.initialBookmark) {
|
||||
setRotation(this.initialRotation);
|
||||
delete this.initialRotation;
|
||||
|
|
|
@ -12,15 +12,20 @@ const props = defineProps({
|
|||
type: String,
|
||||
required: true,
|
||||
default: ''
|
||||
},
|
||||
isWin: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
/**pdf文件地址 */
|
||||
const pdfUrl = ref('');
|
||||
/**pdfjs文件地址 */
|
||||
const fileUrl = getAppInstallUrl('pdfjs-dist/web/viewer.html', 'user', '\\out\\renderer', true) + "?file=" //本地
|
||||
const fileUrl = props.isWin ? props.url : getAppInstallUrl('pdfjs-dist/web/viewer.html', 'user', '\\out\\renderer', true) + "?file=" //本地
|
||||
onMounted(() => {
|
||||
/** 将传入的pdf地址进行编码,防止中文识别错误 */
|
||||
pdfUrl.value = fileUrl + encodeURIComponent(props.url)
|
||||
if(props.isWin) pdfUrl.value = fileUrl
|
||||
else pdfUrl.value = fileUrl + encodeURIComponent(props.url) + '#pageMode=outline'
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,202 +0,0 @@
|
|||
import { nextTick, toRaw } from 'vue'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { listEvaluation } from '@/api/subject'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const { edustage, edusubject } = userStore.user
|
||||
|
||||
let evaluationList = []; // 教材版本list
|
||||
let subjectList = []; // 教材list
|
||||
//当前教材ID
|
||||
let curBookId = -1;
|
||||
|
||||
/**
|
||||
* 外部链接初始化获取 跳转web端的 unitId 专用,
|
||||
* 暂时: 初始化作业设计专用,后期可能会取消
|
||||
*/
|
||||
export const useGetClassWork = async () => {
|
||||
|
||||
const params = {
|
||||
edusubject,
|
||||
edustage,
|
||||
// entpcourseedituserid: userId,
|
||||
itemgroup: 'textbook',
|
||||
orderby: 'orderidx asc',
|
||||
pageSize: 10000
|
||||
}
|
||||
|
||||
if(localStorage.getItem('evaluationList')){
|
||||
evaluationList = JSON.parse(localStorage.getItem('evaluationList'))
|
||||
}else{
|
||||
const { rows } = await listEvaluation(params)
|
||||
localStorage.setItem('evaluationList', JSON.stringify(rows))
|
||||
evaluationList = rows
|
||||
}
|
||||
|
||||
//获取教材版本
|
||||
await getSubject()
|
||||
//上册
|
||||
/**
|
||||
* 不区分上下册
|
||||
* 2024/08/20调整
|
||||
*/
|
||||
// volumeOne = data.filter(item => item.level == 1 && item.semester == '上册')
|
||||
// volumeTwo = data.filter(item => item.level == 1 && item.semester == '下册')
|
||||
getTreeData()
|
||||
}
|
||||
|
||||
//获取教材
|
||||
const getSubject = async () => {
|
||||
if(localStorage.getItem('subjectList')){
|
||||
subjectList = JSON.parse(localStorage.getItem('subjectList'))
|
||||
}else{
|
||||
const { rows } = await listEvaluation({ itemkey: "version", edusubject, edustage, pageSize: 10000,orderby: 'orderidx asc', })
|
||||
|
||||
// subjectList = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject)
|
||||
subjectList = rows
|
||||
localStorage.setItem('subjectList', JSON.stringify(subjectList))
|
||||
}
|
||||
|
||||
// 默认第一个
|
||||
if(!subjectList.length) return
|
||||
// curBookName = subjectList[0].itemtitle
|
||||
curBookId = subjectList[0].id
|
||||
// curBookImg = BaseUrl + subjectList[0].avartar
|
||||
// curBookPath = subjectList[0].fileurl
|
||||
}
|
||||
|
||||
|
||||
const getTreeData = () => {
|
||||
//数据过滤
|
||||
let upData = transData(evaluationList)
|
||||
|
||||
if(upData.length){
|
||||
// treeData = [...upData]
|
||||
}else{
|
||||
// treeData = []
|
||||
return
|
||||
}
|
||||
nextTick(() => {
|
||||
// defaultExpandedKeys = [treeData[0].id]
|
||||
// let currentNodeObj = {...getLastLevelData(upData)[0]}
|
||||
let currentNodeId = getLastLevelData(upData)[0].id
|
||||
let currentNodeName = getLastLevelData(upData)[0].label
|
||||
|
||||
let curNode = {
|
||||
id: currentNodeId,
|
||||
label: currentNodeName,
|
||||
// itemtitle: currentNodeObj.itemtitle,
|
||||
// edudegree: currentNodeObj.edudegree,
|
||||
// edustage: currentNodeObj.edustage,
|
||||
// edusubject: currentNodeObj.edusubject,
|
||||
}
|
||||
let parentNode = findParentByChildId(upData, currentNodeId)
|
||||
curNode.parentNode = toRaw(parentNode)
|
||||
|
||||
let levelFirstId = '';
|
||||
let levelSecondId = '';
|
||||
|
||||
if (curNode.parentNode) {
|
||||
levelFirstId = curNode.parentNode.id
|
||||
} else {
|
||||
levelFirstId = curNode.id
|
||||
levelSecondId = ''
|
||||
}
|
||||
let bookeId = curBookId
|
||||
// 头部 教材分析、作业设计:打开外部链接需要当前章节ID
|
||||
localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId, bookeId}))
|
||||
|
||||
// const data = {
|
||||
// textBook: {
|
||||
// curBookId: curBookId,
|
||||
// curBookName: curBookName,
|
||||
// curBookImg: curBookImg,
|
||||
// curBookPath: curBookPath
|
||||
// },
|
||||
// node: curNode
|
||||
// }
|
||||
// emit('changeBook', data)
|
||||
})
|
||||
}
|
||||
|
||||
const getLastLevelData = (tree) => {
|
||||
let lastLevelData = [];
|
||||
// 递归函数遍历树形结构
|
||||
function traverseTree(nodes) {
|
||||
nodes.forEach((node) => {
|
||||
// 如果当前节点有子节点,继续遍历
|
||||
if (node.children && node.children.length > 0) {
|
||||
traverseTree(node.children);
|
||||
} else {
|
||||
// 如果没有子节点,说明是最后一层的节点
|
||||
lastLevelData.push(node);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 调用递归函数开始遍历
|
||||
traverseTree(tree);
|
||||
|
||||
// 返回最后一层的数据
|
||||
return lastLevelData;
|
||||
}
|
||||
|
||||
// 根据id 拿到父节点数据
|
||||
const findParentByChildId = (treeData, targetNodeId) => {
|
||||
// 递归查找函数
|
||||
// 遍历树中的每个节点
|
||||
for (let node of treeData) {
|
||||
// 检查当前节点的子节点是否包含目标子节点 ID
|
||||
if (node.children && node.children.some(child => child.id === targetNodeId)) {
|
||||
// 如果当前节点的某个子节点的 ID 匹配目标子节点 ID,则当前节点即为父节点
|
||||
return node;
|
||||
}
|
||||
// 如果当前节点没有匹配的子节点,则递归检查当前节点的子节点
|
||||
if (node.children) {
|
||||
let parentNode = findParentByChildId(node.children, targetNodeId);
|
||||
if (parentNode) {
|
||||
return parentNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果未找到匹配的父节点,则返回 null 或者适当的默认值
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
const transData = (data) => {
|
||||
let ary = []
|
||||
data.forEach(item => {
|
||||
let obj = {}
|
||||
// 根据当前教材ID 过滤出对应的单元、章节
|
||||
if (item.rootid == curBookId) {
|
||||
if(item.level == 1){
|
||||
obj.label = item.itemtitle
|
||||
obj.id = item.id
|
||||
obj.itemtitle = item.itemtitle
|
||||
obj.edudegree = item.edudegree
|
||||
obj.edustage = item.edustage
|
||||
obj.edusubject = item.edusubject
|
||||
let ary2 = []
|
||||
evaluationList.forEach(el => {
|
||||
let obj2 = {}
|
||||
if (item.id == el.parentid) {
|
||||
obj2 = {
|
||||
label: el.itemtitle,
|
||||
id: el.id,
|
||||
itemtitle : el.itemtitle,
|
||||
edudegree : el.edudegree,
|
||||
edustage : el.edustage,
|
||||
edusubject : el.edusubject,
|
||||
}
|
||||
ary2.push(obj2)
|
||||
}
|
||||
obj.children = ary2
|
||||
})
|
||||
ary.push(obj)
|
||||
}
|
||||
}
|
||||
})
|
||||
return ary
|
||||
}
|
||||
|
|
@ -80,6 +80,8 @@ import { updateUserInfo } from '@/api/system/user'
|
|||
import logoIco from '@/assets/images/logo.png'
|
||||
import { listEvaluation } from '@/api/classManage/index'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
// import Chat from '@/utils/chat' // im 登录初始化
|
||||
// if (!Chat.imChat) Chat.init()
|
||||
|
||||
let homeTitle = ref(import.meta.env.VITE_APP_TITLE)
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
|
@ -143,6 +145,7 @@ function handleCommand(command) {
|
|||
break
|
||||
case 'logout':
|
||||
logout()
|
||||
// Chat?.logout() // im 退出登录
|
||||
break
|
||||
default:
|
||||
break
|
||||
|
@ -158,7 +161,9 @@ function logout() {
|
|||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
.then(async () => {
|
||||
const Chat = (await import('@/utils/chat')).default
|
||||
if (!!Chat.imChat) Chat.logout()
|
||||
userStore
|
||||
.logOut()
|
||||
.then(() => {
|
||||
|
@ -169,8 +174,7 @@ function logout() {
|
|||
// router.replace('/login')
|
||||
ipcRenderer && ipcRenderer.send('openLoginWindow')
|
||||
})
|
||||
})
|
||||
.catch(() => { })
|
||||
}).catch(()=>{})
|
||||
}
|
||||
|
||||
const emits = defineEmits(['setLayout'])
|
||||
|
|
|
@ -19,8 +19,11 @@ import AppMain from './components/AppMain.vue'
|
|||
import Uploader from './components/Uploader.vue'
|
||||
import AiChart from '@/components/ai-chart/index.vue'
|
||||
import uploaderState from '@/store/modules/uploader'
|
||||
// import Chat from '@/utils/chat'
|
||||
|
||||
let uploaderStore = ref(uploaderState())
|
||||
// window.test = Chat
|
||||
// Chat.init()
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
@ -70,7 +70,10 @@ export class ImChat {
|
|||
// 日志监听
|
||||
this.timChat.TIMSetLogCallback({
|
||||
callback: data => {
|
||||
this.setConsole('%cchat-log ', data[1])
|
||||
const [type, log] = data
|
||||
if (type == log_level) { // 打印对应日志
|
||||
this.setConsole('%cchat-log ', log)
|
||||
}
|
||||
},
|
||||
user_data: ''
|
||||
})
|
||||
|
@ -86,7 +89,7 @@ export class ImChat {
|
|||
if (code == 0) { // 初始化成功
|
||||
this.setConsole('%cim-chat: init', '初始化成功')
|
||||
this.status.isConnect = true
|
||||
this.setConfig() // 设置日志级别
|
||||
// this.setConfig() // 设置日志级别
|
||||
resolve(this)
|
||||
} else { // 失败:具体请看code
|
||||
console.error('[im-chat]:初始化失败', code)
|
||||
|
@ -227,10 +230,11 @@ export class ImChat {
|
|||
})
|
||||
}
|
||||
// 删除群组
|
||||
deleteGroup() {
|
||||
if (!this.timGroupId) return
|
||||
deleteGroup(timGroupId) {
|
||||
const groupId = timGroupId || this.timGroupId
|
||||
if (!groupId) return
|
||||
return this.timChat.TIMGroupDelete({
|
||||
groupId: this.timGroupId,
|
||||
groupId,
|
||||
data: '', // 用户自定义数据
|
||||
})
|
||||
}
|
||||
|
@ -249,7 +253,7 @@ export class ImChat {
|
|||
}
|
||||
// 获取群组列表
|
||||
getGroupList() {
|
||||
return this.timChat.getGroupList().then(res => {
|
||||
return this.timChat.TIMGroupGetJoinedGroupList().then(res => {
|
||||
console.log('获取群组列表', res)
|
||||
return res
|
||||
}).catch(error => {
|
||||
|
|
|
@ -15,6 +15,12 @@ export const constantRoutes = [
|
|||
// component: ()=> import('../login/index.vue'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/fullscreenpdf',
|
||||
component: () => import('@/views/fullScreenPdf/index.vue'),
|
||||
name: 'fullscreenpdf',
|
||||
meta: {title: '全屏显示PDF'}
|
||||
},
|
||||
{
|
||||
path: '/teachClassTask',
|
||||
component: () => import('@/views/classTask/teachClassTask.vue'),
|
||||
|
@ -79,6 +85,7 @@ export const constantRoutes = [
|
|||
name: 'testpdf',
|
||||
meta: {title: '测试PDF'}
|
||||
},
|
||||
|
||||
{
|
||||
path: '/classReserv',
|
||||
component: () => import('@/views/classManage/classReserv.vue'),
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
import axios from "axios";
|
||||
import { getSignature } from "./index";
|
||||
|
||||
let appId = "01ec9aa3";
|
||||
let secret = "M2QxMDAxMjYyYTEzODMwMGRkZTQ4NmUy";
|
||||
let timestamp = Math.floor(Date.now() / 1000);
|
||||
let signature = getSignature(appId, secret, timestamp);
|
||||
|
||||
export function text2Text(data) {
|
||||
return axios({
|
||||
url: "v1/chat/completions",
|
||||
method: "post",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: "Bearer yjCwlZCeUtBYvjHAQZdk:FtWNmJSWcZMCmTBQZfoH",
|
||||
Accept: "*/*",
|
||||
},
|
||||
data: {
|
||||
model: "4.0Ultra",
|
||||
messages: data,
|
||||
stream: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
export function uploadDoc(data) {
|
||||
return axios({
|
||||
url: "openapi/v1/file/upload",
|
||||
method: "post",
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
appId: appId,
|
||||
timestamp: timestamp,
|
||||
signature: signature,
|
||||
},
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
export function queryDocStatus(data) {
|
||||
return axios({
|
||||
url: "openapi/v1/file/status",
|
||||
method: "post",
|
||||
headers: {
|
||||
"Content-Type": "application/form-data",
|
||||
appId: appId,
|
||||
timestamp: timestamp,
|
||||
signature: signature,
|
||||
},
|
||||
data: data
|
||||
});
|
||||
}
|
||||
export function chatByDoc(fileId, data) {
|
||||
const wsUrl = `wss://chatdoc.xfyun.cn/openapi/chat?fileId=${fileId}&appId=${appId}×tamp=${timestamp}&signature=${signature}`;
|
||||
|
||||
const ws = new WebSocket(wsUrl);
|
||||
|
||||
ws.onopen = () => {
|
||||
const messageBody = {
|
||||
fileIds: [fileId],
|
||||
messages: data,
|
||||
chatExtends: {
|
||||
wikiPromptTpl:
|
||||
"请将以下内容作为已知信息:\n<wikicontent>\n请根据以上内容回答用户的问题。\n问题:<wikiquestion>\n回答:",
|
||||
wikiFilterScore: 0.82,
|
||||
temperature: 0.5,
|
||||
sparkWhenWithoutEmbedding: false,
|
||||
},
|
||||
};
|
||||
|
||||
ws.send(JSON.stringify(messageBody));
|
||||
};
|
||||
|
||||
ws.onmessage = (event) => {
|
||||
const response = JSON.parse(event.data);
|
||||
console.log("WebSocket 消息:", response);
|
||||
};
|
||||
|
||||
ws.onerror = (error) => {
|
||||
console.error("WebSocket 错误:", error);
|
||||
};
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/**
|
||||
* 实现单例模式
|
||||
*/
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { ImChat } from '@/plugins/imChat'
|
||||
import * as http from '@/api/apiService' // 自定义api service
|
||||
|
||||
export class Chat {
|
||||
instance = null;
|
||||
sdkAppId = 0; // 应用id
|
||||
sign = ''; // 签名
|
||||
imUserId = ''; // 用户id
|
||||
imChat = null; // IM实例
|
||||
|
||||
constructor() {
|
||||
if (!Chat.instance) { // 存在的时候
|
||||
Chat.instance = this;
|
||||
}
|
||||
return Chat.instance;
|
||||
}
|
||||
/**
|
||||
* 初始化 获取IM签名
|
||||
* @param {*} isInit : 是否初始化IM
|
||||
* @param {*} isLogin : 是否登录IM
|
||||
* @param {*} callback: 监听消息回调函数
|
||||
* @returns Promise<ImChat>
|
||||
*/
|
||||
async init(isInit = true, isLogin = true, callback) {
|
||||
// 特殊处理,只传1个参数且为函数,则默认为callback,isInit和isLogin默认为true
|
||||
if (typeof isInit == 'function'){
|
||||
callback = isInit
|
||||
isInit = true
|
||||
isLogin = true
|
||||
}
|
||||
const userStore = useUserStore()
|
||||
const { timuserid: imUserId } = userStore.user
|
||||
// 获取腾讯云签名
|
||||
const res = await http.imChat.getTxCloudSign({imUserId})
|
||||
if (res && res.code == 200) {
|
||||
const { sdkAppId, sign } = res.data
|
||||
this.sdkAppId = sdkAppId
|
||||
this.sign = sign
|
||||
this.imUserId = imUserId
|
||||
// 初始化IM
|
||||
if (isInit) return await this.initIM(isLogin, callback)
|
||||
}
|
||||
}
|
||||
// 初始化IM
|
||||
async initIM(isLogin, callback) {
|
||||
const imChat = new ImChat(this.sdkAppId, this.sign, this.imUserId)
|
||||
this.imChat = imChat
|
||||
await imChat.init() // 初始化IM
|
||||
callback && this.listenMsg(callback) // 监听消息
|
||||
if(isLogin) await imChat.login() // 登录IM
|
||||
return imChat
|
||||
}
|
||||
// 监听消息
|
||||
async listenMsg(callback) {
|
||||
if (!callback) return
|
||||
if (!this.imChat) return
|
||||
await this.imChat?.watch(msg => callback(msg))
|
||||
}
|
||||
// 解散群
|
||||
async dismissGroup(groupId) {
|
||||
if (!this.imChat) return
|
||||
await this.imChat?.deleteGroup(groupId)
|
||||
}
|
||||
// 退出登录
|
||||
async logout() {
|
||||
if (!this.imChat) return
|
||||
await this.imChat?.logout()
|
||||
this.imChat = null
|
||||
}
|
||||
// 发群消息
|
||||
async sendMsg(conv_id, msg) {
|
||||
if (!this.imChat) return
|
||||
await this.imChat?.sendMsg(conv_id, msg)
|
||||
}
|
||||
// 发群消息
|
||||
async sendMsgGroup(msg, head, type) {
|
||||
if (!this.imChat) return
|
||||
this.imChat?.sendMsgGroup(msg, head, type)
|
||||
}
|
||||
// 发群消息
|
||||
async sendMsgGroupId(groupId, msg, head, type) {
|
||||
if (!this.imChat) return
|
||||
const msgObj = this.imChat?.getMsgObj(head, msg, type)
|
||||
this.imChat?.sendMsg(groupId, msgObj)
|
||||
}
|
||||
// 获取群列表
|
||||
async getGroupList() {
|
||||
if (!this.imChat) return
|
||||
return await this.imChat?.getGroupList()
|
||||
}
|
||||
}
|
||||
|
||||
export default new Chat()
|
|
@ -0,0 +1,33 @@
|
|||
import CryptoJS from 'crypto-js';
|
||||
|
||||
// 生成签名的主方法
|
||||
export function getSignature(appId, secret, ts) {
|
||||
try {
|
||||
const auth = md5(appId + ts);
|
||||
return hmacSHA1Encrypt(auth, secret);
|
||||
} catch (error) {
|
||||
console.error('Error generating signature:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// MD5 加密
|
||||
function md5(cipherText) {
|
||||
try {
|
||||
return CryptoJS.MD5(cipherText).toString(); // 使用 CryptoJS 进行 MD5 加密
|
||||
} catch (error) {
|
||||
console.error('Error in MD5 hashing:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// HMAC-SHA1 加密
|
||||
function hmacSHA1Encrypt(encryptText, encryptKey) {
|
||||
try {
|
||||
// 使用 CryptoJS 进行 HMAC-SHA1 加密,并转换为 Base64 格式
|
||||
return CryptoJS.HmacSHA1(encryptText, encryptKey).toString(CryptoJS.enc.Base64);
|
||||
} catch (error) {
|
||||
console.error('Error in HMAC-SHA1 encryption:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
import axios from "axios";
|
||||
import { getSignature } from "./index";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
let appId = "01ec9aa3";
|
||||
let secret = "M2QxMDAxMjYyYTEzODMwMGRkZTQ4NmUy";
|
||||
let timestamp = Math.floor(Date.now() / 1000);
|
||||
let signature = getSignature(appId, secret, timestamp);
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: "",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
appId: appId,
|
||||
timestamp: timestamp,
|
||||
signature: signature,
|
||||
},
|
||||
});
|
||||
|
||||
const createOutline = async (data) => {
|
||||
console.log("createOutline data:", data);
|
||||
try {
|
||||
const response = await instance.post(
|
||||
"/parth/api/aippt/createOutline",
|
||||
data
|
||||
);
|
||||
console.log("createOutline response:", response);
|
||||
if (response.code == 81002) {
|
||||
ElMessage.error("并发数量超过限制");
|
||||
}
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("请求失败:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
const getBackGround = async () => {
|
||||
try {
|
||||
const response = await instance.get("/parth/api/aippt/themeList");
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("请求失败:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
const createPPT = async (data) => {
|
||||
try {
|
||||
const response = await instance.post("/parth/api/aippt/create", data);
|
||||
console.log("createOutline response:", response);
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("请求失败:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
const createByOutline = async (data) => {
|
||||
try {
|
||||
const response = await instance.post("/parth/api/aippt/createByOutline", data);
|
||||
console.log("createByOutline response:", response);
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("请求失败:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
const getProgress = async (id) => {
|
||||
try {
|
||||
const response = await instance.get(`/parth/api/aippt/progress?sid=${id}`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("请求失败:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
export { instance, createOutline, getBackGround, createPPT, getProgress, createByOutline };
|
|
@ -378,7 +378,22 @@ export const toLinkWeb = (path) => {
|
|||
cookieData: { ...config }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 外部跳转-web网页
|
||||
* @param {*} path
|
||||
* @param {*} params
|
||||
*/
|
||||
export const toRoter = (path) => {
|
||||
const config = baseConfig()
|
||||
// console.log(config)
|
||||
// const fullPath = config.url + path
|
||||
// 通知主进程
|
||||
ipcRenderer.send('openWindow', {
|
||||
key: `win-${Date.now()}`,
|
||||
fullPath: path,
|
||||
cookieData: { ...config }
|
||||
})
|
||||
}
|
||||
// const taskHandles = () => {
|
||||
// // 设置任务栏上下文菜单
|
||||
// const contextMenu = new Remote.Menu()
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
v-if="item.bookImg"
|
||||
@open-edit="reservDialog.openDialog(item)"
|
||||
@delete-reserv="deleteReserv(item)"
|
||||
@change="(...o) => emit('change', ...o)"
|
||||
></reserv-item>
|
||||
<reserv-item-apt
|
||||
v-if="!item.bookImg"
|
||||
|
@ -18,6 +19,7 @@
|
|||
:item="item"
|
||||
@open-edit="reservDialog.openDialog(item)"
|
||||
@delete-reserv="deleteReserv(item)"
|
||||
@change="(...o) => emit('change', ...o)"
|
||||
></reserv-item-apt>
|
||||
</template>
|
||||
</div>
|
||||
|
@ -34,6 +36,10 @@ import Reserv from '@/views/prepare/container/reserv.vue'
|
|||
import { useToolState } from '@/store/modules/tool'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import ReservItemApt from '@/views/classManage/reserv-item-apt.vue'
|
||||
// import Chat from '@/utils/chat' // im 登录初始化
|
||||
// if (!Chat.imChat) Chat.init()
|
||||
|
||||
const emit = defineEmits(['change'])
|
||||
const reservDialog = ref(null)
|
||||
const tabOptions = ref(['进行中', '已结束'])
|
||||
const tabActive = ref('进行中')
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
<span>{{item.caption}}</span>
|
||||
</div>
|
||||
<div class="class-reserv-item-tool" style="width: 200px;max-width: 300px">
|
||||
<el-tag v-if="item.status === 'close'" style="margin-right: 5px" type="success">已结束</el-tag>
|
||||
<el-tag v-if="item.status === 'closed'" style="margin-right: 5px" type="success">已结束</el-tag>
|
||||
<el-tag v-if="item.status === 'open'" style="margin-right: 5px" type="danger">上课中</el-tag>
|
||||
<el-button v-if="item.status === 'open'" :disabled="toolStore.isToolWin" size="small" type="primary" @click="startClassR(item)"
|
||||
>继续上课</el-button
|
||||
>
|
||||
<!-- <el-button v-if="item.status === '未开始'" @click="openEdit">编辑</el-button>-->
|
||||
<el-button v-if="item.status === 'open'" size="small" type="info" @click="endClassR(item)"
|
||||
>下课</el-button
|
||||
<el-button v-if="item.status === 'open'" :loading="loading" size="small" type="info" @click="endClassR(item)"
|
||||
>下课{{ loading?'中...':'' }}</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="class-reserv-item-tool" style="width: 50px;">
|
||||
|
@ -25,13 +25,14 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { useToolState } from '@/store/modules/tool'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { createWindow } from '@/utils/tool'
|
||||
import { deleteSmartReserv, startClass, endClass } from '@/api/classManage'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { listEntpcourse } from '@/api/teaching/classwork'
|
||||
const emit = defineEmits(['openEdit', 'deleteReserv'])
|
||||
const emit = defineEmits(['openEdit', 'deleteReserv', 'change'])
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
|
@ -40,6 +41,7 @@ const props = defineProps({
|
|||
})
|
||||
const basePath = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
||||
const toolStore = useToolState() // 获取状态管理-tool
|
||||
const loading = ref(false) // 下课中的loading
|
||||
const openEdit = () => {
|
||||
emit('openEdit', props.item)
|
||||
}
|
||||
|
@ -54,42 +56,15 @@ const deleteReserv = () => {
|
|||
}
|
||||
})
|
||||
}
|
||||
// 继续上课
|
||||
const startClassR = (item) => {
|
||||
// startClass(item.id).then((res) => {
|
||||
// if (res.data === true) {
|
||||
// item.status = '上课中'
|
||||
// openLesson()
|
||||
// }
|
||||
// })
|
||||
// item.status = '上课中'
|
||||
openLesson()
|
||||
emit('change', 'continue', item)
|
||||
}
|
||||
// 下课
|
||||
const endClassR = (item) => {
|
||||
/*endClass(item.id).then((res) => {
|
||||
if (res.data === true) {
|
||||
ElMessage({
|
||||
message: '下课成功',
|
||||
type: 'success'
|
||||
})
|
||||
item.status = '已结束'
|
||||
}
|
||||
})*/
|
||||
}
|
||||
// const toolStore = useToolState()
|
||||
let wins = null;
|
||||
// 上课-工具类悬浮
|
||||
const openLesson = () => {
|
||||
// startClass(props.item.id)
|
||||
/*listEntpcourse({
|
||||
evalid: props.item.ex2,
|
||||
edituserid: useUserStore().user.userId,
|
||||
pageSize: 500
|
||||
}).then(async res=>{
|
||||
if (res.rows[0].id) {
|
||||
wins = await createWindow('tool-sphere', { url: '/tool/sphere?entpcourseid=' + res.rows[0].id + "&reservId=" + props.item.id })
|
||||
}
|
||||
})*/
|
||||
emit('change', 'close', item, { type: 2, loading })
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.class-reserv-item {
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
>继续上课</el-button
|
||||
>
|
||||
<!-- <el-button v-if="item.status === '未开始'" @click="openEdit">编辑</el-button>-->
|
||||
<el-button v-if="item.status === '上课中'" size="small" type="info" @click="endClassR(item)"
|
||||
>下课</el-button
|
||||
<el-button v-if="item.status === '上课中'" :loading="loading" size="small" type="info" @click="endClassR(item)"
|
||||
>下课{{ loading?'中...':'' }}</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="class-reserv-item-tool" style="width: 50px;">
|
||||
|
@ -25,13 +25,14 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { useToolState } from '@/store/modules/tool'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { createWindow } from '@/utils/tool'
|
||||
import { deleteSmartReserv, startClass, endClass } from '@/api/classManage'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { listEntpcourse } from '@/api/teaching/classwork'
|
||||
const emit = defineEmits(['openEdit', 'deleteReserv'])
|
||||
const emit = defineEmits(['openEdit', 'deleteReserv','change'])
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
|
@ -40,6 +41,7 @@ const props = defineProps({
|
|||
})
|
||||
const basePath = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
||||
const toolStore = useToolState() // 获取状态管理-tool
|
||||
const loading = ref(false) // 下课中的loading
|
||||
const openEdit = () => {
|
||||
emit('openEdit', props.item)
|
||||
}
|
||||
|
@ -80,15 +82,7 @@ const openLesson = () => {
|
|||
})
|
||||
}
|
||||
const endClassR = (item) => {
|
||||
endClass(item.id).then((res) => {
|
||||
if (res.data === true) {
|
||||
ElMessage({
|
||||
message: '下课成功',
|
||||
type: 'success'
|
||||
})
|
||||
item.status = '已结束'
|
||||
}
|
||||
})
|
||||
emit('change', 'close', item, { type: 2, loading })
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
<!--
|
||||
* @Author: 苦逼程序猿
|
||||
* @Date: 2024-09-06 16:58:59
|
||||
* @Warning: 千行代码,Bug露锋芒。
|
||||
-->
|
||||
<template>
|
||||
<el-container class="class-reserv-wrap">
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
|
@ -65,13 +60,14 @@
|
|||
import { ref, onMounted, onUnmounted, computed, watch } from 'vue'
|
||||
import { listByDeadDate, listClassworkdata, listClassworkdataNew } from '@/api/classTask'
|
||||
|
||||
import TaskItem from '@/views/classTask/container/task-item.vue'
|
||||
import TaskItem from '@/views/classTask/container/classTask/task-item.vue'
|
||||
// import ItemDialog from '@/views/classTask/container/item-dialog.vue'
|
||||
import { useToolState } from '@/store/modules/tool'
|
||||
import { getCurrentTime, getTomorrow } from '@/utils/date'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import useClassTaskStore from "@/store/modules/classTask";
|
||||
import {sessionStore, createWindow} from '@/utils/tool'
|
||||
import {createWindow} from '@/utils/tool'
|
||||
import {sessionStore} from '@/utils/store'
|
||||
import {throttle,debounce } from '@/utils/comm'
|
||||
|
||||
|
||||
|
@ -120,7 +116,7 @@ const getData = async () => {
|
|||
classWorkList.value = []
|
||||
loading.value = true
|
||||
// 1、班级列表
|
||||
//getClassList()
|
||||
// getClassList()
|
||||
// 2、班级作业
|
||||
await getClassWorkList()
|
||||
// 3、班级学生作业 包含多个班级
|
||||
|
|
|
@ -99,13 +99,9 @@
|
|||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 作业内容编辑 -->
|
||||
<!-- 作业内容详情 -->
|
||||
<el-dialog v-model="workEdit" title="作业内容详情" width="90%" append-to-body>
|
||||
<div v-if="currentTag=='学习目标定位'" style="display: flex;">
|
||||
<degreeevolution :attainmentList="attainmentList" :show-class="true" :courseQualityList="courseQualityList"/>
|
||||
</div>
|
||||
<!-- 课标研读 目标设定 教材研读 框架梳理 学科定位 -->
|
||||
|
||||
<div v-if="currentTag=='习题训练'" :style="{'padding': '15px', 'overflow': 'auto'}">
|
||||
<el-table :data="workConfObj.quizlist" style="width: 100%;">
|
||||
<el-table-column type="index" width="60" />
|
||||
|
@ -129,6 +125,75 @@
|
|||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- 框架梳理 -->
|
||||
<div v-if="currentTag=='框架梳理'" :style="{'padding': '15px', 'overflow': 'auto'}">
|
||||
<div style="margin: 5px; background-color: white">
|
||||
<template v-for="(_item,index) in workConfObj.chooseWorkLists" :key="index">
|
||||
<div v-if="_item.worktype=='框架梳理'">
|
||||
<div style="color: silver; display: flex;align-items: center;">
|
||||
<div style="flex: 1;">{{ _item.worktype }}</div>
|
||||
<div style="flex: 1;">分值:{{ _item.score }}</div>
|
||||
<div style="display: flex;align-items: center;flex: 1;justify-content: flex-end;">
|
||||
<el-button @click="prevRead(_item)">预览</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<!-- TODO 课堂展示 、常规作业 预览待开发-->
|
||||
<!-- 常规作业:包含多个格式(图片略缩图展示,点击放大;其他附件跳转另外弹窗查看) -->
|
||||
<div v-if="currentTag=='常规作业'" :style="{'padding': '15px', 'overflow': 'auto'}">
|
||||
<div style="margin: 5px; background-color: white">
|
||||
<div v-if="workConfObj.teacherFeedContentList.length > 0">
|
||||
<div class="image_list">
|
||||
<div v-if="workConfObj.teachImageList.length > 0">
|
||||
<div style="margin-bottom: 5px;text-align: left;">
|
||||
<span style="color: red">温馨提示:点击图片可放大预览 </span>
|
||||
</div>
|
||||
<div style="display: flex; flex-wrap: nowrap; flex-direction: row;">
|
||||
<div v-for="(imageItem, index) in workConfObj.teachImageList" :key="index" style="margin: 0 15px;">
|
||||
<el-image
|
||||
style="width: 100px; height: 100px"
|
||||
:src="imageItem.url"
|
||||
:zoom-rate="1.2"
|
||||
:max-scale="7"
|
||||
:min-scale="0.2"
|
||||
:preview-src-list="
|
||||
workConfObj.teachImageList
|
||||
.filter(
|
||||
(item) =>
|
||||
item.name.indexOf('jpg') > -1 ||
|
||||
item.name.indexOf('jpeg') > -1 ||
|
||||
item.name.indexOf('png') > -1
|
||||
)
|
||||
.map((item) => item.url)
|
||||
"
|
||||
:initial-index="4"
|
||||
fit="contain"
|
||||
/>
|
||||
</div>
|
||||
<!-- 其他类型附件 -->
|
||||
<div v-if="workConfObj.teachFileList.length > 0">
|
||||
<div style="margin: 10px 0;text-align: left; margin: auto 0; cursor: pointer;">
|
||||
<span style="color: #409eff" @click="openFile">预览其他类型附件!</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="workConfObj.teachFileList.length > 0">
|
||||
<div style="margin: 10px 0;text-align: left; margin: auto 0; cursor: pointer;">
|
||||
<span style="color: #409eff" @click="openFile">预览其他类型附件!</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div slot="footer" class="dialog-footer" style="text-align: right; margin-top: 20px;">
|
||||
<div style="display: flex">
|
||||
|
@ -137,7 +202,6 @@
|
|||
<el-button type="primary" style="margin-left: auto" :disabled="checkTaskAssigned(currentWorkEdit.currentTask)"
|
||||
@click="submitStudy('submit')">确 定</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
@ -229,6 +293,12 @@
|
|||
<el-button type="primary" @click="handleTaskAssignToAllClassType()" >{{'推送'}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 预览框 -->
|
||||
<prevReadMsgDialog ref="prevReadMsgDialogRef" :bookobj="courseObj"/>
|
||||
<!-- 其他附件预览框 acceptParams-->
|
||||
<prevReadImgFileDialog ref="prevReadImgFileDialogRef"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -247,6 +317,9 @@ import { useGetHomework } from '@/hooks/useGetHomework'
|
|||
import { processList } from '@/hooks/useProcessList'
|
||||
import { uniqBy, groupBy } from 'lodash'
|
||||
import { getCurrentTime } from '@/utils/date'
|
||||
import prevReadMsgDialog from '@/views/classTask/container/newTask/prevReadMsg-Dialog.vue'
|
||||
import prevReadImgFileDialog from '@/views/classTask/container/classTask/prevReadImgFileDialog.vue'
|
||||
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const userStore = useUserStore().user
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
@ -263,7 +336,8 @@ const props = defineProps({
|
|||
// ---------------------------------------------------
|
||||
|
||||
const isCollapse = ref(false)
|
||||
|
||||
const prevReadMsgDialogRef = ref(null);// 预览框ref
|
||||
const prevReadImgFileDialogRef = ref(null);// 其他附件类型预览框ref
|
||||
|
||||
const courseObj = reactive({
|
||||
// 课程相关参数: 教材id,单元id,章节id,课程名称
|
||||
|
@ -287,9 +361,13 @@ const currentWorkEdit = reactive({
|
|||
currentIndex: 0,
|
||||
})// 当前作业编辑
|
||||
const currentTag = ref('');// 当前作业类型
|
||||
|
||||
// 作业列表-详情展示内容
|
||||
const workConfObj = reactive({
|
||||
quizlist: [], // 习题list
|
||||
chooseWorkLists: [], // 框架梳理
|
||||
teacherFeedContentList: [],//常规作业
|
||||
teachFileList: [], // 常规作业文件list
|
||||
teachImageList: [],// 常规作业图片list
|
||||
});
|
||||
|
||||
// 推送相关
|
||||
|
@ -370,6 +448,10 @@ const getTaskList = async () => {
|
|||
let model = [];
|
||||
let mission = [];
|
||||
|
||||
if(res.rows&&res.rows.length > 0){
|
||||
// 根据创建时间 倒序排列一下
|
||||
res.rows.sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp));
|
||||
}
|
||||
for (let item of res.rows){
|
||||
item.taskconfig = [];
|
||||
|
||||
|
@ -452,6 +534,7 @@ const getTaskList = async () => {
|
|||
}
|
||||
list.push(item);
|
||||
}
|
||||
// 根据 父项、子项 创建时间倒序排列一下
|
||||
taskList.value = list;
|
||||
loading.value = false;
|
||||
})
|
||||
|
@ -467,8 +550,22 @@ const handleWorkTitleEdit = (row, index) => {
|
|||
};
|
||||
|
||||
|
||||
// 作业内容-查看详情
|
||||
const handleWorkEdit = (row, index) =>{
|
||||
// 作业内容编辑-跳转到设计界面-传参
|
||||
let classtaskObj = reactive({
|
||||
id: '', //
|
||||
bookName: '', // 课程名称
|
||||
uniquekey: '', // 设计中的标题
|
||||
title: '', // 设计中的说明
|
||||
worktype: '', // 设计中的作业类型
|
||||
quizlist: [], // 设计中的试题列表
|
||||
chooseWorkLists: [],// 设计中的框架梳理list
|
||||
fileHomeworkList: [],// 设计中的常规作业list
|
||||
whiteboardObj: '',// 设计中的课堂展示对象
|
||||
})
|
||||
/**
|
||||
* 作业内容-查看详情
|
||||
* */
|
||||
const handleWorkEdit = (row, index) =>{
|
||||
console.log(row, index)
|
||||
workEdit.value = true
|
||||
currentWorkEdit.currentTask = row;
|
||||
|
@ -477,24 +574,27 @@ const handleWorkEdit = (row, index) =>{
|
|||
// this.attainmentList = row.workcodesList?.attlist;
|
||||
// this.courseQualityList = row.workcodesList?.qualist;
|
||||
if (row.worktype == '框架梳理') {
|
||||
this.$nextTick(()=>{
|
||||
this.getFlowData()
|
||||
//包含 entpcourseworklistarray 内容
|
||||
var listCourseWork = [];
|
||||
for (var i=0; i < row.entpcourseworklistarray.length; i++) {
|
||||
listCourseWork.push(row.entpcourseworklistarray[i]);
|
||||
}
|
||||
nextTick(()=>{
|
||||
// 框架梳理对应只有一个内容 默认读取第一个id即可
|
||||
getEvaluationclue(listCourseWork[0].id).then(res => {
|
||||
if ( res.data==null || res.data==undefined ) {
|
||||
return;
|
||||
}
|
||||
|
||||
res.data.worktype = '框架梳理';
|
||||
res.data.score = listCourseWork[0].score;
|
||||
|
||||
console.log('框架梳理的列表', res.data);
|
||||
// 预览list赋值
|
||||
workConfObj.chooseWorkLists = [res.data];
|
||||
});
|
||||
})
|
||||
}
|
||||
// if (row.worktype == '学科定位') {
|
||||
// // TODO 后续需要再迁
|
||||
// rootid:entpcoursework里的id rootid: row.entpcourseworklistarray[0].id,
|
||||
// listEvaluationclue({ cluegroup: 'graph', edusubject: this.courseObj.edusubject, pageSize: 1000 }).then((res) => {
|
||||
// var glist = [];
|
||||
// for (var i = 0; i < res.rows.length; i++) {
|
||||
// glist.push(res.rows[i]);
|
||||
// }
|
||||
// this.isEditable = false;
|
||||
// this.preKnowList = glist;
|
||||
// this.$refs.jsMind.updateFromParent(this.preKnowList, this.courseObj.edusubject);
|
||||
// this.$refs.jsMind.initJsMindMap();
|
||||
// })
|
||||
// }
|
||||
|
||||
// // 课标研读 目标设定 教材研读 框架梳理 学科定位
|
||||
if (row.worktype == '习题训练') {
|
||||
|
@ -532,63 +632,38 @@ const handleWorkEdit = (row, index) =>{
|
|||
})
|
||||
}
|
||||
|
||||
// 常规作业、课堂展示
|
||||
if(row.worktype == '常规作业' || row.worktype == '课堂展示'){
|
||||
console.log(row,'常规作业-课堂展示');
|
||||
// 老师布置的附件 workcodes ?? 与批改哪里这个字段值不一样
|
||||
//TODO 待完善 课堂展示
|
||||
if(row.worktype == '常规作业'){
|
||||
console.log(row,'常规作业');
|
||||
workConfObj.teacherFeedContentList = [];
|
||||
workConfObj.teachImageList = [];
|
||||
workConfObj.teachFileList = [];
|
||||
|
||||
if(row.workcodes != ''){
|
||||
const teachWorkFileList = JSON.parse(row.workcodes);
|
||||
teachWorkFileList&&teachWorkFileList.forEach(item => {
|
||||
if(item.name.indexOf('jpg') > -1 || item.name.indexOf('jpeg') > -1 || item.name.indexOf('png') > -1){
|
||||
this.teachImageList.push(item);
|
||||
workConfObj.teachImageList.push(item);
|
||||
}else{
|
||||
this.teachFileList.push(item);
|
||||
workConfObj.teachFileList.push(item);
|
||||
}
|
||||
})
|
||||
this.teacherFeedContentList.push(teachWorkFileList);
|
||||
workConfObj.teacherFeedContentList.push(teachWorkFileList);
|
||||
}
|
||||
}
|
||||
};
|
||||
// 作业内容编辑-跳转到设计界面-传参
|
||||
let classtaskObj = reactive({
|
||||
id: '', //
|
||||
bookName: '', // 课程名称
|
||||
uniquekey: '', // 设计中的标题
|
||||
title: '', // 设计中的说明
|
||||
worktype: '', // 设计中的作业类型
|
||||
quizlist: [], // 设计中的试题列表
|
||||
chooseWorkLists: [],// 设计中的框架梳理list
|
||||
fileHomeworkList: [],// 设计中的常规作业list
|
||||
whiteboardObj: '',// 设计中的课堂展示对象
|
||||
})
|
||||
// 作业内容编辑-跳转到设计界面
|
||||
const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
|
||||
// this.newWorkSpace = true;
|
||||
// this.newWorkSpaceEdit = true;
|
||||
// this.currentTask = row;
|
||||
// this.currentIndex = index;
|
||||
// this.currentTag = row.worktype;
|
||||
// this.attainmentList = row.workcodesList?.attlist;
|
||||
// this.courseQualityList = row.workcodesList?.qualist;
|
||||
|
||||
// 更新新任务中的各数据
|
||||
// this.classWorkForm.uniquekey = this.currentTask.uniquekey;
|
||||
// this.classWorkForm.title = this.currentTask.title;
|
||||
// 更新新任务中作业类型
|
||||
// this.classWorkForm.worktype = this.currentTask.worktype;
|
||||
|
||||
//重新更新[新任务]中右侧列表数据
|
||||
var listCourseWork = [];
|
||||
for (var i=0; i < row.entpcourseworklistarray.length; i++) {
|
||||
listCourseWork.push(row.entpcourseworklistarray[i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (listCourseWork.length > 0) {
|
||||
classtaskObj.id= row.id; //
|
||||
classtaskObj.bookObj = courseObj; // 教材对象
|
||||
classtaskObj.bookName = row.evaltitle? row.evalparenttitle+'/'+row.evaltitle: row.evalparenttitle// 课程名称:单元/章节: 单元
|
||||
classtaskObj.bookName = row.evaltitle? row.evalparenttitle? row.evalparenttitle+'/'+row.evaltitle : row.evaltitle: row.evalparenttitle// 课程名称:单元/章节: 单元
|
||||
classtaskObj.uniquekey= row.uniquekey; // 设计中的标题
|
||||
classtaskObj.title= row.title; // 设计中的说明
|
||||
classtaskObj.worktype= row.worktype; // 设计中的作业类型
|
||||
|
@ -600,11 +675,6 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
|
|||
|
||||
if (row.worktype == '框架梳理') {
|
||||
// 框架梳理对应只有一个内容
|
||||
// let queryParams = {}
|
||||
// queryParams.id = listCourseWork[0].id;
|
||||
// queryParams.ppttype = '教材分析';
|
||||
// queryParams.title = '框架梳理';
|
||||
// queryParams.filetype = 'draw';
|
||||
const res = await getEvaluationclue(listCourseWork[0].id);
|
||||
if ( res.data==null || res.data==undefined ) {
|
||||
return;
|
||||
|
@ -615,6 +685,7 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
|
|||
res.data.score = listCourseWork[0].score;
|
||||
classtaskObj.chooseWorkLists.push(res.data);
|
||||
//
|
||||
ToNewClassTask(classtaskObj);
|
||||
}
|
||||
else if (row.worktype == '习题训练') {
|
||||
const ids = listCourseWork.map(item => item.id).join(",");
|
||||
|
@ -636,6 +707,7 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
|
|||
|
||||
classtaskObj.quizlist = idres.rows;
|
||||
//
|
||||
ToNewClassTask(classtaskObj);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -644,23 +716,29 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
|
|||
const workcodes = JSON.parse(row.workcodes);
|
||||
classtaskObj.whiteboardObj = JSON.stringify(workcodes.json);
|
||||
//
|
||||
ToNewClassTask(classtaskObj);
|
||||
}
|
||||
else if (row.worktype == '常规作业') {
|
||||
if(isJson(row.workcodes)){
|
||||
classtaskObj.fileHomeworkList = JSON.parse(row.workcodes);
|
||||
//
|
||||
ToNewClassTask(classtaskObj);
|
||||
}
|
||||
}
|
||||
|
||||
// 跳转 作业设计 进行编辑页面
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 跳转 作业设计 进行编辑页面
|
||||
* @param classtaskObj
|
||||
*/
|
||||
const ToNewClassTask = (classtaskObj) => {
|
||||
router.push({
|
||||
path: '/newClassTask',
|
||||
query: {
|
||||
classtaskObj: JSON.stringify(classtaskObj),
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const isJson = (str) => {
|
||||
if (typeof str == 'string') {
|
||||
|
@ -877,6 +955,8 @@ const handleWorkConfigUpdate = (key,row) => {
|
|||
classWorkConfigForm.classWorkConfigList = [];
|
||||
// 新建的配置方案
|
||||
for (var i=0; i<clist.length; i++) {
|
||||
// clist里面包含多个班级、多个班级的学生。选中的学生中 classWorkConfigForm.studentlist 包含多个班级的学生 studentlist赋值需要根据id判断筛选一下
|
||||
const clsStuList = classWorkConfigForm.studentlist&&classWorkConfigForm.studentlist.filter(item=>item.classid == clist[i].id);
|
||||
classWorkConfigForm.classWorkConfigList.push({
|
||||
id: 0,
|
||||
classid: clist[i].id,
|
||||
|
@ -892,7 +972,7 @@ const handleWorkConfigUpdate = (key,row) => {
|
|||
workdate: '',
|
||||
title: '',
|
||||
workcodes: '',
|
||||
studentlist: classWorkConfigForm.studentlist,
|
||||
studentlist: clsStuList,
|
||||
timelength: classWorkConfigForm.timelength,
|
||||
weights: classWorkConfigForm.weights,
|
||||
feedtype: classWorkConfigForm.feedtype,
|
||||
|
@ -1006,6 +1086,7 @@ const handleTaskAssignToAllClassType = async() => {
|
|||
|
||||
var wForm = {};
|
||||
wForm.classworkarray = JSON.stringify(ttt);
|
||||
console.log(wForm,'推送的配置信息------------')
|
||||
saveByClassWorkArray(wForm).then(response => {
|
||||
console.log(response,'===============response');
|
||||
// this.classWorkToStudent_Loading = false;
|
||||
|
@ -1047,6 +1128,24 @@ const handleNewClassWorkDialog = () => {
|
|||
router.push({ path: '/newClassTask' });
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览框
|
||||
*/
|
||||
const prevRead = (item) => {
|
||||
proxy.$refs.prevReadMsgDialogRef.openDialog(item);
|
||||
}
|
||||
/**
|
||||
* 常规作业:其他附件预览
|
||||
*/
|
||||
const openFile = () => {
|
||||
const obj = {
|
||||
teacherFeedContentList: workConfObj.teacherFeedContentList,//常规作业
|
||||
teachFileList: workConfObj.teachFileList, // 常规作业文件list
|
||||
teachImageList: workConfObj.teachImageList,// 常规作业图片list
|
||||
}
|
||||
proxy.$refs.prevReadImgFileDialogRef.acceptParams(obj);
|
||||
}
|
||||
|
||||
// 作业说明编辑-确认
|
||||
const submitWorkTitle = () => {
|
||||
if(currentWorkEdit.currentTask.title == currentWorkEdit.currentTitle){
|
||||
|
|
|
@ -15,11 +15,11 @@ const chartRef = ref(null);
|
|||
|
||||
// 数据源
|
||||
const dataList = ref([
|
||||
{name: '优', value: 0,rating:1},
|
||||
{name: '优-', value: 0,rating:2},
|
||||
{name: '良', value: 0,rating:3},
|
||||
{name: '良-', value: 0,rating:4},
|
||||
{name: '差', value: 0,rating:5},
|
||||
{name: '完美', value: 0,rating:1,max:100,min:100,},
|
||||
{name: '优秀', value: 0,rating:2,max:99,min:80,},
|
||||
{name: '良好', value: 0,rating:3,max:79,min:70,},
|
||||
{name: '及格', value: 0,rating:4,max:69,min:60,},
|
||||
{name: '不及格', value: 0,rating:5,max:59,min:0,},
|
||||
]);
|
||||
|
||||
// 根据数据生成不同的颜色
|
||||
|
@ -32,6 +32,8 @@ function getColor(index) {
|
|||
// 初始化图表
|
||||
function initChart() {
|
||||
const myChart = echarts.init(chartRef.value);
|
||||
const total = dataList.value.reduce((acc, cur) => acc + cur.value, 0); // 计算总数
|
||||
|
||||
const options = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
|
@ -70,7 +72,11 @@ function initChart() {
|
|||
label: {
|
||||
show: true,
|
||||
position: 'top',
|
||||
formatter: '{c}人',
|
||||
formatter: params => {
|
||||
const value = dataList.value[params.dataIndex].value;
|
||||
const percentage = ((value / total) * 100).toFixed(2); // 计算百分比并保留两位小数
|
||||
return `${percentage}%`; // 显示为百分比形式
|
||||
},
|
||||
color: '#333',
|
||||
fontSize: 12
|
||||
}
|
||||
|
@ -81,10 +87,13 @@ function initChart() {
|
|||
}
|
||||
// 获取表的数据
|
||||
const showEcharts =() => {
|
||||
useOverview.tableList.forEach(item => {
|
||||
const index = dataList.value.findIndex(item1 => item1.rating === item.rating)
|
||||
if(index !== -1)
|
||||
dataList.value[index].value ++
|
||||
useOverview.tableList.forEach((item,index) => {
|
||||
if(item.rating === 0) return // 没批改不计数
|
||||
dataList.value.forEach((item1,index1) => {
|
||||
if(item1.min <= Number(item.scoingRate) && Number(item.scoingRate) <= item1.max ){
|
||||
item1.value ++
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
watch(() => useOverview.tableList,() => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<el-tabs :tab-position="tabPosition" style="height: 100%" class="demo-tabs" @tabChange="handelChange">
|
||||
<template v-for="(item,index) in leftList" :key="index">
|
||||
<el-tab-pane :label="item.label" style="text-align:left">
|
||||
<el-tab-pane :label="item.label" style="text-align:left" stretch="true">
|
||||
<template v-if="item.stuList.length > 0">
|
||||
<template v-for="(stuItem,stuIndex) in item.stuList" :key="stuIndex">
|
||||
<el-tag style="margin:5px 10px 0 0" type="primary">{{stuItem.studentname}}</el-tag>
|
||||
|
@ -23,29 +23,40 @@ const useOverview = overviewStore()
|
|||
const tabPosition = ref('left')
|
||||
const leftList = ref([
|
||||
{
|
||||
label:'优',
|
||||
label:'完美',
|
||||
stuList:[],
|
||||
rating:1
|
||||
rating:1,
|
||||
max:100,
|
||||
min:100,
|
||||
},
|
||||
{
|
||||
label:'优-',
|
||||
label:'优秀',
|
||||
stuList:[],
|
||||
rating:2
|
||||
rating:2,
|
||||
max:99,
|
||||
min:80,
|
||||
|
||||
},
|
||||
{
|
||||
label:'良',
|
||||
label:'良好',
|
||||
stuList:[],
|
||||
rating:3
|
||||
rating:3,
|
||||
max:79,
|
||||
min:70,
|
||||
},
|
||||
{
|
||||
label:'良-',
|
||||
label:'及格',
|
||||
stuList:[],
|
||||
rating:4
|
||||
rating:4,
|
||||
max:69,
|
||||
min:60,
|
||||
},
|
||||
{
|
||||
label:'差',
|
||||
label:'不及格',
|
||||
stuList:[],
|
||||
rating:5
|
||||
rating:5,
|
||||
max:59,
|
||||
min:0,
|
||||
},
|
||||
])
|
||||
//切换展示区域学生
|
||||
|
@ -54,9 +65,12 @@ const handelChange = (item) => {
|
|||
}
|
||||
//取区域的学生
|
||||
const showStudents = (index) => {
|
||||
console.log(useOverview.tableList,'lef')
|
||||
leftList.value[index].stuList = useOverview.tableList.filter(item => {
|
||||
if(item.rating == leftList.value[index].rating) return item
|
||||
if(item.rating > 0){
|
||||
if(leftList.value[index].min <= Number(item.scoingRate || 0) && Number(item.scoingRate || 0) <= leftList.value[index].max ){
|
||||
return item
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
watch(() => useOverview.tableList,() => {
|
||||
|
@ -107,9 +121,9 @@ watch(() => useOverview.tableList,() => {
|
|||
:deep(.el-tabs__item.is-active){
|
||||
background-color: rgb(238, 241, 246);
|
||||
}
|
||||
:deep(.el-tabs--left .el-tabs__item.is-left){
|
||||
:deep(.el-tabs--left .el-tabs__item.is-left, .el-tabs--right .el-tabs__item.is-left){
|
||||
text-align: left;
|
||||
justify-content: flex-start;
|
||||
justify-content: flex-start !important;
|
||||
}
|
||||
|
||||
</style>
|
|
@ -196,7 +196,7 @@
|
|||
</div>
|
||||
|
||||
<div v-if="teachFileList.length > 0">
|
||||
<div style="margin: 10px 0;text-align: left;">
|
||||
<div style="margin: 10px 0;text-align: left; cursor: pointer;">
|
||||
<span style="color: red" @click="openFile"
|
||||
>温馨提示:点击此处 可预览其他类型附件!
|
||||
</span>
|
||||
|
@ -245,7 +245,7 @@
|
|||
</div>
|
||||
|
||||
<div v-if="fileList.length > 0">
|
||||
<div style="margin: 10px 0;text-align: left;">
|
||||
<div style="margin: 10px 0;text-align: left; cursor: pointer;">
|
||||
<span style="color: red" @click="openFile"
|
||||
>温馨提示:点击此处 可预览其他类型附件!
|
||||
</span>
|
|
@ -0,0 +1,179 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
v-model="fileReadopen"
|
||||
title="文件预览"
|
||||
width="80%"
|
||||
:style="{ height: '72vh' }"
|
||||
append-to-body
|
||||
>
|
||||
<div class="file-read-dialog">
|
||||
<div>
|
||||
<!-- 老师附件 -->
|
||||
<div v-if="teachFileList.length > 0">
|
||||
<el-card style="max-width: 480px">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>文件列表</span>
|
||||
</div>
|
||||
</template>
|
||||
<div
|
||||
v-for="item in teachFileList"
|
||||
:key="item"
|
||||
style="margin: 10px; display: flex; align-items: center"
|
||||
>
|
||||
<span style="margin-right: 10px">{{ item.name }}</span>
|
||||
<el-button type="primary" @click="onFileRead(item)">预览</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%" :style="{ height: '72vh' }">
|
||||
<div style="margin-left: 10px">
|
||||
预览展示区域<span style="color: red; margin-left: 10px">
|
||||
温馨提示:若预览失败,<span style="margin-left: 10px">{{ props.name }}</span
|
||||
>可点击此处<a
|
||||
:href="fileitem.url ? fileitem.url : ''"
|
||||
target="_blank"
|
||||
style="color: blue"
|
||||
>下载!</a
|
||||
></span
|
||||
>
|
||||
</div>
|
||||
<ReFilePreview
|
||||
:name="fileitem.name"
|
||||
:type="fileitem.type"
|
||||
:file-type="fileitem.type"
|
||||
:file-path="fileitem.url"
|
||||
:text-content="textContent"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup name="prevReadImgFileDialogRef">
|
||||
import { ref, reactive } from 'vue'
|
||||
import ReFilePreview from '@/components/refile-preview/index.vue'
|
||||
|
||||
const props = defineProps({})
|
||||
|
||||
const fileReadopen = ref(false)
|
||||
|
||||
// 老师常规作业、课堂展示布置题目附件list
|
||||
const teacherFeedContentList = ref([])
|
||||
const teachImageList = ref([])
|
||||
const teachFileList = ref([])
|
||||
|
||||
|
||||
// 确定的线上图片数据
|
||||
//#region 文件内容相关
|
||||
const fileitem = reactive({
|
||||
name: '',
|
||||
type: '',
|
||||
url: ''
|
||||
})
|
||||
// 文件预览
|
||||
const onFileRead = (file) => {
|
||||
textContent.value = '1'
|
||||
//
|
||||
fileitem.type = file.name.split('.').pop().toLowerCase()
|
||||
fileitem.url = file.url
|
||||
fileitem.name = file.name
|
||||
|
||||
// txt 读取
|
||||
if (fileitem.type == 'txt') {
|
||||
loadFileTextContent(fileitem.url)
|
||||
}
|
||||
}
|
||||
|
||||
// txt文件读取
|
||||
const textContent = ref('')
|
||||
const loadFileTextContent = async (url) => {
|
||||
try {
|
||||
const response = await fetch(url)
|
||||
if (!response.ok) {
|
||||
textContent.value = '文件读取失败,您可以点击上方链接跳到另外页面查看'
|
||||
throw new Error('文件读取失败')
|
||||
}
|
||||
textContent.value = await response.text()
|
||||
} catch (error) {
|
||||
console.error('读取文件时出错:', error)
|
||||
textContent.value = '文件读取失败,您可以点击上方链接跳到另外页面查看'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 接收父组件传过来的参数
|
||||
const acceptParams = (params) => {
|
||||
console.log(params)
|
||||
fileReadopen.value = true;
|
||||
teacherFeedContentList.value = params.teacherFeedContentList
|
||||
teachImageList.value = params.teachImageList
|
||||
teachFileList.value = params.teachFileList
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 初始化请求
|
||||
// onMounted(() => {})
|
||||
|
||||
// 暴露给父组件的参数和方法(外部需要什么,都可以从这里暴露出去)
|
||||
defineExpose({
|
||||
acceptParams
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
|
||||
.card-header{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.image_list {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: column;
|
||||
}
|
||||
.file-read-dialog {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.score-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
/* margin-bottom: 20px; */
|
||||
}
|
||||
|
||||
.score-circle {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
background-color: pink;
|
||||
color: red;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 13px;
|
||||
margin: 0 10px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
.score-circle.active {
|
||||
background-color: red;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.card-header{
|
||||
align-items: left;
|
||||
}
|
||||
</style>
|
|
@ -167,7 +167,7 @@ import useUserStore from '@/store/modules/user'
|
|||
import { ElMessage } from 'element-plus'
|
||||
import { getCurrentTime, getAfterMinutes } from '@/utils/date'
|
||||
import { processList } from '@/hooks/useProcessList'
|
||||
import ItemDialogScore from '@/views/classTask/container/item-dialog-score.vue'
|
||||
import ItemDialogScore from '@/views/classTask/container/classTask/item-dialog-score.vue'
|
||||
// zdg: 组件导入
|
||||
import quizStats from '@/views/classTask/container/quizStats.vue'
|
||||
import ClassOverview from '@/views/classTask/container/classOverview.vue'
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
<template>
|
||||
<!-- 预览框 -->
|
||||
<el-dialog v-if="prevReadMsg.visible" v-model="prevReadMsg.visible" class="prev-read-zy-wrap" width="90%" style="height: 80vh" append-to-body>
|
||||
<!-- <div v-if="prevReadMsg.type=='课标研读'" style="height: 100%;">
|
||||
<standard book-type="课标研读" :show-cata="true" :show-tools="false" :course-obj="courseObj" :bookdatahtml="versionObj.bookdata" :teachResObj="activeTeachResOfStandard"></standard>
|
||||
</div>
|
||||
<div v-if="prevReadMsg.type=='目标设定'" style="height: 100%;display: flex;">
|
||||
<degreeevolution :courseObj="courseObj" :show-class="true" :teachResObj="activeTeachResOfStandard" :attainmentList="attainmentList" :courseQualityList="courseQualityList"/>
|
||||
</div>
|
||||
<div v-if="prevReadMsg.type=='教材研读'" style="height: 100%;">
|
||||
<standard book-type="教材研读" :course-obj="courseObj" :show-tools="false" :bookdatahtml="versionObj.bookdata" :teachResObj="activeTeachResOfStandard"></standard>
|
||||
</div> -->
|
||||
<div v-if="prevReadMsg.type=='框架梳理'" style="height: 100%;">
|
||||
<FlowChart ref="flowref" :flowHeight="mainHeight" :dataSource="flowData"/>
|
||||
</div>
|
||||
<!-- <div v-if="prevReadMsg.type=='学科定位'" style="height: 100%;">
|
||||
<teachJsMind :course-obj="courseObj" :teachResObj="activeTeachResOfStandard"></teachJsMind>
|
||||
</div> -->
|
||||
<!-- <div v-if="prevReadMsg.type=='习题训练'">习题训练</div> -->
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup name="prevReadMsgDialogRef">
|
||||
import { onMounted, ref, watch, reactive, getCurrentInstance } from 'vue'
|
||||
|
||||
import { listEntpcoursefile } from '@/api/education/entpcoursefile'
|
||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import FlowChart from "@/components/Flowchart/index.vue";
|
||||
|
||||
// import {listEntpcoursework, listEntpcourseworkNew, getEntpcoursework} from '@/api/education/entpCourseWork'
|
||||
// import { addClassworkReturnId } from '@/api/teaching/classwork'
|
||||
// import { updateClasswork, listEvaluationclue,readFile, listClassworkeval,delClassworkeval,addClassworkeval,updateClassworkeval } from '@/api/classTask'
|
||||
// import { listEvaluation } from '@/api/subject'
|
||||
|
||||
// import { listKnowledgePoint } from "@/api/knowledge/knowledgePoint";
|
||||
|
||||
|
||||
import FileUpload from "@/components/FileUpload/index.vue";
|
||||
import whiteboard from '@/components/whiteboard/whiteboard.vue'
|
||||
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const userStore = useUserStore().user
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const props = defineProps({
|
||||
bookobj: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
})
|
||||
const mainHeight = ref(document.documentElement.clientHeight - 110)
|
||||
|
||||
// 预览
|
||||
const prevReadMsg = reactive({
|
||||
visible: false,
|
||||
type: ""
|
||||
});// 预览msg
|
||||
// 框架梳理----------
|
||||
const flowData = ref({})// 框架梳理
|
||||
|
||||
|
||||
|
||||
// 1、打开弹窗: 预览资源
|
||||
const openDialog = async (item) => {
|
||||
prevReadMsg.visible = true;
|
||||
prevReadMsg.type = item.worktype;
|
||||
// // if (item.worktype==='课标研读'){
|
||||
// // //获取教材文件和批注信息
|
||||
// // listEvaluation({itemkey: 'subject', edusubject: userStore.edusubject, edustage: userStore.edustage}).then(res => {
|
||||
// // // TODO 课标研读-还未接入
|
||||
// // console.log("课标研读-还未接入",res);
|
||||
// // // this.versionObj = res.rows[0];
|
||||
// // // // 读取出课标文件的每一行
|
||||
// // // if (this.versionObj.fileurl.length > 0) {
|
||||
// // // readFile({cluelink: this.versionObj.fileurl}).then(fileres => {
|
||||
// // // this.versionObj.bookdata = fileres;
|
||||
// // // this.activeTeachResOfStandard = item;
|
||||
// // // })
|
||||
// // // }
|
||||
// // })
|
||||
// // }
|
||||
// // if (item.worktype==='目标设定'){
|
||||
// // // TODO 目标设定-还未接入
|
||||
// // // this.activeTeachResOfStandard = item;
|
||||
// // }
|
||||
// if (item.worktype==='教材研读'){
|
||||
// // TODO 教材研读-还未接入
|
||||
// // getEvaluation(this.courseObj.evalrootid).then(bookres => {
|
||||
// // this.versionObj = bookres.data;
|
||||
// // if (this.versionObj.fileurl.length > 0) {
|
||||
// // readFile({cluelink: this.versionObj.fileurl}).then(fileres => {
|
||||
// // this.versionObj.bookdata = fileres;
|
||||
// // this.activeTeachResOfStandard = item;
|
||||
// // })
|
||||
// // }
|
||||
// // })
|
||||
// }
|
||||
if (item.worktype==='框架梳理'){
|
||||
flowData.value = {};
|
||||
const { chapterId } = await useGetHomework(props.bookobj.node)
|
||||
// this.entpcourseid = chapterId
|
||||
let queryParams = {
|
||||
entpcourseid: chapterId,
|
||||
ppttype: '教材分析',
|
||||
parentid: item.id,
|
||||
title: '逻辑框架建构',
|
||||
filetype: 'draw'
|
||||
}
|
||||
listEntpcoursefile(queryParams).then(response=>{
|
||||
if (response.rows.length == 0) {
|
||||
return;
|
||||
}
|
||||
flowData.value = JSON.parse(response.rows[0].datacontent)
|
||||
})
|
||||
}
|
||||
// if (item.worktype==='学科定位'){
|
||||
// // TODO 学科定位-还未接入
|
||||
// // this.activeTeachResOfStandard = item;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
})
|
||||
|
||||
|
||||
watch(() => props.bookobj.levelSecondId, (newVal) => {
|
||||
console.log(props.bookobj,'课程选择')
|
||||
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.prev-read-zy-wrap .el-dialog__header{
|
||||
padding: 0!important;
|
||||
}
|
||||
.prev-read-zy-wrap .el-dialog__header button{
|
||||
z-index: 99;
|
||||
}
|
||||
.prev-read-zy-wrap .el-dialog__body{
|
||||
padding: 0!important;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
|
@ -223,24 +223,7 @@
|
|||
</el-form>
|
||||
|
||||
<!-- 预览框 -->
|
||||
<el-dialog v-if="prevReadMsg.visible" v-model="prevReadMsg.visible" class="prev-read-zy-wrap" width="90%" style="height: 80vh" append-to-body>
|
||||
<!-- <div v-if="prevReadMsg.type=='课标研读'" style="height: 100%;">
|
||||
<standard book-type="课标研读" :show-cata="true" :show-tools="false" :course-obj="courseObj" :bookdatahtml="versionObj.bookdata" :teachResObj="activeTeachResOfStandard"></standard>
|
||||
</div>
|
||||
<div v-if="prevReadMsg.type=='目标设定'" style="height: 100%;display: flex;">
|
||||
<degreeevolution :courseObj="courseObj" :show-class="true" :teachResObj="activeTeachResOfStandard" :attainmentList="attainmentList" :courseQualityList="courseQualityList"/>
|
||||
</div>
|
||||
<div v-if="prevReadMsg.type=='教材研读'" style="height: 100%;">
|
||||
<standard book-type="教材研读" :course-obj="courseObj" :show-tools="false" :bookdatahtml="versionObj.bookdata" :teachResObj="activeTeachResOfStandard"></standard>
|
||||
</div> -->
|
||||
<div v-if="prevReadMsg.type=='框架梳理'" style="height: 100%;">
|
||||
<FlowChart ref="flowref" :flowHeight="mainHeight" :dataSource="flowData"/>
|
||||
</div>
|
||||
<!-- <div v-if="prevReadMsg.type=='学科定位'" style="height: 100%;">
|
||||
<teachJsMind :course-obj="courseObj" :teachResObj="activeTeachResOfStandard"></teachJsMind>
|
||||
</div> -->
|
||||
<!-- <div v-if="prevReadMsg.type=='习题训练'">习题训练</div> -->
|
||||
</el-dialog>
|
||||
<prevReadMsgDialog ref="prevReadMsgDialogRef" :bookobj="props.bookobj"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -260,16 +243,16 @@ import { listKnowledgePoint } from "@/api/knowledge/knowledgePoint";
|
|||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { processList } from '@/hooks/useProcessList'
|
||||
import { getCurrentTime } from '@/utils/date'
|
||||
import FlowChart from "@/components/Flowchart/index.vue";
|
||||
import FileUpload from "@/components/FileUpload/index.vue";
|
||||
import whiteboard from '@/components/whiteboard/whiteboard.vue'
|
||||
|
||||
import prevReadMsgDialog from '@/views/classTask/container/newTask/prevReadMsg-Dialog.vue'
|
||||
|
||||
import { useToolState } from '@/store/modules/tool'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const userStore = useUserStore().user
|
||||
const { proxy } = getCurrentInstance()
|
||||
const router = useRouter()
|
||||
const toolStore = useToolState()
|
||||
|
||||
const props = defineProps({
|
||||
bookobj: {
|
||||
|
@ -286,12 +269,8 @@ const props = defineProps({
|
|||
}
|
||||
})
|
||||
|
||||
const prevReadMsgDialogRef = ref(null);// 预览框ref
|
||||
|
||||
const isDialogOpen = ref(false)
|
||||
const toolStore = useToolState()
|
||||
const openDialog = () => {
|
||||
isDialogOpen.value = true
|
||||
}
|
||||
const classWorkFormRef = ref(null);
|
||||
const entpCourseWorkTypeList = ref([
|
||||
{value: 0, label: "不限"},
|
||||
|
@ -372,12 +351,6 @@ const listWorkType = ref(['习题训练', '框架梳理', '课堂展示', '常
|
|||
|
||||
// 课堂展示-------
|
||||
const boardLoading = ref(false);
|
||||
const prevReadMsg = reactive({
|
||||
visible: false,
|
||||
type: ""
|
||||
});// 预览msg
|
||||
// 框架梳理----------
|
||||
const flowData = ref({})// 框架梳理
|
||||
//常规作业----------
|
||||
const fileLoading = ref(false); // 常规作业loading
|
||||
|
||||
|
@ -388,8 +361,6 @@ const changeFormType = (val) => {
|
|||
classWorkForm.worktype = val;
|
||||
}
|
||||
|
||||
console.log(props.propsformobj)
|
||||
console.log(classWorkForm,'==============zizujian===================')
|
||||
/**
|
||||
* @desc: 根据查询参数查询试题
|
||||
* @return: {*}
|
||||
|
@ -565,61 +536,7 @@ const handleClassWorkQuizAdd = (fromsrc, entpcourseworkid) => {
|
|||
* 预览资源
|
||||
*/
|
||||
const prevRead = async (item) => {
|
||||
prevReadMsg.visible = true;
|
||||
prevReadMsg.type = item.worktype;
|
||||
if (item.worktype==='课标研读'){
|
||||
//获取教材文件和批注信息
|
||||
listEvaluation({itemkey: 'subject', edusubject: userStore.edusubject, edustage: userStore.edustage}).then(res => {
|
||||
// TODO 课标研读-还未接入
|
||||
console.log("课标研读-还未接入",res);
|
||||
// this.versionObj = res.rows[0];
|
||||
// // 读取出课标文件的每一行
|
||||
// if (this.versionObj.fileurl.length > 0) {
|
||||
// readFile({cluelink: this.versionObj.fileurl}).then(fileres => {
|
||||
// this.versionObj.bookdata = fileres;
|
||||
// this.activeTeachResOfStandard = item;
|
||||
// })
|
||||
// }
|
||||
})
|
||||
}
|
||||
if (item.worktype==='目标设定'){
|
||||
// TODO 目标设定-还未接入
|
||||
// this.activeTeachResOfStandard = item;
|
||||
}
|
||||
if (item.worktype==='教材研读'){
|
||||
// TODO 教材研读-还未接入
|
||||
// getEvaluation(this.courseObj.evalrootid).then(bookres => {
|
||||
// this.versionObj = bookres.data;
|
||||
// if (this.versionObj.fileurl.length > 0) {
|
||||
// readFile({cluelink: this.versionObj.fileurl}).then(fileres => {
|
||||
// this.versionObj.bookdata = fileres;
|
||||
// this.activeTeachResOfStandard = item;
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
}
|
||||
if (item.worktype==='框架梳理'){
|
||||
flowData.value = {};
|
||||
const { chapterId } = await useGetHomework(props.bookobj.node)
|
||||
// this.entpcourseid = chapterId
|
||||
let queryParams = {
|
||||
entpcourseid: chapterId,
|
||||
ppttype: '教材分析',
|
||||
parentid: item.id,
|
||||
title: '逻辑框架建构',
|
||||
filetype: 'draw'
|
||||
}
|
||||
listEntpcoursefile(queryParams).then(response=>{
|
||||
if (response.rows.length == 0) {
|
||||
return;
|
||||
}
|
||||
flowData.value = JSON.parse(response.rows[0].datacontent)
|
||||
})
|
||||
}
|
||||
if (item.worktype==='学科定位'){
|
||||
// TODO 学科定位-还未接入
|
||||
// this.activeTeachResOfStandard = item;
|
||||
}
|
||||
proxy.$refs.prevReadMsgDialogRef.openDialog(item);
|
||||
};
|
||||
/**
|
||||
* 添加到作业
|
||||
|
@ -831,7 +748,10 @@ const handleClassWorkSave = async () => {
|
|||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 编辑作业内容
|
||||
* @param cform 表单数据
|
||||
*/
|
||||
const editWork = async (cform) =>{
|
||||
// 基础参数
|
||||
cform.id= classWorkForm.id;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<el-row class="c-warp" :gutter="10">
|
||||
<el-col class="left" :span="14">
|
||||
<el-collapse class="c-item" v-model="activeTopic" accordion>
|
||||
<el-collapse class="c-item" v-model="activeTopic">
|
||||
<template v-for="(item, index) in dataList">
|
||||
<el-collapse-item class="collapse-item" :name="index+1" :id="'collapse-'+(index+1)">
|
||||
<template #title>
|
||||
|
|
|
@ -152,11 +152,11 @@ import useUserStore from '@/store/modules/user'
|
|||
import { ElMessage } from 'element-plus'
|
||||
import { getCurrentTime, getAfterMinutes } from '@/utils/date'
|
||||
import { processList } from '@/hooks/useProcessList'
|
||||
import ItemDialogScore from '@/views/classTask/container/item-dialog-score.vue'
|
||||
import ItemDialogScore from '@/views/classTask/container/classTask/item-dialog-score.vue'
|
||||
// zdg: 组件导入
|
||||
import quizStats from '@/views/classTask/container/quizStats.vue'
|
||||
import ClassOverview from '@/views/classTask/container/classOverview.vue'
|
||||
import {sessionStore} from '@/utils/tool'
|
||||
import {sessionStore} from '@/utils/store'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const emit = defineEmits(['cle-click'])
|
||||
|
@ -636,7 +636,7 @@ onMounted(() => {
|
|||
|
||||
// const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
|
||||
const data = sessionStore.get('teachClassWorkItem');
|
||||
// console.log(data,'????????????????????' )
|
||||
console.log(data,'????????????????????' )
|
||||
if(data){
|
||||
openDialog(data)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ import { ref, onMounted, watch } from 'vue'
|
|||
import useUserStore from '@/store/modules/user'
|
||||
import { homeworklist } from '@/api/teaching/classwork'
|
||||
import { getCurrentTime, getTomorrow } from '@/utils/date'
|
||||
import {sessionStore, createWindow} from '@/utils/tool'
|
||||
import {sessionStore} from '@/utils/store'
|
||||
import {createWindow} from '@/utils/tool'
|
||||
import { useToolState } from '@/store/modules/tool'
|
||||
import {throttle,debounce } from '@/utils/comm'
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<template>
|
||||
<PDF :url="pdfUrl" :isWin="true" v-if="pdfUrl" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import PDF from '@/components/PdfJs/index.vue'
|
||||
import { useRoute } from 'vue-router';
|
||||
import { getStaticUrl } from '@/utils/tool'
|
||||
const route = useRoute();
|
||||
|
||||
const pdfUrl = ref('');
|
||||
const loadPdfAnimation = (path) => {
|
||||
console.log('书本地址====',path);
|
||||
const timer = setTimeout(() => {
|
||||
pdfUrl.value = path
|
||||
clearTimeout(timer);
|
||||
},2000)
|
||||
}
|
||||
onMounted(() => {
|
||||
const bookpath = localStorage.getItem('PDF-LOCAL-PATH')
|
||||
// const filepath = import.meta.env.VITE_APP_RES_FILE_PATH + bookpath
|
||||
// const isDev = process.env.NODE_ENV == 'development'
|
||||
// if (isDev)
|
||||
// pdfUrl.value = getStaticUrl(bookpath, 'user', 'selfFile', true) //本地
|
||||
// else
|
||||
// pdfUrl.value = getStaticUrl(bookpath, 'user', 'selfFile', true) //线上
|
||||
// const newpath = getStaticUrl(bookpath, 'user', 'selfFile', true)
|
||||
loadPdfAnimation(bookpath)
|
||||
// pdfUrl.value = filepath
|
||||
// console.log('课件路径',newpath);
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,697 @@
|
|||
<template>
|
||||
<div class="ai-container">
|
||||
<el-steps style="max-width:100% " :active="activeStep" align-center>
|
||||
<el-step title="开始创作" />
|
||||
<el-step title="输入主题" />
|
||||
<el-step title="编辑大纲" />
|
||||
<el-step title="选择模板" />
|
||||
<el-step title="制作PPT" />
|
||||
</el-steps>
|
||||
<div class="card-box">
|
||||
<el-card class="card1" v-if="activeStep == 0">
|
||||
<el-tabs v-model="activeName" type="card" class="demo-tabs">
|
||||
<el-tab-pane label="输入主题与要求" name="first">
|
||||
<div style="padding: 20px;">输入主题</div>
|
||||
<el-input type="textarea" v-model="inputTheme" :rows="3" placeholder="在此输入您的PPT主题..."
|
||||
@keydown.enter.exact.prevent="addMessage" @keydown.enter.shift.exact.prevent="inputTheme += '\n'" />
|
||||
<div style="padding: 20px;">具体生成要求</div>
|
||||
<el-input type="textarea" v-model="inputRequire" :rows="3" placeholder="请输入对生成大纲的具体要求,比如要包含那些内容"
|
||||
@keydown.enter.exact.prevent="addMessage" @keydown.enter.shift.exact.prevent="inputRequire += '\n'" />
|
||||
<div>
|
||||
<el-button style="margin:15px 0" type="primary" @click="addMessage">生成大纲→</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<!-- <el-tab-pane label="上传文件并解析" name="second">
|
||||
<el-upload action="#" :on-change="onFileChange" :before-upload="beforeUpload" :show-file-list="false">
|
||||
<el-button type="primary">点击上传并解析文件</el-button>
|
||||
<text>(支持 doc/docx、pdf、md、txt 格式文档,不超过 20M,不超过 100W 字符)</text>
|
||||
</el-upload>
|
||||
<br/>
|
||||
<div v-if="enableButton">{{docName}}文档已解析完毕</div>
|
||||
<br/>
|
||||
<div style="padding: 20px;">输入主题</div>
|
||||
<textarea style="width:50vw" v-model="inputTheme" :rows="3" placeholder="在此输入您的PPT主题..."
|
||||
@keydown.enter.shift.exact.prevent="inputTheme += '\n'">
|
||||
</textarea>
|
||||
<div style="padding: 20px;">具体生成要求</div>
|
||||
<textarea style="width:50vw; margin:20px" v-model="docRequire" :rows="3"
|
||||
placeholder="请输入对生成大纲的具体要求,比如要包含那些内容" @keydown.enter.shift.exact.prevent="inputRequire += '\n'">
|
||||
</textarea>
|
||||
<div>
|
||||
<el-button style="padding:15px" type="primary" :disabled="!enableButton"
|
||||
@click="chatDoc">生成大纲→</el-button>
|
||||
</div>
|
||||
</el-tab-pane> -->
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
<el-card class="card2" v-if="activeStep == 1">
|
||||
<div class="paragraphs">
|
||||
{{ outputText }}
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card class="card3" v-if="activeStep == 2">
|
||||
<div class="outline">
|
||||
<el-scrollbar height="250px">
|
||||
<el-row :gutter="20" class="outline-row">
|
||||
<el-col :span="8">
|
||||
<div v-for="item in firstArray" :key="item" class="item-with-dash">{{ item }}</div>
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
<div v-for="(item, index) in secondArray" :key="index">
|
||||
<el-input v-model="item.value"></el-input>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
<el-input type="textarea" v-model="fixRequire" :rows="3" placeholder="与AI对话,告诉AI您想如何修改"
|
||||
@keydown.enter.exact.prevent="fixOutline" @keydown.enter.shift.exact.prevent="inputRequire += '\n'" />
|
||||
<br />
|
||||
<el-button v-if="fixRequire.length > 0" style="padding:15px" type="primary"
|
||||
@click="fixOutline()">发送修改</el-button>
|
||||
<el-button style="margin-top:15px" type="primary" @click="combineOutline()">下一步→</el-button>
|
||||
</el-card>
|
||||
<el-card v-if="activeStep == 3">
|
||||
<div style="padding-bottom: 10px">ppt模板选择</div>
|
||||
<div class="themes">
|
||||
<div v-for="item in backGroundList" :key="item.key" :style="{
|
||||
padding: '20px',
|
||||
paddingRight: '30px',
|
||||
paddingLeft: '30px',
|
||||
margin: '10px',
|
||||
backgroundColor: getBackgroundColor(item.key),
|
||||
borderRadius: '10px',
|
||||
borderBlock: '10px solid #e6e6e6'
|
||||
}" @click="chooseBackground(item.key)" @mouseenter="changeCursor('pointer')" @mouseleave="changeCursor('default')">
|
||||
{{ item.name }}
|
||||
<br />
|
||||
<img style="width: 150px; height: auto" :src="item.thumbnail" alt="" />
|
||||
</div>
|
||||
</div>
|
||||
<el-row class="el-row">
|
||||
<el-col :span="6" class="el-col">
|
||||
<div class="grid-content-1">
|
||||
<div>演讲备注</div>
|
||||
<el-switch v-model="outlineData.is_card_note" />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6" class="el-col">
|
||||
<div class="grid-content-2">
|
||||
<div>生成封面</div>
|
||||
<el-switch v-model="outlineData.is_cover_img" />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6" class="el-col">
|
||||
<div class="grid-content-1">
|
||||
<div>自动配图</div>
|
||||
<el-switch v-model="outlineData.is_figure" />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6" class="el-col">
|
||||
<div class="grid-content-2">
|
||||
<div>PPT作者名:</div>
|
||||
<el-input v-model="outlineData.author" style="width: 50%" />
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div>
|
||||
<el-button style="margin-bottom: 5px;" type="primary" @click="outlineCreatePPT()">生成PPT</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card v-if="activeStep == 4">
|
||||
<el-progress :percentage="30" type="circle" v-if="percentage == 30"></el-progress>
|
||||
<el-progress :percentage="70" type="circle" v-if="percentage == 70"></el-progress>
|
||||
<el-progress :percentage="100" type="circle" v-if="percentage == 100"></el-progress>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
getBackGround,
|
||||
createPPT,
|
||||
getProgress,
|
||||
} from "@/utils/ppt-request.js";
|
||||
import { uploadDoc, queryDocStatus } from "@/utils/aichat.js";
|
||||
import CryptoJS from "crypto-js"
|
||||
|
||||
import { getSignature } from "@/utils/index.js";
|
||||
|
||||
let appId = "01ec9aa3";
|
||||
let secret = "M2QxMDAxMjYyYTEzODMwMGRkZTQ4NmUy";
|
||||
let apikey = "39d05b269fa229f431a56c21794a8ea5"
|
||||
let timestamp = Math.floor(Date.now() / 1000);
|
||||
let signature = getSignature(appId, secret, timestamp);
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
|
||||
|
||||
const outputText = ref(""); // 用于展示的大纲数据
|
||||
const stagingData = ref([]); //储存的对话数据,用于多轮对话
|
||||
const stagOutputText = ref(""); // 暂存大纲用于拆分
|
||||
let extractedParts = ref([]) // 初步拆分
|
||||
|
||||
let firstArray = ref([]); //大纲的大纲等级数字部分
|
||||
let secondArray = ref([]); //大纲的文字部分
|
||||
|
||||
|
||||
const backGroundList = ref([]);
|
||||
|
||||
const inputTheme = ref(""); // 输入的主题
|
||||
const inputRequire = ref("") // 输入的需求
|
||||
const activeStep = ref(0); // 上方进度条
|
||||
const fixRequire = ref(""); // 对话修改大纲
|
||||
const combined = ref('') // 修改完毕的大纲数据,准备传入ppt生成模型
|
||||
|
||||
const treeData = ref([]);
|
||||
const status = ref("init");
|
||||
|
||||
const percentage = ref(0);
|
||||
|
||||
const activeName = ref("first");
|
||||
|
||||
const getBackground = () => {
|
||||
treeData.value = [];
|
||||
getBackGround().then((res) => {
|
||||
console.log(res);
|
||||
backGroundList.value = res.data;
|
||||
});
|
||||
};
|
||||
|
||||
const getBackgroundColor = (key) => {
|
||||
return outlineData.value.theme === key ? '#83e2b6' : '#f5f5f5';
|
||||
};
|
||||
|
||||
const outlineData = ref({
|
||||
query: '', // 用户要求(最多8000字)
|
||||
theme: 'auto', // ppt生成主题
|
||||
author: 'AIX平台',
|
||||
is_card_note: false, // 是否自动生成ppt演讲备注
|
||||
is_cover_img: false, // 是否自动生成封面
|
||||
is_figure: false, // 是否自动配图
|
||||
}
|
||||
)
|
||||
|
||||
// 将输入数据或返回数据存入记忆中
|
||||
function updateStagingData(role, newData) {
|
||||
stagingData.value.push({ role: role, content: newData });
|
||||
}
|
||||
//大纲直接生成ppt
|
||||
const outlineCreatePPT = () => {
|
||||
const newOutlineData = { ...outlineData.value, };
|
||||
newOutlineData.query = combined.value;
|
||||
|
||||
createPPT(newOutlineData).then((res) => {
|
||||
console.log(res, "正在生成中");
|
||||
activeStep.value = 4
|
||||
|
||||
const checkProgress = () => {
|
||||
getProgress(res.data.sid).then((response) => {
|
||||
percentage.value = response.data.process;
|
||||
if (response.data && response.data.pptUrl && response.data.pptUrl.length > 4) {
|
||||
console.log('PPT',response)
|
||||
//TODO window.location.href = response.data.pptUrl;
|
||||
ElMessage.success("生成成功");
|
||||
} else {
|
||||
const sleepTime = 2000;
|
||||
let remainingTime = sleepTime;
|
||||
const intervalId = setInterval(() => {
|
||||
remainingTime -= 100;
|
||||
if (remainingTime <= 0) {
|
||||
clearInterval(intervalId);
|
||||
checkProgress();
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
checkProgress();
|
||||
})
|
||||
};
|
||||
|
||||
//初次对话
|
||||
const addMessage = () => {
|
||||
const themeValue = inputTheme.value;
|
||||
const requireValue = inputRequire.value;
|
||||
firstArray.value = []
|
||||
secondArray.value = []
|
||||
extractedParts.value = []
|
||||
stagOutputText.value = ''
|
||||
const combinedString = `请帮我生成一个ppt大纲,主题为:${themeValue}。具体内容要求为:${requireValue}。注意,用三个等级大纲展示,如1. 1.1 1.1.2 2. 2.1这种类型,且按照这种顺序,不要有完全相同数字等级的大纲,不要有目录`
|
||||
updateStagingData("user", combinedString);
|
||||
connectWebSocket(stagingData.value);
|
||||
activeStep.value = 1
|
||||
};
|
||||
|
||||
//修改大纲时和ai对话
|
||||
const fixOutline = () => {
|
||||
outputText.value = '';
|
||||
firstArray.value = [];
|
||||
secondArray.value = [];
|
||||
extractedParts.value = []
|
||||
stagOutputText.value = ''
|
||||
|
||||
const fixValue = fixRequire.value;
|
||||
updateStagingData('user', fixValue)
|
||||
activeStep.value = 1
|
||||
if (enableButton.value) {
|
||||
uploadAndAskMainContent(stagingData.value)
|
||||
} else { connectWebSocket(stagingData.value); }
|
||||
fixRequire.value = ''
|
||||
};
|
||||
|
||||
// 大纲的拆分
|
||||
function extractAndRemove() {
|
||||
let startIndex = -1;
|
||||
let endIndex = -1;
|
||||
|
||||
for (let i = 0; i < stagOutputText.value.length; i++) {
|
||||
const char = stagOutputText.value[i];
|
||||
if (!isNaN(parseInt(char))) {
|
||||
startIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (startIndex !== -1) {
|
||||
for (let j = startIndex; j < stagOutputText.value.length; j++) {
|
||||
const char2 = stagOutputText.value[j];
|
||||
if (char2 === '\n') {
|
||||
endIndex = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let extractedPart = '';
|
||||
if (startIndex !== -1 && endIndex !== -1) {
|
||||
extractedPart = stagOutputText.value.slice(startIndex, endIndex).replace(/\n/g, '');
|
||||
extractedParts.value.push(extractedPart);
|
||||
stagOutputText.value = stagOutputText.value.replace(extractedPart, '');
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 开始大纲拆分
|
||||
function startExtraction() {
|
||||
stagOutputText.value = outputText.value
|
||||
while (extractAndRemove()) { }
|
||||
|
||||
//将拆分好的大纲的大纲等级和文字部分拆分到两个数组中
|
||||
extractedParts.value.forEach(item => {
|
||||
const parts = item.split(' ');
|
||||
if (parts.length === 2) {
|
||||
firstArray.value.push(parts[0]);
|
||||
secondArray.value.push({ value: parts[1] });
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 拼接修改完毕的大纲
|
||||
function combineOutline() {
|
||||
let tempCombined = '';
|
||||
for (let i = 0; i < Math.max(firstArray.value.length, secondArray.value.length); i++) {
|
||||
tempCombined += firstArray.value[i] || '';
|
||||
tempCombined += secondArray.value[i] ? secondArray.value[i].value : '';
|
||||
tempCombined += i < Math.max(firstArray.value.length, secondArray.value.length) - 1 ? ',' : '';
|
||||
}
|
||||
|
||||
combined.value = tempCombined;
|
||||
fixRequire.value = ''
|
||||
activeStep.value = 3
|
||||
}
|
||||
|
||||
|
||||
let ttsWS
|
||||
function connectWebSocket(data) {
|
||||
outputText.value = ""; //清楚展示部分内容
|
||||
status.value = "ttsing";
|
||||
return getWebsocketUrl().then((url) => {
|
||||
ttsWS = new WebSocket(url);
|
||||
ttsWS.onopen = () => {
|
||||
webSocketSend(ttsWS, data);
|
||||
};
|
||||
ttsWS.onmessage = (e) => {
|
||||
result1(e.data);
|
||||
};
|
||||
ttsWS.onerror = (e) => {
|
||||
status.value = "error";
|
||||
console.log("WebSocket error:", e);
|
||||
};
|
||||
ttsWS.onclose = () => {
|
||||
status.value = "init";
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function getWebsocketUrl() {
|
||||
return new Promise((resolve, reject) => {
|
||||
var apiKey = apikey;
|
||||
var apiSecret = secret;
|
||||
var url = "wss://spark-api.xf-yun.com/v4.0/chat";
|
||||
|
||||
var host = "spark-api.xf-yun.com";
|
||||
var date = new Date().toGMTString();
|
||||
var algorithm = "hmac-sha256";
|
||||
var headers = "host date request-line";
|
||||
var signatureOrigin = `host: ${host}\ndate: ${date}\nGET /v4.0/chat HTTP/1.1`;
|
||||
var signatureSha = CryptoJS.HmacSHA256(signatureOrigin, apiSecret);
|
||||
var signature = CryptoJS.enc.Base64.stringify(signatureSha);
|
||||
|
||||
var authorizationOrigin = `api_key="${apiKey}", algorithm="${algorithm}", headers="${headers}", signature="${signature}"`;
|
||||
var authorization = CryptoJS.enc.Base64.stringify(
|
||||
CryptoJS.enc.Utf8.parse(authorizationOrigin)
|
||||
);
|
||||
|
||||
url = `${url}?authorization=${authorization}&date=${date}&host=${host}`;
|
||||
console.log(url);
|
||||
resolve(url);
|
||||
});
|
||||
}
|
||||
function webSocketSend(ws, data) {
|
||||
const params = {
|
||||
header: {
|
||||
app_id: appId,
|
||||
},
|
||||
parameter: {
|
||||
chat: {
|
||||
domain: "4.0Ultra",
|
||||
temperature: 0.5,
|
||||
max_tokens: 1024,
|
||||
},
|
||||
},
|
||||
payload: {
|
||||
message: {
|
||||
text: data,
|
||||
},
|
||||
},
|
||||
};
|
||||
ws.send(JSON.stringify(params));
|
||||
}
|
||||
|
||||
function result1(resultData) {
|
||||
let jsonData = JSON.parse(resultData);
|
||||
outputText.value += jsonData.payload.choices.text[0].content;
|
||||
const div = document.querySelector('.paragraphs');
|
||||
if (div) {
|
||||
div.scrollTop = div.scrollHeight;
|
||||
}
|
||||
if (jsonData.payload && jsonData.payload.usage) {
|
||||
startExtraction() // 返回完毕后开始拆分大纲
|
||||
console.log(firstArray.value, secondArray.value)
|
||||
activeStep.value = 2
|
||||
updateStagingData("assistant", outputText.value) //返回数据存入记忆池
|
||||
}
|
||||
if (jsonData.header.code !== 0) {
|
||||
alert(`提问失败: ${jsonData.header.code}:${jsonData.header.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const selectedFile = ref(null);
|
||||
|
||||
const maxSize = 1024 * 1024 * 20;
|
||||
const allowedTypes = [
|
||||
"application/pdf",
|
||||
"application/msword",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
"text/markdown",
|
||||
"text/plain",
|
||||
];
|
||||
const fileType = "wiki";
|
||||
const parseType = "AUTO";
|
||||
const upfileId = ref('');
|
||||
const docName = ref('')
|
||||
|
||||
const docTheme = ref('') // 文档生成ppt的主题
|
||||
const docRequire = ref('') // 文档生成要求
|
||||
|
||||
const onFileChange = (file) => {
|
||||
console.log(file);
|
||||
if (!allowedTypes.includes(file.raw.type)) {
|
||||
console.error("不支持的文件类型");
|
||||
return;
|
||||
}
|
||||
if (file.size > maxSize) {
|
||||
console.error("文件过大");
|
||||
return;
|
||||
}
|
||||
docName.value = file.raw.name
|
||||
selectedFile.value = file.raw;
|
||||
uploadFile();
|
||||
};
|
||||
const beforeUpload = (file) => {
|
||||
return false;
|
||||
};
|
||||
const uploadFile = async () => {
|
||||
if (!selectedFile.value) {
|
||||
console.error("请先选择文件");
|
||||
return;
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("file", selectedFile.value);
|
||||
formData.append("fileType", fileType);
|
||||
formData.append("parseType", parseType);
|
||||
|
||||
for (const pair of formData.entries()) {
|
||||
console.log(pair[0], pair[1]);
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await uploadDoc(formData);
|
||||
const upfileData = new FormData();
|
||||
upfileId.value = response.data.data.fileId;
|
||||
upfileData.append("fileIds", upfileId.value);
|
||||
askdoc(upfileData);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
//文档状态查询
|
||||
const askdoc = async (data) => {
|
||||
const response = await queryDocStatus(data);
|
||||
if (response.data.data && response.data.data.length > 0) {
|
||||
let foundVectored = false;
|
||||
for (const item of response.data.data) {
|
||||
if (item.fileStatus === 'vectored') {
|
||||
foundVectored = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundVectored) {
|
||||
enableButton.value = true
|
||||
} else {
|
||||
const sleepTime = 2000;
|
||||
let remainingTime = sleepTime;
|
||||
const intervalId = setInterval(() => {
|
||||
remainingTime -= 100;
|
||||
if (remainingTime <= 0) {
|
||||
clearInterval(intervalId);
|
||||
askdoc(data);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//文档对话
|
||||
function chatDoc() {
|
||||
const docthemeValue = docTheme.value;
|
||||
const docrequireValue = docRequire.value;
|
||||
firstArray.value = []
|
||||
secondArray.value = []
|
||||
extractedParts.value = []
|
||||
stagOutputText.value = ''
|
||||
const combinedString = `请帮我生成一个ppt大纲,主题为:${docthemeValue}。具体内容要求为:${docrequireValue}。注意,用三个等级大纲展示,如1. 1.1 1.1.2 2. 2.1这种类型,且按照这种顺序,不要有完全相同数字等级的大纲,不要有目录`
|
||||
updateStagingData("user", combinedString);
|
||||
activeStep.value = 1
|
||||
uploadAndAskMainContent(stagingData.value);
|
||||
}
|
||||
|
||||
function chatByDoc(fileId, data) {
|
||||
const wsUrl = `wss://chatdoc.xfyun.cn/openapi/chat?fileId=${fileId}&appId=${appId}×tamp=${timestamp}&signature=${signature}`;
|
||||
|
||||
const ws = new WebSocket(wsUrl);
|
||||
|
||||
ws.onopen = () => {
|
||||
const messageBody = {
|
||||
fileIds: [fileId],
|
||||
messages: data,
|
||||
chatExtends: {
|
||||
wikiPromptTpl:
|
||||
"请将以下内容作为已知信息:\n<wikicontent>\n请根据以上内容回答用户的问题。\n问题:<wikiquestion>\n回答:",
|
||||
wikiFilterScore: 0.82,
|
||||
temperature: 0.5,
|
||||
sparkWhenWithoutEmbedding: false,
|
||||
},
|
||||
};
|
||||
|
||||
ws.send(JSON.stringify(messageBody));
|
||||
};
|
||||
|
||||
ws.onmessage = (event) => {
|
||||
const response = JSON.parse(event.data);
|
||||
result2(response)
|
||||
console.log("WebSocket 消息:", response);
|
||||
};
|
||||
|
||||
ws.onerror = (error) => {
|
||||
console.error("WebSocket 错误:", error);
|
||||
};
|
||||
}
|
||||
|
||||
function result2(resultData) {
|
||||
const div = document.querySelector('.paragraphs');
|
||||
if (div) {
|
||||
div.scrollTop = div.scrollHeight;
|
||||
}
|
||||
if (resultData.status == 1) {
|
||||
outputText.value += resultData.content
|
||||
}
|
||||
if (resultData.status == 2) {
|
||||
startExtraction() // 返回完毕后开始拆分大纲
|
||||
activeStep.value = 2
|
||||
updateStagingData("assistant", outputText.value) //返回数据存入记忆池
|
||||
}
|
||||
if (resultData.code !== 0) {
|
||||
alert(`提问失败: ${jsonData.header.code}:${jsonData.header.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//文档上传问题查询
|
||||
const uploadAndAskMainContent = async (data) => {
|
||||
try {
|
||||
// const formData = new FormData();
|
||||
// formData.append(
|
||||
// "url",
|
||||
// "https://bjcdn.openstorage.cn/xinghuo/chatdocs/2024-09-13/dad35a4f-e7c1-4efc-b6df-cae763cb984b/39052b09-d154-419f-9832-20884adeb2f41726226211177.pdf"
|
||||
// );
|
||||
// formData.append("fileName", "test.pdf");
|
||||
// formData.append("appId", "2ff2cc26");
|
||||
// formData.append("secret", "YTMyZWFiOGVlYTc5ZGM5NGIwOTU3NWMx");
|
||||
// // formData.append("fileType", "wiki");
|
||||
// // formData.append("parseType", "AUTO");
|
||||
|
||||
// const uploadResp = await uploadDoc(formData);
|
||||
// const fileId = uploadResp.data.data.fileId;
|
||||
const fileId = upfileId.value;
|
||||
chatByDoc(fileId, data);
|
||||
|
||||
} catch (error) {
|
||||
console.error("上传或提问过程中发生错误:", error);
|
||||
}
|
||||
};
|
||||
const enableButton = ref(false);
|
||||
|
||||
const chooseBackground = (data) => {
|
||||
outlineData.value.theme = data
|
||||
}
|
||||
|
||||
const changeCursor = (cursorStyle) => {
|
||||
document.documentElement.style.cursor = cursorStyle;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
connectWebSocket("");
|
||||
getBackground();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ai-container {
|
||||
width: 100%;
|
||||
background-color: #f5f7f6;
|
||||
padding: 20px
|
||||
}
|
||||
|
||||
.card-box {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.card1 {
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.paragraphs {
|
||||
white-space: pre-wrap;
|
||||
text-align: left;
|
||||
max-height: 60vh;
|
||||
overflow-y: auto;
|
||||
border: 1px solid #409EFF;
|
||||
padding: 10px;
|
||||
margin: 5px
|
||||
}
|
||||
|
||||
.themes {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
height: 250px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.outline {
|
||||
white-space: pre-wrap;
|
||||
text-align: left;
|
||||
|
||||
border: 1px solid #409EFF;
|
||||
padding: 10px;
|
||||
outline-style: none;
|
||||
/* margin: 5px */
|
||||
}
|
||||
|
||||
.outline-row {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.outline-row>.el-col {
|
||||
display: flex;
|
||||
flex-direction: column
|
||||
}
|
||||
|
||||
.outline-row>.el-col>div,
|
||||
.outline-row>.el-col>div>.el-input {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.item-with-dash {
|
||||
margin-left: 100px
|
||||
}
|
||||
|
||||
.item-with-dash::after {
|
||||
content: "";
|
||||
border-bottom: 1px dashed #000;
|
||||
flex-grow: 1;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.grid-content-1 {
|
||||
border-radius: 4px;
|
||||
background-color: #c2dbf3;
|
||||
}
|
||||
|
||||
.grid-content-2 {
|
||||
border-radius: 4px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.el-row {
|
||||
padding: 20px
|
||||
}
|
||||
:deep(.el-card__body){
|
||||
padding: 10px 15px;
|
||||
}
|
||||
</style>
|
|
@ -24,7 +24,8 @@
|
|||
<el-col :span="24">
|
||||
<c-form v-bind="classForm">
|
||||
<template #item_classid="{prop, form}">
|
||||
<el-select v-model="form[prop]" placeholder="请选择班级">
|
||||
<span v-if="dt.ctCourse">{{ dt.ctCourse?.caption }}</span>
|
||||
<el-select v-else v-model="form[prop]" placeholder="请选择班级">
|
||||
<el-option v-for="item in listData.classList" :value="item.id"
|
||||
:label="`${item.caption} (${item.classstudentcount}人)`" />
|
||||
</el-select>
|
||||
|
@ -118,7 +119,9 @@ const dt = reactive({ // 其他数据
|
|||
isHistory: false, // 是否显示-历史记录
|
||||
loading: false, // 加载-loading
|
||||
loadingDel: false, // 删除-loading
|
||||
atClass: {}, // 当前班级
|
||||
atCourse: {}, // 当前课程
|
||||
ctCourse: null, // 继续课程
|
||||
})
|
||||
let chat = null // im-chat 对象
|
||||
|
||||
|
@ -128,9 +131,10 @@ onMounted(() => {
|
|||
})
|
||||
/**
|
||||
* @description 暴露方法-打开对话框
|
||||
* @param row 课件对象
|
||||
* @param id 课件id
|
||||
* @param classObj 课程对象-用于继续上课
|
||||
*/
|
||||
const open = async (id) => {
|
||||
const open = async (id, classObj) => {
|
||||
visible.value = true
|
||||
if (id) {
|
||||
// 重置数据
|
||||
|
@ -139,6 +143,11 @@ const open = async (id) => {
|
|||
await getAptInfo(id)
|
||||
// 获取班级列表
|
||||
getClassList()
|
||||
// 继续上课
|
||||
if (!!classObj) {
|
||||
dt.ctCourse = classObj
|
||||
teacherForm.form.classcourseid = classObj.id
|
||||
}
|
||||
// 初始化im-chat
|
||||
nextTick(async() => {
|
||||
chat = await imChatRef.value?.initImChat()
|
||||
|
@ -148,8 +157,9 @@ const open = async (id) => {
|
|||
// 关闭弹窗
|
||||
const handleClose = async () => {
|
||||
reset() // 重置数据
|
||||
await chat?.logout()
|
||||
chat = null
|
||||
// await chat?.logout()
|
||||
// chat = null
|
||||
dt.ctCourse = null
|
||||
emit('close')
|
||||
}
|
||||
// 初始化-数据
|
||||
|
@ -177,8 +187,10 @@ const reset = () => {
|
|||
teacherForm.form = { classcourseid: 0 }
|
||||
dt.isCreate = false
|
||||
dt.isHistory = false
|
||||
dt.atClass = {}
|
||||
dt.atCourse = {}
|
||||
}
|
||||
|
||||
// 获取课件APT
|
||||
const getAptInfo = async (id) => {
|
||||
const res = await Http_Entpcoursefile.getEntpcoursefile(id)
|
||||
|
@ -338,9 +350,9 @@ const chatChange = (type, data, ...args) => {
|
|||
// 监听-班级id
|
||||
watch(() => classForm.form.classid, (val)=> {
|
||||
// 获取选中课程
|
||||
dt.atCourse = listData.classList.find(o => o.id === val) || {}
|
||||
dt.atClass = listData.classList.find(o => o.id === val) || {}
|
||||
// 获取选中课程-学生列表
|
||||
listData.activeStudentList = dt.atCourse?.classstudentlist || []
|
||||
// listData.activeStudentList = dt.atClass?.classstudentlist || []
|
||||
// 清空课程列表
|
||||
listData.classcourseList = []
|
||||
// 如果当前显示历史, 就从新获取
|
||||
|
|
|
@ -102,7 +102,7 @@ import { deleteSmarttalk, updateSmarttalk, getPrepareById } from '@/api/file'
|
|||
import useUserStore from '@/store/modules/user'
|
||||
import outLink from '@/utils/linkConfig'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { listClasscourseNew } from '@/api/teaching/classcourse'
|
||||
import { listClasscourseNew, updateClasscourse } from '@/api/teaching/classcourse'
|
||||
import { endClass, getSelfReserv } from '@/api/classManage'
|
||||
import { listEntpcourse } from '@/api/teaching/classwork'
|
||||
import { createWindow } from '@/utils/tool'
|
||||
|
@ -137,7 +137,7 @@ export default {
|
|||
}
|
||||
},
|
||||
expose: ['openFileWin'],
|
||||
emits: { 'on-start-class': null, 'on-delete': null, 'on-set': null, 'on-delhomework': null,'on-filearg': null },
|
||||
emits: { 'on-start-class': null, 'on-delete': null, 'on-set': null, 'on-delhomework': null,'on-filearg': null, 'change': null },
|
||||
data() {
|
||||
return {
|
||||
listenList: [],
|
||||
|
@ -148,27 +148,24 @@ export default {
|
|||
this.userInfo = useUserStore().user
|
||||
},
|
||||
methods: {
|
||||
getOpenCourse() {
|
||||
return Promise.all([listClasscourseNew({teacherid: this.userInfo.userId,status:"open",evalid: this.curNode.id,pageSize:1000}), getSelfReserv({ex2:this.curNode.id})]).then(([res1,res2])=>{
|
||||
let list2 = res1.rows || []
|
||||
let list = res2.data || []
|
||||
let one = list.find(item1 => {
|
||||
if (item1.status === "上课中") {
|
||||
return true
|
||||
}
|
||||
// 获取当前上课的课程列表
|
||||
getOpenCourse(isApt) {
|
||||
const curNodeId = this.curNode.id
|
||||
if (isApt) { // APT课程
|
||||
const params = {teacherid: this.userInfo.userId,status:"open",evalid: curNodeId,pageSize:1000}
|
||||
return listClasscourseNew(params).then(res => {
|
||||
return (res.rows || [])
|
||||
})
|
||||
if (one) {
|
||||
return one
|
||||
}
|
||||
if (list2.length>0) {
|
||||
one = list2[0]
|
||||
}
|
||||
return one
|
||||
} else { // 普通课程PPT
|
||||
return getSelfReserv({ex2: curNodeId}).then(res => {
|
||||
return (res.data || []).filter(o => o.status === "上课中")
|
||||
})
|
||||
}
|
||||
},
|
||||
clickStartClass(item) {
|
||||
this.getOpenCourse().then(res=>{
|
||||
if(!res){
|
||||
const isApt = item.fileFlag === 'apt'
|
||||
this.getOpenCourse(isApt).then(res => {
|
||||
if(!res || res.length === 0){
|
||||
this.$emit('on-start-class', item)
|
||||
}else{
|
||||
ElMessageBox.alert('<strong>上次课程尚未结束,是否继续上课?</strong>', '', {
|
||||
|
@ -185,51 +182,80 @@ export default {
|
|||
confirmButtonClass: "el-button--danger",
|
||||
center: true,
|
||||
beforeClose: (action, instance, done) => {
|
||||
const obj = res[0]
|
||||
// console.log(action, obj, item)
|
||||
if (action === 'confirm'){
|
||||
// 下课
|
||||
if (res.bookImg) {
|
||||
//PPT
|
||||
endClass(res.id).then((res1) => {
|
||||
if (res1.data === true) {
|
||||
ElMessage({
|
||||
message: '下课成功',
|
||||
type: 'success'
|
||||
})
|
||||
res.status = '已结束'
|
||||
done()
|
||||
}
|
||||
})
|
||||
}else {
|
||||
//APT
|
||||
}
|
||||
this.$emit('change', 'close', obj, { type: 1, instance, done })
|
||||
// if (obj.bookImg) {
|
||||
// // //PPT
|
||||
// // endClass(obj.id).then((res1) => {
|
||||
// // if (res1.data === true) {
|
||||
// // ElMessage({
|
||||
// // message: '下课成功',
|
||||
// // type: 'success'
|
||||
// // })
|
||||
// // obj.status = '已结束'
|
||||
// // done()
|
||||
// // }
|
||||
// // })
|
||||
// }else {
|
||||
// //APT 结束课程-父组件触发
|
||||
// // this.$emit('change', 'close', obj, { type: 1, instance, done })
|
||||
// // this.closeCourse(obj, instance, done)
|
||||
// }
|
||||
}
|
||||
if (action === 'cancel'){
|
||||
// 继续上课
|
||||
if (res.bookImg) {
|
||||
if (obj.bookImg) {
|
||||
console.log('PPT')
|
||||
//PPT
|
||||
listEntpcourse({
|
||||
evalid: res.ex2,
|
||||
evalid: obj.ex2,
|
||||
edituserid: useUserStore().user.userId,
|
||||
pageSize: 500
|
||||
}).then(async res1=>{
|
||||
if (res1.rows[0].id) {
|
||||
createWindow('tool-sphere', { url: '/tool/sphere?entpcourseid=' + res1.rows[0].id + "&reservId=" + res.id })
|
||||
createWindow('tool-sphere', { url: '/tool/sphere?entpcourseid=' + res1.rows[0].id + "&reservId=" + obj.id })
|
||||
done()
|
||||
}
|
||||
})
|
||||
}else {
|
||||
//APT
|
||||
this.$emit('on-start-class', item, obj)
|
||||
done()
|
||||
}
|
||||
}
|
||||
if (action === 'close') {
|
||||
done()
|
||||
}
|
||||
},
|
||||
})
|
||||
}).catch(() => {})
|
||||
}
|
||||
})
|
||||
// this.$emit('on-start-class', item)
|
||||
},
|
||||
// 结束课程(下课)
|
||||
// async closeCourse(row, instance, done) {
|
||||
// instance.confirmButtonLoading = true
|
||||
// instance.confirmButtonText = '下课中...'
|
||||
// // 发送-下课消息
|
||||
// if (!!row.timgroupid) {
|
||||
// const msg = { msgKey: 'closed', actor: 'teacher', classcourseid: row.id }
|
||||
// Chat.sendMsg(row.timgroupid, msg)
|
||||
// }
|
||||
// // 接口-修改状态
|
||||
// const params = { id: row.id, status: 'closed', timgroupid: '' }
|
||||
// await updateClasscourse(params)
|
||||
// // 解散群
|
||||
// setTimeout(async() => {
|
||||
// if (!!row.timgroupid) await Chat.dismissGroup(row.timgroupid)
|
||||
// instance.confirmButtonLoading = false
|
||||
// instance.confirmButtonText = '下课'
|
||||
// done()
|
||||
// ElMessage({ type: 'success', message: `下课成功!` })
|
||||
// }, 1000)
|
||||
// },
|
||||
editTalk(item) {
|
||||
ElMessageBox.prompt('请输入新的标签', '添加标签', {
|
||||
confirmButtonText: '确认',
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-dialog class="ppt-dialog" v-model="model" :show-close="false" width="900" destroy-on-close :top="'3vh'">
|
||||
<template #header="{ close, titleId, titleClass }">
|
||||
<div class="dialog-header">
|
||||
<h4 :id="titleId" :class="titleClass">生成PPT(试验版)</h4>
|
||||
<i class="iconfont icon-guanbi" @click="close"></i>
|
||||
</div>
|
||||
</template>
|
||||
<AiPpt/>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import AiPpt from './ai-ppt.vue';
|
||||
const model = defineModel()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.ppt-dialog){
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
.dialog-header{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.icon-guanbi {
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -13,6 +13,10 @@
|
|||
<div class="create-btn-title"><el-icon><Plus /></el-icon><label>创建PPT</label></div>
|
||||
<div class="create-btn-info">传统课件</div>
|
||||
</div>
|
||||
<div class="center-create-btn" style="background-color: #909399" @click="pptDialog = true">
|
||||
<div class="create-btn-title"><el-icon><Plus /></el-icon><label>生成PPT</label></div>
|
||||
<div class="create-btn-info">试验版</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="prepare-center-body">
|
||||
<kj-list-item
|
||||
|
@ -24,12 +28,14 @@
|
|||
:curNode="currentNode"
|
||||
@on-delete="deleteTalk"
|
||||
@on-start-class="startClass"
|
||||
@change="changeClass"
|
||||
>
|
||||
</kj-list-item>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="教学实录" name="教学实录" class="prepare-center-jxsl">
|
||||
<class-reserv v-if="activeAptTab==='教学实录'" :curNode="currentNode"></class-reserv>
|
||||
<class-reserv v-if="activeAptTab==='教学实录'" :curNode="currentNode"
|
||||
@change="changeClass"></class-reserv>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
@ -131,6 +137,7 @@
|
|||
></reserv>
|
||||
<!-- 上课配置 -->
|
||||
<class-start ref="calssRef" @close="closeChange"/>
|
||||
<PptDialog v-model="pptDialog"/>
|
||||
</template>
|
||||
<script setup>
|
||||
import { Check,Plus } from '@element-plus/icons-vue'
|
||||
|
@ -148,6 +155,7 @@ import { useToolState } from '@/store/modules/tool'
|
|||
import MoveFile from '@/components/move-file/index.vue'
|
||||
import FileListItem from '@/views/prepare/container/file-list-item.vue'
|
||||
import KjListItem from '@/views/prepare/container/kj-list-item.vue'
|
||||
import PptDialog from './container/ppt-dialog.vue'
|
||||
import { getSmarttalkPage, moveSmarttalk, creatAPT } from '@/api/file'
|
||||
import { toTimeText } from '@/utils/date'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
@ -155,16 +163,21 @@ import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile'
|
|||
import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue'
|
||||
import SetHomework from '@/components/set-homework/index.vue'
|
||||
import outLink from '@/utils/linkConfig'
|
||||
import { createWindow, sessionStore } from '@/utils/tool'
|
||||
import { createWindow, sessionStore, getAppInstallUrl, ipcMsgSend } from '@/utils/tool'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { delClasswork, listEntpcourse } from '@/api/teaching/classwork'
|
||||
import { getClassInfo, getSelfReserv } from '@/api/classManage'
|
||||
import { updateClasscourse } from '@/api/teaching/classcourse'
|
||||
import { getClassInfo, getSelfReserv, endClass } from '@/api/classManage'
|
||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { addEntpcoursefileReturnId } from '@/api/education/entpcoursefile'
|
||||
import ClassReserv from '@/views/classManage/classReserv.vue'
|
||||
import classStart from './container/class-start.vue' // 预备上课
|
||||
const toolStore = useToolState()
|
||||
import MsgEnum from '@/plugins/imChat/msgEnum' // im 消息枚举
|
||||
import Chat from '@/utils/chat' // im 登录初始化
|
||||
import msgEnum from '@/plugins/imChat/msgEnum'
|
||||
if (!Chat.imChat) Chat.init()
|
||||
|
||||
const toolStore = useToolState()
|
||||
const fs = require('fs')
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
|
||||
|
@ -219,6 +232,7 @@ export default {
|
|||
isOpenHomework: false,
|
||||
// 当前上课课程
|
||||
activeClass: null,
|
||||
pptDialog: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -272,7 +286,8 @@ export default {
|
|||
// }
|
||||
// },
|
||||
methods: {
|
||||
startClass(item) {
|
||||
// 开始上课
|
||||
startClass(item, classObj) {
|
||||
// 关闭状态,打开上课相关功能(已打开,忽略)
|
||||
const id = sessionStore.has('activeClass.id') ? sessionStore.get('activeClass.id') : null
|
||||
if (id && id == item.id) return ElMessage.warning('当前正在上课,请勿重复操作')
|
||||
|
@ -283,11 +298,68 @@ export default {
|
|||
this.openReserv()
|
||||
}
|
||||
if(item.fileFlag === 'apt') {
|
||||
this.$refs.calssRef.open(item.fileId)
|
||||
this.$refs.calssRef.open(item.fileId, classObj)
|
||||
}
|
||||
},
|
||||
// 继续上课-apt
|
||||
async changeClass(type, row, other) {
|
||||
switch(type) {
|
||||
case 'continue': { // 继续上课
|
||||
const aptFileId = row.entpcoursefileid
|
||||
this.$refs.calssRef.open(aptFileId, row)
|
||||
break
|
||||
}
|
||||
case 'close': { // 关闭上课
|
||||
const head = MsgEnum.HEADS.MSG_closed // closed
|
||||
const msgT = msgEnum.TYPES.TEACHER // teacher
|
||||
const isApt = !row.bookImg // bookImg ppt 否则Apt
|
||||
row.ex3 == 'undefined' && (row.ex3 = null)
|
||||
const timgroupid = isApt ? row.timgroupid : row.ex3 // ex3 ppt 否则Apt
|
||||
if (other.type == 1) { // 弹窗-下课
|
||||
other.instance.confirmButtonLoading = true
|
||||
other.instance.confirmButtonText = '下课中...'
|
||||
} else { // 列表-下课
|
||||
other.loading.value = true
|
||||
}
|
||||
// 发送-下课消息
|
||||
if (!!timgroupid) {
|
||||
const msg = { msgKey: head, actor: msgT, classcourseid: row.id }
|
||||
Chat.sendMsg(timgroupid, msg)
|
||||
}
|
||||
if (isApt) { // Apt
|
||||
// 接口-修改状态
|
||||
await updateClasscourse({ id: row.id, status: head, timgroupid: '' })
|
||||
} else { // PPT
|
||||
const toolStore = useToolState()
|
||||
// 窗口已打开,直接关闭
|
||||
if (toolStore.isToolWin) {
|
||||
toolStore.resetDef() // 重置状态
|
||||
ipcMsgSend('tool-sphere:close') // 关闭窗口
|
||||
}
|
||||
// 接口-修改状态
|
||||
await endClass(row.id)
|
||||
}
|
||||
// 解散群
|
||||
setTimeout(async() => {
|
||||
if (!!timgroupid) await Chat.dismissGroup(timgroupid)
|
||||
if (other.type == 1) { // 弹窗-下课
|
||||
other.instance.confirmButtonLoading = false
|
||||
other.instance.confirmButtonText = '下课'
|
||||
other.done()
|
||||
} else {
|
||||
other.loading.value = false
|
||||
row.status = isApt ? head : '已结束'
|
||||
}
|
||||
ElMessage({ type: 'success', message: `下课成功!` })
|
||||
}, 1000)
|
||||
break
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
},
|
||||
closeChange() { // 上课弹窗被关闭-触发
|
||||
console.log('关闭上课弹窗')
|
||||
// console.log('关闭上课弹窗')
|
||||
// this.activeClass = null
|
||||
sessionStore.delete('activeClass')
|
||||
},
|
||||
|
@ -298,8 +370,8 @@ export default {
|
|||
this.$refs['kjItemRef'+this.activeClass.id][0].openFileWin(this.activeClass);
|
||||
})
|
||||
},
|
||||
getBookPathFromServer() {
|
||||
let fileName = this.curBookPath
|
||||
getBookPathFromServer(path) {
|
||||
let fileName = path ? path : this.curBookPath
|
||||
if (!fileName) return
|
||||
fileName = fileName.replace('.txt', '.pdf')
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@ -549,6 +621,9 @@ export default {
|
|||
if (this.currentNode.id === data.node.id) return
|
||||
this.curBookImg = data.textBook.curBookImg
|
||||
this.curBookPath = data.textBook.curBookPath
|
||||
const path = await this.getBookPathFromServer(data.textBook.curBookPath)
|
||||
const localpath = getAppInstallUrl('pdfjs-dist/web/viewer.html', 'user', '\\out\\renderer', true) + "?file="
|
||||
localStorage.setItem('PDF-LOCAL-PATH',localpath + encodeURIComponent(import.meta.env.VITE_APP_RES_FILE_PATH + path))
|
||||
this.checkFileList = []
|
||||
this.currentWorkList = []
|
||||
let cata = parseCataByNode(data.node)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<el-image class="imges" :src="bookInfo ? bookInfo.avartar : ''" />
|
||||
</div>
|
||||
<div class="stand-head-right">
|
||||
<div class="stand-head-right-tit">{{booktitle}}</div>
|
||||
<div class="stand-head-right-tit">{{bookInfo ? bookInfo.bookName: ''}}</div>
|
||||
<i class="iconfont icon-yidongdaozu stand-head-right-icon" @click="dialogVisible = true"></i>
|
||||
<div class="stand-head-right-row">
|
||||
<div class="stand-head-right-row-time">更新2024.9.10</div>
|
||||
|
@ -72,7 +72,7 @@
|
|||
<div class="booklist">
|
||||
<div :class="{'item': true,'active': booksel === idx}" v-for="item,idx in bookList" :key="idx" @click="bookChange(item,idx)">
|
||||
<el-image class="bookimg" :src="item.avartar" />
|
||||
<div class="bookname">{{item.fileurl.replace('.txt', '')}}</div>
|
||||
<div class="bookname">{{item.bookName}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
@ -84,11 +84,13 @@ import PDF from '@/components/PdfJs/index.vue'
|
|||
import { useRoute } from 'vue-router';
|
||||
import useResoureStore from '../resource/store'
|
||||
import { listEvaluationclue } from '@/api/teaching/classwork'
|
||||
import { uploadServer, getJSONFile } from '@/utils/common'
|
||||
// import { uploadServer, getJSONFile } from '@/utils/common'
|
||||
import { ElNotification } from 'element-plus'
|
||||
import ChooseTextbook from "@/components/choose-textbook/index.vue";
|
||||
import { listEvaluation } from '@/api/classManage/index'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { useGetSubject } from '@/hooks/useGetSubject'
|
||||
const userStore = useUserStore()
|
||||
const sourceStore = useResoureStore()
|
||||
// import { getStaticUrl } from '@/utils/tool'
|
||||
|
@ -105,7 +107,6 @@ const headref = ref(null);
|
|||
const searchref = ref(null);
|
||||
const listHeight = ref(0);
|
||||
const dialogVisible = ref(false);
|
||||
const booktitle = ref('');
|
||||
const bookInfo = ref(null);
|
||||
const booksel = ref(0);
|
||||
const bookList = ref([])
|
||||
|
@ -248,31 +249,45 @@ const getAllSubject = async () => {
|
|||
const dataList = [];
|
||||
rows && rows.map((item,idx) => {
|
||||
if(item.fileurl !== ''){
|
||||
dataList.push({...item,avartar: import.meta.env.VITE_APP_BUILD_BASE_PATH + item.avartar})
|
||||
dataList.push({...item,avartar: import.meta.env.VITE_APP_BUILD_BASE_PATH + item.avartar,bookName: item.fileurl.replace('.txt','')})
|
||||
}
|
||||
})
|
||||
bookList.value = dataList
|
||||
bookInfo.value = {...dataList[0],avartar: dataList[0].avartar}
|
||||
booktitle.value = dataList[0].fileurl.replace('.txt','')
|
||||
const filePath = import.meta.env.VITE_APP_RES_FILE_PATH + dataList[0].fileurl.replace('.txt','.pdf')
|
||||
const session = sessionStore.get('subject.curNode')
|
||||
console.log('session',session);
|
||||
let filePath = import.meta.env.VITE_APP_RES_FILE_PATH;
|
||||
if(session.rootid){
|
||||
const idx = dataList.findIndex(item => item.id === session.rootid)
|
||||
if(idx > -1){
|
||||
bookInfo.value = {...dataList[idx]}
|
||||
filePath += dataList[idx].fileurl.replace('.txt','.pdf')
|
||||
}else{
|
||||
bookInfo.value = {...dataList[0]}
|
||||
filePath += dataList[0].fileurl.replace('.txt','.pdf')
|
||||
}
|
||||
await loadPdfAnimation(filePath)
|
||||
}else{
|
||||
bookInfo.value = {...dataList[0]}
|
||||
filePath += dataList[0].fileurl.replace('.txt','.pdf')
|
||||
}
|
||||
}
|
||||
const bookChange = async (item, idx) => {
|
||||
booksel.value = idx
|
||||
bookInfo.value = {...item}
|
||||
booktitle.value = item.fileurl.replace('.txt','')
|
||||
pdfUrl.value = '';
|
||||
const filepath = import.meta.env.VITE_APP_RES_FILE_PATH + item.fileurl.replace('.txt','.pdf')
|
||||
await loadPdfAnimation(filepath)
|
||||
dialogVisible.value = false
|
||||
}
|
||||
const loadPdfAnimation = (path) => {
|
||||
console.log('书本地址====',path);
|
||||
const timer = setTimeout(() => {
|
||||
pdfUrl.value = path
|
||||
clearTimeout(timer);
|
||||
},2000)
|
||||
}
|
||||
onMounted(async () => {
|
||||
await useGetSubject();
|
||||
await getAllSubject();
|
||||
if(cardref.value && headref.value){
|
||||
const cardH = cardref.value.offsetHeight;
|
||||
|
@ -423,13 +438,18 @@ onMounted(async () => {
|
|||
z-index: 2;
|
||||
&-tit{
|
||||
width: 100%;
|
||||
height: 44px;
|
||||
line-height: 22px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #3b3b3b;
|
||||
text-align: left;
|
||||
padding-right: 30px;
|
||||
}
|
||||
&-icon{
|
||||
position: absolute;
|
||||
|
@ -443,7 +463,6 @@ onMounted(async () => {
|
|||
height: 32px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 12px;
|
||||
&-time{
|
||||
font-size: var(--el-font-size-extra-small);
|
||||
color: var(--el-color-info-rgb);
|
||||
|
@ -537,9 +556,10 @@ onMounted(async () => {
|
|||
width: 130px;
|
||||
height: 180px;
|
||||
}
|
||||
.name{
|
||||
.bookname{
|
||||
height: 60px;
|
||||
line-height: 20px;
|
||||
font-size: 14px;
|
||||
color: #3b3b3b;
|
||||
}
|
||||
}
|
||||
.item:hover{
|
||||
|
|
|
@ -38,7 +38,7 @@ import { computed, defineProps, ref, reactive, watchEffect, onMounted } from 'vu
|
|||
import homework from './homework.vue';
|
||||
|
||||
// 功能说明:侧边-工具栏
|
||||
const colors = ['#00f389', '#ff7f00', '#ffff00', '#409EFF', '#00baff', '#13b189', '#F56C6C']
|
||||
const colors = ['#409EFF','#00f389', '#ff7f00', '#ffff00', '#00baff', '#13b189', '#F56C6C']
|
||||
const emit = defineEmits(['update:modelValue','change'])
|
||||
const props = defineProps({
|
||||
modelValue: { // 是否显示
|
||||
|
@ -48,6 +48,7 @@ const props = defineProps({
|
|||
data: { // 数据
|
||||
type: Array,
|
||||
default: () => [
|
||||
{ label: '课件', prop: 'book', isExtra: true, icon: 'icon--kejian' },
|
||||
{ label: '活动', prop: 'resource', icon: 'icon-kechengziyuan1' },
|
||||
// { label: '互动', prop: 'interact', icon: 'icon-hudong' },
|
||||
// { label: '窗口', prop: 'win', icon: 'icon-tubiaozhizuomobanyihuifu-' },
|
||||
|
|
|
@ -52,7 +52,7 @@ import imChat from './components/imChat.vue' // im-chat-子组件
|
|||
import vDrag from './directive/drag' // 自定义指令-拖拽
|
||||
import vIgnore from './directive/ignore' // 自定义指令-穿透
|
||||
import { useToolState } from '@/store/modules/tool' // 数据状态-缓存
|
||||
import { ipcMsgSend, ipcMain, sessionStore } from '@/utils/tool' // 相关工具
|
||||
import { ipcMsgSend, ipcMain, sessionStore, toRoter } from '@/utils/tool' // 相关工具
|
||||
import MsgEnum from '@/plugins/imChat/msgEnum' // 消息头-相关定义(nuem)
|
||||
|
||||
const route = useRoute();
|
||||
|
@ -62,6 +62,7 @@ const isDrag = ref(false) // 开始拖拽
|
|||
const dragtime = ref(0) // 拖拽时间-计算点击还是拖动
|
||||
const isShow = ref(false) // 是否显示-画板
|
||||
const isOver = ref(false) // 是否下课
|
||||
const isOpenBook = ref(false)
|
||||
const toolStore = useToolState() // 状态管理
|
||||
const boardVueRef=ref(null) // 画板ref
|
||||
const upvoteRef = ref(null) // 点赞 ref
|
||||
|
@ -70,6 +71,7 @@ const classObj = reactive({ // 课程相关
|
|||
id: route.query.reservId, // 课程id
|
||||
data: {} // 课程信息
|
||||
})
|
||||
const bookInfo = ref(null)
|
||||
const msgIds = [] // 消息id
|
||||
const electron = window.electron // electron
|
||||
const btnList = [ // 工具栏按钮列表
|
||||
|
@ -88,6 +90,7 @@ onMounted(async() => {
|
|||
// window.test1 = toolStore
|
||||
getClassInfo() // 获取课堂详情 ex3
|
||||
resetStatus() // 开启重置状态-监听
|
||||
|
||||
})
|
||||
|
||||
// ==== 方法 ===
|
||||
|
@ -204,6 +207,16 @@ const sideMouse = e => {
|
|||
const sideChange = async o => {
|
||||
// console.log(o)
|
||||
switch(o.prop) {
|
||||
case 'book':
|
||||
if(isOpenBook.value) {
|
||||
isOpenBook.value = false
|
||||
ElMessage.info('已经打开课本了哦')
|
||||
}else {
|
||||
// createWindow('fullScreen-PDF',{url: '/fullscreenpdf'})
|
||||
toRoter(`${process.env['ELECTRON_RENDERER_URL']}/#/fullscreenpdf`)
|
||||
isOpenBook.value = true
|
||||
}
|
||||
break
|
||||
case 'resource': // 资源
|
||||
break
|
||||
case 'interact': // 互动
|
||||
|
@ -226,7 +239,7 @@ const sideChange = async o => {
|
|||
// 延迟2秒后关闭窗口,如果马上解散群,会导致群组不存在
|
||||
setTimeout(async() => {
|
||||
await imChatRef.value?.deleteGroup() // 解散群
|
||||
await imChatRef.value?.logout() // 退出im
|
||||
// await imChatRef.value?.logout() // 退出im
|
||||
elMsg.close()
|
||||
ipcMsgSend('tool-sphere:close') // 关闭窗口
|
||||
}, 500);
|
||||
|
|
Loading…
Reference in New Issue