create.blade.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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">
  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. <div class="form-group row">
  64. <label class="col-sm-2 col-sm-offset-1 control-label">视频封面</label>
  65. <div class="col-sm-8">
  66. {!! widget('Tools.ImgUpload')->single('video-cover', 'data[pic_url]') !!}
  67. </div>
  68. @if($errors->has('pic_url'))
  69. <span class="help-block">{{ $errors->first('pic_url') }}</span>
  70. @endif
  71. </div>
  72. @endif
  73. <div class="form-group row">
  74. <label class="col-sm-2 col-sm-offset-1 control-label">排序</label>
  75. <div class="col-sm-8">
  76. <input type="text" name="data[sort]" class="form-control" placeholder="请输入排序" value="{{ isset(old('data')['sort']) ? old('data')['sort'] : 0 }}">
  77. </div>
  78. @if($errors->has('sort'))
  79. <span class="help-block">{{ $errors->first('sort') }}</span>
  80. @endif
  81. </div>
  82. <div class="form-group row">
  83. <div class="col-sm-8 col-sm-offset-3">
  84. <button type="submit" class="btn btn-sm btn-primary">提交</button>
  85. </div>
  86. </div>
  87. </form>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. @endsection
  95. @section('footer')
  96. <script type="text/javascript">
  97. $(function () {
  98. $('#upload-video-btn').on('click', function () {
  99. $('#upload-video-input').click();
  100. });
  101. $('#upload-video-input').change(function () {
  102. if(this['files'].length > 0) {
  103. $('#upload-video-path').val(this['files'][0]['name']);
  104. }
  105. });
  106. UE.getEditor('content-editor');
  107. })
  108. </script>
  109. @endsection