chapter.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <!-- 探险管理模块 -->
  2. <div class="layui-card">
  3. <div class="layui-card-header">探险管理</div>
  4. <div class="layui-card-body">
  5. <form class="layui-form" id="chapterForm">
  6. <div class="layui-form-item">
  7. <label class="layui-form-label">关卡ID:</label>
  8. <div class="layui-input-inline">
  9. <input type="number" id="chapterLevelID" placeholder="关卡ID, 空或0所有关卡" class="layui-input">
  10. </div>
  11. <div class="layui-input-inline">
  12. <input type="number" id="chapterLevelCount" placeholder="当前挑战次数" min="0" value="0"
  13. class="layui-input">
  14. </div>
  15. <div class="layui-input-inline double-button">
  16. <button id="setChapterBtn" class="layui-btn layui-btn-normal" type="button"
  17. onclick="submitChapterForm()">设置次数</button>
  18. <button id="resetAllBtn" class="layui-btn layui-btn-danger" type="button"
  19. onclick="resetAllChapters()">重置所有关卡次数</button>
  20. <button id="fastLevelBtn" class="layui-btn layui-btn-normal" type="button"
  21. onclick="fastLevel()">快速通关</button>
  22. </div>
  23. </div>
  24. <div class="layui-form-item">
  25. <!-- 新增红色备注 -->
  26. <div style="color: red; margin-left:50px; margin-top: 5px; font-size: 18px;">
  27. *【关卡ID】请参考配置表中【T-探险-关卡.xlsx】表中的关卡ID
  28. </div>
  29. </div>
  30. </form>
  31. </div>
  32. </div>
  33. <script>
  34. // 探险管理模块的提交逻辑
  35. function submitChapterForm() {
  36. chapterLevelID = $("#chapterLevelID").val();
  37. if (!chapterLevelID) {
  38. chapterLevelID = 0
  39. }
  40. if (chapterLevelID < 0) {
  41. layer.msg("关卡ID错误", { icon: 3 });
  42. return
  43. }
  44. chapterLevelCount = $("#chapterLevelCount").val();
  45. var params = [
  46. "set",
  47. chapterLevelID,
  48. chapterLevelCount
  49. ]
  50. toChapterSubmitForm(params); // 调用统一的 submitForm 方法
  51. }
  52. // 重置所有关卡次数
  53. function resetAllChapters() {
  54. var params = [
  55. "set",
  56. "0",
  57. "0"
  58. ]
  59. toChapterSubmitForm(params);
  60. }
  61. // 快速通关
  62. function fastLevel() {
  63. chapterLevelID = $("#chapterLevelID").val();
  64. if (!chapterLevelID) {
  65. chapterLevelID = 0
  66. }
  67. if (chapterLevelID < 0) {
  68. layer.msg("关卡ID错误", { icon: 3 });
  69. return
  70. }
  71. var params = [
  72. "level",
  73. chapterLevelID
  74. ]
  75. toChapterSubmitForm(params);
  76. }
  77. // 提交表单
  78. function toChapterSubmitForm(params) {
  79. var command = "/gm chapter " + params.join(" ")
  80. // 提交表单
  81. submitForm(command); // 调用统一的 submitForm 方法
  82. }
  83. </script>