create.blade.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. @extends('admin.layout')
  2. <style type="text/css">
  3. </style>
  4. @section('header')
  5. @endsection
  6. @section('content')
  7. <div id="sg-main-container-sg">
  8. <div class="wrapper wrapper-content animated fadeInRight">
  9. <div class="row">
  10. <div class="col-sm-12">
  11. <div class="ibox float-e-margins">
  12. <div class="ibox-title">
  13. <h5>{{ '添加' . $model_name }}</h5>
  14. <div class="ibox-tools">
  15. <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
  16. </a>
  17. </div>
  18. </div>
  19. <div class="ibox-content">
  20. <div class="row">
  21. <div class="col-sm-12 pull-right">
  22. <a href="{{ $pre_uri . 'index?type' . $type }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
  23. </div>
  24. </div>
  25. <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'store' }}" enctype="multipart/form-data">
  26. {{ csrf_field() }}
  27. <input type="hidden" name="data[type]" value="{{ $type }}">
  28. <div class="form-group row">
  29. <label class="col-sm-2 col-sm-offset-1 control-label">标题</label>
  30. <div class="col-sm-8">
  31. <input type="text" name="data[title]" class="form-control" placeholder="请输入标题" value="{{ isset(old('data')['title']) ? old('data')['title'] : '' }}" required>
  32. </div>
  33. @if($errors->has('title'))
  34. <span class="help-block">{{ $errors->first('title') }}</span>
  35. @endif
  36. </div>
  37. @if($type != 3)
  38. <div class="form-group row">
  39. <label class="col-sm-2 col-sm-offset-1 control-label">内容</label>
  40. <div class="col-sm-8">
  41. <script id="content-editor" name="data[content]" type="text/plain"></script>
  42. </div>
  43. @if($errors->has('title'))
  44. <span class="help-block">{{ $errors->first('title') }}</span>
  45. @endif
  46. </div>
  47. @else
  48. <div class="form-group row">
  49. <label class="col-sm-2 col-sm-offset-1 control-label">视频</label>
  50. <div class="col-sm-8">
  51. <div class="input-group">
  52. <input type="text" class="form-control" placeholder="上传视频文件" value="{{ isset(old('data')['title']) ? old('data')['title'] : '' }}" readonly id="upload-video-path">
  53. <input type="file" name="video" accept="video/*" style="display: none" id="upload-video-input" required>
  54. <span class="input-group-btn" id="upload-video-btn">
  55. <button class="btn btn-success" type="button">选择文件</button>
  56. </span>
  57. </div>
  58. </div>
  59. @if($errors->has('title'))
  60. <span class="help-block">{{ $errors->first('title') }}</span>
  61. @endif
  62. </div>
  63. @endif
  64. <div class="form-group row">
  65. <label class="col-sm-2 col-sm-offset-1 control-label">排序</label>
  66. <div class="col-sm-8">
  67. <input type="text" name="data[sort]" class="form-control" placeholder="请输入排序" value="{{ isset(old('data')['sort']) ? old('data')['sort'] : 0 }}">
  68. </div>
  69. @if($errors->has('sort'))
  70. <span class="help-block">{{ $errors->first('sort') }}</span>
  71. @endif
  72. </div>
  73. <div class="form-group row">
  74. <div class="col-sm-8 col-sm-offset-3">
  75. <button type="submit" class="btn btn-sm btn-primary">提交</button>
  76. </div>
  77. </div>
  78. </form>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. @endsection
  86. @section('footer')
  87. <script type="text/javascript">
  88. $(function () {
  89. $('#upload-video-btn').on('click', function () {
  90. $('#upload-video-input').click();
  91. });
  92. $('#upload-video-input').change(function () {
  93. if(this['files'].length > 0) {
  94. $('#upload-video-path').val(this['files'][0]['name']);
  95. }
  96. });
  97. UE.getEditor('content-editor');
  98. })
  99. </script>
  100. @endsection