Compare commits
5 Commits
e6a0859f87
...
1871e7e565
Author | SHA1 | Date |
---|---|---|
yangws | 1871e7e565 | |
lyc | bb56c3fdab | |
lyc | df8f4fcf92 | |
lyc | d6b4ae011d | |
yangws | bf7f740aaf |
|
@ -50,7 +50,7 @@ export function getClassmain(id) {
|
|||
// 获取小组列表
|
||||
export function listClassgroup(query) {
|
||||
return request({
|
||||
url: '/education/classgroup/list',
|
||||
url: '/education/classgroup/new/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
@ -177,8 +177,8 @@ export function endClass(id) {
|
|||
}
|
||||
/**
|
||||
* @description 获取课堂信息
|
||||
* @param {*} id
|
||||
* @returns
|
||||
* @param {*} id
|
||||
* @returns
|
||||
*/
|
||||
export function getClassInfo(id) {
|
||||
return request({
|
||||
|
|
|
@ -76,3 +76,36 @@ export const toTimeText = (timeStamp, simple) => {
|
|||
}
|
||||
return timeText
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns 当前年-月-日
|
||||
*/
|
||||
export const getCurrentTime = (format)=> {
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = (now.getMonth() + 1).toString().padStart(2, '0');
|
||||
const day = now.getDate().toString().padStart(2, '0');
|
||||
const hours = now.getHours().toString().padStart(2, '0');
|
||||
const minutes = now.getMinutes().toString().padStart(2, '0');
|
||||
if(format == 'YYYY-MM-DD'){
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
if(format == 'HH:mm'){
|
||||
return `${hours}:${minutes}`;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {number} m 指定时间
|
||||
* @returns 指定时间之后的 小时:分钟
|
||||
*/
|
||||
export const getAfterMinutes = (m) => {
|
||||
const now = new Date();
|
||||
const afterMinutes = new Date(now.getTime() + m * 60 * 1000);
|
||||
let hours = afterMinutes.getHours();
|
||||
hours = hours < 10 ? ('0' + hours) : hours
|
||||
let minutes = afterMinutes.getMinutes();
|
||||
minutes = minutes < 10 ? ('0' + minutes) : minutes
|
||||
return `${hours}:${minutes}`;
|
||||
}
|
|
@ -35,6 +35,7 @@
|
|||
placeholder="请选择日期"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
:disabled-date="disabledDate"
|
||||
/>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
|
@ -53,6 +54,8 @@
|
|||
range-separator="-"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
:disabled-hours="disabledHours"
|
||||
:disabled-minutes="disabledMinute"
|
||||
/>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
|
@ -81,6 +84,8 @@ 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'
|
||||
import { getCurrentTime, getAfterMinutes } from '@/utils/date'
|
||||
|
||||
const emit = defineEmits(['addSuccess'])
|
||||
const props = defineProps({
|
||||
bookId: {
|
||||
|
@ -143,6 +148,47 @@ const locationOptions = [
|
|||
const locationMessage = computed(() => {
|
||||
return locationOptions.find((item) => item.value === form.type).message
|
||||
})
|
||||
|
||||
// 设置一个月后的日期不能选择
|
||||
const disabledDate = (time)=> {
|
||||
// 禁用今天之前的日期
|
||||
const today = new Date();
|
||||
if (time.getTime() < today.getTime() - 8.64e7) {
|
||||
// 返回true表示禁用
|
||||
return true;
|
||||
}
|
||||
// 同时禁用超过一个月后的日期
|
||||
const oneMonthLater = new Date(today.getTime() + 30 * 24 * 60 * 60 * 1000);
|
||||
if (time.getTime() > oneMonthLater.getTime()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 限制小时-返回被禁选的小时
|
||||
const disabledHours = ()=>{
|
||||
if(getCurrentTime('YYYY-MM-DD') == form.day){
|
||||
const arrs = []
|
||||
for (let i = 0; i < 24; i++) {
|
||||
if (new Date().getHours() <= i) continue;
|
||||
arrs.push(i)
|
||||
}
|
||||
return arrs;
|
||||
}
|
||||
}
|
||||
// 限制分-返回被禁选的
|
||||
const disabledMinute = () => {
|
||||
if(getCurrentTime('YYYY-MM-DD') == form.day){
|
||||
const arrs = []
|
||||
for (let i = 0; i < 60; i++) {
|
||||
if (new Date().getMinutes() <= i && form.time[0]) continue;
|
||||
arrs.push(i)
|
||||
}
|
||||
return arrs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const openDialog = (data) => {
|
||||
if (data) {
|
||||
updateForm.value = data
|
||||
|
@ -154,6 +200,11 @@ const openDialog = (data) => {
|
|||
form.resource = data.classList.split(',').map((item) => parseInt(item))
|
||||
form.classRoom = data.classRoom
|
||||
}
|
||||
else{
|
||||
// 默认当前时间
|
||||
form.day = getCurrentTime('YYYY-MM-DD')
|
||||
form.time = [getCurrentTime('HH:mm'), getAfterMinutes(45)]
|
||||
}
|
||||
centerDialogVisible.value = true
|
||||
}
|
||||
const closeDialog = () => {
|
||||
|
|
|
@ -19,6 +19,7 @@ const emit = defineEmits(['update:modelValue'])
|
|||
onMounted(async() => {
|
||||
if (canvasRef.value) {
|
||||
FabricVue.drawConfig.drawColors = ['red']
|
||||
FabricVue.drawConfig.drawWidth = 3
|
||||
FabricVue.boardConfig.mode = TYPES.ActionMode.OTHER
|
||||
FabricVue.boardConfig.backgroundColor = 'transparent'
|
||||
const option = { freeDrawingCursor: 'default' }
|
||||
|
|
Loading…
Reference in New Issue