script.blade.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. @include('UEditor::head')
  2. <script src="//apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
  3. <script>
  4. $('#base-form').ajaxForm({
  5. success: function (result) {
  6. $("input[name='id']").val(result.data);
  7. if (result.status) {
  8. swal({
  9. title: "保存成功!",
  10. text: "",
  11. type: "success"
  12. }, function () {
  13. location = '{{route('admin.course.course.index')}}';
  14. });
  15. } else {
  16. swal({
  17. title: result.message,
  18. text: "",
  19. type: "error"
  20. })
  21. }
  22. }
  23. });
  24. let str = "{{$course->vip_level}}";
  25. var arr = str.split(',');
  26. arr.map(item => {
  27. $("input:checkbox[value='" + item + "']").attr('checked', 'true');
  28. });
  29. $(function () {
  30. $.ajax({
  31. type: "GET",
  32. url: '{{route('admin.course.course.getsimilartags')}}',
  33. success: function (data) {
  34. if (data) {
  35. $('#inputDiscountTags').tagator({
  36. autocomplete: data
  37. });
  38. }
  39. }
  40. });
  41. });
  42. $(function () {
  43. var uploader = WebUploader.create({
  44. // 选完文件后,是否自动上传。
  45. auto: true,
  46. swf: '{{url(env("APP_URL").'/assets/backend/libs/webuploader-0.1.5/Uploader.swf')}}',
  47. server: '{{route('ibrand.file.upload',['_token'=>csrf_token()])}}',
  48. pick: '#AuthorAvatarPicker',
  49. fileVal: 'upload_file',
  50. accept: {
  51. title: 'Images',
  52. extensions: 'gif,jpg,jpeg,bmp,png',
  53. mimeTypes: 'image/*'
  54. }
  55. });
  56. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  57. uploader.on('uploadSuccess', function (file, response) {
  58. $('.banner-image').attr('src', response.data.url).show();
  59. $("input[name='banner_pic']").val(response.data.file);
  60. $("input[name='cover']").val(response.data.path);
  61. });
  62. });
  63. var ue = UE.getEditor('container', {
  64. initialFrameHeight: 500
  65. });
  66. ue.ready(function () {
  67. ue.execCommand('serverparam', '_token', '{{ csrf_token() }}');//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
  68. });
  69. </script>