Compare commits

...

52 Commits

Author SHA1 Message Date
“zouyf” 9a2a55c62b 1 2024-12-16 17:30:00 +08:00
“zouyf” 19efe185c5 Merge branch 'main' into zouyf_dev 2024-12-16 17:14:22 +08:00
yangws 55efc7f3e1 Merge pull request 'fix:修复头像问题;' (#144) from yws_dev into main
Reviewed-on: #144
2024-12-16 17:06:28 +08:00
小杨 122c5341e9 fix:修复头像问题; 2024-12-16 17:06:01 +08:00
朱浩 c2a4f2c708 Merge remote-tracking branch 'origin/main' 2024-12-16 16:46:22 +08:00
yangws eb18344b6b Merge pull request 'yws_dev' (#143) from yws_dev into main
Reviewed-on: #143
2024-12-16 16:41:13 +08:00
小杨 e080e39e1c Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk_WS into yws_dev 2024-12-16 16:40:43 +08:00
小杨 25f09cb4e0 fix:头像类型修改; 2024-12-16 16:40:33 +08:00
朱浩 3b67c34ccb Merge remote-tracking branch 'origin/main' 2024-12-16 16:20:53 +08:00
朱浩 187c222fe5 大模型页面补全 2024-12-16 16:20:30 +08:00
lyc a255b1af71 Merge pull request 'edit 模板' (#142) from lyc-dev into main 2024-12-16 16:18:02 +08:00
lyc 546c8ad72f edit 模板 2024-12-16 16:17:32 +08:00
zhengdegang e58cb334e4 Merge pull request 'ppt -优化活动列表' (#141) from zdg_dev into main
Reviewed-on: #141
2024-12-16 15:03:14 +08:00
zdg c298e1c0a2 ppt -优化活动列表 2024-12-16 15:01:07 +08:00
朱浩 ed8051d0e0 Merge remote-tracking branch 'origin/main' 2024-12-16 14:24:16 +08:00
朱浩 628055fb58 大模型页面补全 2024-12-16 14:24:00 +08:00
zhengdegang 1698ce30dd Merge pull request '更新ppt活动' (#140) from zdg_dev into main
Reviewed-on: #140
2024-12-16 12:18:57 +08:00
zdg a973d296fe 更新ppt活动 2024-12-16 12:18:19 +08:00
zhangxuelin bf4b857eb7 Merge pull request 'zxl' (#139) from zxl into main
Reviewed-on: #139
2024-12-16 10:19:55 +08:00
zhangxuelin 79839458f0 Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk_WS into zxl 2024-12-16 10:19:14 +08:00
zhangxuelin d018a28200 添加注册验证码倒计时 2024-12-16 10:19:04 +08:00
zhengdegang 2214c5d805 Merge pull request 'ppt上课 拖动更新排序 动画播放等' (#138) from zdg_dev into main
Reviewed-on: #138
2024-12-16 10:16:14 +08:00
zdg 9ad959dfb7 ppt上课 拖动更新排序 动画播放等 2024-12-16 10:15:08 +08:00
lyc 0b9fce21f3 Merge pull request 'edit' (#137) from lyc-dev into main 2024-12-16 10:06:40 +08:00
lyc 37d0592dcc edit 2024-12-16 10:06:14 +08:00
yangws a421ca94bc Merge pull request 'fix:修改监听活动的方式;' (#136) from yws_dev into main
Reviewed-on: #136
2024-12-16 09:56:18 +08:00
小杨 6eda37c8c9 fix:修改监听活动的方式; 2024-12-16 09:55:48 +08:00
lyc 2a11173874 Merge pull request 'lyc-dev' (#135) from lyc-dev into main 2024-12-16 09:50:59 +08:00
lyc 88869e9a8a Merge branch 'main' into lyc-dev 2024-12-16 09:50:30 +08:00
lyc 08db70a3f2 edit 2024-12-16 09:50:17 +08:00
yangws f9efb76282 Merge pull request 'fix:修改头像是取消头像消失的问题;' (#134) from yws_dev into main
Reviewed-on: #134
2024-12-13 14:01:33 +08:00
小杨 ec3d728896 fix:修改头像是取消头像消失的问题; 2024-12-13 14:01:13 +08:00
yangws cb0ab7f2e9 Merge pull request 'fix:ppt活动类型判断;' (#133) from yws_dev into main
Reviewed-on: #133
2024-12-13 13:48:19 +08:00
小杨 43e9c9f44e fix:ppt活动类型判断; 2024-12-13 13:47:56 +08:00
yangws 809c639ce9 Merge pull request 'fix:头像问题;' (#132) from yws_dev into main
Reviewed-on: #132
2024-12-13 13:46:49 +08:00
小杨 243561dfd8 fix:头像问题; 2024-12-13 13:45:06 +08:00
zhengdegang e5bc693f66 Merge pull request 'zdg_dev' (#131) from zdg_dev into main
Reviewed-on: #131
2024-12-13 13:18:09 +08:00
zdg 29888b0674 ppt播放 已经翻页异常情况 2024-12-13 13:17:18 +08:00
zdg 645f9ab120 Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk_WS into zdg_dev 2024-12-13 13:16:31 +08:00
朱浩 74767b44df Merge remote-tracking branch 'origin/main' 2024-12-13 13:01:34 +08:00
朱浩 ef4ec36bbe 大模型页面补全 2024-12-13 13:00:02 +08:00
zdg c4a15e9c53 Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk_WS into zdg_dev 2024-12-13 12:46:51 +08:00
yangws 15b9f38810 Merge pull request 'yws_dev' (#130) from yws_dev into main
Reviewed-on: #130
2024-12-13 11:19:23 +08:00
小杨 a34883abbb Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk_WS into yws_dev 2024-12-13 11:18:48 +08:00
小杨 8f8016cb0b fix:添加默认头像以及pptlist的bug; 2024-12-13 11:18:33 +08:00
lyc a3079a87d0 edit 模板 2024-12-13 10:58:01 +08:00
lyc e43573bae2 Merge pull request 'edit' (#129) from lyc-dev into main 2024-12-13 10:34:04 +08:00
lyc 83d885bcbe 查询模板增加user 2024-12-13 10:33:35 +08:00
lyc b5669a97f1 模板查询增加user 2024-12-13 10:28:42 +08:00
lyc be2afadd43 edit 2024-12-13 10:10:36 +08:00
zdg 6a9392d498 Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk_WS into zdg_dev 2024-12-12 17:33:47 +08:00
zdg e8ecc27441 全屏 2024-12-12 17:33:39 +08:00
36 changed files with 854 additions and 343 deletions

View File

@ -33,6 +33,7 @@ export default defineConfig({
proxy: { proxy: {
'/dev-api': { '/dev-api': {
target: 'http://27.128.240.72:7865', target: 'http://27.128.240.72:7865',
// target: 'https://prev.ysaix.com:7868/prod-api/',
// target: 'http://36.134.181.164:7863', // target: 'http://36.134.181.164:7863',
// target: 'http://192.168.0.102:7865', // target: 'http://192.168.0.102:7865',
changeOrigin: true, changeOrigin: true,

View File

@ -1,6 +1,6 @@
{ {
"name": "aix-win-ws", "name": "aix-win-ws",
"version": "2.5.5", "version": "2.5.6",
"description": "", "description": "",
"main": "./out/main/index.js", "main": "./out/main/index.js",
"author": "上海交大重庆人工智能研究院", "author": "上海交大重庆人工智能研究院",

View File

@ -28,8 +28,8 @@ import msgUtils from '@/plugins/modal' // 消息工具
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // api import * as API_entpcoursefile from '@/api/education/entpcoursefile' // api
import { PPTApi } from './api' import { PPTApi } from './api'
import { sessionStore } from '@/utils/store' // electron-store import { sessionStore } from '@/utils/store' // electron-store
// import './api/watcher' //
import watcher from './api/watcher' // import watcher from './api/watcher' //
import emitter from '@/utils/mitt' //mitt 线
watcher() // watcher() //
const loading = ref(true) const loading = ref(true)
const _isPC = isPC() const _isPC = isPC()
@ -74,6 +74,8 @@ const initLoad: Function = () => {
!!(opt.ratio??null) && slidesStore.setViewportRatio(opt.ratio)// !!(opt.ratio??null) && slidesStore.setViewportRatio(opt.ratio)//
} }
return PPTApi.getSlideList(resource.id) return PPTApi.getSlideList(resource.id)
// PPTApi.updateWorkList()
// return Promise.resolve()
} }
return Promise.resolve() return Promise.resolve()
} }

View File

@ -7,11 +7,13 @@ import { sessionStore } from '@/utils/store' // electron-store 状态管理
import * as useStore from '../store' // pptist-状态管理 import * as useStore from '../store' // pptist-状态管理
import ChatWs from '@/plugins/socket' // 聊天socket import ChatWs from '@/plugins/socket' // 聊天socket
import msgUtils from '@/plugins/modal' // 消息工具 import msgUtils from '@/plugins/modal' // 消息工具
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
const slidesStore = useStore.useSlidesStore() // 幻灯片-状态管理 const slidesStore = useStore.useSlidesStore() // 幻灯片-状态管理
const screenStore = useStore.useScreenStore() // 全屏-状态管理 const screenStore = useStore.useScreenStore() // 全屏-状态管理
const classcourseStore = useStore.useClasscourseStore() // 课堂信息-状态管理 const classcourseStore = useStore.useClasscourseStore() // 课堂信息-状态管理
const classcourse = sessionStore.get('curr.classcourse') // 课堂信息 const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
const execPlay = useExecPlay() // 播放控制
export class Classcourse { export class Classcourse {
msgObj:ElMessageBox = null // 提示消息对象 msgObj:ElMessageBox = null // 提示消息对象
@ -27,17 +29,25 @@ export class Classcourse {
load() { load() {
console.log('classcourse-load', classcourse) console.log('classcourse-load', classcourse)
// 打开全屏 // 打开全屏
screenStore.setScreening(!!classcourse) const isCourse = !!classcourse
screenStore.setScreening(isCourse)
// 如果课堂信息有值则连接socket // 如果课堂信息有值则连接socket
if (!!classcourse) { if (isCourse) {
// 连接socket // 连接socket
if (!ChatWs.ws) ChatWs.init() if (!ChatWs.ws) ChatWs.init()
ChatWs.id = classcourse.timgroupid // 群组id ChatWs.id = classcourse.timgroupid // 群组id
this.classcourse = classcourse // 课堂信息 this.classcourse = classcourse // 课堂信息
this.id = classcourse.id // 课堂id this.id = classcourse.id // 课堂id
// 如果课堂信息有paging则更新当前页码 // 如果课堂信息有paging则更新当前页码
const isPaging = !!classcourse.paging||classcourse.paging==0 const isPaging = !!classcourse.paging
if (isPaging) slidesStore.updateSlideIndex(classcourse.paging) if (isPaging) slidesStore.updateSlideIndex(classcourse.paging)
// 如果课堂信息有paging则更新动画播放状态
const isAnim = !!classcourse.cartoonTimes
if (isAnim) { // 动画播放
for (let i = 0; i <= classcourse.cartoonTimes; i++) {
execPlay.runAnimation(true) // 异步执行动画
}
}
// 课堂信息-状态管理 // 课堂信息-状态管理
classcourseStore.setClasscourse(classcourse) classcourseStore.setClasscourse(classcourse)
// 待上课提示 // 待上课提示

View File

@ -3,16 +3,18 @@
* @author zdg * @author zdg
* @date 2024-11-26 * @date 2024-11-26
*/ */
import { toRaw } from 'vue' import { toRaw, nextTick } from 'vue'
import type { Result } from './types' // 接口类型 import type { Result } from './types' // 接口类型
import msgUtils from '@/plugins/modal' // 消息工具 import msgUtils from '@/plugins/modal' // 消息工具
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
import * as API_smarttalk from '@/api/file' // 相关api import * as API_smarttalk from '@/api/file' // 相关api
import * as API_classwork from '@/api/teaching/classwork' // 相关api
import * as useStore from '../store' // pptist-状态管理 import * as useStore from '../store' // pptist-状态管理
import { sessionStore } from '@/utils/store' // electron-store 状态管理 import { sessionStore } from '@/utils/store' // electron-store 状态管理
import useUserStore from '@/store/modules/user' // 外部-用户信息 import useUserStore from '@/store/modules/user' // 外部-用户信息
import * as Api_server from '@/api/apiService' // 相关api import * as Api_server from '@/api/apiService' // 相关api
import * as commUtils from '@/utils/comm.js' import * as commUtils from '@/utils/comm.js' // 工具
import { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库
const slidesStore = useStore.useSlidesStore() const slidesStore = useStore.useSlidesStore()
const userStore = useUserStore() const userStore = useUserStore()
@ -55,12 +57,13 @@ export class PPTApi {
// 变量 // 变量
static isUpdate = true // 是否更新数据 static isUpdate = true // 是否更新数据
// 获取所有幻灯片列表 // 获取所有幻灯片列表 isUpdate为true不更新
static getSlideList(parentid: (Number | String)): Promise<Boolean> { static getSlideList(parentid: (Number | String),isUpdate?:Boolean): Promise<Boolean> {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const params: object = { parentid, orderByColumn: 'fileidx', isAsc: 'asc', pageSize: 9999 } const params: object = { parentid, orderByColumn: 'fileidx', isAsc: 'asc', pageSize: 9999 }
const res: Result = await API_entpcoursefile.listEntpcoursefileNew(params) const res: Result = await API_entpcoursefile.listEntpcoursefileNew(params)
if (res.code === 200) { if (res.code === 200) {
if(!isUpdate){
const slides = (res.rows || []).map(o => { const slides = (res.rows || []).map(o => {
if (!!o.datacontent) { if (!!o.datacontent) {
const json = JSON.parse(o.datacontent) const json = JSON.parse(o.datacontent)
@ -70,15 +73,18 @@ export class PPTApi {
// 如果没有数据,默认空白页 // 如果没有数据,默认空白页
return {id: o.id,elements:[],background:{type:"solid",color:"#fff"}} return {id: o.id,elements:[],background:{type:"solid",color:"#fff"}}
}) })
// 活动列表处理
const workList = (res.rows || []).map(o => o.activityContent)
const workItem = [...res.rows]
// slidesStore.updateSlideIndex(0) // 下标0 为第一页 // slidesStore.updateSlideIndex(0) // 下标0 为第一页
slidesStore.setSlides(slides) // 写入数据 slidesStore.setSlides(slides) // 写入数据
}
// 活动列表处理
// const workList = (res.rows || []).map(o => o.activityContent)
const workItem = res.rows ? [...res.rows] : []
// 写入作业列表数据 // 写入作业列表数据
slidesStore.setWorkList(workList) // slidesStore.setWorkList(workList)
// 获取所有的pptlist的数据 // 获取所有的pptlist的数据
slidesStore.setWorkItem(workItem) slidesStore.setWorkItem(workItem)
this.updateWorkList()
resolve(true) resolve(true)
} else msgUtils.msgError(res.msg || '获取数据失败');resolve(false) } else msgUtils.msgError(res.msg || '获取数据失败');resolve(false)
}) })
@ -111,7 +117,6 @@ export class PPTApi {
data.id = rid data.id = rid
slidesStore.updateSlide(data) slidesStore.updateSlide(data)
// msgUtils.msgSuccess('新增成功') // msgUtils.msgSuccess('新增成功')
PPTApi.getSlideList(resource.id)
this.isUpdate = false // 新增后会触发监听,不再更新数据 this.isUpdate = false // 新增后会触发监听,不再更新数据
resolve(true) resolve(true)
} else msgUtils.msgError('新增失败');resolve(false) } else msgUtils.msgError('新增失败');resolve(false)
@ -132,11 +137,19 @@ export class PPTApi {
const currentSlide = toRaw(slidesStore.currentSlide) const currentSlide = toRaw(slidesStore.currentSlide)
const isAdd = !/^\d+$/.test(currentSlide.id) // 是否新增 const isAdd = !/^\d+$/.test(currentSlide.id) // 是否新增
const currInd = toRaw(slidesStore.slideIndex) // 当前页索引-new
const oldInd = oldData.findIndex(o => o.id == currentSlide.id) // 当前页索引-old
const isBatch = oldVal && oldVal.length && currInd != oldInd // 是否批量更新-排序
if (isAdd) { // 新增的幻灯片(id 为非数字,说明是新增的幻灯片) if (isAdd) { // 新增的幻灯片(id 为非数字,说明是新增的幻灯片)
const bool = await this.addSlide(currentSlide) const bool = await this.addSlide(currentSlide)
bool && this.batchUpdateSlides(newData, true) // 批量更新-排序 bool && await this.batchUpdateSlides(newData, true) // 批量更新-排序
const resource = sessionStore.get('curr.resource')||{}
await PPTApi.getSlideList(resource.id)
} else { // 防抖-更新 } else { // 防抖-更新
if (!this.isUpdate) return this.isUpdate = true // 下次更新数据 if (!this.isUpdate) return this.isUpdate = true // 下次更新数据
if (isBatch) { // 批量更新-排序
this.batchUpdateSlides(newData, true)
} else { // 更新当前页幻灯片
const params = { const params = {
id: currentSlide.id, id: currentSlide.id,
datacontent: JSON.stringify(currentSlide), datacontent: JSON.stringify(currentSlide),
@ -144,9 +157,14 @@ export class PPTApi {
Utils.mxThrottle(() => {this.updateSlide(params)}, 200, 2) Utils.mxThrottle(() => {this.updateSlide(params)}, 200, 2)
} }
} }
// 更新幻灯片 }
static updateSlide(data: object): Promise<Boolean> { // 更新幻灯片 isThum 是否更新缩略图
static updateSlide(data: object, isThum = true): Promise<Boolean> {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
if (isThum) { // 更新缩略图
const thumUrl = await this.getSlideThumUrl()
data.base64Code = thumUrl // 更新缩略图
}
const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data) const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data)
if (res.code === 200) { if (res.code === 200) {
resolve(true) resolve(true)
@ -190,6 +208,42 @@ export class PPTApi {
}) })
} }
// 更新-活动列表
static async updateWorkList(): Promise<Boolean> {
const resolveData = (resolve, data = []) => {
slidesStore.setWorkList(data)
return resolve()
}
return new Promise(async (resolve, reject) => {
const workItem = slidesStore.workItem // 所有的pptlist的数据-原始数据
const currentSlide = slidesStore.currentSlide // 当前页幻灯片
const slideId = currentSlide.id // 当前页幻灯片id
if (!slideId) return resolveData(resolve)
// slide详情获取-作业id
// const res = await API_entpcoursefile.getEntpcoursefile(slideId)
// const workIds = res?.data?.activityContent||''
// workItem-获取作业id
const workIds = workItem.find(o => o.id == slideId)?.activityContent
if (!workIds) return resolveData(resolve)
// 获取作业列表
const resW = await API_classwork.homeworklist({ ids: workIds, pageSize: 1000 })
if (resW && resW.rows) return resolveData(resolve, resW.rows)
else msgUtils.msgError(resW.msg || '更新失败');return resolveData(resolve)
})
}
// 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 (o:any) => { static toRousrceUrl =async (o:any) => {
const formData = new FormData() const formData = new FormData()
@ -200,8 +254,7 @@ export class PPTApi {
url &&(o.src = url) url &&(o.src = url)
return url return url
} }
}
}
} }
export class Homework{ export class Homework{

View File

@ -12,6 +12,7 @@ import Classcourse from './classcourse' // 课程相关
import msgUtils from '@/plugins/modal' // 消息工具 import msgUtils from '@/plugins/modal' // 消息工具
import { Homework } from './index' // api-作业相关 import { Homework } from './index' // api-作业相关
import emitter from '@/utils/mitt' //mitt 事件总线 import emitter from '@/utils/mitt' //mitt 事件总线
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
/** /**
* @description * @description
@ -21,6 +22,7 @@ export default () => {
const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理 const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理
const resource = sessionStore.get('curr.resource') // apt 资源 const resource = sessionStore.get('curr.resource') // apt 资源
const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源 const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源
const execPlay = useExecPlay() // 播放控制
// 监听幻灯片内容变化 // 监听幻灯片内容变化
watch(() => slidesStore.slides, (newVal, oldVal) => { watch(() => slidesStore.slides, (newVal, oldVal) => {
@ -33,6 +35,11 @@ export default () => {
updatePPT({title: newVal}) updatePPT({title: newVal})
}) })
// 监听幻灯片下标变化
watch(() => slidesStore.slideIndex, (newVal, oldVal) => {
PPTApi.updateWorkList()
})
// 消息监听ws // 消息监听ws
// console.log('监听器已开启', ChatWs) // console.log('监听器已开启', ChatWs)
if (!!ChatWs.ws) { if (!!ChatWs.ws) {
@ -82,8 +89,11 @@ export default () => {
} }
break break
case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页 case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页
const slideIndex = content.current const slideIndex = content?.current || 0
slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标 const type = content?.animation
if (type === 'Nextsteps') emitter.emit('useExecPlay', 'execNext') // 下一步
else if (type === 'Previoustep') emitter.emit('useExecPlay', 'turnPrevSlide') // 上一步清空-动画
else slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
break break
case MsgEnum.HEADS.MSG_homework: // 作业|活动-布置 case MsgEnum.HEADS.MSG_homework: // 作业|活动-布置
if (!content.classWorkId) return if (!content.classWorkId) return

View File

@ -145,21 +145,16 @@ export const useSlidesStore = defineStore('slides', {
setWorkItem(list: Object[]) { setWorkItem(list: Object[]) {
this.workItem = list 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[]) { addSlide(slide: Slide | Slide[]) {
const slides = Array.isArray(slide) ? slide : [slide] const slides = Array.isArray(slide) ? slide : [slide]
for (const slide of slides) { for (const slide of slides) {
if (slide.sectionTag) delete slide.sectionTag if (slide.sectionTag) delete slide.sectionTag
} }
this.slides.splice(this.slideIndex, 0, ...slides) const addIndex = this.slideIndex + 1
this.slides.splice(addIndex, 0, ...slides)
this.slideIndex = addIndex
}, },
updateSlide(props: Partial<Slide>, slideId?: string) { updateSlide(props: Partial<Slide>, slideId?: string) {
const slideIndex = slideId ? this.slides.findIndex(item => item.id === slideId) : this.slideIndex const slideIndex = slideId ? this.slides.findIndex(item => item.id === slideId) : this.slideIndex
this.slides[slideIndex] = { ...this.slides[slideIndex], ...props } this.slides[slideIndex] = { ...this.slides[slideIndex], ...props }

View File

@ -32,22 +32,22 @@
<!-- 作业列表 --> <!-- 作业列表 -->
<div class="c-apt-r" v-loading='loadingActive'> <div class="c-apt-r" v-loading='loadingActive'>
<!-- 显示-作业内容 --> <!-- 显示-作业内容 -->
<template v-for="(item, index) in workList" :key="index"> <template v-for="(item, index) in slidesStore.workList" :key="index">
<div class="item"> <div class="item">
<div class="item-title"> <div class="item-title">
<el-tag :type="getTagType(item.worktype) || 'primary'">{{item.worktype}}</el-tag> <el-tag :type="getTagType(item.worktype) || 'primary'">{{item.worktype}}</el-tag>
<el-tooltip :content="item.uniquekey" placement="top"> <el-tooltip :content="item.uniquekey" placement="top">
<div class="tt">{{item.uniquekey}}</div> <div class="tt">{{item.uniquekey}}</div>
</el-tooltip> </el-tooltip>
<el-button class="btn-del" type="danger" link @click="handleRemoveDemoActivityClassWork(item)">删除</el-button> <el-button class="btn-del" type="danger" link @click="removeWork(item, index)">删除</el-button>
</div> </div>
</div> </div>
</template> </template>
</div> </div>
<!-- // --> <!-- // -->
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="90%" height="500"> <el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="85%" height="500">
<el-scrollbar height="550"> <el-scrollbar>
<div style="height: 550px;"> <div style="height: 75vh;">
<NewClassTsakAssign :currentCourse='currentCourse' @getData="getData" /> <NewClassTsakAssign :currentCourse='currentCourse' @getData="getData" />
</div> </div>
</el-scrollbar> </el-scrollbar>
@ -80,21 +80,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, onMounted, nextTick, watch } from 'vue' import { ref, reactive, onMounted, nextTick, watch } from 'vue'
import Divider from '../../../../../components/Divider.vue' import Divider from '../../../../../components/Divider.vue'
import { listEntpcoursefile } from '@/api/education/entpcoursefile'
import { homeworklist } from '@/api/teaching/classwork'
import { processList } from "@/hooks/useProcessList";
import { listEntpcoursework } from "@/api/classTask/index";
import { ElMessageBox,ElMessage } from 'element-plus' import { ElMessageBox,ElMessage } from 'element-plus'
import NewClassTsakAssign from '@/views/classTask/newClassTaskAssign/index.vue' import NewClassTsakAssign from '@/views/classTask/newClassTaskAssign/index.vue'
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import { useGetHomework } from '@/hooks/useGetHomework' import { useGetHomework } from '@/hooks/useGetHomework'
import { PPTApi } from '../../../../../api/index' 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 slidesStore = useSlidesStore()
const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore)
interface CourseNode { interface CourseNode {
rootid: number; rootid: number;
parentNode: { id: number }; parentNode: { id: number };
@ -112,12 +104,6 @@ interface CurrentCourse {
worktype: string; worktype: string;
} }
interface Params {
parentid: number;
pageSize: number;
orderby: string;
}
interface WorkType { interface WorkType {
label: string; label: string;
value: string; value: string;
@ -168,63 +154,31 @@ const type = ref<WorkType[]>([
label: '常规作业', label: '常规作业',
value: 'primary' value: 'primary'
}, },
{
label: '框架梳理',
value: 'primary'
}
]) ])
const objItem = ref<any>({})
//
const workList = ref<WorkItem[]>([])
// //
const selectedWorkList = ref<WorkItem[]>([]) const selectedWorkList = ref<WorkItem[]>([])
// loading // loading
const loadingActive = ref<boolean>(false) const loadingActive = ref<boolean>(false)
//
const paramData = ref<{ id: number, activityContent: string }>({} as { id: number, activityContent: string })
const selectable = (row: WorkItem, index: number): boolean => { const selectable = (row: WorkItem, index: number): boolean => {
return row.status === '10'; return row.status === '10';
}; };
//
const formatClassWorkFile = async (postData: WorkItem[]): Promise<void> => { const removeWork = (item: WorkItem, index: number) => {
for (let i = 0; i < postData.length; i++) {
let item = postData[i];
switch (item.worktype) {
case '框架梳理': {
}
break;
case '习题训练': {
// let workIds = item.quizlist!.map(items => items.id).join(',');
// let ress = await listEntpcoursework({ ids: workIds });
// const arr = ress.rows.map((item:{id:number}) => {
// return item.id
// })
// processList(ress.rows);
}
break;
case '课堂展示': {
// item.base64 = JSON.parse(item.workcodes).base64;
}
break;
case '常规作业': {
// item.prevData = JSON.parse(item.workcodes);
}
}
workList.value.push(item)
loadingActive.value = false
}
await nextTick();
}//
const handleRemoveDemoActivityClassWork = (item: WorkItem) => {
ElMessageBox.confirm('是否确认删除?') ElMessageBox.confirm('是否确认删除?')
.then(() => { .then(async() => {
workList.value = [] // workList
const arr = paramData.value.activityContent.split(',') // slidesStore.workList.splice(index, 1)
const filterArr = arr.filter(itemId => itemId!== item.id.toString()) console.log('删除作业', item)
paramData.value.activityContent = filterArr.join(',') await upDateData('del', [item.id])
upDateData() ElMessage.success('删除成功')
}) })
.catch(() => { }); .catch(() => { });
} }
@ -253,6 +207,7 @@ const showDialog = (item: string) => {
dialogVisible.value = true dialogVisible.value = true
} }
//
const openList = () => { const openList = () => {
activeVisible.value = true activeVisible.value = true
initHomeWork() initHomeWork()
@ -260,65 +215,44 @@ const openList = () => {
// //
const savePPtData = async () => { const savePPtData = async () => {
if (selectedWorkList.value.length === 0) { if (!selectedWorkList.value.length) {
ElMessage.warning('请选择活动') ElMessage.warning('请选择活动')
return return
} }
workList.value = []
const arr = selectedWorkList.value.map(item => item.id) const arr = selectedWorkList.value.map(item => item.id)
// await upDateData('add', arr)
const existingIds = paramData.value.activityContent ? paramData.value.activityContent.split(',') : []
paramData.value.activityContent = Array.from(new Set([...existingIds, ...arr])).join(',')
upDateData()
activeVisible.value = false activeVisible.value = false
} }
// ppt
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
const res = await homeworklist({ ids: objItem.value?.activityContent, pageSize: 100 })
await formatClassWorkFile(res.rows)
}
}
// //
const getData = async (data: WorkItem) => { const getData = async (data: WorkItem) => {
workList.value = [] await upDateData('add', [data.id])
if(paramData.value.activityContent){
const arr = paramData.value.activityContent.split(',')
arr.push(data.id.toString())
const unitArr = Array.from(new Set(arr))
paramData.value.activityContent = unitArr.join(',')
}else{
paramData.value.activityContent = data.id.toString()
}
upDateData()
dialogVisible.value = false dialogVisible.value = false
} }
const upDateData = async () => { // - type add/ | del/ ids id
// await PPTApi.updateSlide(paramData.value) const upDateData = (type: string, ids: number[]): Promise<any> => {
return new Promise(async (resolve, reject) => {
loadingActive.value = true loadingActive.value = true
await updateEntpcoursefileNew(paramData.value) //
const resource = sessionStore.get('curr.resource') let workIds = slidesStore.workList.map((o:any) => o.id)
await PPTApi.getSlideList(resource.id) const id = slidesStore.currentSlide.id
const res = await homeworklist({ ids: paramData.value.activityContent, pageSize: 100 }) if (type === 'del') { //
await formatClassWorkFile(res.rows) workIds = workIds.filter(id => !ids.includes(id))
} } else { //
// workIds = Array.from(new Set([...workIds, ...ids]))
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; //
const wItem:any = slidesStore.workItem.find((o:any) => o.id === id)
const workIdsStr = workIds.join(',') // id->
if (!!wItem) wItem.activityContent = workIdsStr
const data = { id, activityContent: workIdsStr }
//
await PPTApi.updateSlide(data, false)
//
await PPTApi.updateWorkList()
loadingActive.value = false
resolve(true)
})
} }
onMounted(() => { onMounted(() => {
@ -328,16 +262,8 @@ onMounted(() => {
currentCourse.levelSecondId = curNode.id currentCourse.levelSecondId = curNode.id
currentCourse.coursetitle = curNode.itemtitle currentCourse.coursetitle = curNode.itemtitle
currentCourse.node = curNode currentCourse.node = curNode
objItem.value = workItem.value[slideIndex.value]
getCurrentPPtData()
}) })
watch(() => [workItem.value.length,slideIndex.value], (newVal,oldVal) => {
if(!objectsAreEqual(newVal,oldVal))
getCurrentPPtData()
})
// watch(() => workItem.value.length, () => {
// getCurrentPPtData()
// })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.buttonDiv{ .buttonDiv{

View File

@ -100,7 +100,6 @@ const {
execNext, execNext,
animationIndex, animationIndex,
} = useExecPlay() } = useExecPlay()
const { slideWidth, slideHeight } = useSlideSize() const { slideWidth, slideHeight } = useSlideSize()
const { exitScreening } = useScreening() const { exitScreening } = useScreening()
const { fullscreenState, manualExitFullscreen } = useFullscreen() const { fullscreenState, manualExitFullscreen } = useFullscreen()
@ -197,6 +196,37 @@ const contextmenus = (): ContextmenuItem[] => {
emitter.on('upvoteTrigger', (type) => { emitter.on('upvoteTrigger', (type) => {
upvoteRef.value?.trigger(type) upvoteRef.value?.trigger(type)
}); });
// zdg: 使
const execPlay = {
autoPlayTimer,
autoPlay,
closeAutoPlay,
autoPlayInterval,
setAutoPlayInterval,
loopPlay,
setLoopPlay,
mousewheelListener,
touchStartListener,
touchEndListener,
turnPrevSlide,
turnNextSlide,
turnSlideToIndex,
turnSlideToId,
execPrev,
execNext,
animationIndex,
}
emitter.on('useExecPlay', (data: string|any) => {
if (!data) throw new Error('参数错误')
if (typeof data === 'string') { //
if (execPlay[data]) execPlay[data]()
else throw new Error('方法不存在')
} else { //
const { method, ...params } = data || {}
if (execPlay[method]) execPlay[method](...params)
else throw new Error('方法不存在')
}
})
</script> </script>

View File

@ -19,10 +19,10 @@ export default () => {
// 最小已播放页面索引 // 最小已播放页面索引
const playedSlidesMinIndex = ref(slideIndex.value) const playedSlidesMinIndex = ref(slideIndex.value)
// 执行元素动画 // 执行元素动画 isAsync 为 true 时,异步执行,否则同步执行
const runAnimation = () => { const runAnimation = (isAsync: boolean) => {
// 正在执行动画时,禁止其他新的动画开始 // 正在执行动画时,禁止其他新的动画开始
if (inAnimation.value) return if (inAnimation.value && !isAsync) return
const { animations, autoNext } = formatedAnimations.value[animationIndex.value] const { animations, autoNext } = formatedAnimations.value[animationIndex.value]
animationIndex.value += 1 animationIndex.value += 1
@ -174,45 +174,50 @@ export default () => {
// 鼠标滚动翻页 // 鼠标滚动翻页
const mousewheelListener = throttle(function(e: WheelEvent) { const mousewheelListener = throttle(function(e: WheelEvent) {
if (e.deltaY < 0) execPrev() if (e.deltaY < 0) turning(e, 'prev')
else if (e.deltaY > 0) execNext() else if (e.deltaY > 0) turning(e, 'next')
}, 500, { leading: true, trailing: false }) }, 500, { leading: true, trailing: false })
// 触摸屏上下滑动翻页 // 触摸屏上下滑动翻页
const touchInfo = ref<{ x: number; y: number; } | null>(null) const touchInfo = ref<{ x: number; y: number; } | null>(null)
const touchStartListener = (e: TouchEvent) => { const touchStartListener = (e: TouchEvent) => {
e.preventDefault() // 阻止默认事件
touchInfo.value = { touchInfo.value = {
x: e.changedTouches[0].pageX, // x: e.changedTouches[0].pageX,
y: e.changedTouches[0].pageY, // y: e.changedTouches[0].pageY,
x: e.changedTouches[0].clientX,
y: e.changedTouches[0].clientY,
} }
} }
const touchEndListener = (e: TouchEvent) => { const touchEndListener = (e: TouchEvent) => {
if (!touchInfo.value) return if (!touchInfo.value) return
const offsetX = Math.abs(touchInfo.value.x - e.changedTouches[0].clientX)
const offsetX = Math.abs(touchInfo.value.x - e.changedTouches[0].pageX) const offsetY = e.changedTouches[0].clientY - touchInfo.value.y
const offsetY = e.changedTouches[0].pageY - touchInfo.value.y
if ( Math.abs(offsetY) > offsetX && Math.abs(offsetY) > 50 ) { if ( Math.abs(offsetY) > offsetX && Math.abs(offsetY) > 50 ) {
touchInfo.value = null touchInfo.value = null
if (offsetY > 0) turning(e, 'prev')
if (offsetY > 0) execPrev() else turning(e, 'next')
else execNext()
} }
} }
// 向上翻页/向下翻页
const turning = (e, type) => {
e.preventDefault() // 阻止默认事件
if (type === 'prev') execPrev()
else if (type === 'next') execNext()
}
// 快捷键翻页 // 快捷键翻页
const keydownListener = (e: KeyboardEvent) => { const keydownListener = (e: KeyboardEvent) => {
const key = e.key.toUpperCase() const key = e.key.toUpperCase()
if (key === KEYS.UP || key === KEYS.LEFT || key === KEYS.PAGEUP) execPrev() if (key === KEYS.UP || key === KEYS.LEFT || key === KEYS.PAGEUP) turning(e, 'prev')
else if ( else if (
key === KEYS.DOWN || key === KEYS.DOWN ||
key === KEYS.RIGHT || key === KEYS.RIGHT ||
key === KEYS.SPACE || key === KEYS.SPACE ||
key === KEYS.ENTER || key === KEYS.ENTER ||
key === KEYS.PAGEDOWN key === KEYS.PAGEDOWN
) execNext() ) turning(e, 'next')
} }
onMounted(() => document.addEventListener('keydown', keydownListener)) onMounted(() => document.addEventListener('keydown', keydownListener))

View File

@ -71,3 +71,11 @@ export const addFileToKj = (id) => {
method: 'get' method: 'get'
}) })
} }
export const getModelInfo = (params) => {
return request({
url: '/education/llmModel/getModelInfo',
method: 'post',
params
})
}

View File

@ -1,8 +1,8 @@
@font-face { @font-face {
font-family: "iconfont"; /* Project id 4723712 */ font-family: "iconfont"; /* Project id 4723712 */
src: url('iconfont.woff2?t=1733880548695') format('woff2'), src: url('iconfont.woff2?t=1734337029245') format('woff2'),
url('iconfont.woff?t=1733880548695') format('woff'), url('iconfont.woff?t=1734337029245') format('woff'),
url('iconfont.ttf?t=1733880548695') format('truetype'); url('iconfont.ttf?t=1734337029245') format('truetype');
} }
.iconfont { .iconfont {
@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-yinle:before {
content: "\e6c9";
}
.icon-yuyin:before { .icon-yuyin:before {
content: "\e648"; content: "\e648";
} }

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,13 @@
"css_prefix_text": "icon-", "css_prefix_text": "icon-",
"description": "", "description": "",
"glyphs": [ "glyphs": [
{
"icon_id": "11819186",
"name": "音乐",
"font_class": "yinle",
"unicode": "e6c9",
"unicode_decimal": 59081
},
{ {
"icon_id": "6338162", "icon_id": "6338162",
"name": "语音生成", "name": "语音生成",

View File

@ -41,6 +41,7 @@ const getFileTypeIcon = () => {
airobot: 'icon-jiqirenfushi', // airobot: 'icon-jiqirenfushi', //
aiimg: 'icon-xiangmuicon_maobishufa', // aiimg: 'icon-xiangmuicon_maobishufa', //
aidraw: 'icon-meishu-F', // aidraw: 'icon-meishu-F', //
aiyinyue: 'icon-yinle' //
} }
if (iconObj[name]) { if (iconObj[name]) {
return '#' + iconObj[name] return '#' + iconObj[name]

View File

@ -40,7 +40,7 @@ const props = defineProps({
type: Number, type: Number,
default: 1 default: 1
}, },
item: { // item: { //
type: Object, type: Object,
default: () => { default: () => {
return { ex3: '' } return { ex3: '' }
@ -73,23 +73,25 @@ const loading = ref(false)
const saveAdd = async () => { const saveAdd = async () => {
loading.value = true loading.value = true
if (props.item.ex3 == '1') { if (props.item.ex3 == '1') {
let id; // id id
if (props.item.isAdd) { if (props.item.isAdd) {
id = props.item.id
}
else{
// item item.parentId
id = props.item.parentId
}
try { try {
// copy // copy
const { msg } = await addKeyWords({ name: form.name, id: props.item.id }) const { msg } = await addKeyWords({ name: form.name, id })
emitter.emit('onGetMain') emitter.emit('onGetMain')
ElMessage.success(msg) ElMessage.success(msg)
mode.value = false mode.value = false
} finally { } finally {
loading.value = false loading.value = false
} }
}
else{
onAddChildTemp(props.item.parentId)
}
} else {
} else {
if (props.item.isAdd) { if (props.item.isAdd) {
onAddChildTemp(props.item.id) onAddChildTemp(props.item.id)
} }

View File

@ -16,12 +16,12 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted, nextTick } from 'vue' import { ref, onMounted, nextTick, reactive } from 'vue'
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import PDF from '@/components/PdfJs/index.vue' import PDF from '@/components/PdfJs/index.vue'
import LeftDialog from './left-dialog.vue' import LeftDialog from './left-dialog.vue'
const props = defineProps(['curNode', 'type']) const props = defineProps(['type'])
const showDialog = ref(false) const showDialog = ref(false)
const onClick = () => { const onClick = () => {
@ -31,8 +31,13 @@ const onClick = () => {
// PDF // PDF
const pdfUrl = ref('') const pdfUrl = ref('')
const curNode = reactive({})
onMounted(async () => { onMounted(async () => {
await nextTick() await nextTick()
//
let nodeData = sessionStore.get('subject.curNode')
Object.assign(curNode, nodeData);
let data = sessionStore.get('subject.curBook') let data = sessionStore.get('subject.curBook')
let fileurl = data.fileurl let fileurl = data.fileurl
if(props.type == 1){ if(props.type == 1){

View File

@ -83,7 +83,7 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted, watch, onUnmounted, nextTick } from 'vue' import { ref, reactive, onMounted, onUnmounted, nextTick } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { tempSave, completion, modelList, removeChildTemp, tempResult, editTempResult } from '@/api/mode/index' import { tempSave, completion, modelList, removeChildTemp, tempResult, editTempResult } from '@/api/mode/index'
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
@ -91,10 +91,12 @@ import keywordDialog from './keyword-dialog.vue';
import AdjustDialog from './adjust-dialog.vue' import AdjustDialog from './adjust-dialog.vue'
import EditDialog from './edit-dialog.vue' import EditDialog from './edit-dialog.vue'
import TypingEffect from '@/components/typing-effect/index.vue' import TypingEffect from '@/components/typing-effect/index.vue'
import useUserStore from '@/store/modules/user'
import emitter from '@/utils/mitt'; import emitter from '@/utils/mitt';
import { dataSetJson } from '@/utils/comm.js' import { dataSetJson } from '@/utils/comm.js'
const props = defineProps(['curNode', 'type']) const props = defineProps(['type'])
const { user } = useUserStore()
/*****************提示词相关****************/ /*****************提示词相关****************/
@ -137,7 +139,7 @@ const curTemplate = reactive({ name: '', id: '' })
const templateList = ref([]) const templateList = ref([])
const childTempList = ref([]) const childTempList = ref([])
const getTemplateList = () => { const getTemplateList = () => {
modelList({ model: props.type, type: 1, pageNum: 1, pageSize: 10000, ex1: curNode.edustage, ex2: curNode.edusubject }).then(res => { modelList({ createUser: user.userId, model: props.type, type: 1, pageNum: 1, pageSize: 10000, ex1: curNode.edustage, ex2: curNode.edusubject }).then(res => {
templateList.value = res.rows templateList.value = res.rows
if(res.rows.length > 0){ if(res.rows.length > 0){
Object.assign(curTemplate, res.rows[0]); Object.assign(curTemplate, res.rows[0]);
@ -161,7 +163,7 @@ const isStarted = ref([]);
const listRef = ref() const listRef = ref()
// //
const getTempResult = () => { const getTempResult = () => {
tempResult({ mainModelId: curTemplate.id, pageNum: 1, pageSize: 10000 }).then(res => { tempResult({ mainModelId: curTemplate.id, pageNum: 1, pageSize: 10000, ex1: curNode.id }).then(res => {
let rows = res.rows let rows = res.rows
childTempList.value.forEach(item => { childTempList.value.forEach(item => {
rows.forEach(el => { rows.forEach(el => {
@ -268,21 +270,6 @@ const onEdit = (index, item) => {
isEdit.value = true isEdit.value = true
} }
const modeType = ref('课标')
watch(() => props.type, (newVal) => {
if (newVal == 1) {
modeType.value = '课标'
}
if (newVal == 2) {
modeType.value = '教材'
}
if (newVal == 3) {
modeType.value = '考试'
}
}, { immediate: false })
// //
const params = reactive( const params = reactive(
{ {
@ -309,7 +296,7 @@ const againResult = async (index, item) => {
await nextTick() await nextTick()
childTempList.value[index].loading = true childTempList.value[index].loading = true
item.aiShow = true item.aiShow = true
params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value}${curNode.itemtitle}进行教学分析` params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value}${curNode.itemtitle}进行教学分析`
const { data } = await completion(params) const { data } = await completion(params)
childTempList.value[index].answer = getResult(data.answer); childTempList.value[index].answer = getResult(data.answer);
isStarted.value[index] = true isStarted.value[index] = true
@ -333,7 +320,7 @@ const getCompletion = async () => {
try { try {
item.loading = true item.loading = true
item.aiShow = true item.aiShow = true
params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value}${curNode.itemtitle}进行教学分析` params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value}${curNode.itemtitle}进行教学分析`
const { data } = await completion(params) const { data } = await completion(params)
item.answer = getResult(data.answer) item.answer = getResult(data.answer)
onSaveTemp(item) onSaveTemp(item)
@ -377,7 +364,8 @@ const onSaveTemp = (item) => {
mainModelId: curTemplate.id, mainModelId: curTemplate.id,
modelId: item.id, modelId: item.id,
examDocld: '', examDocld: '',
content: item.answer content: item.answer,
ex1: curNode.id
} }
tempSave(data).then(res => { }) tempSave(data).then(res => { })
} }
@ -399,9 +387,12 @@ emitter.on('onGetMain', () => {
const curNode = reactive({}) const curNode = reactive({})
const modeType = ref('')
onMounted(() => { onMounted(() => {
let data = sessionStore.get('subject.curNode') let data = sessionStore.get('subject.curNode')
Object.assign(curNode, data); Object.assign(curNode, data);
modeType.value = props.type == 1 ? '课标' : props.type == 2 ? '教材' : '考试'
getTemplateList() getTemplateList()
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}` let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
params.dataset_id = dataSetJson[jsonKey] params.dataset_id = dataSetJson[jsonKey]

View File

@ -2,18 +2,16 @@
<div class="page-template flex"> <div class="page-template flex">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<Left :curNode="curNode" :type="type" /> <Left :type="type" />
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<Right :curNode="curNode" :type="type" /> <Right :type="type" />
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</template> </template>
<script setup> <script setup>
import { reactive, onMounted } from 'vue'
import { sessionStore } from '@/utils/store'
import Left from './container/left.vue' import Left from './container/left.vue'
import Right from './container/right.vue' import Right from './container/right.vue'
@ -23,13 +21,6 @@ const props = defineProps({
default: 1 default: 1
}, },
}) })
const curNode = reactive({})
onMounted(() =>{
let data = sessionStore.get('subject.curNode')
Object.assign(curNode, data);
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -5,7 +5,7 @@
<el-popover ref="popoverRef" placement="right" trigger="hover" popper-class="popoverStyle" :tabindex="999" > <el-popover ref="popoverRef" placement="right" trigger="hover" popper-class="popoverStyle" :tabindex="999" >
<template #reference> <template #reference>
<div class="user-info"> <div class="user-info">
<el-image class="user-img" :src="dev_api + userStore.user.avatar" /> <el-image class="user-img" :src="userStore.user.avatar ==='/img/avatar-default.jpg' || userStore.user.avatar ==='/images/img-avatar.png' ? defaultUserImg : dev_api + userStore.user.avatar" />
<span>{{ userStore.user.nickName }}</span> <span>{{ userStore.user.nickName }}</span>
</div> </div>
</template> </template>
@ -59,12 +59,12 @@ import { ElMessageBox, ElMessage } from 'element-plus'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import pkc from "../../../../../package.json" import pkc from "../../../../../package.json"
import defaultUserImg from '@/assets/images/img-avatar.png'
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
const dev_api = ref(import.meta.env.VITE_APP_BASE_API) const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
const userStore = useUserStore() const userStore = useUserStore()
console.log(userStore)
const router = useRouter() const router = useRouter()
const currentRoute = ref('') const currentRoute = ref('')
const activeId = ref('/home') const activeId = ref('/home')

View File

@ -396,5 +396,12 @@ export const dataSetJson = {
"课标-高中-数学": "e03aa4fe9fd011ef91270242ac140006", "课标-高中-数学": "e03aa4fe9fd011ef91270242ac140006",
"课标-高中-地理": "270516829fd111efb13c0242ac140006", "课标-高中-地理": "270516829fd111efb13c0242ac140006",
"课标-高中-政治": "a2f0b247b85d11ef84290242ac140005", "课标-高中-政治": "a2f0b247b85d11ef84290242ac140005",
"教材-高中-语文": "cee3062a9fcf11efa6910242ac140006",
"教材-高中-生物": "fb5d01d59fd011ef9bb90242ac140006",
"教材-高中-历史": "f2f6c1fb9fd011ef98740242ac140006",
"教材-高中-英语": "e889fcac9fd011efb22a0242ac140006",
"教材-高中-数学": "e03aa4fe9fd011ef91270242ac140006",
"教材-高中-地理": "270516829fd111efb13c0242ac140006",
"教材-高中-政治": "a2f0b247b85d11ef84290242ac140005",
"鉴权": "ragflow-IwMDI1MGU2YTU3NjExZWZiNWEzMDI0Mm" "鉴权": "ragflow-IwMDI1MGU2YTU3NjExZWZiNWEzMDI0Mm"
} }

View File

@ -422,6 +422,19 @@ export const toLinkWeb = (path) => {
cookieData: { ...config } cookieData: { ...config }
}) })
} }
/**
* @description 外部跳转-web网页
* @param {*} url
*/
export const toLinkLeftWeb = (url) => {
// 通知主进程
ipcRenderer.send('openWindow', {
key: `win-${Date.now()}`,
fullPath: url
})
}
/** /**
* @description 外部跳转-web网页 * @description 外部跳转-web网页
* @param {*} path * @param {*} path

View File

@ -4,7 +4,7 @@
<div style="font-size: 18px; display: flex; flex-wrap: nowrap"> <div style="font-size: 18px; display: flex; flex-wrap: nowrap">
<div style="flex: 1"> <div style="flex: 1">
{{ classWorkAnalysis.title }}完成情况 {{ classWorkAnalysis.title }}完成情况
<el-tag :type="classWorkAnalysis.workclass" size="large" style="height: 25px">{{ <el-tag :type="classWorkAnalysis.workclass||'info'" size="large" style="height: 25px">{{
classWorkAnalysis.worktype classWorkAnalysis.worktype
}}</el-tag> }}</el-tag>
</div> </div>
@ -726,6 +726,7 @@ const msgHandle = (msg) => {
openDialog(data, false); openDialog(data, false);
break break
case MsgEnum.HEADS.MSG_slideFlapping: // case MsgEnum.HEADS.MSG_slideFlapping: //
console.log('切换页面-关闭窗口')
window.close() // window.close() //
break break
// case 'TIMAddRecvNewMsgCallback': // data=[] // case 'TIMAddRecvNewMsgCallback': // data=[]
@ -765,6 +766,7 @@ onMounted(() => {
// im // im
if (ChatWs.ws) { if (ChatWs.ws) {
console.log('socket监听消息')
ChatWs.watch((msg, e) => { ChatWs.watch((msg, e) => {
try { try {
msgHandle(JSON.parse(msg)) msgHandle(JSON.parse(msg))

View File

@ -38,7 +38,7 @@
<el-input v-model="ruleForm.username" placeholder="请输入手机号" /> <el-input v-model="ruleForm.username" placeholder="请输入手机号" />
</el-form-item> </el-form-item>
<el-form-item label="验证码" prop="smsCode" style="display: flex"> <el-form-item label="验证码" prop="smsCode" style="display: flex">
<el-input style="width:185px" v-model="ruleForm.smsCode" placeholder="请输入验证码" /><el-button style="margin-left:10px;width:100px" type="primary" @click="sendyzm">发送验证码</el-button> <el-input style="width:185px" v-model="ruleForm.smsCode" placeholder="请输入验证码" /><el-button style="margin-left:10px;width:100px" :disabled="codeName=='发送验证码'?false:true" type="primary" @click="sendyzm">{{ codeName }}</el-button>
</el-form-item> </el-form-item>
<el-form-item label="密码" prop="password" > <el-form-item label="密码" prop="password" >
<el-input autocomplete="on" type="password" v-model="ruleForm.password" placeholder="请输入密码" /> <el-input autocomplete="on" type="password" v-model="ruleForm.password" placeholder="请输入密码" />
@ -64,7 +64,7 @@
width="500" width="500"
style=" -webkit-app-region: no-drag;" style=" -webkit-app-region: no-drag;"
> >
<span>根据图片回答相关问题</span> <span>根据图片回答相关问题1</span>
<div style="display: flex;align-items: center;;margin-top:30px"> <div style="display: flex;align-items: center;;margin-top:30px">
<img :src="isPeopleImg" style="width:200px;height:60px;cursor: pointer;" alt="" srcset="" @click="refreshImg"> <img :src="isPeopleImg" style="width:200px;height:60px;cursor: pointer;" alt="" srcset="" @click="refreshImg">
<el-input v-model="ruleForm.imgCode" style="width: 250px;height:40px;margin-left:20px" placeholder="请根据图片填入答案" /> <el-input v-model="ruleForm.imgCode" style="width: 250px;height:40px;margin-left:20px" placeholder="请根据图片填入答案" />
@ -162,6 +162,14 @@ const sbmitImg=()=>{
ElMessage.success('短信发送成功') ElMessage.success('短信发送成功')
ruleForm.Code=res.data ruleForm.Code=res.data
isImg.value=false isImg.value=false
codeName.value=60
timer.value=setInterval(()=>{
codeName.value--
if(codeName.value==0){
codeName.value='发送验证码'
clearInterval(timer.value);
}
},1000)
} }
}) })
@ -182,14 +190,14 @@ const sendyzm=()=>{
isPeopleImg.value='data:image/jpg;base64,'+res.img isPeopleImg.value='data:image/jpg;base64,'+res.img
isImg.value=true isImg.value=true
resImg.imgData=res resImg.imgData=res
codeName.value=60 // codeName.value=60
timer.value=setInterval(()=>{ // timer.value=setInterval(()=>{
codeName.value-- // codeName.value--
if(codeName.value==0){ // if(codeName.value==0){
codeName.value='发送验证码' // codeName.value=''
clearInterval(timer.value); // clearInterval(timer.value);
} // }
},1000) // },1000)
}else{ }else{
ElMessage.error(res.msg) ElMessage.error(res.msg)
} }
@ -278,6 +286,9 @@ const setCookie = (name, value) => {
} }
const gotoLogin = () => { const gotoLogin = () => {
codeName.value='发送验证码' codeName.value='发送验证码'
if (timer.value){
clearInterval(timer.value);
}
if (ruleFormRef.value) ruleFormRef.value.resetFields() if (ruleFormRef.value) ruleFormRef.value.resetFields()
isRegister.value = true isRegister.value = true
} }

View File

@ -9,8 +9,8 @@
<el-icon class="item-icon"><Flag /></el-icon> <el-icon class="item-icon"><Flag /></el-icon>
<div class="content-header-title">{{item.name}}</div> <div class="content-header-title">{{item.name}}</div>
<div class="content-header-body"> <div class="content-header-body">
<div class="content-header-num">6</div> <div class="content-header-num">{{item.num}}</div>
<div class="content-header-text">分析结果</div> <div class="content-header-text">{{item.type}}</div>
</div> </div>
</div> </div>
</div> </div>
@ -83,14 +83,14 @@ import useUserStore from '@/store/modules/user' // 用户信息
import ChooseTextbook from '@/components/choose-textbook/index.vue' import ChooseTextbook from '@/components/choose-textbook/index.vue'
import KjListItem from '@/views/prepare/container/kj-list-item.vue' import KjListItem from '@/views/prepare/container/kj-list-item.vue'
import FileImage from '@/components/file-image/index.vue' import FileImage from '@/components/file-image/index.vue'
import {creatAPT, getSmarttalkPage} from '@/api/file' import {creatAPT, getSmarttalkPage, getModelInfo} from '@/api/file'
import {ArrowDown, Flag, Position} from '@element-plus/icons-vue' import {ArrowDown, Flag, Position} from '@element-plus/icons-vue'
import {asyncLocalFile, parseCataByNode} from "@/utils/talkFile"; import {asyncLocalFile, parseCataByNode} from "@/utils/talkFile";
import { dataSetJson } from '@/utils/comm' // id import { dataSetJson } from '@/utils/comm' // id
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import {listEntpcourse} from "@/api/teaching/classwork"; import {listEntpcourse} from "@/api/teaching/classwork";
import {addEntpcoursefileReturnId, getEntpcoursefile} from "@/api/education/entpcoursefile"; import {addEntpcoursefileReturnId, getEntpcoursefile} from "@/api/education/entpcoursefile";
import {createWindow, ipcMsgSend} from "@/utils/tool"; import {createWindow, toLinkLeftWeb} from "@/utils/tool";
import {ElMessage} from "element-plus"; import {ElMessage} from "element-plus";
import {PPTXFileToJson} from "@/AixPPTist/src/hooks/useImport"; import {PPTXFileToJson} from "@/AixPPTist/src/hooks/useImport";
import * as API_entpcoursefile from "@/api/education/entpcoursefile"; import * as API_entpcoursefile from "@/api/education/entpcoursefile";
@ -112,27 +112,33 @@ const collectRef = (key) => {
const tags = reactive([{ const tags = reactive([{
name: '课标分析', name: '课标分析',
path: '/model/curriculum', path: '/model/curriculum',
bgcolor: 'rgb(241,65,108)' bgcolor: 'rgb(241,65,108)',
type: '分析结果'
},{ },{
name: '教材分析', name: '教材分析',
path: '/model/teaching', path: '/model/teaching',
bgcolor: 'rgb(114,57,234)' bgcolor: 'rgb(114,57,234)',
type: '分析结果'
},{ },{
name: '考试分析', name: '考试分析',
path: '/model/examination', path: '/model/examination',
bgcolor: 'rgb(251,132,4)' bgcolor: 'rgb(251,132,4)',
type: '分析结果'
},{ },{
name: '素材设计', name: '素材设计',
path: '/model/aiKolors', path: '/model/aiKolors',
bgcolor: 'rgb(25,123,237)' bgcolor: 'rgb(25,123,237)',
type: '素材'
},{ },{
name: '作业设计', name: '作业设计',
path: '/model/newClassTaskAssign', path: '/model/newClassTaskAssign',
bgcolor: 'rgb(23,198,83)' bgcolor: 'rgb(23,198,83)',
type: '作业'
},{ },{
name: '框架设计', name: '框架设计',
path: '/model/design', path: '/model/design',
bgcolor: 'rgb(34,35,43)' bgcolor: 'rgb(34,35,43)',
type: '设计框架'
}]) }])
const tools = reactive([{ const tools = reactive([{
@ -155,6 +161,11 @@ const tools = reactive([{
name: '视频生成', name: '视频生成',
path: '', path: '',
img: 'aivideo' img: 'aivideo'
},{
name: '音乐生成',
path: 'https://ai.ysaix.com:7845/',
type: 'link',
img: 'aiyinyue'
}]) }])
const uploadData = ref({ const uploadData = ref({
@ -165,11 +176,13 @@ const uploadData = ref({
fileRoot: '备课' fileRoot: '备课'
}) })
const currentFileList = ref([]) const currentFileList = ref([])
//
onMounted(() => {
})
const gotoRoute = (item) => { const gotoRoute = (item) => {
if (item.type === 'link') {
//link
toLinkLeftWeb(item.path);
return
}
if (item.path) { if (item.path) {
if (item.path === '/model/aiKolors') { if (item.path === '/model/aiKolors') {
gotoAiKolors(item.path) gotoAiKolors(item.path)
@ -389,9 +402,38 @@ const changeBook = async(data) => {
let cata = parseCataByNode(data.node) let cata = parseCataByNode(data.node)
currentNode.value = data.node currentNode.value = data.node
uploadData.value.levelFirstId = cata[0] uploadData.value.levelFirstId = cata[0]
uploadData.value.levelSecondId = cata[1] uploadData.value.levelSecondId = cata[1]==null||cata[1]== undefined ? '' : cata[1]
uploadData.value.levelThirdId = cata[2] uploadData.value.levelThirdId = cata[2]==null||cata[2]== undefined ? '' : cata[2]
uploadData.value.textbookId = data.textBook.curBookId uploadData.value.textbookId = data.textBook.curBookId
getModelInfo({cataid: currentNode.value.id}).then(res=>{
console.log(res)
if (res&&res.data) {
tags.filter(item=>{
switch (item.name) {
case '课标分析':
item.num = res.data.kbs
break;
case '教材分析':
item.num = res.data.jcs
break;
case '考试分析':
item.num = res.data.kss
break;
case '素材设计':
item.num = res.data.scs
break;
case '作业设计':
item.num = res.data.zys
break;
case '框架设计':
item.num = res.data.kjs
break;
default:
break;
}
})
}
})
getSmarttalkPage({ getSmarttalkPage({
...uploadData.value, ...uploadData.value,
orderByColumn: 'createTime', orderByColumn: 'createTime',
@ -469,6 +511,11 @@ const changeClass = async (type, row, other) => {
break break
} }
} }
//
onMounted(() => {
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.model-wrap{ .model-wrap{

View File

@ -1131,6 +1131,7 @@ export default {
position: absolute; position: absolute;
right: 10px; right: 10px;
top: 4px; top: 4px;
z-index: 10;
} }
.prepare-center-jxkj{ .prepare-center-jxkj{
height: 100%; height: 100%;

View File

@ -11,7 +11,7 @@
<!-- 裁剪+效果 --> <!-- 裁剪+效果 -->
<div class="box"> <div class="box">
<div class="box_1"> <div class="box_1">
<img :src="dev_api + filePath" ref="image" /> <img :src="filePath" ref="image" />
</div> </div>
<!--裁剪完的图片--> <!--裁剪完的图片-->
@ -164,7 +164,7 @@ export default {
// //
onMounted(() => { onMounted(() => {
if (props.filePath) { if (props.filePath) {
dataFile.image.src = dev_api.value + props.filePath; dataFile.image.src = props.filePath;
copper(); copper();
} }
}); });

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="user-info-head" @click="editCropper()"> <div class="user-info-head" @click="editCropper()">
<img :src="dev_api + options.img" title="点击上传头像" class="img-circle img-lg" /> <img :src="options.img" title="点击上传头像" class="img-circle img-lg" />
<el-dialog <el-dialog
v-model="open" v-model="open"
append-to-body append-to-body
@ -23,6 +23,7 @@ import { uploadAvatar } from '@/api/system/user'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import CropperImage from './cropperImage.vue' import CropperImage from './cropperImage.vue'
import defaultUserImg from '@/assets/images/img-avatar.png'
const userStore = useUserStore() const userStore = useUserStore()
@ -32,7 +33,7 @@ const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
// //
const options = reactive({ const options = reactive({
img: userStore.user.avatar, // img: userStore.user.avatar ==='/img/avatar-default.jpg' || userStore.user.avatar ==='/images/img-avatar.png' ? defaultUserImg : dev_api.value + userStore.user.avatar, //
autoCrop: true, // autoCrop: true, //
autoCropWidth: 400, // autoCropWidth: 400, //
autoCropHeight: 400, // autoCropHeight: 400, //
@ -40,7 +41,6 @@ const options = reactive({
outputType: 'png', // PNG outputType: 'png', // PNG
previews: {} // previews: {} //
}) })
const cropper = ref(null) const cropper = ref(null)
/** 编辑头像 */ /** 编辑头像 */
@ -69,7 +69,7 @@ function uploadImg(data) {
/** 关闭窗口 */ /** 关闭窗口 */
function closeDialog() { function closeDialog() {
options.img = userStore.user.avatar options.img = userStore.user.avatar ==='/img/avatar-default.jpg' || userStore.user.avatar ==='/images/img-avatar.png' ? defaultUserImg : dev_api.value + userStore.user.avatar
options.visible = false options.visible = false
} }
const cancle = () => { const cancle = () => {

View File

@ -8,7 +8,7 @@
</el-form-item> </el-form-item>
<el-form-item label="所属学校" prop="identity"> <el-form-item label="所属学校" prop="identity">
<div style="display: flex;"> <div style="display: flex;">
<div>{{ userStore.DeptInfo.register.schoolName }}</div> <div>{{ userStore.DeptInfo.register ? userStore.DeptInfo.register.schoolName : '' }}</div>
<div> <div>
<el-button type="primary" link>更改学校</el-button> <el-button type="primary" link>更改学校</el-button>
</div> </div>

View File

@ -0,0 +1,159 @@
<template>
<el-dialog v-model="mode" :show-close="false" width="600" append-to-body destroy-on-close>
<template #header>
<div class="custom-header flex">
<span>{{ item.ex3 == '1' ? '请输入新的模板名称' : item.isAdd ? '添加提示词' : '编辑提示词' }}</span>
<i class="iconfont icon-guanbi" @click="mode = false"></i>
</div>
</template>
<div class="dialog-content" v-loading="loading">
<p class="small-tip" v-if="item && item.ex3 == '1'">*当前模板为系统预设不支持直接操作需要复制一份为自己的然后再操作</p>
<el-form :model="form" label-width="auto">
<el-form-item label="名称">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="提示词" v-if="item.ex3 == '1' ? false : true">
<el-input v-model="form.prompt" type="textarea" />
</el-form-item>
</el-form>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="mode = false">取消</el-button>
<el-button type="primary" @click="saveAdd">
确定
</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup>
import { ref, reactive, watch } from 'vue'
import { ElMessage } from 'element-plus'
import emitter from '@/utils/mitt';
import { addKeyWords, addChildTemp, editChildTemp } from '@/api/mode/index'
const mode = defineModel()
const props = defineProps({
modeType: {
type: Number,
default: 1
},
item: { //
type: Object,
default: () => {
return { ex3: '' }
}
},
})
const form = reactive({
name: '',
prompt: '',
})
watch(() => mode.value, (newVal) => {
if(newVal){
if (props.item.isAdd) {
form.name = ''
form.prompt = ''
}
else{
form.name = props.item?.name
form.prompt = props.item?.prompt
}
}
},{ deep: true})
const loading = ref(false)
const saveAdd = async () => {
loading.value = true
if (props.item.ex3 == '1') {
let id; // id id
if (props.item.isAdd) {
id = props.item.id
}
else{
// item item.parentId
id = props.item.parentId
}
try {
// copy
const { msg } = await addKeyWords({ name: form.name, id })
emitter.emit('onGetMain', props.item)
ElMessage.success(msg)
mode.value = false
} finally {
loading.value = false
}
} else {
if (props.item.isAdd) {
onAddChildTemp(props.item.id)
}
else {
try {
let data = JSON.parse(JSON.stringify(props.item))
data.name = form.name;
data.prompt = form.prompt
const { msg } = await editChildTemp(data)
emitter.emit('onGetChild', data )
ElMessage.success(msg)
mode.value = false
} finally {
loading.value = false
}
}
}
}
//
const onAddChildTemp = async (parentId) => {
//
let obj = {
name: form.name,
type: 2, // 2
sortNum: 1,
parentId,
lmType: 1,
model: props.modeType,
prompt: form.prompt,
ex1: props.item.ex1, //
ex2: props.item.ex2, //
ex3: '', //
}
try {
var { msg } = await addChildTemp(obj)
emitter.emit('onGetChild')
ElMessage.success(msg)
mode.value = false
} finally {
loading.value = false
}
}
</script>
<style lang="scss" scoped>
.custom-header {
justify-content: space-between;
align-items: center;
.icon-guanbi {
cursor: pointer;
font-weight: bold;
}
}
.small-tip {
text-align: left;
font-size: 12px;
margin-bottom: 15px;
color: #F56C6C;
}
</style>

View File

@ -2,13 +2,14 @@
<div class="container-left flex"> <div class="container-left flex">
<div class="left-header flex">教学模式</div> <div class="left-header flex">教学模式</div>
<div class="left-con" v-loading="loading"> <div class="left-con" v-loading="loading">
<div class="con-item" v-for="item in tempList" :key="item.id"> <el-empty v-if="!(tempList.length)" description="暂无数据" />
<div class="con-item" v-for="item in tempList" :key="item.id" :class=" actId == item.id ? 'item-act' : ''">
<div class="item-header flex"> <div class="item-header flex">
<span>{{ item.name }}</span> <span>{{ item.name }}</span>
<el-button type="primary" link @click="onSelect(item)">选择模式</el-button> <el-button type="primary" link @click="onSelect(item)">选择模式</el-button>
</div> </div>
<div class="content-list"> <div class="content-list">
<div class="item-list flex"> <div class="item-list flex" >
<el-card class="item-card" shadow="never" v-for="el in item.child" :key="el.id"> <el-card class="item-card" shadow="never" v-for="el in item.child" :key="el.id">
<p class="card-name"> <p class="card-name">
<el-text line-clamp="1" :title="el.name"> <el-text line-clamp="1" :title="el.name">
@ -29,27 +30,34 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from 'vue'; import { ref, reactive, onMounted, onUnmounted } from 'vue';
import emitter from '@/utils/mitt'; import emitter from '@/utils/mitt';
import { modelList } from '@/api/mode/index' import { modelList } from '@/api/mode/index'
import useUserStore from '@/store/modules/user'
import { sessionStore } from '@/utils/store'
const { user } = useUserStore()
// //
let list = [] let list = ref([])
const getTemplate = () => { const getTemplate = async (id) => {
modelList({ model: 1, type: 1, ex3: 1 }).then(res => { const { rows } = await modelList({ createUser: user.userId, model: 4, type: 1, pageNum: 1, pageSize: 10000})
list = res.rows list.value = rows
getChildTemp() if(list.value.length){
}) getChildTemp(id)
}
} }
// //
const actId = ref('')
const loading = ref(false) const loading = ref(false)
const tempList = ref([]) const tempList = ref([])
const getChildTemp = async () => { const getChildTemp = async (parentId) => {
tempList.value.length = 0
loading.value = true loading.value = true
for (let item of list) { for (let item of list.value) {
try { try {
const { rows } = await modelList({ model: 1, type: 2, parentId: item.id }) const { rows } = await modelList({ model: 4, type: 2, parentId: item.id })
tempList.value.push({ tempList.value.push({
id: item.id, id: item.id,
name: item.name, name: item.name,
@ -57,20 +65,52 @@ const getChildTemp = async () => {
}) })
} finally { } finally {
loading.value = false loading.value = false
}
actId.value = tempList.value[0].id
}
if(parentId){
const item = tempList.value.find(item => item.id == parentId)
emitter.emit('changeMode', item)
}
else{
emitter.emit('changeMode', tempList.value[0]) emitter.emit('changeMode', tempList.value[0])
} }
}
} }
//
emitter.on('onGetChild', async (data) => {
await getTemplate(data.parentId)
})
//
emitter.on('onGetMain', (item) => {
getTemplate(item.parentId)
})
// //
const emit = defineEmits(['']) const emit = defineEmits([''])
const onSelect = (item) =>{ const onSelect = (item) =>{
actId.value = item.id
emitter.emit('changeMode', item) emitter.emit('changeMode', item)
} }
const curNode = reactive({})
onMounted(() => { onMounted(() => {
let data = sessionStore.get('subject.curNode')
Object.assign(curNode, data);
getTemplate() getTemplate()
}) })
//
onUnmounted(() => {
emitter.off('onGetMain');
emitter.off('onGetChild');
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -96,7 +136,7 @@ onMounted(() => {
padding: 15px; padding: 15px;
box-sizing: border-box; box-sizing: border-box;
font-size: 14px; font-size: 14px;
overflow: auto;
.item-header { .item-header {
justify-content: space-between; justify-content: space-between;
margin-bottom: 5px; margin-bottom: 5px;
@ -104,10 +144,16 @@ onMounted(() => {
.con-item { .con-item {
margin-bottom: 20px; margin-bottom: 20px;
display: flex; display: flex;
flex-direction: column flex-direction: column;
padding: 10px;
} }
.item-list{ .item-list{
margin-bottom: 10px;
padding: 10px;
}
.item-act{
border: solid 1px #409eff;
border-radius: 5px;
} }
.item-card { .item-card {
width: 130px; width: 130px;

View File

@ -10,22 +10,32 @@
</el-button> </el-button>
</div> </div>
<div class="header-right"> <div class="header-right">
<el-button type="primary" :disabled="!(resultList.length)" @click="getCompletion">一键研读</el-button>
<el-button type="primary">生成大纲</el-button> <el-button type="primary">生成大纲</el-button>
<el-button type="danger" @click="pptDialog = true">生成PPT</el-button> <el-button type="danger" @click="pptDialog = true">生成PPT</el-button>
</div> </div>
</div> </div>
<div class="right-con flex"> <div class="right-con flex" ref="listRef">
<el-empty v-if="!(resultList.length)" description="暂无数据" />
<div class="con-item flex" v-for="(item, index) in resultList" :key="item.id" v-loading="item.loading"> <div class="con-item flex" v-for="(item, index) in resultList" :key="item.id" v-loading="item.loading">
<div class="item-top flex"> <div class="item-top flex">
<span>{{ item.name }}</span> <span>{{ item.name }}</span>
<el-button type="info" link> <el-popover placement="bottom-end" trigger="hover" popper-class="template-custom-popover">
<i class="iconfont icon-xiazai9"></i> <template #reference>
</el-button> <el-button link type="primary">
<i class="iconfont icon-shenglvehao"></i></el-button>
</template>
<template #default>
<el-button type="primary" link @click="editKeyWord(item, false)">编辑</el-button>
<el-button type="primary" link @click="removeItem(item, true)">移除</el-button>
</template>
</el-popover>
</div> </div>
<div class="item-bom"> <div class="item-bom">
<div class="item-prompt">{{ item.prompt }}</div> <div class="item-prompt">{{ item.prompt }}</div>
<div class="item-answer" v-if="item.answer"> <div class="item-answer" v-if="item.answer">
<div class="answer-text" v-html="item.answer"> <div class="answer-text">
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow" @complete="handleCompleteText($event,index)" @updateScroll="scrollToBottom($event,index)" />
</div> </div>
<div class="item-btn flex"> <div class="item-btn flex">
<el-button type="primary" link @click="againResult(index, item)"> <el-button type="primary" link @click="againResult(index, item)">
@ -51,19 +61,24 @@
<AdjustDialog v-model="isAdjust" :item="curItem" /> <AdjustDialog v-model="isAdjust" :item="curItem" />
<PptDialog @add-success="addAiPPT" :dataList="resultList" v-model="pptDialog"/> <PptDialog @add-success="addAiPPT" :dataList="resultList" v-model="pptDialog"/>
<progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" /> <progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" />
<!--添加编辑提示词-->
<keywordDialog v-model="isWordDialog" :item="curItem" />
</template> </template>
<script setup> <script setup>
import { ref, onMounted, onUnmounted, reactive } from 'vue' import { ref, onMounted, onUnmounted, reactive, nextTick } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import emitter from '@/utils/mitt' import emitter from '@/utils/mitt'
import EditDialog from './edit-dialog.vue' import EditDialog from './edit-dialog.vue'
import AdjustDialog from './adjust-dialog.vue' import AdjustDialog from './adjust-dialog.vue'
import progressDialog from './progress-dialog.vue' import progressDialog from './progress-dialog.vue'
import { completion, tempResult } from '@/api/mode/index.js' import { completion, tempResult, tempSave, removeChildTemp, editTempResult } from '@/api/mode/index.js'
// import { dataSetJson } from '@/utils/comm.js' // import { dataSetJson } from '@/utils/comm.js'
import * as commUtils from '@/utils/comm.js' import * as commUtils from '@/utils/comm.js'
import PptDialog from '@/views/prepare/container/pptist-dialog.vue' import PptDialog from '@/views/prepare/container/pptist-dialog.vue'
import keywordDialog from './keyword-dialog.vue'
import TypingEffect from '@/components/typing-effect/index.vue'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import {PPTXFileToJson} from '@/AixPPTist/src/hooks/useImport' // pptjson import {PPTXFileToJson} from '@/AixPPTist/src/hooks/useImport' // pptjson
@ -97,28 +112,155 @@ const pgDialog = reactive({ // 弹窗-进度条
}) })
emitter.on('changeMode', (item) => { emitter.on('changeMode', (item) => {
resultList.value = item.child resultList.value = item.child
// conversation()
getTempResult(item.id) getTempResult(item.id)
}) })
//
const getCompletion = async () => {
isStarted.value = new Array(resultList.length).fill(false)
isStarted.value[0] = true
resultList.value.forEach(item =>{
if(item.answer){
item.answer = ''
}
})
for (let item of resultList.value) {
try {
item.loading = true
item.aiShow = true
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}${curNode.itemtitle}进行教学分析`
const { data } = await completion(params)
item.answer = getResult(data.answer)
onSaveTemp(item)
} finally {
item.loading = false
}
}
}
const handleCompleteText = async (answer, index) =>{
if (index < resultList.value.length - 1) {
isStarted.value[index + 1] = true; //
}
if(isAgain.value){
try{
await editTempResult({ id: resultList.value[index].resultId, content: answer })
}finally{
isAgain.value = false
}
}
}
//
const onSaveTemp = (item) => {
if (item.answer == '') return
const data = {
mainModelId: item.parentId,
modelId: item.id,
examDocld: '',
content: item.answer,
ex1: curNode.id
}
tempSave(data).then(res => { })
}
const isWordDialog = ref(false)
const editKeyWord = (item, val) => {
/**
* isAdd: 子模板中的移除 为编辑false 头部删除 添加提示词为新增 true
*/
Object.assign(curItem, item)
curItem.isAdd = val
isWordDialog.value = true
}
//
const removeItem = async (item, isChild) => {
/**
* item: 当前操作的模板
* isChild: 子模板中的移除为 true
*/
if (item.ex3 != '1') {
ElMessageBox.confirm(
'确认是否移除?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).then(() => {
removeChildTemp(item.id).then(res => {
ElMessage.success('操作成功')
if (isChild) {
//
emitter.emit('onGetChild', item)
}
else {
//
// getTemplateList()
}
})
})
}
else {
// editKeyWord(item, !isChild)
}
}
const listRef = ref()
// //
const isStarted = ref([]);
const getTempResult = (id) => { const getTempResult = (id) => {
tempResult({ mainModelId: id }).then(res => { tempResult({ mainModelId: id }).then(res => {
let rows = res.rows let rows = res.rows
if (rows.length > 0) { if (rows.length > 0) {
isStarted.value = new Array(rows.length).fill(true)
resultList.value.forEach(item => { resultList.value.forEach(item => {
rows.forEach(el => { rows.forEach(el => {
if (item.id == el.modelId) { if (item.id == el.modelId) {
item.answer = el.content item.answer = getResult(el.content)
item.reultId = el.id item.resultId = el.id
} }
}) })
}) })
} }
}) })
} }
const scrollToBottom = (height,index) =>{
if (listRef.value) {
let sum = 0
let listDom = listRef.value.children
if(index == 0){
// 220
let screenHeight = window.innerHeight - 220
if(height > screenHeight){
listRef.value.scrollTop = (height - screenHeight + 50)
}
}
else{
for(let i = 0; i < index; i++){
sum += listDom[i].clientHeight
}
listRef.value.scrollTop = sum + height
}
}
}
// ### **
let getResult = (str) => {
let newStr = str.replace(/#+|(\*\*)/g, '');
return newStr
}
const params = reactive( const params = reactive(
{ {
@ -176,18 +318,7 @@ const addAiPPT = async(res) => {
} }
}) })
} }
const conversation = async () => {
for (let item of resultList.value) {
item.loading = true
try {
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}课标对${curNode.itemtitle}进行教学分析`
const { data } = await completion(params)
item.answer = data.answer
} finally {
item.loading = false
}
}
}
const isEdit = ref(false) const isEdit = ref(false)
// //
@ -196,17 +327,32 @@ const curIndex = ref(-1)
const curItem = reactive({}) const curItem = reactive({})
// //
const isAgain = ref(false)
const againResult = async (index, item) => { const againResult = async (index, item) => {
isAgain.value = true
isStarted.value[index] = false
resultList.value[index].answer = ''
if(index == 0){
listRef.value.scrollTop = 0
}else{
scrollToBottom(50, index)
}
try { try {
await nextTick()
resultList.value[index].loading = true resultList.value[index].loading = true
item.aiShow = true
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}课标对${curNode.itemtitle}进行教学分析` params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}课标对${curNode.itemtitle}进行教学分析`
const { data } = await completion(params) const { data } = await completion(params)
resultList.value[index].answer = data.answer resultList.value[index].answer = getResult(data.answer)
isStarted.value[index] = true
} finally { } finally {
resultList.value[index].loading = false resultList.value[index].loading = false
} }
} }
// //
const isAdjust = ref(false) const isAdjust = ref(false)
const onAdjust = (index, item) => { const onAdjust = (index, item) => {
@ -346,7 +492,7 @@ const toRousrceUrl = async(o) => {
if (o?.background?.image) await toRousrceUrl(o.background.image) if (o?.background?.image) await toRousrceUrl(o.background.image)
if(o?.elements){ if(o?.elements){
for (let element of o.elements) { for (let element of o.elements) {
await this.toRousrceUrl(element); await toRousrceUrl(element);
} }
} }
} }
@ -368,8 +514,10 @@ onUnmounted(() => {
emitter.off('changeMode') emitter.off('changeMode')
emitter.off('changeResult') emitter.off('changeResult')
emitter.off('changeAdjust') emitter.off('changeAdjust')
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -396,12 +544,42 @@ onUnmounted(() => {
.con-item { .con-item {
width: 100%; width: 100%;
flex-direction: column; flex-direction: column;
margin-bottom: 20px; padding-bottom: 20px;
position: relative;
padding-left: 15px;
box-sizing: border-box;
&::after{
content: '';
width: 15px;
height: 15px;
border-radius: 50%;
background: #409eff;
position: absolute;
left: -8px;
top: 5px;
}
&::before{
content: '';
width: 2px;
height: 100%;
background: #409eff;
position: absolute;
left: -1px;
top: 5px;
}
&:last-child{
&::before{
content: '';
width: 0
}
}
.item-top { .item-top {
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 5px; margin-bottom: 5px;
.icon-shenglvehao{
font-weight: bold
}
} }
.item-bom { .item-bom {
@ -446,3 +624,9 @@ onUnmounted(() => {
} }
} }
</style> </style>
<style>
.template-custom-popover {
width: 110px !important;
min-width: 110px !important;
}
</style>