二期:预约开发
This commit is contained in:
parent
ae500c94ce
commit
c2876ff983
|
@ -243,4 +243,4 @@ function handleAll() {
|
|||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ function stateChange(store) {
|
|||
// 更新状态
|
||||
store.$patch(stateJson)
|
||||
// 您可以通过将其 $state 属性设置为新对象来替换 Store 的整个状态
|
||||
// store.$state = stateJson
|
||||
// store.$state = stateJson
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,4 +12,4 @@ export const useToolState = defineStore('tool', {
|
|||
}),
|
||||
actions: {
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
@ -19,7 +19,7 @@ const isDev = isNode?process.env.NODE_ENV !== 'production':''
|
|||
export const ipcMain = Remote?.ipcMain || {}
|
||||
/**
|
||||
* 获取静态资源,开发和生产环境
|
||||
* @param {*} url
|
||||
* @param {*} url
|
||||
* @param {*} type 类型 app 应用内 user (用户目录 selfFile 自定义文件路径)
|
||||
* @returns
|
||||
*/
|
||||
|
@ -67,9 +67,9 @@ export function ipcMsgInvoke(key, ...args) {
|
|||
/**
|
||||
* @description 封装ipcRenderer事件监听
|
||||
* @param {*} fn on once handle invoke
|
||||
* @param {*} key
|
||||
* @param {*} key
|
||||
* @param {Function} cb 回调函数
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
export function ipcHandle(fn,key, cb) {
|
||||
return ipcRenderer[fn](key, cb)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
@ -118,7 +122,7 @@ const sideChange = o => {
|
|||
|
||||
// === 监听器 ===
|
||||
watchEffect(() => {
|
||||
// 不同的时候, 更新值: 是否显示-画板
|
||||
// 不同的时候, 更新值: 是否显示-画板
|
||||
const show = !toolStore.isPdfWin && toolStore.showBoardAll
|
||||
if (show != isShow.value) isShow.value = show
|
||||
})
|
||||
|
@ -170,4 +174,4 @@ watchEffect(() => {
|
|||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue