config_add.blade.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. @extends('base.base')
  2. @section('base')
  3. <!-- 内容区域 -->
  4. <div class="main-panel">
  5. <div class="content-wrapper">
  6. <div class="row">
  7. <div class="col-12 grid-margin stretch-card">
  8. <div class="card">
  9. <div class="card-body">
  10. <h4 class="card-title">{{ __('auto.请输入模板名称') }}</h4>
  11. <form class="forms-sample" id="form">
  12. <div class="form-group">
  13. <input type="text" class="form-control required" name="Name" placeholder="{{ __('auto.请输入模板名称') }}">
  14. </div>
  15. <div>
  16. <label for="">
  17. {{ __('auto.配置模板(所有模板百分比)') }}
  18. </label>
  19. </div>
  20. @foreach($GameDataText as $gamekey=>$gamename)
  21. <div style="width: 48%;float: left">
  22. <label for="">{{$gamename}}:</label>
  23. <input type="number" class="form-control" name="{{$gamekey}}"
  24. id="{{$gamekey}}" value="{{$UserControlKind[$gamekey] ?? ''}}">
  25. </div>
  26. @endforeach
  27. <div style="clear: both"></div>
  28. <br>
  29. <button type="button" onclick="commit()"
  30. class="btn btn-sm btn-gradient-primary btn-icon-text">
  31. <i class="mdi mdi-file-check btn-icon-prepend"></i>
  32. {{ __('auto.提交') }}
  33. </button>
  34. <button type="button" onclick="cancel()"
  35. class="btn btn-sm btn-gradient-warning btn-icon-text">
  36. <i class="mdi mdi-reload btn-icon-prepend"></i>
  37. {{ __('auto.取消') }}
  38. </button>
  39. </form>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. <script>
  47. function commit(ID) {
  48. if (!checkForm()) {
  49. return false;
  50. }
  51. var data = $("#form").serializeObject();
  52. for (var i in data) {
  53. if (i === 'Name') {
  54. continue
  55. }
  56. if (parseInt(data[i]) < 0 || parseInt(data[i]) > 100) {
  57. layer.msg('{{ __('auto.控制等级区间') }}0-100');
  58. return false;
  59. }
  60. }
  61. myRequest("/admin/Control/ControlConfig_add", "post", data, function (res) {
  62. if (res.code == '200') {
  63. layer.msg(res.msg)
  64. setTimeout(function () {
  65. parent.location.reload();
  66. }, 1500)
  67. } else {
  68. layer.msg(res.msg)
  69. }
  70. });
  71. }
  72. function cancel() {
  73. parent.location.reload();
  74. }
  75. </script>
  76. @endsection