Compare commits
18 Commits
7545e68a62
...
3d8f7c2a3a
Author | SHA1 | Date |
---|---|---|
yangws | 3d8f7c2a3a | |
小杨 | 78cc5edd39 | |
朱浩 | 9f4e232d6f | |
朱浩 | afc9fe89d1 | |
朱浩 | 894ed269ce | |
zhangxuelin | 64d2dbcabb | |
zhangxuelin | f4cb3a8916 | |
yangws | 69db6bd8b1 | |
小杨 | e522fc8ee5 | |
yangws | 5b50404d3c | |
小杨 | bbed835ffe | |
zhangxuelin | d9bdd5424f | |
zhangxuelin | 979621b515 | |
朱浩 | 9c7aeb1a27 | |
朱浩 | a9faeea3fd | |
朱浩 | 5493de7a61 | |
朱浩 | 02ab1ffa8e | |
朱浩 | 10e76add35 |
|
@ -22,4 +22,4 @@ VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/'
|
|||
VITE_APP_WS_URL = 'wss://file.ysaix.com:7868'
|
||||
|
||||
# 是否显示开发工具
|
||||
VITE_SHOW_DEV_TOOLS = 'false'
|
||||
VITE_SHOW_DEV_TOOLS = 'true'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "aix-win-ws",
|
||||
"version": "2.5.4",
|
||||
"version": "2.5.5",
|
||||
"description": "",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "上海交大重庆人工智能研究院",
|
||||
|
|
|
@ -39,8 +39,8 @@ const slidesStore = useSlidesStore()
|
|||
const { databaseId } = storeToRefs(mainStore)
|
||||
const { screening } = storeToRefs(useScreenStore())
|
||||
|
||||
if (import.meta.env.MODE !== 'development') {
|
||||
window.onbeforeunload = () => false
|
||||
if (import.meta.env.MODE === 'development') {
|
||||
// window.onbeforeunload = () => false
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
|
|
|
@ -3,22 +3,22 @@
|
|||
* @author zdg
|
||||
* @date 2024-11-26
|
||||
*/
|
||||
import { toRaw, nextTick } from 'vue'
|
||||
import { toRaw } from 'vue'
|
||||
import type { Result } from './types' // 接口类型
|
||||
import msgUtils from '@/plugins/modal' // 消息工具
|
||||
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
||||
import * as API_smarttalk from '@/api/file' // 相关api
|
||||
import * as Api_server from '@/api/apiService' // 相关api
|
||||
import * as CreateHomework from '@/views/tool/createHomework' // 统计相关
|
||||
import * as useStore from '../store' // pptist-状态管理
|
||||
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
||||
import useUserStore from '@/store/modules/user' // 外部-用户信息
|
||||
import { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库
|
||||
// import * as commUtils from '@/utils/comm.js'
|
||||
import { createWindow } from '@/utils/tool'
|
||||
import { useToolState } from '@/store/modules/tool'
|
||||
import * as Api_server from '@/api/apiService' // 相关api
|
||||
import * as commUtils from '@/utils/comm.js'
|
||||
const slidesStore = useStore.useSlidesStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
import { getClassWorkList,getStudentClassWorkData } from '@/views/tool/createHomework'
|
||||
import {createWindow} from '@/utils/tool'
|
||||
import { useToolState } from '@/store/modules/tool'
|
||||
const toolStore = useToolState()
|
||||
/** 工具类 */
|
||||
export class Utils {
|
||||
|
@ -110,6 +110,9 @@ export class PPTApi {
|
|||
const rid = await API_entpcoursefile.addEntpcoursefileReturnId(params)
|
||||
if (!!rid) {
|
||||
data.id = rid
|
||||
params.id = rid
|
||||
params.activityContent = null
|
||||
slidesStore.addWorkItem(params)
|
||||
slidesStore.updateSlide(data)
|
||||
// msgUtils.msgSuccess('新增成功')
|
||||
this.isUpdate = false // 新增后会触发监听,不再更新数据
|
||||
|
@ -147,11 +150,7 @@ export class PPTApi {
|
|||
// 更新幻灯片
|
||||
static updateSlide(data: object): Promise<Boolean> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const thumUrl = await this.getSlideThumUrl()
|
||||
data.base64Code = thumUrl // 更新缩略图
|
||||
const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data)
|
||||
console.log(data,'data');
|
||||
console.log(res,'dresata');
|
||||
if (res.code === 200) {
|
||||
resolve(true)
|
||||
} else msgUtils.msgError(res.msg || '更新失败');resolve(false)
|
||||
|
@ -193,40 +192,30 @@ export class PPTApi {
|
|||
else msgUtils.msgError(res.msg || '更新失败');return false
|
||||
})
|
||||
}
|
||||
// thumbnail-slide thumbnail
|
||||
static getSlideThumUrl(): Promise<Boolean> {
|
||||
return nextTick().then(async() => {
|
||||
const slideIndex = slidesStore.slideIndex
|
||||
const elements = document.querySelectorAll('.thumbnail-slide')
|
||||
if (elements.length && slideIndex >= 0) {
|
||||
const element = elements[slideIndex]
|
||||
return await toPng(element)
|
||||
}
|
||||
return null
|
||||
})
|
||||
}
|
||||
|
||||
// 图片|音频|视频 转换为在线地址
|
||||
static toRousrceUrl =async (file: File|any) => {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const res = await Api_server.Other.uploadFile(formData)
|
||||
if (res && res.code == 200){
|
||||
const url = res?.url
|
||||
url &&(o.src = url)
|
||||
return url
|
||||
}
|
||||
}
|
||||
static toRousrceUrl =async (o:any) => {
|
||||
const formData = new FormData()
|
||||
formData.append('file', o)
|
||||
const res = await Api_server.Other.uploadFile(formData)
|
||||
if (res && res.code == 200){
|
||||
const url = res?.url
|
||||
url &&(o.src = url)
|
||||
return url
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export class Homework{
|
||||
// 作业弹窗
|
||||
static async showHomework(id: any) {
|
||||
let result = await CreateHomework.getClassWorkList(id)
|
||||
result = await CreateHomework.getStudentClassWorkData()
|
||||
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
||||
toolStore.isTaskWin=true; // 设置打开批改窗口
|
||||
createWindow('open-taskwin',{url:'/teachClassTask'});
|
||||
let result = await getClassWorkList(id)
|
||||
result = await getStudentClassWorkData()
|
||||
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
||||
toolStore.isTaskWin=true; // 设置打开批改窗口
|
||||
// emit('closeActive')
|
||||
createWindow('open-taskwin',{url:'/teachClassTask'});
|
||||
}
|
||||
}
|
||||
export default PPTApi
|
|
@ -1,17 +1,26 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
export interface ScreenState {
|
||||
screening: boolean
|
||||
screening: boolean,
|
||||
like: number,
|
||||
doubt: number,
|
||||
}
|
||||
|
||||
export const useScreenStore = defineStore('screen', {
|
||||
state: (): ScreenState => ({
|
||||
screening: false, // 是否进入放映状态
|
||||
like:0, // 点赞数量
|
||||
doubt:0, // 疑问数量
|
||||
}),
|
||||
|
||||
actions: {
|
||||
setScreening(screening: boolean) {
|
||||
this.screening = screening
|
||||
},
|
||||
// 打开点赞或疑问
|
||||
openUpvote(type: 'like' | 'doubt'){
|
||||
if (type === 'like') this.like++
|
||||
else this.doubt++
|
||||
}
|
||||
},
|
||||
})
|
|
@ -5,9 +5,12 @@ import type { Slide, SlideTheme, PPTElement, PPTAnimation } from '../types/slide
|
|||
import { slides } from '../mocks/slides'
|
||||
import { theme } from '../mocks/theme'
|
||||
import { layouts } from '../mocks/layout'
|
||||
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
||||
import useUserStore from '@/store/modules/user' // 外部-用户信息
|
||||
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
||||
|
||||
import PPTApi from '../api/store'
|
||||
|
||||
const userStore = useUserStore()
|
||||
interface RemovePropData {
|
||||
id: string
|
||||
propName: string | string[]
|
||||
|
@ -142,16 +145,19 @@ export const useSlidesStore = defineStore('slides', {
|
|||
setWorkItem(list: Object[]) {
|
||||
this.workItem = list
|
||||
},
|
||||
addWorkItem(data: any) {
|
||||
const id = data?.id
|
||||
if (!id) return
|
||||
this.workItem.splice(this.slideIndex + 1, 0, data)
|
||||
this.slideIndex += 1
|
||||
},
|
||||
|
||||
addSlide(slide: Slide | Slide[]) {
|
||||
const slides = Array.isArray(slide) ? slide : [slide]
|
||||
for (const slide of slides) {
|
||||
if (slide.sectionTag) delete slide.sectionTag
|
||||
}
|
||||
|
||||
const addIndex = this.slideIndex + 1
|
||||
this.slides.splice(addIndex, 0, ...slides)
|
||||
this.slideIndex = addIndex
|
||||
this.slides.splice(this.slideIndex, 0, ...slides)
|
||||
},
|
||||
|
||||
updateSlide(props: Partial<Slide>, slideId?: string) {
|
||||
|
@ -188,6 +194,7 @@ export const useSlidesStore = defineStore('slides', {
|
|||
const isDel = await PPTApi.delSlide(deletedId)
|
||||
if (isDel) {
|
||||
// 后端删除成功,更新页面数据
|
||||
this.workItem.splice(index, 1)
|
||||
deleteSlidesIndex.push(index)
|
||||
slides.splice(index, 1)
|
||||
}
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
<div class="item">
|
||||
<div class="item-title">
|
||||
<el-tag :type="getTagType(item.worktype) || 'primary'">{{item.worktype}}</el-tag>
|
||||
<el-tooltip :content="item.evaltitle" placement="top">
|
||||
<div class="tt">{{item.evaltitle}}</div>
|
||||
<el-tooltip :content="item.uniquekey" placement="top">
|
||||
<div class="tt">{{item.uniquekey}}</div>
|
||||
</el-tooltip>
|
||||
<el-button class="btn-del" type="danger" link @click="handleRemoveDemoActivityClassWork(item)">删除</el-button>
|
||||
</div>
|
||||
|
@ -62,7 +62,7 @@
|
|||
>
|
||||
<el-table :data="taskList" style="width: 100%" height="500" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" :selectable="selectable"/>
|
||||
<el-table-column prop="evaltitle" label="活动名称" width="150" />
|
||||
<el-table-column prop="uniquekey" label="活动名称" width="150" />
|
||||
<el-table-column prop="worktype" label="活动类型" width="120" sortable>
|
||||
<template #default="scope">
|
||||
<el-tag :type="getTagType(scope.row.worktype) || 'primary'">{{ scope.row.worktype }}</el-tag>
|
||||
|
@ -90,7 +90,8 @@ import { sessionStore } from '@/utils/store'
|
|||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { PPTApi } from '../../../../../api/index'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import {useSlidesStore} from '../../../../../store'
|
||||
import {useSlidesStore} from '../../../../../store'
|
||||
import { updateEntpcoursefileNew } from '@/api/education/entpcoursefile'
|
||||
const slidesStore = useSlidesStore()
|
||||
const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore)
|
||||
|
||||
|
@ -131,7 +132,7 @@ interface WorkItem {
|
|||
base64?: string;
|
||||
prevData?: any;
|
||||
id: number;
|
||||
evaltitle?: string; // 添加 evaltitle 属性
|
||||
uniquekey?: string; // 添加 evaltitle 属性
|
||||
}
|
||||
|
||||
const currentCourse = reactive<CurrentCourse>({
|
||||
|
@ -277,6 +278,7 @@ const getCurrentPPtData = async () => {
|
|||
workList.value = []
|
||||
objItem.value = workItem.value[slideIndex.value]
|
||||
paramData.value.id = objItem.value.id
|
||||
|
||||
paramData.value.activityContent = objItem.value?.activityContent
|
||||
if (objItem.value?.activityContent) {
|
||||
loadingActive.value = true
|
||||
|
@ -300,13 +302,24 @@ const getData = async (data: WorkItem) => {
|
|||
dialogVisible.value = false
|
||||
}
|
||||
const upDateData = async () => {
|
||||
await PPTApi.updateSlide(paramData.value)
|
||||
// await PPTApi.updateSlide(paramData.value)
|
||||
loadingActive.value = true
|
||||
await updateEntpcoursefileNew(paramData.value)
|
||||
const res = await homeworklist({ ids: paramData.value.activityContent, pageSize: 100 })
|
||||
await formatClassWorkFile(res.rows)
|
||||
const resource = sessionStore.get('curr.resource')
|
||||
await PPTApi.getSlideList(resource.id)
|
||||
}
|
||||
// 判断是否做操作
|
||||
const objectsAreEqual = (obj1: Record<string, any>, obj2: Record<string, any>) => {
|
||||
const keys1 = Object.keys(obj1);
|
||||
const keys2 = Object.keys(obj2);
|
||||
if (keys1.length !== keys2.length) return false;
|
||||
for (const key of keys1) {
|
||||
if (obj1[key] !== obj2[key]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const curNode = sessionStore.get('subject.curNode') as CourseNode
|
||||
|
@ -318,9 +331,13 @@ onMounted(() => {
|
|||
objItem.value = workItem.value[slideIndex.value]
|
||||
getCurrentPPtData()
|
||||
})
|
||||
watch(() => slideIndex.value, () => {
|
||||
getCurrentPPtData()
|
||||
watch(() => [workItem.value.length,slideIndex.value], (newVal,oldVal) => {
|
||||
if(!objectsAreEqual(newVal,oldVal))
|
||||
getCurrentPPtData()
|
||||
})
|
||||
// watch(() => workItem.value.length, () => {
|
||||
// getCurrentPPtData()
|
||||
// })
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.buttonDiv{
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</div>
|
||||
<!-- 点赞组件 -->
|
||||
<div style="z-index: 999;position: absolute;top:10px">
|
||||
<upvote-vue ref="upvoteRef" :test='true' type="2"></upvote-vue>
|
||||
<upvote-vue ref="upvoteRef" type="2"></upvote-vue>
|
||||
</div>
|
||||
<div
|
||||
class="tools-right" :class="{ 'visible': rightToolsVisible }"
|
||||
|
@ -58,9 +58,9 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref , watchEffect} from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useSlidesStore } from '../../store'
|
||||
import { useSlidesStore ,useScreenStore} from '../../store'
|
||||
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
||||
import { enterFullscreen } from '../../utils/fullscreen'
|
||||
import useScreening from '../../hooks/useScreening'
|
||||
|
@ -73,6 +73,8 @@ import SlideThumbnails from './SlideThumbnails.vue'
|
|||
import WritingBoardTool from './WritingBoardTool.vue'
|
||||
import CountdownTimer from './CountdownTimer.vue'
|
||||
import upvoteVue from '@/views/tool/components/upvote.vue' // 点赞-子组件
|
||||
import emitter from '@/utils/mitt';
|
||||
|
||||
const props = defineProps<{
|
||||
changeViewMode: (mode: 'base' | 'presenter') => void
|
||||
}>()
|
||||
|
@ -108,7 +110,8 @@ const writingBoardToolVisible = ref(false)
|
|||
const timerlVisible = ref(false)
|
||||
const slideThumbnailModelVisible = ref(false)
|
||||
const laserPen = ref(false)
|
||||
|
||||
const upvoteRef = ref(null)
|
||||
const screenStore =useScreenStore()
|
||||
const contextmenus = (): ContextmenuItem[] => {
|
||||
return [
|
||||
{
|
||||
|
@ -190,6 +193,12 @@ const contextmenus = (): ContextmenuItem[] => {
|
|||
},
|
||||
]
|
||||
}
|
||||
// 打开点赞或者疑问 1点赞 2疑问
|
||||
emitter.on('upvoteTrigger', (type) => {
|
||||
upvoteRef.value?.trigger(type)
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<template>
|
||||
<div class="book-wrap">
|
||||
<el-scrollbar height="100%">
|
||||
<div class="book-name flex" @click="dialogVisible = true">
|
||||
<div class="book-name flex" v-if="isStadium() === true"> {{userStore.user.deptName}}</div>
|
||||
<div v-else class="book-name flex" @click="dialogVisible = true">
|
||||
<span>{{ curBook.data.itemtitle }}</span>
|
||||
<i class="iconfont icon-xiangyou"></i>
|
||||
</div>
|
||||
|
@ -46,8 +47,14 @@ import { onMounted, ref, nextTick, toRaw, reactive } from 'vue';
|
|||
import { cloneDeep } from 'lodash'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { useGetSubject } from '@/hooks/useGetSubject'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const userStore = useUserStore()
|
||||
|
||||
const BaseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
||||
const isStadium = () => {
|
||||
let roles = userStore.user.roles
|
||||
return roles.some(item => item.roleKey === 'stadium')
|
||||
}
|
||||
// 定义要发送的emit事件
|
||||
const emit = defineEmits(['nodeClick', 'changeBook'])
|
||||
let useSubject = null
|
||||
|
@ -139,7 +146,7 @@ const handleNodeClick = (data) => {
|
|||
* data : 当前节点数据
|
||||
*/
|
||||
let nodeData = cloneDeep(toRaw(data));
|
||||
|
||||
|
||||
//增加一个label 之前取的label
|
||||
nodeData.label = nodeData.itemtitle
|
||||
let parentNode
|
||||
|
@ -181,13 +188,17 @@ onMounted( async () => {
|
|||
curBook.data = sessionStore.get('subject.curBook')
|
||||
}
|
||||
else{
|
||||
curBook.data = subjectList.value[0]
|
||||
if (subjectList.value) {
|
||||
curBook.data = subjectList.value[0]
|
||||
}else {
|
||||
curBook.data = {}
|
||||
}
|
||||
}
|
||||
|
||||
// 章节"树"
|
||||
treeData.value = useSubject.getTreeData(curBook.data.id)
|
||||
sessionStore.set('subject.subjectTree',useSubject.getTreeData(curBook.data.id))
|
||||
|
||||
|
||||
nextTick(() =>{
|
||||
// 默认展开 选中
|
||||
if(sessionStore.get('subject.curNode')){
|
||||
|
@ -199,7 +210,7 @@ onMounted( async () => {
|
|||
}
|
||||
handleNodeClick(curNode.data)
|
||||
})
|
||||
|
||||
|
||||
} finally{
|
||||
treeLoading.value = false
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ const handleNodeClick = (data) => {
|
|||
id: nodeData.parentid,
|
||||
label: nodeData.parenttitle,
|
||||
itemtitle: nodeData.parenttitle
|
||||
}
|
||||
}
|
||||
const parentNode = nodeData.parentid ? parent : null
|
||||
nodeData.parentNode = parentNode
|
||||
|
||||
|
@ -204,7 +204,11 @@ onMounted(async () => {
|
|||
curBook.data = sessionStore.get('subject.curBook')
|
||||
}
|
||||
else{
|
||||
curBook.data = subjectList.value[0]
|
||||
if (subjectList.value) {
|
||||
curBook.data = subjectList.value[0]
|
||||
}else {
|
||||
curBook.data = {}
|
||||
}
|
||||
}
|
||||
|
||||
// 章节"树"
|
||||
|
@ -220,7 +224,7 @@ onMounted(async () => {
|
|||
}
|
||||
handleNodeClick(curNode.data)
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -15,24 +15,40 @@ export const useGetSubject = async () =>{
|
|||
// 单元章节树结构
|
||||
let treeData = null
|
||||
|
||||
// 根据学科 + 学段 获取所有单元章节
|
||||
// 根据学科 + 学段 获取所有单元章节
|
||||
const getSubjectUnit = async () =>{
|
||||
if(sessionStore.get('subject.unitList')){
|
||||
unitList.value = sessionStore.get('subject.unitList')
|
||||
}
|
||||
else{
|
||||
if(isStadium(userStore.user)) {
|
||||
//如果是基地人员,直接拿treeData
|
||||
const unitParams = {
|
||||
edusubject,
|
||||
edustage,
|
||||
itemgroup: 'textbook',
|
||||
itemgroup: '基地课程',
|
||||
orderby: 'orderidx asc',
|
||||
entpid: userStore.user.deptId,
|
||||
pageSize: 10000
|
||||
}
|
||||
const { rows } = await listEvaluation(unitParams)
|
||||
unitList.value = rows
|
||||
sessionStore.set('subject.unitList', rows)
|
||||
}else{
|
||||
if(sessionStore.get('subject.unitList')){
|
||||
unitList.value = sessionStore.get('subject.unitList')
|
||||
}
|
||||
else{
|
||||
const unitParams = {
|
||||
edusubject,
|
||||
edustage,
|
||||
itemgroup: 'textbook',
|
||||
orderby: 'orderidx asc',
|
||||
pageSize: 10000
|
||||
}
|
||||
const { rows } = await listEvaluation(unitParams)
|
||||
unitList.value = rows
|
||||
sessionStore.set('subject.unitList', rows)
|
||||
}
|
||||
await getSubject()
|
||||
}
|
||||
await getSubject()
|
||||
}
|
||||
const isStadium = (user) => {
|
||||
let roles = user.roles
|
||||
return roles.some(item => item.roleKey === 'stadium')
|
||||
}
|
||||
|
||||
// 根据学科 + 学段 获取教材
|
||||
|
@ -42,7 +58,7 @@ export const useGetSubject = async () =>{
|
|||
subjectList = sessionStore.get('subject.bookList')
|
||||
}
|
||||
else{
|
||||
const subjectParams = {
|
||||
const subjectParams = {
|
||||
itemkey: "version",
|
||||
edusubject,
|
||||
edustage,
|
||||
|
@ -68,11 +84,14 @@ export const useGetSubject = async () =>{
|
|||
|
||||
// 单元章节数据转为“树”结构
|
||||
const getTreeData = (bookId) =>{
|
||||
// 根据当前教材的id 查找出对应的章节
|
||||
let data = unitList.value.filter(item => item.rootid == bookId && item.level == 1)
|
||||
if (!bookId) {
|
||||
return unitList.value
|
||||
}
|
||||
// 根据当前教材的id 查找出对应的章节
|
||||
let data = unitList.value.filter(item => item.rootid == bookId && item.level == 1)
|
||||
data.forEach( item => {
|
||||
item.children = unitList.value.filter( item2 => item2.parentid == item.id && item2.level == 2)
|
||||
})
|
||||
})
|
||||
return data
|
||||
}
|
||||
|
||||
|
@ -80,4 +99,4 @@ export const useGetSubject = async () =>{
|
|||
|
||||
return { subjectList, treeData, getTreeData }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</template>
|
||||
<div class="head-aside">
|
||||
<ul >
|
||||
<li :class="computedregistertype==1 || computedregistertype==3?'auth-li':'auth-li pointer-events'" @click="onUserTo('/schoolCertification')" >
|
||||
<li v-if="!isStadium" :class="computedregistertype==1 || computedregistertype==3?'auth-li':'auth-li pointer-events'" @click="onUserTo('/schoolCertification')" >
|
||||
<i class="iconfont icon-renzheng-" :style="computedregistertype==4?'color:green;':''"></i>
|
||||
<span class="mlr-5" v-if="computedregistertype!=4">学校认证</span>
|
||||
<span class="mlr-5" v-else>{{ userStore.DeptInfo.register.schoolName }}</span>
|
||||
|
@ -19,8 +19,8 @@
|
|||
</li>
|
||||
<li v-if="computedregistertype!=4" :class="computedregistertype==1 || computedregistertype==2 ? '':'pointer-events'" @click="onUserTo('/joinSchool')">加入学校</li>
|
||||
<li @click="onUserTo('/profile')">个人中心</li>
|
||||
<li @click="onUserTo('/schoolManagement')">学校管理</li>
|
||||
<li @click="onUserTo('/class')">班级中心</li>
|
||||
<li v-if="!isStadium" @click="onUserTo('/schoolManagement')">学校管理</li>
|
||||
<li v-if="!isStadium" @click="onUserTo('/class')">班级中心</li>
|
||||
<li @click="logout">退出登录</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -53,7 +53,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch , reactive, onMounted,computed} from 'vue'
|
||||
import { ref, watch , reactive, onMounted, onBeforeMount, computed} from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessageBox, ElMessage } from 'element-plus'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
@ -64,6 +64,7 @@ import pkc from "../../../../../package.json"
|
|||
const { ipcRenderer } = window.electron || {}
|
||||
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
|
||||
const userStore = useUserStore()
|
||||
console.log(userStore)
|
||||
const router = useRouter()
|
||||
const currentRoute = ref('')
|
||||
const activeId = ref('/home')
|
||||
|
@ -74,7 +75,19 @@ const version = ref(pkc.version)
|
|||
|
||||
const popoverRef = ref('')
|
||||
|
||||
const headerMenus = [
|
||||
//是否是基地人员
|
||||
const isStadium = () => {
|
||||
let user = userStore.user
|
||||
let roles = user.roles
|
||||
return roles.some(item => item.roleKey === 'stadium')
|
||||
}
|
||||
|
||||
const headerMenus = isStadium() ?[{
|
||||
name: '教学实践',
|
||||
id: 4,
|
||||
icon: 'icon-jiaoxueshijian',
|
||||
path: '/prepare'
|
||||
},]:[
|
||||
{
|
||||
name: '教学大模型',
|
||||
id: 1,
|
||||
|
|
|
@ -16,6 +16,7 @@ import router from './router'
|
|||
import log from 'electron-log/renderer' // 渲染进程日志-文件记录
|
||||
import customComponent from '@/components/common' // 自定义组件
|
||||
import plugins from './plugins' // plugins插件
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
if(process.env.NODE_ENV != 'development') { // 非开发环境,将日志打印到日志文件
|
||||
Object.assign(console, log.functions) // 渲染进程日志-控制台替换
|
||||
|
@ -47,3 +48,16 @@ app.use(router)
|
|||
.use(Icon)
|
||||
.use(Directive)
|
||||
.mount('#app')
|
||||
|
||||
const isStadium = (user) => {
|
||||
let roles = user.roles
|
||||
return roles.some(item => item.roleKey === 'stadium')
|
||||
}
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.path === '/model/index') {
|
||||
isStadium(useUserStore().user) === true ? next('/prepare') :next()
|
||||
}else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
|
|
@ -101,7 +101,7 @@ const dynamicRoutes = [
|
|||
{
|
||||
path: '/',
|
||||
component: Layout,
|
||||
redirect: '/desktop',
|
||||
redirect: '/model/index',
|
||||
meta: { title: '教学工作台' },
|
||||
children: [
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<el-form-item label="密码" prop="password" >
|
||||
<el-input autocomplete="on" type="password" v-model="ruleForm.password" placeholder="请输入密码" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item>
|
||||
<el-button class="btn" type="primary" @click="RegisterForm(ruleFormRef)">立即注册</el-button>
|
||||
</el-form-item>
|
||||
|
@ -77,8 +77,8 @@
|
|||
<SelectSubject v-model="isSubject" :login-data="loginForm" />
|
||||
<!--注册弹框-->
|
||||
<Register ref="RegModel"></Register>
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
|
@ -118,7 +118,7 @@ const loginForm = reactive({
|
|||
})
|
||||
// 注册表单
|
||||
const ruleForm = reactive({
|
||||
|
||||
|
||||
})
|
||||
//表单规则
|
||||
const rules = reactive({
|
||||
|
@ -175,7 +175,7 @@ const sendyzm=()=>{
|
|||
if(ruleForm.username){
|
||||
const pattern = /^1[3-9]\d{9}$/;
|
||||
if( pattern.test(ruleForm.username) ){
|
||||
|
||||
|
||||
getCodeImg().then(res=>{
|
||||
if(res.code==200){
|
||||
ruleForm.imgCode=null
|
||||
|
@ -231,7 +231,7 @@ const submitForm = async (formEl) => {
|
|||
try {
|
||||
await userStore.login(loginForm)
|
||||
await userStore.getInfo()
|
||||
if (userStore.user.edustage || userStore.user.edusubject) {
|
||||
if (userStore.user.edustage || userStore.user.edusubject || isStadium(userStore.user)) {
|
||||
ElMessage.success('登录成功')
|
||||
ipcRenderer && ipcRenderer.send('openMainWindow')
|
||||
} else {
|
||||
|
@ -244,6 +244,11 @@ const submitForm = async (formEl) => {
|
|||
})
|
||||
}
|
||||
|
||||
const isStadium = (user) => {
|
||||
let roles = user.roles
|
||||
return roles.some(item => item.roleKey === 'stadium')
|
||||
}
|
||||
|
||||
const getCookie = async () => {
|
||||
const username = (await getCookieDetail('username'))[0]
|
||||
const password = (await getCookieDetail('password'))[0]
|
||||
|
@ -298,12 +303,12 @@ const RegisterForm = async (formEl) => {
|
|||
}
|
||||
onMounted(() => {
|
||||
localStorage.clear()
|
||||
sessionStore.set('subject', {
|
||||
bookList: null,
|
||||
curBook: null,
|
||||
curNode: null,
|
||||
defaultExpandedKeys: [],
|
||||
subjectTree: []
|
||||
sessionStore.set('subject', {
|
||||
bookList: null,
|
||||
curBook: null,
|
||||
curNode: null,
|
||||
defaultExpandedKeys: [],
|
||||
subjectTree: []
|
||||
})
|
||||
getCookie()
|
||||
})
|
||||
|
|
|
@ -18,7 +18,20 @@
|
|||
<div class="content-body-left">
|
||||
<div class="content-body-left-title">
|
||||
文枢课件
|
||||
<el-button class="add-btn" size="small" type="primary" @click="createAIPPT">新建</el-button>
|
||||
<!-- <el-button class="add-btn" size="small" type="primary" @click="createAIPPT">新建</el-button>-->
|
||||
<el-dropdown class="prepare-center-dropdown add-btn">
|
||||
<el-button type="primary">
|
||||
新建<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="createAIPPT">新建文枢课件</el-dropdown-item>
|
||||
<el-dropdown-item @click="router.push({path: '/model/design'})">AI一键生成</el-dropdown-item>
|
||||
<el-dropdown-item @click="openFilePicker">导入PPT</el-dropdown-item>
|
||||
<input type="file" ref="fileInput" style="display: none;" @change="handleFileChange" accept="application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation">
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<div class="content-body-left-body">
|
||||
<kj-list-item
|
||||
|
@ -59,6 +72,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</el-row>
|
||||
<progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -70,14 +84,20 @@ import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
|||
import KjListItem from '@/views/prepare/container/kj-list-item.vue'
|
||||
import FileImage from '@/components/file-image/index.vue'
|
||||
import {creatAPT, getSmarttalkPage} from '@/api/file'
|
||||
import {Flag, Position} from '@element-plus/icons-vue'
|
||||
import {ArrowDown, Flag, Position} from '@element-plus/icons-vue'
|
||||
import {asyncLocalFile, parseCataByNode} from "@/utils/talkFile";
|
||||
import { dataSetJson } from '@/utils/comm' // 数据集id文生图
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import {listEntpcourse} from "@/api/teaching/classwork";
|
||||
import {addEntpcoursefileReturnId, getEntpcoursefile} from "@/api/education/entpcoursefile";
|
||||
import {createWindow, ipcMsgSend} from "@/utils/tool";
|
||||
import {ElMessage} from "element-plus"; // 学科名字文生图
|
||||
import {ElMessage} from "element-plus";
|
||||
import {PPTXFileToJson} from "@/AixPPTist/src/hooks/useImport";
|
||||
import * as API_entpcoursefile from "@/api/education/entpcoursefile";
|
||||
import progressDialog from '@/views/teachingDesign/container/progress-dialog.vue'
|
||||
import msgUtils from "@/plugins/modal";
|
||||
import * as commUtils from "@/utils/comm";
|
||||
import * as Api_server from "@/api/apiService"; // 学科名字文生图
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore().user // 用户信息
|
||||
const currentNode = ref({})
|
||||
|
@ -212,6 +232,153 @@ const createAIPPT = () => {
|
|||
})
|
||||
}
|
||||
|
||||
const pgDialog = ref({ // 弹窗-进度条
|
||||
visible: false,
|
||||
title: 'PPT解析中...',
|
||||
width: 300,
|
||||
showClose: false,
|
||||
draggable: true,
|
||||
beforeClose: done => {}, // 阻止-弹窗事件
|
||||
pg: { // 进度条-参数
|
||||
percentage: 0, // 百分比
|
||||
color: [
|
||||
{ color: '#1989fa', percentage: 50 }, // 蓝色
|
||||
{ color: '#e6a23c', percentage: 80 }, // 橙色
|
||||
{ color: '#5cb87a', percentage: 100 }, // 绿色
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
const fileInput = ref(null)
|
||||
|
||||
const openFilePicker = () =>{
|
||||
fileInput.value.click();
|
||||
}
|
||||
|
||||
const handleFileChange = ()=> {
|
||||
const file = event.target.files[0];
|
||||
if (file) {
|
||||
console.log(file);
|
||||
createAIPPTByFile(file)
|
||||
}
|
||||
}
|
||||
|
||||
const createAIPPTByFile = async (file)=> {
|
||||
pgDialog.value.visible = true
|
||||
pgDialog.value.pg.percentage = 0
|
||||
const resPptJson = await PPTXFileToJson(file)
|
||||
const { def, slides, ...content } = resPptJson
|
||||
// 转换图片|音频|视频 为线上地址
|
||||
let completed = 0
|
||||
const total = slides.length
|
||||
for( let o of slides ) {
|
||||
completed++
|
||||
await toRousrceUrl(o)
|
||||
// 设置进度条
|
||||
pgDialog.value.pg.percentage = Math.floor(completed / total * 100)
|
||||
}
|
||||
pgDialog.value.pg.percentage = 0
|
||||
pgDialog.value.visible = false
|
||||
listEntpcourse({
|
||||
evalid: currentNode.value.id,
|
||||
edituserid: userStore.userId,
|
||||
pageSize: 500
|
||||
}).then((response) => {
|
||||
if (response.rows.length <= 0) return
|
||||
let resCourse = response.rows[0]
|
||||
// 添加
|
||||
let form = {
|
||||
parentid: 0,
|
||||
entpid: userStore.deptId,
|
||||
entpcourseid: resCourse.id,
|
||||
ppttype: 'file',
|
||||
title: resCourse.coursetitle,
|
||||
fileurl: '',
|
||||
filetype: 'aippt',
|
||||
datacontent: '',
|
||||
parentContent: JSON.stringify(content),
|
||||
filekey: '',
|
||||
filetag: '',
|
||||
fileidx: 0,
|
||||
dflag: 0,
|
||||
status: '',
|
||||
edituserid: userStore.userId
|
||||
}
|
||||
addEntpcoursefileReturnId(form).then((slideid) => {
|
||||
creatAPT({
|
||||
...uploadData.value,
|
||||
fileId: slideid,
|
||||
fileFlag: 'aippt',
|
||||
fileShowName: currentNode.value.itemtitle + '.aippt'
|
||||
}).then(async (res) => {
|
||||
|
||||
const resSlides = slides.map(({id, ...slide}) => JSON.stringify(slide))
|
||||
let params = {
|
||||
parentid: slideid,
|
||||
entpid: resCourse.entpid,
|
||||
entpcourseid: resCourse.id,
|
||||
title: '',
|
||||
filetype: 'slide',
|
||||
slides: resSlides,
|
||||
edituserid: userStore.userId
|
||||
}
|
||||
const res_3 = await API_entpcoursefile.batchAddNew(params)
|
||||
if (res_3 && res_3.code == 200) {
|
||||
msgUtils.msgSuccess('导入PPT课件成功')
|
||||
currentFileList.value.unshift(res.resData)
|
||||
await nextTick();
|
||||
refs.value['kjItemRef'+res.resData.id].openFileWin(res.resData);
|
||||
} else {
|
||||
msgUtils.msgWarning('导入PPT课件失败')
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const toRousrceUrl = async (o) => {
|
||||
if (!!o.src) { // 如果有src就转换
|
||||
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
||||
const isBlobUrl = /^blob:/.test(o.src)
|
||||
// console.log('isBase64', o, isBase64)
|
||||
if (isBase64) {
|
||||
const bolb = commUtils.base64ToBlob(o.src)
|
||||
const fileName = Date.now() + '.png'
|
||||
const file = commUtils.blobToFile(bolb, fileName)
|
||||
// o.src = fileName
|
||||
// console.log('file', file)
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const res = await Api_server.Other.uploadFile(formData)
|
||||
if (res && res.code == 200){
|
||||
const url = res?.url
|
||||
url &&(o.src = url)
|
||||
}
|
||||
} else if (isBlobUrl) { // 视频和音频
|
||||
const res = await fetch(o.src)
|
||||
const blob = await res.blob()
|
||||
const fileName = o.type=='video'? Date.now() + '.mp4':Date.now() + '.mp3'
|
||||
const file = commUtils.blobToFile(blob, fileName)
|
||||
// o.src = fileName
|
||||
// console.log('file', file)
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const ress = await Api_server.Other.uploadFile(formData)
|
||||
if (ress && ress.code == 200){
|
||||
const url = ress?.url
|
||||
url &&(o.src = url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (o?.background?.image) await toRousrceUrl(o.background.image)
|
||||
if(o?.elements){
|
||||
for (let element of o.elements) {
|
||||
await toRousrceUrl(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const deleteTalk = (item) => {
|
||||
let index = currentFileList.value.indexOf(item)
|
||||
currentFileList.value.splice(index, 1)
|
||||
|
@ -219,7 +386,6 @@ const deleteTalk = (item) => {
|
|||
|
||||
// 教材选中
|
||||
const changeBook = async(data) => {
|
||||
console.log(data)
|
||||
let cata = parseCataByNode(data.node)
|
||||
currentNode.value = data.node
|
||||
uploadData.value.levelFirstId = cata[0]
|
||||
|
|
|
@ -418,7 +418,7 @@ export default {
|
|||
} else {
|
||||
other.loading.value = false
|
||||
row.status = isApt ? head : '已结束'
|
||||
}
|
||||
}
|
||||
ElMessage({ type: 'success', message: `下课成功!` })
|
||||
}, 1000)
|
||||
break
|
||||
|
@ -603,8 +603,6 @@ export default {
|
|||
// 设置进度条
|
||||
this.pgDialog.pg.percentage = Math.floor(completed / total * 100)
|
||||
}
|
||||
console.log('结束', slides)
|
||||
return
|
||||
this.pgDialog.pg.percentage = 0
|
||||
this.pgDialog.visible = false
|
||||
listEntpcourse({
|
||||
|
@ -641,8 +639,6 @@ export default {
|
|||
}).then(async (res) => {
|
||||
|
||||
const resSlides = slides.map(({id, ...slide}) => JSON.stringify(slide))
|
||||
console.log(resSlides)
|
||||
return
|
||||
let params = {
|
||||
parentid: slideid,
|
||||
entpid: resCourse.entpid,
|
||||
|
@ -1131,7 +1127,6 @@ export default {
|
|||
background-color: white;
|
||||
position: relative;
|
||||
.prepare-center-dropdown{
|
||||
z-index: 9999;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 4px;
|
||||
|
|
Loading…
Reference in New Issue