1.补充图标和颜色说明文档,在页面添加图例说明。
This commit is contained in:
parent
63aedaf041
commit
e6f7a87211
4
.kiro/settings/mcp.json
Normal file
4
.kiro/settings/mcp.json
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
}
|
||||||
|
}
|
||||||
2
.vscode/settings.json
vendored
Normal file
2
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
{
|
||||||
|
}
|
||||||
256
docs/bug/1.0.0bug.md
Normal file
256
docs/bug/1.0.0bug.md
Normal file
|
|
@ -0,0 +1,256 @@
|
||||||
|
# 麻将组局预约小程序 v1.0.0 Bug报告
|
||||||
|
|
||||||
|
## Bug统计
|
||||||
|
- **总数量**: 9个
|
||||||
|
- **已修复**: 1个 ✅
|
||||||
|
- **未修改**: 8个
|
||||||
|
- **分类**: 后端问题 6个,前端问题 2个,前后端问题 3个
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Bug详情
|
||||||
|
|
||||||
|
### cs110_23 - 后台房间管理图标说明缺失
|
||||||
|
**状态**: ✅ 已修复
|
||||||
|
**类型**: 后端
|
||||||
|
**优先级**: 低
|
||||||
|
|
||||||
|
**问题描述**:
|
||||||
|
后台房间预约管理页面,颜色和图标意义不明确,用户无法理解各种状态的含义。
|
||||||
|
|
||||||
|
**解决方案**:
|
||||||
|
补充图标和颜色说明文档,在页面添加图例说明。
|
||||||
|
|
||||||
|
**修复内容**:
|
||||||
|
1. **房间价格管理页面** (`sqroompricing/index.html`)
|
||||||
|
- 添加了可折叠的状态图例说明区域
|
||||||
|
- 包含时间段状态说明:可预约(绿色)、已预约(橙色)、使用中(灰色)、不可预约(红色)、后台预约(深橙色)
|
||||||
|
- 包含特殊日期标识:今天(青色边框)、节假日价格(橙色边框+节字标识)
|
||||||
|
- 添加了操作说明和使用提示
|
||||||
|
|
||||||
|
2. **预约管理页面** (`sqreservations/index.html`)
|
||||||
|
- 添加了参与者角色说明:发起者(绿色)、参与者(蓝色)
|
||||||
|
- 添加了参与状态说明:正常(绿色)、已退出(红色)
|
||||||
|
- 添加了鸽子费状态说明:无需退款(灰色)、已付鸽子费(蓝色)、退款中(黄色)、退款成功(绿色)、退款失败(红色)
|
||||||
|
- 添加了展开/收起功能,节省页面空间
|
||||||
|
|
||||||
|
**修复时间**: 2025-01-01
|
||||||
|
**测试状态**: 待测试
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### cs110_24 - 已评价组局消息未消失
|
||||||
|
**状态**: 未修改
|
||||||
|
**类型**: 后端
|
||||||
|
**优先级**: 中
|
||||||
|
|
||||||
|
**问题描述**:
|
||||||
|
我的页面中,已结束的牌局在给牌友评价后,该组局消息没有消失。
|
||||||
|
|
||||||
|
**解决方案**:
|
||||||
|
需要明确消失逻辑:
|
||||||
|
- 所有参与者都完成评价后消息消失
|
||||||
|
- 或者预约结束后7天自动消失
|
||||||
|
- 需要产品确认具体的消失逻辑
|
||||||
|
- uniapp\mahjong_group\pages\me\me-page.vue 我的页面
|
||||||
|
---
|
||||||
|
|
||||||
|
### cs120_1 - 时间段预约逻辑错误
|
||||||
|
**状态**: 未修改
|
||||||
|
**类型**: 后端
|
||||||
|
**优先级**: 高
|
||||||
|
|
||||||
|
**问题描述**:
|
||||||
|
当前时间14:00,房间列表显示凌晨、上午不可预约,但进入预约页面时:
|
||||||
|
1. 开始时间、结束时间能选择凌晨和上午的时间
|
||||||
|
2. 能成功发起预约
|
||||||
|
3. 发起后前端首页看不到该组局
|
||||||
|
4. 我的页面能看到组局信息但不能解散
|
||||||
|
5. 点击取消提示"预约开始前30分钟无法取消"
|
||||||
|
|
||||||
|
**解决方案**:
|
||||||
|
凌晨、上午已经被预约时,提交预约应直接提示用户该时间段已被预约,不允许创建。
|
||||||
|
|
||||||
|
**涉及接口**:
|
||||||
|
- `CanCreateSQReservation` - 预约前校验
|
||||||
|
- `AddSQReservation` - 创建预约
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### cs120_2 - 开始时间选择无限制
|
||||||
|
**状态**: 未修改
|
||||||
|
**类型**: 后端
|
||||||
|
**优先级**: 高
|
||||||
|
|
||||||
|
**问题描述**:
|
||||||
|
发起预约时,"开始时间"没有做限制,能选择已过去的时间。
|
||||||
|
例如:当前时间14:00,可以预约今天早上8点~9点的局。
|
||||||
|
|
||||||
|
**解决方案**:
|
||||||
|
对"开始时间"做以下限制:
|
||||||
|
1. **限制一**:只能选择可预约的时间段
|
||||||
|
- 如早上约满了,现在是早上时间,只能选择下午时间段
|
||||||
|
2. **限制二**:当前时间段无人预约时
|
||||||
|
- 只能选择当前时间+30分钟的时间
|
||||||
|
- 不能选择已经过去的时间
|
||||||
|
- 如当前时间为14:00,开始时间只能选择14:30及以后的时间
|
||||||
|
3. **结束时间**:默认为开始时间的一小时后,不能低于1小时
|
||||||
|
|
||||||
|
**涉及接口**:
|
||||||
|
- `GetAvailableDates` - 可选日期
|
||||||
|
- `GetRoomListWithSlotsNew` - 房间时段状态
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### cs120_3 - 首页高度显示异常
|
||||||
|
**状态**: 已修改
|
||||||
|
**类型**: 前端
|
||||||
|
**优先级**: 中
|
||||||
|
|
||||||
|
**问题描述**:
|
||||||
|
首页空状态和列表的高度不对,高度过高,不是之前的高度。
|
||||||
|
|
||||||
|
**解决方案**:
|
||||||
|
下调到和以前一样的高度。
|
||||||
|
|
||||||
|
**涉及文件**:
|
||||||
|
- `pages/index/index.vue`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### cs120_4 - 房间卡片文字显示不全
|
||||||
|
**状态**: 未修改
|
||||||
|
**类型**: 前端
|
||||||
|
**优先级**: 中
|
||||||
|
|
||||||
|
**问题描述**:
|
||||||
|
首页房间列表,房间的底图没有把该房间全部文字都包裹进去,文字被截断。
|
||||||
|
|
||||||
|
**解决方案**:
|
||||||
|
调整卡片样式,确保包裹全部文字内容。
|
||||||
|
|
||||||
|
**涉及文件**:
|
||||||
|
- `components/index/MahjongCard.vue`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### cs120_5 - 签到后页面状态未刷新
|
||||||
|
**状态**: 未修改
|
||||||
|
**类型**: 前端+后端
|
||||||
|
**优先级**: 中
|
||||||
|
|
||||||
|
**问题描述**:
|
||||||
|
我的页面,签到成功后,前端状态没有改变,用户看不到最新状态。
|
||||||
|
|
||||||
|
**解决方案**:
|
||||||
|
签到成功后应强制刷新当前页面或更新页面状态。
|
||||||
|
|
||||||
|
**涉及文件**:
|
||||||
|
- `pages/me/me-page.vue`
|
||||||
|
- `components/com/page/qiandao-popup.vue`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### cs120_6 - 首页Banner未显示
|
||||||
|
**状态**: 已完成
|
||||||
|
**类型**: 前端+后端
|
||||||
|
**优先级**: 中
|
||||||
|
|
||||||
|
**问题描述**:
|
||||||
|
后台配置了首页banner,但前端没显示。
|
||||||
|
|
||||||
|
**解决方案**:
|
||||||
|
1. 前端应显示banner
|
||||||
|
2. 需要明确后台"广告位置列表"和"广告列表"的区别
|
||||||
|
|
||||||
|
**涉及文件**:
|
||||||
|
- `pages/index/index.vue`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### cs120_7 - 个人信息数值显示异常
|
||||||
|
**状态**: 未修改
|
||||||
|
**类型**: 前端+后端
|
||||||
|
**优先级**: 中
|
||||||
|
|
||||||
|
**问题描述**:
|
||||||
|
我的页面,我的评分、信誉、牌品、牌技、鸽子数没有数值显示。
|
||||||
|
|
||||||
|
**解决方案**:
|
||||||
|
应显示默认数值或用户参与评价后的修正数值:
|
||||||
|
- 信誉分:默认5.0
|
||||||
|
- 牌品:默认4.0
|
||||||
|
- 牌技:默认4.0
|
||||||
|
- 鸽子数:默认0
|
||||||
|
|
||||||
|
**涉及文件**:
|
||||||
|
- `pages/me/me-page.vue`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### cs120_8 - 评价后分数显示错误
|
||||||
|
**状态**: 未修改
|
||||||
|
**类型**: 后端
|
||||||
|
**优先级**: 中
|
||||||
|
|
||||||
|
**问题描述**:
|
||||||
|
组局结束后对牌友进行评价:
|
||||||
|
1. 评价前显示了该牌友当前的牌品、牌技分
|
||||||
|
2. 评价后分数变成了刚刚给该牌友的评分(而不是修正后的平均分)
|
||||||
|
|
||||||
|
**解决方案**:
|
||||||
|
评分后再次点开,应显示修正后的分值(重新计算的平均分)。
|
||||||
|
|
||||||
|
**涉及接口**:
|
||||||
|
- `AddEvaluateServices` - 添加评价
|
||||||
|
- 评价后需要重新计算用户的平均分
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### cs120_9 - 鸽子费审核功能缺失
|
||||||
|
**状态**: 未修改
|
||||||
|
**类型**: 后端
|
||||||
|
**优先级**: 高
|
||||||
|
|
||||||
|
**问题描述**:
|
||||||
|
测试场景:
|
||||||
|
1. 组了有鸽子费的局,2个人,每人付0.01元
|
||||||
|
2. 签到时选择某人未到场,提交
|
||||||
|
3. 后台的未到场审核里没有数据
|
||||||
|
|
||||||
|
**解决方案**:
|
||||||
|
后台应有未到场审核功能:
|
||||||
|
- **通过审核**:到场人员平分鸽子费
|
||||||
|
- **不通过审核**:鸽子费各自退回
|
||||||
|
|
||||||
|
**需要开发**:
|
||||||
|
- 后台审核页面
|
||||||
|
- 审核通过/拒绝的处理逻辑
|
||||||
|
- 鸽子费分配/退回机制
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 修复优先级建议
|
||||||
|
|
||||||
|
### 🔴 高优先级(影响核心功能)
|
||||||
|
- cs120_1 - 时间段预约逻辑错误
|
||||||
|
- cs120_2 - 开始时间选择无限制
|
||||||
|
- cs120_9 - 鸽子费审核功能缺失
|
||||||
|
|
||||||
|
### 🟡 中优先级(影响用户体验)
|
||||||
|
- cs110_24 - 已评价组局消息未消失
|
||||||
|
- cs120_3 - 首页高度显示异常
|
||||||
|
- cs120_4 - 房间卡片文字显示不全
|
||||||
|
- cs120_5 - 签到后页面状态未刷新
|
||||||
|
- cs120_6 - 首页Banner未显示
|
||||||
|
- cs120_7 - 个人信息数值显示异常
|
||||||
|
- cs120_8 - 评价后分数显示错误
|
||||||
|
|
||||||
|
### 🟢 低优先级(优化项)
|
||||||
|
- ✅ cs110_23 - 后台房间管理图标说明缺失(已修复)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**更新时间**: 2024年
|
||||||
|
**版本**: v1.0.0
|
||||||
|
**整理人**: 开发团队
|
||||||
|
|
@ -8,6 +8,66 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--当前位置结束-->
|
<!--当前位置结束-->
|
||||||
|
|
||||||
|
<!-- 状态图例说明区域 -->
|
||||||
|
<div class="layui-card" style="margin-bottom: 10px;">
|
||||||
|
<div class="layui-card-header" style="padding: 10px 15px;">
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
|
<span style="font-weight: bold; color: #333;">📋 状态图例说明</span>
|
||||||
|
<button class="layui-btn layui-btn-xs layui-btn-primary" id="toggleReservationLegendBtn" type="button">
|
||||||
|
<i class="layui-icon layui-icon-down"></i> 展开
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-card-body" id="reservationLegendContent" style="display: none; padding: 15px;">
|
||||||
|
<div class="layui-row">
|
||||||
|
<div class="layui-col-md4">
|
||||||
|
<h4 style="margin: 0 0 10px 0; color: #333; font-size: 14px;">👥 参与者角色</h4>
|
||||||
|
<div style="display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px;">
|
||||||
|
<span style="display: inline-block; padding: 3px 8px; background: #5FB878; color: white; border-radius: 3px; font-size: 12px; width: fit-content;">
|
||||||
|
<i class="layui-icon layui-icon-username"></i> 发起者
|
||||||
|
</span>
|
||||||
|
<span style="display: inline-block; padding: 3px 8px; background: #1E9FFF; color: white; border-radius: 3px; font-size: 12px; width: fit-content;">
|
||||||
|
<i class="layui-icon layui-icon-group"></i> 参与者
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-md4">
|
||||||
|
<h4 style="margin: 0 0 10px 0; color: #333; font-size: 14px;">🔄 参与状态</h4>
|
||||||
|
<div style="display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px;">
|
||||||
|
<span style="display: inline-block; padding: 3px 8px; background: #5FB878; color: white; border-radius: 3px; font-size: 12px; width: fit-content;">
|
||||||
|
<i class="layui-icon layui-icon-ok-circle"></i> 正常
|
||||||
|
</span>
|
||||||
|
<span style="display: inline-block; padding: 3px 8px; background: #FF5722; color: white; border-radius: 3px; font-size: 12px; width: fit-content;">
|
||||||
|
<i class="layui-icon layui-icon-close-fill"></i> 已退出
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-md4">
|
||||||
|
<h4 style="margin: 0 0 10px 0; color: #333; font-size: 14px;">💰 鸽子费状态</h4>
|
||||||
|
<div style="display: flex; flex-direction: column; gap: 6px;">
|
||||||
|
<span style="display: inline-block; padding: 2px 6px; background: #999; color: white; border-radius: 2px; font-size: 11px; width: fit-content;">无需退款</span>
|
||||||
|
<span style="display: inline-block; padding: 2px 6px; background: #1E9FFF; color: white; border-radius: 2px; font-size: 11px; width: fit-content;">已付鸽子费</span>
|
||||||
|
<span style="display: inline-block; padding: 2px 6px; background: #FFB800; color: white; border-radius: 2px; font-size: 11px; width: fit-content;">退款中</span>
|
||||||
|
<span style="display: inline-block; padding: 2px 6px; background: #5FB878; color: white; border-radius: 2px; font-size: 11px; width: fit-content;">退款成功</span>
|
||||||
|
<span style="display: inline-block; padding: 2px 6px; background: #FF5722; color: white; border-radius: 2px; font-size: 11px; width: fit-content;">退款失败</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-row" style="margin-top: 15px;">
|
||||||
|
<div class="layui-col-md12">
|
||||||
|
<div style="background: #f8f9fa; padding: 10px; border-radius: 4px; border-left: 4px solid #17a2b8;">
|
||||||
|
<p style="margin: 0; font-size: 12px; color: #666;">
|
||||||
|
<i class="layui-icon layui-icon-tips" style="color: #17a2b8;"></i>
|
||||||
|
<strong>说明:</strong>
|
||||||
|
不同颜色的标签代表不同的状态,便于快速识别参与者角色、参与状态和鸽子费处理情况。发起者可以强制退出参与者或转让发起者权限。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div style="font-size: 14px;color: #999;margin-left: 10px;">
|
<div style="font-size: 14px;color: #999;margin-left: 10px;">
|
||||||
从后台添加预约记录不会处理房间的预约时间限制
|
从后台添加预约记录不会处理房间的预约时间限制
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1040,4 +1100,23 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 图例展开/收起功能
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#toggleReservationLegendBtn').on('click', function() {
|
||||||
|
var $content = $('#reservationLegendContent');
|
||||||
|
var $btn = $(this);
|
||||||
|
var $icon = $btn.find('i');
|
||||||
|
|
||||||
|
if ($content.is(':visible')) {
|
||||||
|
$content.slideUp(300);
|
||||||
|
$icon.removeClass('layui-icon-up').addClass('layui-icon-down');
|
||||||
|
$btn.html('<i class="layui-icon layui-icon-down"></i> 展开');
|
||||||
|
} else {
|
||||||
|
$content.slideDown(300);
|
||||||
|
$icon.removeClass('layui-icon-down').addClass('layui-icon-up');
|
||||||
|
$btn.html('<i class="layui-icon layui-icon-up"></i> 收起');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -223,6 +223,65 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="calendar-view" id="calendar-view">
|
<div class="calendar-view" id="calendar-view">
|
||||||
|
<!-- 图例说明区域 -->
|
||||||
|
<div class="layui-card" style="margin-bottom: 15px;">
|
||||||
|
<div class="layui-card-header" style="padding: 10px 15px;">
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
|
<span style="font-weight: bold; color: #333;">📋 状态图例说明</span>
|
||||||
|
<button class="layui-btn layui-btn-xs layui-btn-primary" id="toggleLegendBtn" type="button">
|
||||||
|
<i class="layui-icon layui-icon-down"></i> 展开
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-card-body" id="legendContent" style="display: none; padding: 15px;">
|
||||||
|
<div class="layui-row">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<h4 style="margin: 0 0 10px 0; color: #333; font-size: 14px;">🕐 时间段状态</h4>
|
||||||
|
<div style="display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 15px;">
|
||||||
|
<span class="calendar-slot available" style="display: inline-block; padding: 4px 8px; border-radius: 3px; font-size: 12px;">
|
||||||
|
<i class="layui-icon layui-icon-ok-circle" style="color: #4caf50;"></i> 可预约
|
||||||
|
</span>
|
||||||
|
<span class="calendar-slot reserved" style="display: inline-block; padding: 4px 8px; border-radius: 3px; font-size: 12px;">
|
||||||
|
<i class="layui-icon layui-icon-time" style="color: #ff9800;"></i> 已预约
|
||||||
|
</span>
|
||||||
|
<span class="calendar-slot using" style="display: inline-block; padding: 4px 8px; border-radius: 3px; font-size: 12px;">
|
||||||
|
<i class="layui-icon layui-icon-play" style="color: #ff9800;"></i> 使用中
|
||||||
|
</span>
|
||||||
|
<span class="calendar-slot unavailable" style="display: inline-block; padding: 4px 8px; border-radius: 3px; font-size: 12px;">
|
||||||
|
<i class="layui-icon layui-icon-close-fill" style="color: #f44336;"></i> 不可预约
|
||||||
|
</span>
|
||||||
|
<span class="calendar-slot backend-reservation" style="display: inline-block; padding: 4px 8px; border-radius: 3px; font-size: 12px;">
|
||||||
|
<i class="layui-icon layui-icon-set" style="color: #fff;"></i> 后台预约
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<h4 style="margin: 0 0 10px 0; color: #333; font-size: 14px;">📅 特殊日期标识</h4>
|
||||||
|
<div style="display: flex; flex-wrap: wrap; gap: 10px;">
|
||||||
|
<span style="display: inline-block; padding: 4px 8px; border: 2px solid #009688; background: #f0fffe; border-radius: 3px; font-size: 12px; color: #009688;">
|
||||||
|
<i class="layui-icon layui-icon-date"></i> 今天
|
||||||
|
</span>
|
||||||
|
<span style="display: inline-block; padding: 4px 8px; border: 2px solid #ff9800; background: #fff8e1; border-radius: 3px; font-size: 12px; color: #ff9800; position: relative;">
|
||||||
|
<i class="layui-icon layui-icon-star-fill"></i> 节假日价格
|
||||||
|
<span style="position: absolute; top: -5px; right: -5px; background: #ff9800; color: #fff; padding: 1px 4px; border-radius: 2px; font-size: 10px;">节</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-row" style="margin-top: 15px;">
|
||||||
|
<div class="layui-col-md12">
|
||||||
|
<div style="background: #f8f9fa; padding: 10px; border-radius: 4px; border-left: 4px solid #17a2b8;">
|
||||||
|
<p style="margin: 0; font-size: 12px; color: #666;">
|
||||||
|
<i class="layui-icon layui-icon-tips" style="color: #17a2b8;"></i>
|
||||||
|
<strong>说明:</strong>
|
||||||
|
点击日期可查看详细信息;右键点击可进行快速操作;不同颜色代表不同的预约状态,便于快速识别房间使用情况。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="calendar-header">
|
<div class="calendar-header">
|
||||||
<div class="calendar-nav">
|
<div class="calendar-nav">
|
||||||
<button class="layui-btn layui-btn-sm" id="prevMonthBtn">
|
<button class="layui-btn layui-btn-sm" id="prevMonthBtn">
|
||||||
|
|
@ -300,30 +359,30 @@
|
||||||
, laytpl = layui.laytpl;
|
, laytpl = layui.laytpl;
|
||||||
|
|
||||||
var searchwhere;
|
var searchwhere;
|
||||||
|
|
||||||
// 日期内容模板缓存(只加载一次,永久缓存)
|
// 日期内容模板缓存(只加载一次,永久缓存)
|
||||||
var dayContentTemplate = null;
|
var dayContentTemplate = null;
|
||||||
var templateLoadPromise = null;
|
var templateLoadPromise = null;
|
||||||
|
|
||||||
// 加载日期内容模板(只加载一次,后续直接返回缓存的模板)
|
// 加载日期内容模板(只加载一次,后续直接返回缓存的模板)
|
||||||
function loadDayContentTemplate() {
|
function loadDayContentTemplate() {
|
||||||
// 如果模板已缓存,直接返回已解决的 Promise
|
// 如果模板已缓存,直接返回已解决的 Promise
|
||||||
if (dayContentTemplate) {
|
if (dayContentTemplate) {
|
||||||
return $.Deferred().resolve().promise();
|
return $.Deferred().resolve().promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果正在加载,返回现有的 Promise
|
// 如果正在加载,返回现有的 Promise
|
||||||
if (templateLoadPromise) {
|
if (templateLoadPromise) {
|
||||||
return templateLoadPromise;
|
return templateLoadPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建新的加载 Promise(只加载一次)
|
// 创建新的加载 Promise(只加载一次)
|
||||||
templateLoadPromise = $.ajax({
|
templateLoadPromise = $.ajax({
|
||||||
url: setter.views + 'sq/sqroompricing/day-content.html',
|
url: setter.views + 'sq/sqroompricing/day-content.html',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
dataType: 'html',
|
dataType: 'html',
|
||||||
cache: true // 启用浏览器缓存
|
cache: true // 启用浏览器缓存
|
||||||
}).then(function(html) {
|
}).then(function (html) {
|
||||||
var tempDiv = $('<div>').html(html);
|
var tempDiv = $('<div>').html(html);
|
||||||
var templateElement = tempDiv.find('#LAY-template-day-content');
|
var templateElement = tempDiv.find('#LAY-template-day-content');
|
||||||
if (templateElement.length > 0) {
|
if (templateElement.length > 0) {
|
||||||
|
|
@ -334,15 +393,15 @@
|
||||||
console.error('日期内容模板未找到');
|
console.error('日期内容模板未找到');
|
||||||
throw new Error('日期内容模板未找到');
|
throw new Error('日期内容模板未找到');
|
||||||
}
|
}
|
||||||
}).fail(function() {
|
}).fail(function () {
|
||||||
console.error('加载日期内容模板失败');
|
console.error('加载日期内容模板失败');
|
||||||
templateLoadPromise = null; // 失败后重置,允许重试
|
templateLoadPromise = null; // 失败后重置,允许重试
|
||||||
throw new Error('加载日期内容模板失败');
|
throw new Error('加载日期内容模板失败');
|
||||||
});
|
});
|
||||||
|
|
||||||
return templateLoadPromise;
|
return templateLoadPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 统一的日期内容渲染函数(使用缓存的模板 + laytpl 处理数据)
|
// 统一的日期内容渲染函数(使用缓存的模板 + laytpl 处理数据)
|
||||||
// 注意:此函数假设模板已经加载并缓存,直接使用缓存的模板进行渲染
|
// 注意:此函数假设模板已经加载并缓存,直接使用缓存的模板进行渲染
|
||||||
function renderDayContent(roomData, errorMsg) {
|
function renderDayContent(roomData, errorMsg) {
|
||||||
|
|
@ -350,12 +409,12 @@
|
||||||
if (errorMsg) {
|
if (errorMsg) {
|
||||||
return '<div style="text-align:center;color:#f44336;padding:10px 0;">' + (errorMsg || '加载失败') + '</div>';
|
return '<div style="text-align:center;color:#f44336;padding:10px 0;">' + (errorMsg || '加载失败') + '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有房间数据,直接返回提示
|
// 如果没有房间数据,直接返回提示
|
||||||
if (!roomData || !roomData.time_slots || !Array.isArray(roomData.time_slots) || roomData.time_slots.length === 0) {
|
if (!roomData || !roomData.time_slots || !Array.isArray(roomData.time_slots) || roomData.time_slots.length === 0) {
|
||||||
return '<div style="text-align:center;color:#999;padding:10px 0;">无房间数据</div>';
|
return '<div style="text-align:center;color:#999;padding:10px 0;">无房间数据</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用缓存的模板,通过 laytpl 渲染数据(不再请求网络,直接使用内存中的缓存)
|
// 使用缓存的模板,通过 laytpl 渲染数据(不再请求网络,直接使用内存中的缓存)
|
||||||
if (dayContentTemplate) {
|
if (dayContentTemplate) {
|
||||||
// 模板已缓存,直接使用 laytpl 渲染(不请求网络,使用缓存)
|
// 模板已缓存,直接使用 laytpl 渲染(不请求网络,使用缓存)
|
||||||
|
|
@ -366,10 +425,10 @@
|
||||||
return '<div style="text-align:center;color:#999;padding:10px 0;">模板加载中...</div>';
|
return '<div style="text-align:center;color:#999;padding:10px 0;">模板加载中...</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== 页面初始化加载流程:先加载模板,模板加载成功后再加载日历数据 ==========
|
// ========== 页面初始化加载流程:先加载模板,模板加载成功后再加载日历数据 ==========
|
||||||
// 步骤1:页面加载时先获取模板(只加载一次并缓存)
|
// 步骤1:页面加载时先获取模板(只加载一次并缓存)
|
||||||
loadDayContentTemplate().then(function() {
|
loadDayContentTemplate().then(function () {
|
||||||
// 步骤2:模板加载成功后,再加载房间选项
|
// 步骤2:模板加载成功后,再加载房间选项
|
||||||
coreHelper.Post("Api/SQRoomUnavailableTimes/GetIndex", null, function (e) {
|
coreHelper.Post("Api/SQRoomUnavailableTimes/GetIndex", null, function (e) {
|
||||||
if (e.code === 0 && e.data && e.data.roomOptions) {
|
if (e.code === 0 && e.data && e.data.roomOptions) {
|
||||||
|
|
@ -395,7 +454,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).fail(function(error) {
|
}).fail(function (error) {
|
||||||
console.error('模板加载失败,无法继续加载日历数据', error);
|
console.error('模板加载失败,无法继续加载日历数据', error);
|
||||||
layer.msg('模板加载失败,请刷新页面重试');
|
layer.msg('模板加载失败,请刷新页面重试');
|
||||||
});
|
});
|
||||||
|
|
@ -1184,17 +1243,17 @@
|
||||||
|
|
||||||
// 同时加载房间数据和节假日价格标识
|
// 同时加载房间数据和节假日价格标识
|
||||||
$.when(
|
$.when(
|
||||||
$.Deferred(function(dfd) {
|
$.Deferred(function (dfd) {
|
||||||
coreHelper.Get("Api/SQRoomPricing/GetRoomListWithSlots?date=" + encodeURIComponent(dateStr) + "&showOnlyAvailable=false", function(e) {
|
coreHelper.Get("Api/SQRoomPricing/GetRoomListWithSlots?date=" + encodeURIComponent(dateStr) + "&showOnlyAvailable=false", function (e) {
|
||||||
dfd.resolve(e);
|
dfd.resolve(e);
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
$.Deferred(function(dfd) {
|
$.Deferred(function (dfd) {
|
||||||
coreHelper.Get("Api/SQRoomPricing/HasHolidayPricing?roomId=" + selectedRoomId + "&date=" + encodeURIComponent(dateStr), function(e) {
|
coreHelper.Get("Api/SQRoomPricing/HasHolidayPricing?roomId=" + selectedRoomId + "&date=" + encodeURIComponent(dateStr), function (e) {
|
||||||
dfd.resolve(e);
|
dfd.resolve(e);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
).done(function(roomResult, holidayResult) {
|
).done(function (roomResult, holidayResult) {
|
||||||
// 再次清空内容(包括加载提示)
|
// 再次清空内容(包括加载提示)
|
||||||
dayElement.find('div:not(.calendar-day-header)').remove();
|
dayElement.find('div:not(.calendar-day-header)').remove();
|
||||||
|
|
||||||
|
|
@ -1247,17 +1306,17 @@
|
||||||
|
|
||||||
// 同时加载房间数据和节假日价格标识
|
// 同时加载房间数据和节假日价格标识
|
||||||
$.when(
|
$.when(
|
||||||
$.Deferred(function(dfd) {
|
$.Deferred(function (dfd) {
|
||||||
coreHelper.Get("Api/SQRoomPricing/GetRoomListWithSlots?date=" + encodeURIComponent(dateStr) + "&showOnlyAvailable=false", function(e) {
|
coreHelper.Get("Api/SQRoomPricing/GetRoomListWithSlots?date=" + encodeURIComponent(dateStr) + "&showOnlyAvailable=false", function (e) {
|
||||||
dfd.resolve(e);
|
dfd.resolve(e);
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
$.Deferred(function(dfd) {
|
$.Deferred(function (dfd) {
|
||||||
coreHelper.Get("Api/SQRoomPricing/HasHolidayPricing?roomId=" + roomId + "&date=" + encodeURIComponent(dateStr), function(e) {
|
coreHelper.Get("Api/SQRoomPricing/HasHolidayPricing?roomId=" + roomId + "&date=" + encodeURIComponent(dateStr), function (e) {
|
||||||
dfd.resolve(e);
|
dfd.resolve(e);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
).done(function(roomResult, holidayResult) {
|
).done(function (roomResult, holidayResult) {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
console.log('日期:', dateStr, '房间数据:', roomResult, '节假日:', holidayResult);
|
console.log('日期:', dateStr, '房间数据:', roomResult, '节假日:', holidayResult);
|
||||||
}
|
}
|
||||||
|
|
@ -1354,6 +1413,23 @@
|
||||||
|
|
||||||
//重载form
|
//重载form
|
||||||
form.render();
|
form.render();
|
||||||
|
|
||||||
|
// 图例展开/收起功能
|
||||||
|
$('#toggleLegendBtn').on('click', function() {
|
||||||
|
var $content = $('#legendContent');
|
||||||
|
var $btn = $(this);
|
||||||
|
var $icon = $btn.find('i');
|
||||||
|
|
||||||
|
if ($content.is(':visible')) {
|
||||||
|
$content.slideUp(300);
|
||||||
|
$icon.removeClass('layui-icon-up').addClass('layui-icon-down');
|
||||||
|
$btn.html('<i class="layui-icon layui-icon-down"></i> 展开');
|
||||||
|
} else {
|
||||||
|
$content.slideDown(300);
|
||||||
|
$icon.removeClass('layui-icon-down').addClass('layui-icon-up');
|
||||||
|
$btn.html('<i class="layui-icon layui-icon-up"></i> 收起');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
// 开发环境配置
|
// 开发环境配置
|
||||||
const development = {
|
const development = {
|
||||||
// API基础URL
|
// API基础URL
|
||||||
baseUrl: 'https://sqqp.zpc-xy.com',
|
// baseUrl: 'https://sqqp.zpc-xy.com',
|
||||||
host: ['https://sqqp.zpc-xy.com'],
|
// host: ['https://sqqp.zpc-xy.com'],
|
||||||
// baseUrl: 'http://192.168.1.21:2016',
|
baseUrl: 'http://192.168.1.21:2016',
|
||||||
// host: ['http://192.168.1.21:2016'],
|
host: ['http://192.168.1.21:2016'],
|
||||||
// baseUrl: 'http://192.168.1.24:2016',
|
// baseUrl: 'http://192.168.1.24:2016',
|
||||||
// host: ['http://192.168.1.24:2016'],
|
// host: ['http://192.168.1.24:2016'],
|
||||||
imageUrl: 'https://guyu-1308826010.cos.ap-shanghai.myqcloud.com',
|
imageUrl: 'https://guyu-1308826010.cos.ap-shanghai.myqcloud.com',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user