1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <script>
- $('#base-form').ajaxForm({
- success: function (result) {
- if(!result.status){
- swal({
- title: result.message,
- text: "",
- type: "error"
- })
- } else {
- swal({
- title: "保存成功!",
- text: "",
- type: "success"
- }, function () {
- location = '{{route('admin.course.teacher.index')}}';
- });
- }
- }
- });
- $(function () {
- var uploader = WebUploader.create({
- // 选完文件后,是否自动上传。
- auto: true,
- swf: '{{url(env("APP_URL").'/assets/backend/libs/webuploader-0.1.5/Uploader.swf')}}',
- server: '{{route('ibrand.file.upload',['_token'=>csrf_token()])}}',
- pick: '#filePicker',
- fileVal: 'upload_file',
- accept: {
- title: 'Images',
- extensions: 'gif,jpg,jpeg,bmp,png',
- mimeTypes: 'image/*'
- }
- });
- // 文件上传成功,给item添加成功class, 用样式标记上传成功。
- uploader.on('uploadSuccess', function (file, response) {
- $('#userAvatar img').attr("src", response.data.url);
- $('#userAvatar input').val('/storage/' + response.data.path);
- });
- });
- $(function () {
- var datas = [];
- $.ajax({
- type: "GET",
- url: '{{route('admin.course.teacher.getsimilartags')}}',
- success: function (data) {
- if (data) {
- console.log(data);
- datas = data;
- $("#inputDiscountTags").tagator({
- autocomplete: datas
- });
- }
- }
- });
- });
- function delColumn(_self) {
- $(_self).parent().parent().remove();
- }
- $(function () {
- var type_html = $('#type-template').html();
- $('#add-type').click(function () {
- var num = $('.typeList').length;
- $('#typeBody').append(type_html.replace(/{NUM}/g, num));
- });
- var content_html = $('#content-template').html();
- $('#add-content').click(function () {
- var num = $('.contentList').length;
- $('#contentBody').append(content_html.replace(/{NUM}/g, num));
- });
- })
- </script>
|