zhuhao_dev #114

Merged
zhuhao merged 8 commits from zhuhao_dev into main 2024-08-09 17:27:16 +08:00
9 changed files with 81 additions and 34 deletions
Showing only changes of commit c2876ff983 - Show all commits

View File

@ -20,7 +20,7 @@ export function shareStorePlugin({store}) {
function stateSync(store) {
const storeName = store.$id
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)
}

View File

@ -24,10 +24,11 @@
</template>
<script setup>
import { ref, onMounted, computed } from 'vue'
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('进行中')
@ -48,6 +49,15 @@ const doneDataList = computed(() => {
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

View File

@ -24,16 +24,20 @@
>上课</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 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: {
@ -59,15 +63,26 @@ const deleteReserv = () => {
const startClassR = (item) => {
startClass(item.id).then((res) => {
if (res.data === true) {
ElMessage({
message: '上课成功',
type: 'success'
})
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) {

View File

@ -81,6 +81,7 @@ import { ref, defineExpose, onMounted, reactive, computed, watch } from 'vue'
import { addSmartClassReserv, updateSmartClassReserv, listClassmain } from '@/api/classManage'
import useUserStore from '@/store/modules/user'
import { ElMessage } from 'element-plus'
const emit = defineEmits(['addSuccess'])
const props = defineProps({
bookId: {
type: Number,
@ -232,6 +233,7 @@ const addClassReserv = (formData) => {
type: 'success',
message: '预约成功!'
})
emit('addSuccess')
} else {
ElMessage({
type: 'error',

View File

@ -3,8 +3,9 @@
<ChooseTextbook @change-book="nodeClick" @node-click="nodeClick" />
<div class="page-right">
<div class="header-top flex">
<div class="textbook-img" @click="navtoPdf">
<el-image style="width: 80px; height: 110px" :src="curBookImg" />
<div class="textbook-img">
<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 class="top-item">
<el-button class="btn" @click="handleOutLink('standard')">课标研读</el-button>
@ -12,7 +13,7 @@
<el-button class="btn" @click="handleOutLink('gk')">高考研读</el-button>
<el-button class="btn" @click="handleOutLink('aiModel')">教学大模型</el-button>
</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">
<label><i class="iconfont icon-lingdang"></i>上课</label>
<label>{{ curClassReserv.classDay }} {{ getWeekday1(curClassReserv.classDay) }}</label>
<label>{{ curClassReserv.startTime }}-{{ curClassReserv.endTime }}</label>
@ -104,7 +105,7 @@
@on-close="closeHomework"
/>
</div>
<reserv ref="reservDialog" :current-node="currentNode" :book-id="uploadData.textbookId"></reserv>
<reserv ref="reservDialog" @add-success="initReserv" :current-node="currentNode" :book-id="uploadData.textbookId"></reserv>
</template>
<script setup>
import { Check } from '@element-plus/icons-vue'
@ -131,7 +132,8 @@ import outLink from '@/utils/linkConfig'
import { createWindow } from '@/utils/tool'
import { uniqBy, cloneDeep } from 'lodash'
import { delClasswork, addEntpcourse } from '@/api/teaching/classwork'
import { getSelfReserv } from '@/api/classManage'
import { getSelfReserv, startClass } from '@/api/classManage'
const toolStore = useToolState()
const fs = require('fs')
const { ipcRenderer } = window.electron || {}
@ -161,6 +163,7 @@ export default {
currentWorkList: [],
curBookPath: '',
curClassReserv: {},
downloadNum: 0,
lastAsyncAllTime: '',
uploadData: {
textbookId: null,
@ -202,24 +205,33 @@ export default {
this.callback(param)
})
this.lastAsyncAllTime = localStorage.getItem('lastAsyncAllTime')
this.initReserv()
},
mounted() {
getSelfReserv().then((res) => {
let list = res.data.filter((item) => {
return item.status !== '已结束'
})
if (list.length > 0) {
this.curClassReserv = list[list.length - 1]
}
this.$watch(()=>toolStore.isToolWin,(newD, oldD)=>{
setTimeout(this.initReserv, 500)
})
},
activated() {
if (this.uploadData.textbookId !== null) {
this.asyncAllFile()
this.initHomeWork()
this.initReserv()
}
},
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() {
let fileName = this.curBookPath
if (!fileName) return
@ -255,8 +267,7 @@ export default {
})
},
progDownFile(e, num) {
console.log(num)
//TODO
this.downloadNum = num
},
createFile() {
creatPPT(this.currentNode.label + '.pptx', this.uploadData).then((res) => {
@ -559,7 +570,6 @@ export default {
// PDF-
async navtoPdf() {
const toolStore = useToolState()
if (toolStore.isPdfWin) return this.$message.error('您当前已打开课本,请勿重复操作')
let path = await this.getBookPathFromServer()
createWindow('open-PDF', {
@ -570,7 +580,8 @@ export default {
openLesson() {
const toolStore = useToolState()
if (toolStore.isToolWin) return this.$message.error('您当前已开始上课,请勿重复操作')
createWindow('tool-sphere', { url: '/tool/sphere?entpcourseid=' + this.entpcourseid })
startClass(this.curClassReserv.id)
createWindow('tool-sphere', { url: '/tool/sphere?entpcourseid=' + this.entpcourseid + "&reservId=" + this.curClassReserv.id })
}
}
}
@ -645,9 +656,14 @@ export default {
overflow: hidden;
margin-right: 20px;
z-index: 1;
position: relative;
&:hover {
cursor: pointer;
}
:deep(.el-progress-circle) {
width: 90px!important;
background-color: white;
}
}
.top-item {

View File

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