for(var i = 0; i < timeArr.length - 1; i++) { var row = document.createElement('div'); row.className = 'row';
var html = `<div class="cell">${timeArr[i]} ~ ${timeArr[i+1]}</div>`;
days.forEach(d => { var key = `${d.date}#${timeArr[i]}`; if(map[key]) { var m = map[key]; var colorClass = {1:'yellow', 3:'blue', 4:'pink', 5:'gray'}[m.status];
// 计算会议跨越的单元格数量 var startIndex = timeArr.indexOf(m.start); var span = m.time;
function getWeekMeetings(room, startDate) { var meetings = []; var monday = new Date(startDate); monday.setDate(monday.getDate() - monday.getDay() + 1);
for(var i = 0; i < 7; i++) { var date = dayjs(monday).add(i, 'day').format('YYYY-MM-DD'); if(mockDataByDate[date] && mockDataByDate[date][room]) { mockDataByDate[date][room].forEach(meeting => { meetings.push({ ...meeting, date: date, room: room }); }); }
function initTimeSelectors() { var startTimeSelect = document.getElementById('startTimeSelect'); var endTimeSelect = document.getElementById('endTimeSelect');
for(var i = 0; i < timeArr.length - 1; i++) { var row = document.createElement('div'); row.className = 'row';
var html = `<div class="cell">${timeArr[i]} ~ ${timeArr[i+1]}</div>`;
days.forEach(d => { var key = `${d.date}#${timeArr[i]}`; if(map[key]) { var m = map[key]; var colorClass = {1:'yellow', 3:'blue', 4:'pink', 5:'gray'}[m.status];
// 计算会议跨越的单元格数量 var startIndex = timeArr.indexOf(m.start); var span = m.time;
html += `<div class="cell"> <div class="meeting-container"> <div class="meeting ${colorClass}" style="width:100%;height: ${height}" onclick="showMeetingDetail(event, '${m.id}', '${m.date}')"> ${m.title} ${m.isCreator === 'true' && [1, 3].includes(m.status) ? `<button class="close-btn" onclick="delMeet(event,'${m.id}', '${m.date}', '${m.room}')">×</button>` : ''} </div> </div> </div>`; } else if (i > startIndex && i < startIndex + span) { // 对于被会议跨越的中间单元格,保持空单元格 html += '<div class="cell"></div>'; } else { html += '<div class="cell"></div>'; } } else { html += '<div class="cell"></div>'; } });
row.innerHTML = html; box.appendChild(row); } }
function search() { var room = document.getElementById('roomSel').value; if(!room) { alert('请选择会议室'); return; }
var currentDate = new Date();
var days = []; var monday = new Date(currentDate); monday.setDate(monday.getDate() - monday.getDay() + 1);
for(var i = 0; i < 7; i++) { var d = dayjs(monday).add(i, 'day').format('YYYY-MM-DD'); var dateObj = new Date(d); // 修改日期显示格式为 "月/日(周几)" var monthDay = `${dateObj.getMonth() + 1}/${dateObj.getDate()}`; var weekday = '周' +'日一二三四五六'[dateObj.getDay()]; days.push({ date: d, day: `${monthDay}(${weekday})` }); }
var allMeetings = getWeekMeetings(room, currentDate);
var map = {}; allMeetings.forEach(m => { map[`${m.date}#${m.start}`] = m; });
renderCal(map, days); }
function openApplyModal() { var modal = document.getElementById('applyModal'); document.getElementById('modalApplyDate').value = dayjs(new Date()).format('YYYY-MM-DD');
function closeApplyModal() { document.getElementById('applyModal').style.display = 'none'; }
function submitMeeting() { var title = document.getElementById('modalMeetingTitle').value; var content = document.getElementById('modalMeetingContent').value; var date = document.getElementById('modalApplyDate').value; var room = document.getElementById('modalApplyRoom').value; var attendeeCount = document.getElementById('modalAttendeeCount').value; var startTime = document.getElementById('startTimeSelect').value; var endTime = document.getElementById('endTimeSelect').value;
// 添加用户申请的数据 userMeetings.forEach(meeting => { if (meeting.date === date && meeting.room === room) { currentDateMeetings.push(meeting); } });
// 检查时间冲突 var hasConflict = false; for (var existingMeeting of currentDateMeetings) { var existingStartIndex = timeArr.indexOf(existingMeeting.start); var existingEndIndex = existingStartIndex + existingMeeting.time;
function closeMeetingModal() { document.getElementById('meetingModal').style.display = 'none'; }
function updateEndTimeOptions() { var startTimeSelect = document.getElementById('startTimeSelect'); var endTimeSelect = document.getElementById('endTimeSelect'); var selectedStartTime = startTimeSelect.value; var currentEndTime = endTimeSelect.value;
endTimeSelect.innerHTML = '';
var startIndex = timeArr.indexOf(selectedStartTime); for (var i = startIndex + 1; i < timeArr.length; i++) { var option = document.createElement('option'); option.value = timeArr[i]; option.textContent = timeArr[i]; endTimeSelect.appendChild(option); }
<script src="https://map.qq.com/api/gljs?v=1.exp&key=your_key&libraries=service"></script> <script> var map; // 地图对象 var markerLayer; // 标记图层对象 var search_map = document.getElementById('search_map');
// 为搜索按钮添加点击事件监听器 search_map.addEventListener('click', function () { var address = document.getElementById('address').value; if (address) { searchMap(address) } })
// 初始化地图函数 function initMap(lat = 39.903630, lng = 116.397712) { // 创建地图中心点坐标对象 var center = new TMap.LatLng(lat, lng) // 创建地图实例并设置配置参数 map = new TMap.Map(document.getElementById('map-container'), { center: center, zoom: 12, }); // 创建并初始化多标记图层 markerLayer = new TMap.MultiMarker({ map: map, styles: { "myStyle": new TMap.MarkerStyle({ "width": 25, "height": 35, "anchor": { x: 16, y: 32 } }) }, geometries: [{ "id": "1", "styleId": 'myStyle', "position": new TMap.LatLng(lat, lng), }] }); // 绑定点击事件 map.on("click",clickHandler) document.getElementById('lat').value = lat; document.getElementById('lng').value = lng; } // 处理地图点击事件 function clickHandler (e) { var lat = e.latLng.getLat().toFixed(6); var lng = e.latLng.getLng().toFixed(6); changeCoordinate(lat,lng); } // 地址搜索 function searchMap(address) { var geocoder = new TMap.service.Geocoder(); geocoder.getLocation({address:address}).then((res)=>{ if (res.status != 0) { console.log('获取经纬度错误:',res); return; } changeCoordinate(res.result.location.lat,res.result.location.lng); map.setCenter(new TMap.LatLng(res.result.location.lat,res.result.location.lng)); }).catch((res)=>{ console.log('获取经纬度错误:',res) }) } // 更新坐标位置 function changeCoordinate(lat,lng){ markerLayer.updateGeometries([ { "id": "1", "styleId":"myStyle", "position": new TMap.LatLng(lat, lng), } ]) // 更新坐标显示 document.getElementById('lng').value = lng; document.getElementById('lat').value = lat; } initMap() </script> </body> </html>
var rows = Math.ceil(CONFIG.chars.length / CONFIG.cols); var W = CONFIG.cellPx * CONFIG.cols; var H = CONFIG.cellPx * rows; document.getElementById('paper').style.width = W + 'px'; document.getElementById('paper').style.height = H + 'px';
for (var i = 0; i < CONFIG.chars.length; i++) { var r = Math.floor(i / CONFIG.cols); var c = i % CONFIG.cols; var x = c * CONFIG.cellPx; var y = r * CONFIG.cellPx; var cx = x + CONFIG.cellPx / 2; var cy = y + CONFIG.cellPx / 2;
function pos(e) { var rect = uCanvas.getBoundingClientRect(); var x = (e.touches ? e.touches[0].clientX : e.clientX) - rect.left; var y = (e.touches ? e.touches[0].clientY : e.clientY) - rect.top; return [x, y]; }
{{commentItem.nickName}}
{{formatIntervalTime(commentItem.createTime)}}{{childComment.nickName}} {{childComment.replyNickName}}
{{childComment.createTimeDescribe}}