zhuhao_dev #114

Merged
zhuhao merged 8 commits from zhuhao_dev into main 2024-08-09 17:27:16 +08:00
14 changed files with 450 additions and 34 deletions

View File

@ -24,8 +24,8 @@ export default defineConfig({
server: { server: {
proxy: { proxy: {
'/dev-api': { '/dev-api': {
target: 'http://27.128.240.72:7865', // target: 'http://27.128.240.72:7865',
// target: 'http://192.168.2.52:7863', target: 'http://192.168.2.52:7863',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '') rewrite: (p) => p.replace(/^\/dev-api/, '')
} }

View File

@ -250,7 +250,9 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
onDownloadStarted: async ({ id, item, webContents }) => { onDownloadStarted: async ({ id, item, webContents }) => {
// Do something with the download id // Do something with the download id
}, },
onDownloadProgress: async ({ id, item, percentCompleted }) => {}, onDownloadProgress: async ({ id, item, percentCompleted }) => {
e.reply('download-file-default-prog' + fileName, percentCompleted)
},
onDownloadCompleted: async ({ id, item }) => { onDownloadCompleted: async ({ id, item }) => {
console.log('完成') console.log('完成')
e.reply('download-file-default' + fileName, true) e.reply('download-file-default' + fileName, true)

View File

@ -130,3 +130,46 @@ export function addStudentmainByNameArray(data) {
data: data data: data
}) })
} }
//新增课程预约
export function addSmartClassReserv(data) {
return request({
url: '/smarttalk/classReserv/addSmartClassReserv',
method: 'post',
data: data
})
}
//修改课程预约
export function updateSmartClassReserv(data) {
return request({
url: '/smarttalk/classReserv/updateSmartClassReserv',
method: 'post',
data: data
})
}
//查询课程预约
export function getSelfReserv() {
return request({
url: '/smarttalk/classReserv/getSelfReserv',
method: 'get'
})
}
export function deleteSmartReserv(id) {
return request({
url: '/smarttalk/classReserv/' + id,
method: 'delete'
})
}
export function startClass(id) {
return request({
url: '/smarttalk/classReserv/startClass',
method: 'get',
params: {id}
})
}
export function endClass(id) {
return request({
url: '/smarttalk/classReserv/endClass',
method: 'get',
params: {id}
})
}

View File

@ -35,6 +35,7 @@
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item @click="changePage('/profile')">个人中心</el-dropdown-item> <el-dropdown-item @click="changePage('/profile')">个人中心</el-dropdown-item>
<el-dropdown-item @click="changePage('/classReserv')">课程预约</el-dropdown-item>
<el-dropdown-item @click="changePage('/class')">班级中心</el-dropdown-item> <el-dropdown-item @click="changePage('/class')">班级中心</el-dropdown-item>
<el-dropdown-item divided command="logout"> <el-dropdown-item divided command="logout">
<span>退出登录</span> <span>退出登录</span>

View File

@ -20,7 +20,7 @@ export function shareStorePlugin({store}) {
function stateSync(store) { function stateSync(store) {
const storeName = store.$id const storeName = store.$id
const jsonStr = JSON.stringify(store.$state) const jsonStr = JSON.stringify(store.$state)
// console.log('state-change', jsonStr, storeName) console.log('state-change', jsonStr, storeName)
// 通知主线程更新 // 通知主线程更新
ipcRenderer?.invoke('pinia-state-change', storeName, jsonStr) ipcRenderer?.invoke('pinia-state-change', storeName, jsonStr)
} }

View File

@ -45,6 +45,12 @@ export const constantRoutes = [
name: 'profile', name: 'profile',
meta: {title: '个人中心'} meta: {title: '个人中心'}
}, },
{
path: '/classReserv',
component: () => import('@/views/classManage/classReserv.vue'),
name: 'classReserv',
meta: {title: '课程预约'}
},
{ {
path: '/class', path: '/class',
component: () => import('@/views/classManage/index.vue'), component: () => import('@/views/classManage/index.vue'),

View File

@ -0,0 +1,85 @@
<template>
<el-container class="class-reserv-wrap">
<div class="class-reserv-tabs">
<el-segmented v-model="tabActive" block :options="tabOptions" size="large" />
</div>
<div class="class-reserv-body">
<reserv-item
v-for="(item, index) in activeDataList"
v-show="tabActive === '进行中'"
:key="index"
:item="item"
@open-edit="reservDialog.openDialog(item)"
@delete-reserv="deleteReserv(item)"
></reserv-item>
<reserv-item
v-for="(item, index) in doneDataList"
v-show="tabActive === '已结束'"
:key="index"
:item="item"
></reserv-item>
</div>
<reserv ref="reservDialog"></reserv>
</el-container>
</template>
<script setup>
import { ref, onMounted, computed, watch } from 'vue'
import { getSelfReserv } from '@/api/classManage'
import ReservItem from '@/views/classManage/reserv-item.vue'
import Reserv from '@/views/prepare/container/reserv.vue'
import { useToolState } from '@/store/modules/tool'
const reservDialog = ref(null)
const tabOptions = ref(['进行中', '已结束'])
const tabActive = ref('进行中')
const dataList = ref([])
const activeDataList = computed(() => {
return dataList.value.filter((item) => {
return item.status !== '已结束'
})
})
const deleteReserv = (item) => {
dataList.value = dataList.value.filter((is) => {
return is.id !== item.id
})
}
const doneDataList = computed(() => {
return dataList.value.filter((item) => {
return item.status === '已结束'
})
})
const toolStore = useToolState()
watch(
() => toolStore.isToolWin,
(newD, oldD) => {
getSelfReserv().then((res) => {
dataList.value = [...res.data]
})
}
)
onMounted(() => {
getSelfReserv().then((res) => {
dataList.value = res.data
})
})
</script>
<style scoped lang="scss">
.class-reserv-wrap {
height: 100%;
display: flex;
flex-direction: column;
padding: 15px 30px;
.class-reserv-tabs {
width: 30%;
text-align: left;
}
.class-reserv-body {
height: 100%;
flex: 1;
overflow: auto;
padding: 10px 0;
}
}
</style>

View File

@ -0,0 +1,133 @@
<template>
<div class="class-reserv-item">
<div class="class-reserv-item-img">
<img :src="basePath + item.bookImg" alt="封面" />
</div>
<div class="class-reserv-item-body">
<div class="class-reserv-item-title1">
<label>{{ item.className }}</label>
<el-tag style="margin-left: 5px" type="primary"> {{ item.classType }}</el-tag>
<el-tag style="margin-left: 5px" type="primary"> {{ item.classSubject }}</el-tag>
</div>
<div class="class-reserv-item-title2">
{{ item.classDay }}&nbsp;{{ item.startTime }} ~ {{ item.classDay }}&nbsp;{{ item.endTime }}
{{ item.createUserName }}老师
</div>
<div class="class-reserv-item-title3">
<span v-for="(tag, index) in item.classItemList" :key="index" style="margin-left: 5px">
{{ index === 0 ? tag.name : '、' + tag.name }}</span
>
</div>
</div>
<div class="class-reserv-item-tool">
<el-button v-if="item.status !== '已结束'" type="primary" @click="startClassR(item)"
>上课</el-button
>
<el-button v-if="item.status === '未开始'" @click="openEdit">编辑</el-button>
<!-- <el-button v-if="item.status === '上课中'" type="info" @click="endClassR(item)"
>下课</el-button
>-->
<el-button type="danger" @click="deleteReserv">删除</el-button>
</div>
</div>
</template>
<script setup>
import { useToolState } from '@/store/modules/tool'
import useUserStore from '@/store/modules/user'
import { createWindow } from '@/utils/tool'
import { deleteSmartReserv, startClass, endClass } from '@/api/classManage'
import { ElMessage } from 'element-plus'
import { listEntpcourse } from '@/api/teaching/classwork'
const emit = defineEmits(['openEdit', 'deleteReserv'])
const props = defineProps({
item: {
type: Object,
default: () => {}
}
})
const basePath = import.meta.env.VITE_APP_BUILD_BASE_PATH
const openEdit = () => {
emit('openEdit', props.item)
}
const deleteReserv = () => {
deleteSmartReserv([props.item.id]).then((res) => {
if (res.data === true) {
ElMessage({
message: '删除成功',
type: 'success'
})
emit('deleteReserv', props.item)
}
})
}
const startClassR = (item) => {
startClass(item.id).then((res) => {
if (res.data === true) {
item.status = '上课中'
openLesson()
}
})
}
const toolStore = useToolState()
// -
const openLesson = () => {
if (toolStore.isToolWin) return ElMessage.error('您当前已开始上课,请勿重复操作')
startClass(props.item.id)
listEntpcourse({
evalid: props.item.ex2,
edituserid: useUserStore().user.userId,
pageSize: 500
}).then(res=>{
if (res.rows[0].id) {
createWindow('tool-sphere', { url: '/tool/sphere?entpcourseid=' + res.rows[0].id + "&reservId=" + props.item.id })
}
})
}
const endClassR = (item) => {
endClass(item.id).then((res) => {
if (res.data === true) {
ElMessage({
message: '下课成功',
type: 'success'
})
item.status = '已结束'
}
})
}
</script>
<style scoped lang="scss">
.class-reserv-item {
display: flex;
background-color: white;
border-radius: 10px;
padding: 5px;
margin-bottom: 10px;
.class-reserv-item-img {
width: 80px;
padding-left: 20px;
img {
width: 100%;
}
}
.class-reserv-item-body {
flex: 1;
display: flex;
flex-direction: column;
text-align: left;
padding-left: 30px;
font-size: 14px;
.class-reserv-item-title1 {
flex: 1;
label {
font-size: 20px;
font-weight: bold;
}
}
}
.class-reserv-item-tool {
margin-left: 15px;
display: flex;
align-items: center;
}
}
</style>

View File

@ -77,20 +77,42 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup> <script setup>
import { ref, defineExpose, onMounted, reactive, computed } from 'vue' import { ref, defineExpose, onMounted, reactive, computed, watch } from 'vue'
import { listClassmain } from '@/api/classManage' import { addSmartClassReserv, updateSmartClassReserv, listClassmain } from '@/api/classManage'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { ElMessage } from 'element-plus'
const emit = defineEmits(['addSuccess'])
const props = defineProps({
bookId: {
type: Number,
default: 0
},
currentNode: {
type: Object,
default: () => {
return {}
}
}
})
const ruleFormDialog = ref(null) const ruleFormDialog = ref(null)
const nowType = ref('add')
const userStore = useUserStore().user const userStore = useUserStore().user
const centerDialogVisible = ref(false) const centerDialogVisible = ref(false)
const form = reactive({ const form = reactive({
name: '', name: '',
type: '常规课', type: '常规课',
day: '', day: '',
time: '', time: [],
resource: [], resource: [],
classRoom: '' classRoom: ''
}) })
const updateForm = ref({})
watch(
() => props.currentNode,
(newValue, oldValue) => {
form.name = newValue.label
}
)
const ruleForm = reactive({ const ruleForm = reactive({
name: [{ required: true, message: '请输入课程名称', trigger: 'blur' }], name: [{ required: true, message: '请输入课程名称', trigger: 'blur' }],
day: [{ required: true, message: '请选择上课日期', trigger: 'change' }], day: [{ required: true, message: '请选择上课日期', trigger: 'change' }],
@ -121,17 +143,29 @@ const locationOptions = [
const locationMessage = computed(() => { const locationMessage = computed(() => {
return locationOptions.find((item) => item.value === form.type).message return locationOptions.find((item) => item.value === form.type).message
}) })
const openDialog = () => { const openDialog = (data) => {
if (data) {
updateForm.value = data
nowType.value = 'update'
form.name = data.className
form.type = data.classType
form.day = data.classDay
form.time = [data.startTime, data.endTime]
form.resource = data.classList.split(',').map((item) => parseInt(item))
form.classRoom = data.classRoom
}
centerDialogVisible.value = true centerDialogVisible.value = true
} }
const closeDialog = () => { const closeDialog = () => {
ruleFormDialog.value.resetFields() ruleFormDialog.value.resetFields()
centerDialogVisible.value = false centerDialogVisible.value = false
form.name = props.currentNode.label
} }
const classList = ref([]) const classList = ref([])
onMounted(() => { onMounted(() => {
listClassmain({ classuserid: userStore.userId, pageSize: 100, status: 'open' }).then( listClassmain({ classuserid: userStore.userId, pageSize: 100, status: 'open' }).then(
(response) => { (response) => {
console.log(response)
classList.value = [...response.rows] classList.value = [...response.rows]
} }
) )
@ -141,10 +175,73 @@ const submitForm = async () => {
if (!formEl) return if (!formEl) return
await formEl.validate((valid) => { await formEl.validate((valid) => {
if (valid) { if (valid) {
if (nowType.value === 'update') {
updateClassReserv(form)
} else {
addClassReserv(form)
}
centerDialogVisible.value = false centerDialogVisible.value = false
} }
}) })
} }
const updateClassReserv = (formData) => {
let ids = formData.resource.join(',')
let param = {
className: formData.name,
classType: formData.type,
classDay: formData.day,
startTime: formData.time[0],
endTime: formData.time[1],
classList: ids,
classRoom: formData.classRoom,
id: updateForm.value.id
}
updateSmartClassReserv(param).then((res) => {
if (res.data === true) {
closeDialog()
ElMessage({
type: 'success',
message: '修改预约成功!'
})
Object.assign(updateForm.value, param)
} else {
ElMessage({
type: 'error',
message: res.message
})
}
})
}
const addClassReserv = (formData) => {
let ids = formData.resource.join(',')
let param = {
className: formData.name,
classType: formData.type,
classDay: formData.day,
startTime: formData.time[0],
endTime: formData.time[1],
classList: ids,
classRoom: formData.classRoom,
classSubject: props.currentNode.edusubject,
ex1: props.bookId,
ex2: props.currentNode.id
}
addSmartClassReserv(param).then((res) => {
if (res.data === true) {
closeDialog()
ElMessage({
type: 'success',
message: '预约成功!'
})
emit('addSuccess')
} else {
ElMessage({
type: 'error',
message: res.message
})
}
})
}
defineExpose({ defineExpose({
openDialog, openDialog,
closeDialog closeDialog

View File

@ -3,8 +3,9 @@
<ChooseTextbook @change-book="nodeClick" @node-click="nodeClick" /> <ChooseTextbook @change-book="nodeClick" @node-click="nodeClick" />
<div class="page-right"> <div class="page-right">
<div class="header-top flex"> <div class="header-top flex">
<div class="textbook-img" @click="navtoPdf"> <div class="textbook-img">
<el-image style="width: 80px; height: 110px" :src="curBookImg" /> <el-image style="width: 80px; height: 110px" :src="curBookImg" @click="navtoPdf"/>
<el-progress v-if="downloadNum>0 && downloadNum < 100" style="position:absolute;left: 0;z-index: 999;" type="circle" :percentage="downloadNum" />
</div> </div>
<div class="top-item"> <div class="top-item">
<el-button class="btn" @click="handleOutLink('standard')">课标研读</el-button> <el-button class="btn" @click="handleOutLink('standard')">课标研读</el-button>
@ -12,9 +13,11 @@
<el-button class="btn" @click="handleOutLink('gk')">高考研读</el-button> <el-button class="btn" @click="handleOutLink('gk')">高考研读</el-button>
<el-button class="btn" @click="handleOutLink('aiModel')">教学大模型</el-button> <el-button class="btn" @click="handleOutLink('aiModel')">教学大模型</el-button>
</div> </div>
<el-button type="primary" class="to-class-btn" @click="openLesson"> <el-button :type="!curClassReserv.id?'info' : 'primary'" :disabled="!curClassReserv.id" class="to-class-btn" @click="openLesson">
<i class="iconfont icon-lingdang"></i>上课</el-button <label><i class="iconfont icon-lingdang"></i>上课</label>
> <label>{{ curClassReserv.classDay }} {{ getWeekday1(curClassReserv.classDay) }}</label>
<label>{{ curClassReserv.startTime }}-{{ curClassReserv.endTime }}</label>
</el-button>
<div class="top-zoom-style"></div> <div class="top-zoom-style"></div>
</div> </div>
<div class="prepare-body-header"> <div class="prepare-body-header">
@ -60,7 +63,7 @@
<uploadDialog v-model="isDialogOpen" @submit-file="submitFile" /> <uploadDialog v-model="isDialogOpen" @submit-file="submitFile" />
<SetHomework v-model="setDialog" :entpcourseid="entpcourseid" :row="row" @on-close="closeHomework" /> <SetHomework v-model="setDialog" :entpcourseid="entpcourseid" :row="row" @on-close="closeHomework" />
</div> </div>
<reserv ref="reservDialog"></reserv> <reserv ref="reservDialog" @add-success="initReserv" :current-node="currentNode" :book-id="uploadData.textbookId"></reserv>
</template> </template>
<script setup> <script setup>
import { Check } from '@element-plus/icons-vue' import { Check } from '@element-plus/icons-vue'
@ -87,7 +90,9 @@ import outLink from '@/utils/linkConfig'
import { createWindow } from '@/utils/tool' import { createWindow } from '@/utils/tool'
import { uniqBy, cloneDeep } from 'lodash' import { uniqBy, cloneDeep } from 'lodash'
import { delClasswork, addEntpcourse } from '@/api/teaching/classwork' import { delClasswork, addEntpcourse } from '@/api/teaching/classwork'
const fs = require('fs'); import { getSelfReserv, startClass } from '@/api/classManage'
const toolStore = useToolState()
const fs = require('fs')
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
export default { export default {
@ -114,6 +119,8 @@ export default {
currentNode: {}, currentNode: {},
currentFileList: [], currentFileList: [],
curBookPath: '', curBookPath: '',
curClassReserv: {},
downloadNum: 0,
lastAsyncAllTime: '', lastAsyncAllTime: '',
uploadData: { uploadData: {
textbookId: null, textbookId: null,
@ -155,15 +162,33 @@ export default {
this.callback(param) this.callback(param)
}) })
this.lastAsyncAllTime = localStorage.getItem('lastAsyncAllTime') this.lastAsyncAllTime = localStorage.getItem('lastAsyncAllTime')
this.initReserv()
},
mounted() {
this.$watch(()=>toolStore.isToolWin,(newD, oldD)=>{
setTimeout(this.initReserv, 500)
})
}, },
mounted() { },
activated() { activated() {
if (this.uploadData.textbookId !== null) { if (this.uploadData.textbookId !== null) {
this.asyncAllFile() this.asyncAllFile()
this.initHomeWork() this.initHomeWork()
this.initReserv()
} }
}, },
methods: { methods: {
initReserv() {
getSelfReserv().then((res) => {
let list = res.data.filter((item) => {
return item.status !== '已结束'
})
if (list.length > 0) {
this.curClassReserv = list[list.length - 1]
}else {
this.curClassReserv = {}
}
})
},
getBookPathFromServer() { getBookPathFromServer() {
let fileName = this.curBookPath let fileName = this.curBookPath
if (!fileName) return if (!fileName) return
@ -180,6 +205,8 @@ export default {
url: filePath, url: filePath,
fileName: fileName fileName: fileName
}) })
ipcRenderer.removeListener('download-file-default-prog' + fileName, this.progDownFile)
ipcRenderer.on('download-file-default-prog' + fileName, this.progDownFile)
ipcRenderer.once('download-file-default' + fileName, (e, isSuccess) => { ipcRenderer.once('download-file-default' + fileName, (e, isSuccess) => {
if (isSuccess === true) { if (isSuccess === true) {
resolve(appRootFilePath + fileName) resolve(appRootFilePath + fileName)
@ -196,6 +223,9 @@ export default {
}) })
}) })
}, },
progDownFile(e, num) {
this.downloadNum = num
},
createFile() { createFile() {
creatPPT(this.currentNode.label + '.pptx', this.uploadData).then((res) => { creatPPT(this.currentNode.label + '.pptx', this.uploadData).then((res) => {
this.currentFileList.unshift(res.resData) this.currentFileList.unshift(res.resData)
@ -469,6 +499,11 @@ export default {
this.currentFileList = cloneDeep(ary) this.currentFileList = cloneDeep(ary)
}) })
}, },
getWeekday1(date) {
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
const weekday = new Date(date).getDay()
return weekdays[weekday]
},
// //
openSet(row) { openSet(row) {
this.row = row this.row = row
@ -492,18 +527,18 @@ export default {
// PDF- // PDF-
async navtoPdf() { async navtoPdf() {
const toolStore = useToolState()
if (toolStore.isPdfWin) return this.$message.error('您当前已打开课本,请勿重复操作') if (toolStore.isPdfWin) return this.$message.error('您当前已打开课本,请勿重复操作')
let path = await this.getBookPathFromServer() let path = await this.getBookPathFromServer()
path=path.replace(/^.*[\\\/]/, ''); createWindow('open-PDF', {
// console.log(this.uploadData.textbookId) url: '/classBegins/index?textbookId=' + this.uploadData.textbookId + '&path=' + path
createWindow('open-PDF', { url: '/classBegins/index?textbookId='+this.uploadData.textbookId+'&path='+ path }) })
}, },
// - // -
openLesson() { openLesson() {
const toolStore = useToolState() const toolStore = useToolState()
if (toolStore.isToolWin) return this.$message.error('您当前已开始上课,请勿重复操作') if (toolStore.isToolWin) return this.$message.error('您当前已开始上课,请勿重复操作')
createWindow('tool-sphere', { url: '/tool/sphere?entpcourseid=' + this.entpcourseid +'&label=' + this.currentNode.label }) startClass(this.curClassReserv.id)
createWindow('tool-sphere', { url: '/tool/sphere?entpcourseid=' + this.entpcourseid +'&label=' + this.currentNode.label+ "&reservId=" + this.curClassReserv.id })
} }
} }
} }
@ -578,9 +613,14 @@ export default {
overflow: hidden; overflow: hidden;
margin-right: 20px; margin-right: 20px;
z-index: 1; z-index: 1;
position: relative;
&:hover { &:hover {
cursor: pointer; cursor: pointer;
} }
:deep(.el-progress-circle) {
width: 90px!important;
background-color: white;
}
} }
.top-item { .top-item {
@ -617,7 +657,13 @@ export default {
margin-left: 25px; margin-left: 25px;
font-size: 18px; font-size: 18px;
z-index: 1; z-index: 1;
& label:hover {
cursor: pointer !important;
}
& > :deep(span) {
flex-direction: column !important;
font-size: 12px;
}
.icon-lingdang { .icon-lingdang {
margin-right: 5px; margin-right: 5px;
color: #ffffff; color: #ffffff;

View File

@ -35,7 +35,8 @@
<script setup> <script setup>
// electron // electron
import { onMounted, ref, reactive, watchEffect } from 'vue' import { onMounted, ref, reactive, watchEffect } from 'vue'
import { useRoute } from 'vue-router';
import { endClass } from '@/api/classManage'
import logo from '@root/resources/icon.png' // logo import logo from '@root/resources/icon.png' // logo
import boardVue from './components/board.vue' // - import boardVue from './components/board.vue' // -
import sideVue from './components/side.vue' // - import sideVue from './components/side.vue' // -
@ -44,6 +45,7 @@ import vDrag from './directive/drag' // 自定义指令-拖拽
import vIgnore from './directive/ignore' // -穿 import vIgnore from './directive/ignore' // -穿
import { useToolState } from '@/store/modules/tool' // - import { useToolState } from '@/store/modules/tool' // -
import { ipcMsgSend, ipcHandle, ipcMain, ipcMsgInvoke } from '@/utils/tool' // import { ipcMsgSend, ipcHandle, ipcMain, ipcMsgInvoke } from '@/utils/tool' //
const route = useRoute();
const tabActive = ref('select') // const tabActive = ref('select') //
const isFold = ref(false) // const isFold = ref(false) //
const isDrag = ref(false) // const isDrag = ref(false) //
@ -118,6 +120,7 @@ const sideChange = o => {
break break
case 'over': // case 'over': //
toolStore.isToolWin = false toolStore.isToolWin = false
endClass(route.query.reservId)
ipcMsgSend('tool-sphere:close') ipcMsgSend('tool-sphere:close')
break break
} }