This commit is contained in:
白了个白 2024-10-10 14:00:29 +08:00
parent f0313653e6
commit e7f439dd0c
4 changed files with 68 additions and 26 deletions

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

View File

@ -155,10 +155,7 @@
<el-dialog v-model="workConfDialogOpen" title="作业布置推送配置" width="60%" append-to-body>
<el-row>
<el-col :span="24">
<!-- <div style="display: flex; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid silver">
<div style="padding-left: 30px">作业布置配置详细参数</div>
</div> -->
<el-form ref="classWorkConfigFormRef" :model="classWorkConfigForm" label-width="100px" style="margin-top: 30px">
<el-form ref="classWorkConfigFormRef" :model="classWorkConfigForm" label-width="100px">
<el-row>
<el-col :span="24">
<el-form-item label="班级" prop="grade">
@ -1042,6 +1039,14 @@ const handleTaskAssignToAllClass = () => {
}
}
/**
* 设计作业
*/
const handleNewClassWorkDialog = () => {
//
router.push({ path: '/newClassTask' });
}
// -
const submitWorkTitle = () => {
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 {sessionStore, createWindow} from '@/utils/tool'
import { useToolState } from '@/store/modules/tool'
import {throttle,debounce } from '@/utils/comm'
const user = useUserStore().user
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) => {
console.log('开启弹窗')
if(openDialogTime.value) return;
clearTimeout(openDialogTime.value)
openDialogTime.value = setTimeout(() => {
openDialogTime.value = null;
toolState.isTaskWin=true; //
sessionStore.set('teachClassWorkItem', item); // item
//
createWindow('open-taskwin',{url:'/teachClassTask'})
}, 1000*2)
console.log('防抖开启弹窗')
sessionStore.set('teachClassWorkItem', item); // item
debounceOpenWin();
}
const tagType = (time) => {