feat(selfpage&schedule): 添加反馈空内容校验与任务跨天逻辑优化
1. 新增多语言文案用于反馈内容为空提示 2. 调整个人页面头像控件尺寸并隐藏默认显示 3. 增加反馈提交前的内容非空校验 4. 优化BLE设备mac字段提交逻辑 5. 重构日程任务判断逻辑,支持跨天任务识别
This commit is contained in:
parent
2e59fd86ff
commit
85ee694121
5
Assets/.trae/rules/git-commit-message.md
Normal file
5
Assets/.trae/rules/git-commit-message.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
alwaysApply: true
|
||||||
|
scene: git_message
|
||||||
|
---
|
||||||
|
使用中文编写提交信息
|
||||||
@ -1498,6 +1498,11 @@
|
|||||||
"key": "100300",
|
"key": "100300",
|
||||||
"zh": "今日消杀分布",
|
"zh": "今日消杀分布",
|
||||||
"en": "Today elimination distribution"
|
"en": "Today elimination distribution"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "100301",
|
||||||
|
"zh": "反馈内容不能为空",
|
||||||
|
"en": "Feedback content cannot be empty"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1817,7 +1817,7 @@ RectTransform:
|
|||||||
m_AnchorMin: {x: 0.5, y: 1}
|
m_AnchorMin: {x: 0.5, y: 1}
|
||||||
m_AnchorMax: {x: 0.5, y: 1}
|
m_AnchorMax: {x: 0.5, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: -226}
|
m_AnchoredPosition: {x: 0, y: -226}
|
||||||
m_SizeDelta: {x: 165, y: 165}
|
m_SizeDelta: {x: 180, y: 180}
|
||||||
m_Pivot: {x: 0.5, y: 1}
|
m_Pivot: {x: 0.5, y: 1}
|
||||||
--- !u!222 &8950144054270730730
|
--- !u!222 &8950144054270730730
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
|
|||||||
@ -64,6 +64,11 @@ namespace Kill.UI.Pages
|
|||||||
if (tasks == null || tasks.Length == 0)
|
if (tasks == null || tasks.Length == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
// 昨天的标志位(用于跨天任务判断)
|
||||||
|
byte yesterdayFlag = (byte)((todayFlag == ScheduleTask.REPEAT_MONDAY)
|
||||||
|
? ScheduleTask.REPEAT_SUNDAY
|
||||||
|
: (todayFlag >> 1));
|
||||||
|
|
||||||
ScheduleTask? nearestTask = null;
|
ScheduleTask? nearestTask = null;
|
||||||
int nearestTimeDiff = int.MaxValue;
|
int nearestTimeDiff = int.MaxValue;
|
||||||
int currentTime = DateTime.Now.Hour * 60 + DateTime.Now.Minute;
|
int currentTime = DateTime.Now.Hour * 60 + DateTime.Now.Minute;
|
||||||
@ -74,19 +79,23 @@ namespace Kill.UI.Pages
|
|||||||
if (!task.Enabled)
|
if (!task.Enabled)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
int taskTime = task.StartHour * 60 + task.StartMinute;
|
||||||
|
int endTime = task.EndHour * 60 + task.EndMinute;
|
||||||
|
bool isCrossDay = endTime <= taskTime;
|
||||||
|
|
||||||
// 检查是否是今天的任务:
|
// 检查是否是今天的任务:
|
||||||
// 1. Repeat == 0 表示仅一次,认为是当天的任务
|
// 1. Repeat == 0 表示仅一次,认为是当天的任务
|
||||||
// 2. Repeat & todayFlag != 0 表示今天有重复
|
// 2. Repeat & todayFlag != 0 表示今天有重复(任务从今天开始)
|
||||||
bool isTodayTask = task.Repeat == 0 || (task.Repeat & todayFlag) != 0;
|
// 3. 跨天任务:昨天开始、今天仍未结束,也视为今天任务
|
||||||
|
bool isTodayTask = task.Repeat == 0
|
||||||
|
|| (task.Repeat & todayFlag) != 0
|
||||||
|
|| (isCrossDay && currentTime < endTime && (task.Repeat & yesterdayFlag) != 0);
|
||||||
|
|
||||||
if (!isTodayTask)
|
if (!isTodayTask)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int taskTime = task.StartHour * 60 + task.StartMinute;
|
// 跳过已结束的任务(非跨天任务 && 当前时间已过结束时间)
|
||||||
int endTime = task.EndHour * 60 + task.EndMinute;
|
if (!isCrossDay && currentTime >= endTime)
|
||||||
|
|
||||||
// 跳过已结束的任务
|
|
||||||
if (currentTime >= endTime)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int timeDiff = taskTime - currentTime;
|
int timeDiff = taskTime - currentTime;
|
||||||
@ -114,7 +123,13 @@ namespace Kill.UI.Pages
|
|||||||
// 判断任务是未来还是进行中
|
// 判断任务是未来还是进行中
|
||||||
int currentTime = DateTime.Now.Hour * 60 + DateTime.Now.Minute;
|
int currentTime = DateTime.Now.Hour * 60 + DateTime.Now.Minute;
|
||||||
int taskTime = task.StartHour * 60 + task.StartMinute;
|
int taskTime = task.StartHour * 60 + task.StartMinute;
|
||||||
bool isFutureTask = taskTime > currentTime;
|
int endTime = task.EndHour * 60 + task.EndMinute;
|
||||||
|
bool isCrossDay = endTime <= taskTime;
|
||||||
|
|
||||||
|
// 跨天任务:如果 startTime > currentTime 但 currentTime < endTime,
|
||||||
|
// 说明任务昨天已开始、今天仍在运行,应视为进行中而非未开始
|
||||||
|
bool isFutureTask = taskTime > currentTime
|
||||||
|
&& !(isCrossDay && currentTime < endTime);
|
||||||
|
|
||||||
if (scheduleText != null)
|
if (scheduleText != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -158,13 +158,23 @@ namespace Kill.UI.Pages
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public async void SubmitFeedback()
|
public async void SubmitFeedback()
|
||||||
{
|
{
|
||||||
|
if(issueInput.text==null||issueInput.text=="")
|
||||||
|
{
|
||||||
|
ToastUI.Show("100301");
|
||||||
|
return;
|
||||||
|
}
|
||||||
LoadingUI.Show();
|
LoadingUI.Show();
|
||||||
|
|
||||||
// 准备表单数据
|
// 准备表单数据
|
||||||
List<IMultipartFormSection> formData = new List<IMultipartFormSection>();
|
List<IMultipartFormSection> formData = new List<IMultipartFormSection>();
|
||||||
|
|
||||||
// 添加文本字段
|
// 添加文本字段
|
||||||
formData.Add(new MultipartFormDataSection("device_ble_mac",DataManager.Instance.selectedDevice.ble_mac));
|
if(DataManager.Instance.selectedDevice!=null&&DataManager.Instance.selectedDevice.ble_mac!="")
|
||||||
|
{
|
||||||
|
formData.Add(new MultipartFormDataSection("device_ble_mac",DataManager.Instance.selectedDevice.ble_mac));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
formData.Add(new MultipartFormDataSection("device_ble_mac"," "));
|
||||||
formData.Add(new MultipartFormDataSection("phone_model",SystemInfo.deviceModel));
|
formData.Add(new MultipartFormDataSection("phone_model",SystemInfo.deviceModel));
|
||||||
formData.Add(new MultipartFormDataSection("os_version",SystemInfo.operatingSystem));
|
formData.Add(new MultipartFormDataSection("os_version",SystemInfo.operatingSystem));
|
||||||
formData.Add(new MultipartFormDataSection("app_version",Application.version));
|
formData.Add(new MultipartFormDataSection("app_version",Application.version));
|
||||||
|
|||||||
@ -65,7 +65,6 @@ namespace Kill.UI.Pages
|
|||||||
public async Task RefreshAsync()
|
public async Task RefreshAsync()
|
||||||
{
|
{
|
||||||
userInfo = DataManager.Instance.userInfo;
|
userInfo = DataManager.Instance.userInfo;
|
||||||
avatarImage.gameObject.SetActive(false);
|
|
||||||
nicknameText.text = userInfo.username;
|
nicknameText.text = userInfo.username;
|
||||||
emailText.text = userInfo.email;
|
emailText.text = userInfo.email;
|
||||||
if (!string.IsNullOrEmpty(userInfo.avatar))
|
if (!string.IsNullOrEmpty(userInfo.avatar))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user