This commit is contained in:
parent
f0313653e6
commit
e7f439dd0c
|
@ -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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -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)
|
|
||||||
openDialogTime.value = setTimeout(() => {
|
|
||||||
openDialogTime.value = null;
|
|
||||||
toolState.isTaskWin=true; // 设置打开批改窗口
|
|
||||||
sessionStore.set('teachClassWorkItem', item); // 缓存点击的item
|
sessionStore.set('teachClassWorkItem', item); // 缓存点击的item
|
||||||
// 调用新窗口批改页面
|
debounceOpenWin();
|
||||||
createWindow('open-taskwin',{url:'/teachClassTask'})
|
|
||||||
}, 1000*2)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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){
|
||||||
|
|
|
@ -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;
|
|
||||||
clearTimeout(openDialogTime.value)
|
|
||||||
openDialogTime.value = setTimeout(() => {
|
|
||||||
openDialogTime.value = null;
|
|
||||||
toolState.isTaskWin=true; // 设置打开批改窗口
|
|
||||||
sessionStore.set('teachClassWorkItem', item); // 缓存点击的item
|
sessionStore.set('teachClassWorkItem', item); // 缓存点击的item
|
||||||
// 调用新窗口批改页面
|
debounceOpenWin();
|
||||||
createWindow('open-taskwin',{url:'/teachClassTask'})
|
|
||||||
}, 1000*2)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const tagType = (time) => {
|
const tagType = (time) => {
|
||||||
|
|
Loading…
Reference in New Issue