This commit is contained in:
zdg 2024-12-13 12:46:51 +08:00
commit c4a15e9c53
15 changed files with 87 additions and 66 deletions

View File

@ -22,4 +22,4 @@ VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/'
VITE_APP_WS_URL = 'wss://prev.ysaix.com:7868' VITE_APP_WS_URL = 'wss://prev.ysaix.com:7868'
# 是否显示开发工具 # 是否显示开发工具
VITE_SHOW_DEV_TOOLS = 'true' VITE_SHOW_DEV_TOOLS = 'false'

View File

@ -55,26 +55,28 @@ 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) {
const slides = (res.rows || []).map(o => { if(!isUpdate){
if (!!o.datacontent) { const slides = (res.rows || []).map(o => {
const json = JSON.parse(o.datacontent) if (!!o.datacontent) {
!!json && (json.id = o.id) const json = JSON.parse(o.datacontent)
return json !!json && (json.id = o.id)
} return json
// 如果没有数据,默认空白页 }
return {id: o.id,elements:[],background:{type:"solid",color:"#fff"}} // 如果没有数据,默认空白页
}) return {id: o.id,elements:[],background:{type:"solid",color:"#fff"}}
})
// slidesStore.updateSlideIndex(0) // 下标0 为第一页
slidesStore.setSlides(slides) // 写入数据
}
// 活动列表处理 // 活动列表处理
const workList = (res.rows || []).map(o => o.activityContent) const workList = (res.rows || []).map(o => o.activityContent)
const workItem = [...res.rows] const workItem = res.rows ? [...res.rows] : []
// slidesStore.updateSlideIndex(0) // 下标0 为第一页
slidesStore.setSlides(slides) // 写入数据
// 写入作业列表数据 // 写入作业列表数据
slidesStore.setWorkList(workList) slidesStore.setWorkList(workList)
// 获取所有的pptlist的数据 // 获取所有的pptlist的数据
@ -111,7 +113,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)
@ -134,7 +135,9 @@ export class PPTApi {
const isAdd = !/^\d+$/.test(currentSlide.id) // 是否新增 const isAdd = !/^\d+$/.test(currentSlide.id) // 是否新增
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 // 下次更新数据
const params = { const params = {

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
} }
// const addIndex = this.slideIndex + 1
this.slides.splice(this.slideIndex, 0, ...slides) this.slides.splice(this.slideIndex, 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

@ -19,7 +19,8 @@
import { ref, reactive, onMounted, computed } from 'vue'; import { ref, reactive, onMounted, computed } from 'vue';
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import { getSmarttalkPage } from '@/api/file' import { getSmarttalkPage } from '@/api/file'
import { getFileSuffix, urlToBase64 } from '@/utils/ruoyi.js' import * as commUtils from '@/utils/comm.js'
import { getFileSuffix } from '@/utils/ruoyi.js'
const emit = defineEmits(['insertMaterial', 'close']) const emit = defineEmits(['insertMaterial', 'close'])
@ -62,12 +63,15 @@ const fileUrl = computed(() => (item) =>{
// //
const onInsert = async (item) =>{ const onInsert = async (item) =>{
const res = await fetch(item.fileFullPath)
const bolb = await res.blob()
const file = commUtils.blobToFile(bolb, item.fileShowName)
if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){ if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){
emit('insertMaterial',{ type: 'video', data: item.fileFullPath }) emit('insertMaterial',{ type: 'video', file })
} }
else{ else{
const base64 = await urlToBase64(item.fileFullPath) emit('insertMaterial',{ type: 'img', file })
emit('insertMaterial',{ type: 'img', data: base64 })
} }
} }

View File

@ -132,7 +132,7 @@
<Modal <Modal
v-model:visible="imgVisible" v-model:visible="imgVisible"
:width="1300"> :width="1300">
<TextCreateImg hasPPt @insertImg="(url: string) => { createImageElement(url); imgVisible = false }" /> <TextCreateImg hasPPt @insertImg="insertImg" />
</Modal> </Modal>
</div> </div>
</template> </template>
@ -165,6 +165,7 @@ import { PPTApi } from '../../../api'
import TextCreateImg from '@/components/ai-kolors/index.vue' import TextCreateImg from '@/components/ai-kolors/index.vue'
import { toPng } from 'html-to-image' // html-to-image import { toPng } from 'html-to-image' // html-to-image
const mainStore = useMainStore() const mainStore = useMainStore()
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore) const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
const { canUndo, canRedo } = storeToRefs(useSnapshotStore()) const { canUndo, canRedo } = storeToRefs(useSnapshotStore())
@ -280,21 +281,31 @@ const toggleNotesPanel = () => {
// //
interface MaterialParams { interface MaterialParams {
type: string, type: string,
data: string file: any
} }
const insertMaterial = (item: MaterialParams) =>{ const insertMaterial = (item: MaterialParams) =>{
const { type, data } = item const { type, file } = item
if(type == 'video'){ PPTApi.toRousrceUrl(file).then(data=>{
createVideoElement(data) if(type == 'video'){
} createVideoElement(data)
else{ }
createImageElement(data) else{
} createImageElement(data)
materiaVisible.value = false }
materiaVisible.value = false
})
} }
// //
const imgVisible = ref(false) const imgVisible = ref(false)
const insertImg = async (file: any) =>{
PPTApi.toRousrceUrl(file).then(data=>{
createImageElement(data)
imgVisible.value = false
})
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -302,9 +302,9 @@ const getData = async (data: WorkItem) => {
dialogVisible.value = false dialogVisible.value = false
} }
const upDateData = async () => { const upDateData = async () => {
// await PPTApi.updateSlide(paramData.value)
loadingActive.value = true loadingActive.value = true
await updateEntpcoursefileNew(paramData.value) await PPTApi.updateSlide(paramData.value)
// await updateEntpcoursefileNew(paramData.value)
const resource = sessionStore.get('curr.resource') const resource = sessionStore.get('curr.resource')
await PPTApi.getSlideList(resource.id) await PPTApi.getSlideList(resource.id)
const res = await homeworklist({ ids: paramData.value.activityContent, pageSize: 100 }) const res = await homeworklist({ ids: paramData.value.activityContent, pageSize: 100 })

View File

@ -482,10 +482,7 @@ export default {
// //
async saveImage(resultIndex, index, url, resultItem) { async saveImage(resultIndex, index, url, resultItem) {
if(this.hasPPt){
this.$emit('insertImg', url)
return
}
this.buttonStates[resultIndex][index].disabled = true; this.buttonStates[resultIndex][index].disabled = true;
this.buttonStates[resultIndex][index].text = "正在保存..."; this.buttonStates[resultIndex][index].text = "正在保存...";
const numberIndex = url.indexOf('filename='); const numberIndex = url.indexOf('filename=');
@ -495,6 +492,7 @@ export default {
try { try {
const blob = await this.getImageBlob(`https://ai.ysaix.com:7853/view?filename=${finalPath}&type=temp`); const blob = await this.getImageBlob(`https://ai.ysaix.com:7853/view?filename=${finalPath}&type=temp`);
const hash = CryptoJS.MD5(blob).toString(); const hash = CryptoJS.MD5(blob).toString();
const formData = new FormData(); const formData = new FormData();
@ -502,7 +500,10 @@ export default {
let file = new File([blob], `${resultItem}.png`, { let file = new File([blob], `${resultItem}.png`, {
type: 'image/png' type: 'image/png'
}) })
if(this.hasPPt){
this.$emit('insertImg', file)
return
}
// //
formData.append('md5', hash); formData.append('md5', hash);
formData.append('file', file); formData.append('file', file);

View File

@ -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(['curNode', '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 => {
@ -309,7 +311,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 +335,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 +379,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 => { })
} }

View File

@ -5,13 +5,13 @@
<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' ? defaultUserImg : dev_api + userStore.user.avatar" />
<span>{{ userStore.user.nickName }}</span> <span>{{ userStore.user.nickName }}</span>
</div> </div>
</template> </template>
<div class="head-aside"> <div class="head-aside">
<ul > <ul >
<li v-if="!isStadium" :class="computedregistertype==1 || computedregistertype==3?'auth-li':'auth-li pointer-events'" @click="onUserTo('/schoolCertification')" > <li v-if="isStadium() !== true" :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> <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-if="computedregistertype!=4">学校认证</span>
<span class="mlr-5" v-else>{{ userStore.DeptInfo.register.schoolName }}</span> <span class="mlr-5" v-else>{{ userStore.DeptInfo.register.schoolName }}</span>
@ -19,8 +19,8 @@
</li> </li>
<li v-if="computedregistertype!=4" :class="computedregistertype==1 || computedregistertype==2 ? '':'pointer-events'" @click="onUserTo('/joinSchool')">加入学校</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('/profile')">个人中心</li>
<li v-if="!isStadium" @click="onUserTo('/schoolManagement')">学校管理</li> <li v-if="isStadium() !== true" @click="onUserTo('/schoolManagement')">学校管理</li>
<li v-if="!isStadium" @click="onUserTo('/class')">班级中心</li> <li v-if="isStadium() !== true" @click="onUserTo('/class')">班级中心</li>
<li @click="logout">退出登录</li> <li @click="logout">退出登录</li>
</ul> </ul>
</div> </div>
@ -59,6 +59,7 @@ 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 || {}

View File

@ -44,7 +44,6 @@ const breadList = ref([])
watch( watch(
() => router.currentRoute.value, () => router.currentRoute.value,
(newValue) => { (newValue) => {
console.log(newValue)
const { showBread } = newValue.meta const { showBread } = newValue.meta
if (showBread) { if (showBread) {
isShowBack.value = true isShowBack.value = true

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

@ -4,7 +4,7 @@
<userAvatar /> <userAvatar />
<div class="info"> <div class="info">
<div class="info-name">{{ state.user.nickName }}</div> <div class="info-name">{{ state.user.nickName }}</div>
<div class="infomation"> <div class="infomation" v-if="isStadium() !== true" >
<selectClass v-if="!isSubject"/> <selectClass v-if="!isSubject"/>
</div> </div>
</div> </div>
@ -35,7 +35,7 @@ import { getUserProfile } from '@/api/system/user'
import pkc from "../../../../../package.json" import pkc from "../../../../../package.json"
// //
import selectClass from './components/selectClass.vue' import selectClass from './components/selectClass.vue'
import useUserStore from '@/store/modules/user'
const version = ref(pkc.version) const version = ref(pkc.version)
const activeTab = ref('userinfo') const activeTab = ref('userinfo')
@ -46,6 +46,12 @@ const state = reactive({
postGroup: {} postGroup: {}
}) })
const isStadium = () => {
let user = useUserStore().user
let roles = user.roles
return roles.some(item => item.roleKey === 'stadium')
}
const isSubject = ref(false) const isSubject = ref(false)
async function getUser() { async function getUser() {
getUserProfile().then((response) => { getUserProfile().then((response) => {

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' ? defaultUserImg : dev_api + userStore.user.avatar, //
autoCrop: true, // autoCrop: true, //
autoCropWidth: 400, // autoCropWidth: 400, //
autoCropHeight: 400, // autoCropHeight: 400, //

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

@ -96,7 +96,6 @@ const pgDialog = reactive({ // 弹窗-进度条
} }
}) })
emitter.on('changeMode', (item) => { emitter.on('changeMode', (item) => {
console.log(item, 'item')
resultList.value = item.child resultList.value = item.child
// conversation() // conversation()
getTempResult(item.id) getTempResult(item.id)
@ -106,7 +105,6 @@ emitter.on('changeMode', (item) => {
// //
const getTempResult = (id) => { const getTempResult = (id) => {
tempResult({ mainModelId: id }).then(res => { tempResult({ mainModelId: id }).then(res => {
console.log(res, 2000)
let rows = res.rows let rows = res.rows
if (rows.length > 0) { if (rows.length > 0) {
resultList.value.forEach(item => { resultList.value.forEach(item => {
@ -357,7 +355,6 @@ const toRousrceUrl = async(o) => {
const curNode = reactive({}) const curNode = reactive({})
onMounted(() => { onMounted(() => {
let data = sessionStore.get('subject.curNode') let data = sessionStore.get('subject.curNode')
console.log('data', sessionStore)
Object.assign(curNode, data); Object.assign(curNode, data);
courseObj.node = data courseObj.node = data