baigl #305

Merged
baigl merged 12 commits from baigl into main 2024-10-10 15:53:19 +08:00
4 changed files with 68 additions and 26 deletions
Showing only changes of commit e7f439dd0c - Show all commits

View File

@ -310,3 +310,44 @@ export function timeToStr(time,str = '时分秒', isPad = false) {
if (isPad) return `${h?toStr(h)+arr[0]:''}${m?toStr(m)+arr[1]:''}${toStr(s)}${arr[2]||''}` if (isPad) return `${h?toStr(h)+arr[0]:''}${m?toStr(m)+arr[1]:''}${toStr(s)}${arr[2]||''}`
return `${h?h+arr[0]:''}${m?m+arr[1]:''}${s?s+arr[2]||'':''}` return `${h?h+arr[0]:''}${m?m+arr[1]:''}${s?s+arr[2]||'':''}`
} }
/**
* 防抖一定时间内如果函数被连续调用则只执行最后一次调用
* debounce(() => {
console.log('Input event handled');
}, 300);
* @param {*} func
* @param {*} wait
* @returns
*/
export function debounce(func, wait) {
let timeout;
return function() {
const context = this;
const args = arguments;
clearTimeout(timeout);
timeout = setTimeout(() => func.apply(context, args), wait);
};
}
/**
* 节流一定时间内函数最多只执行一次
* throttle(() => {
console.log('Scroll event handled');
}, 300);
* @param {*} func
* @param {*} wait
* @returns
*/
export function throttle(func, wait) {
let lastTime = 0;
return function() {
const context = this;
const args = arguments;
const now = new Date();
if (now - lastTime >= wait) {
func.apply(context, args);
lastTime = now;
}
};
}

View File

@ -72,6 +72,7 @@ import { getCurrentTime, getTomorrow } from '@/utils/date'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import useClassTaskStore from "@/store/modules/classTask"; import useClassTaskStore from "@/store/modules/classTask";
import {sessionStore, createWindow} from '@/utils/tool' import {sessionStore, createWindow} from '@/utils/tool'
import {throttle,debounce } from '@/utils/comm'
const toolState = useToolState(); const toolState = useToolState();
@ -377,7 +378,10 @@ const closeDialog = () => {
getStudentClassWorkDataPolling() getStudentClassWorkDataPolling()
} }
const openDialogTime = ref(null);// const debounceOpenWin = debounce(() => {
toolState.isTaskWin=true; //
createWindow('open-taskwin',{url:'/teachClassTask'}); //
}, 1000);
/** /**
* 开启新批改弹窗 * 开启新批改弹窗
* @param item 作业对象 * @param item 作业对象
@ -385,17 +389,10 @@ const openDialogTime = ref(null);//弹窗
const onClickItem = (item) => { const onClickItem = (item) => {
console.log('开启弹窗,关闭作业进度轮询') console.log('开启弹窗,关闭作业进度轮询')
clearInterval(pollingST.value) clearInterval(pollingST.value)
// itemDialogRef.value.openDialog(item)
if(openDialogTime.value) return; console.log('防抖开启弹窗')
clearTimeout(openDialogTime.value) sessionStore.set('teachClassWorkItem', item); // item
openDialogTime.value = setTimeout(() => { debounceOpenWin();
openDialogTime.value = null;
toolState.isTaskWin=true; //
sessionStore.set('teachClassWorkItem', item); // item
//
createWindow('open-taskwin',{url:'/teachClassTask'})
}, 1000*2)
} }

View File

@ -155,10 +155,7 @@
<el-dialog v-model="workConfDialogOpen" title="作业布置推送配置" width="60%" append-to-body> <el-dialog v-model="workConfDialogOpen" title="作业布置推送配置" width="60%" append-to-body>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<!-- <div style="display: flex; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid silver"> <el-form ref="classWorkConfigFormRef" :model="classWorkConfigForm" label-width="100px">
<div style="padding-left: 30px">作业布置配置详细参数</div>
</div> -->
<el-form ref="classWorkConfigFormRef" :model="classWorkConfigForm" label-width="100px" style="margin-top: 30px">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="班级" prop="grade"> <el-form-item label="班级" prop="grade">
@ -1042,6 +1039,14 @@ const handleTaskAssignToAllClass = () => {
} }
} }
/**
* 设计作业
*/
const handleNewClassWorkDialog = () => {
//
router.push({ path: '/newClassTask' });
}
// - // -
const submitWorkTitle = () => { const submitWorkTitle = () => {
if(currentWorkEdit.currentTask.title == currentWorkEdit.currentTitle){ if(currentWorkEdit.currentTask.title == currentWorkEdit.currentTitle){

View File

@ -37,6 +37,7 @@ import { homeworklist } from '@/api/teaching/classwork'
import { getCurrentTime, getTomorrow } from '@/utils/date' import { getCurrentTime, getTomorrow } from '@/utils/date'
import {sessionStore, createWindow} from '@/utils/tool' import {sessionStore, createWindow} from '@/utils/tool'
import { useToolState } from '@/store/modules/tool' import { useToolState } from '@/store/modules/tool'
import {throttle,debounce } from '@/utils/comm'
const user = useUserStore().user const user = useUserStore().user
const toolState = useToolState(); const toolState = useToolState();
@ -68,19 +69,17 @@ const getHomework = async () => {
} }
} }
const openDialogTime = ref(null);//
const debounceOpenWin = debounce(() => {
toolState.isTaskWin=true; //
createWindow('open-taskwin',{url:'/teachClassTask'}); //
}, 1000);
// //
const onClickItem = (item) => { const onClickItem = (item) => {
console.log('开启弹窗') console.log('防抖开启弹窗')
if(openDialogTime.value) return; sessionStore.set('teachClassWorkItem', item); // item
clearTimeout(openDialogTime.value) debounceOpenWin();
openDialogTime.value = setTimeout(() => {
openDialogTime.value = null;
toolState.isTaskWin=true; //
sessionStore.set('teachClassWorkItem', item); // item
//
createWindow('open-taskwin',{url:'/teachClassTask'})
}, 1000*2)
} }
const tagType = (time) => { const tagType = (time) => {