(isNextData = false)
| 984 | |
| 985 | |
| 986 | function showTaskDescriptionModal(isNextData = false) { |
| 987 | const modal = document.getElementById('taskDescriptionModal'); |
| 988 | const taskInput = document.getElementById('taskDescription'); |
| 989 | const confirmBtn = document.getElementById('confirmTaskBtn'); |
| 990 | const header = modal.querySelector('.task-modal-header h3'); |
| 991 | |
| 992 | // 根据场景修改标题 |
| 993 | if (isNextData) { |
| 994 | header.textContent = '📝 下一条数据 - 任务描述'; |
| 995 | } else { |
| 996 | header.textContent = '📝 任务描述'; |
| 997 | } |
| 998 | |
| 999 | // 清空输入框 |
| 1000 | taskInput.value = ''; |
| 1001 | taskInput.focus(); |
| 1002 | |
| 1003 | // 显示弹窗 |
| 1004 | modal.style.display = 'flex'; |
| 1005 | |
| 1006 | // 只绑定确认按钮事件 |
| 1007 | confirmBtn.onclick = async () => { |
| 1008 | const description = taskInput.value.trim(); |
| 1009 | if (description === '') { |
| 1010 | alert('请输入任务描述才能开始任务!'); |
| 1011 | taskInput.focus(); |
| 1012 | return; |
| 1013 | } |
| 1014 | |
| 1015 | currentTaskDescription = description; |
| 1016 | hideTaskDescriptionModal(); |
| 1017 | |
| 1018 | if (isNextData) { |
| 1019 | await continueWithNextDataCollection(); |
| 1020 | } else { |
| 1021 | await startDataCollectionWithDescription(); |
| 1022 | } |
| 1023 | }; |
| 1024 | } |
| 1025 | |
| 1026 | function hideTaskDescriptionModal() { |
| 1027 | const modal = document.getElementById('taskDescriptionModal'); |
no test coverage detected