123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- @extends('admin/layout')
- @section('header')
- <link href="{{asset('css/plugins/chosen/chosen.css')}}" rel="stylesheet">
- <link href="{{asset('css/plugins/switchery/switchery.css')}}" rel="stylesheet">
- <link rel="stylesheet"
- href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/css/bootstrap-select.min.css">
- @endsection
- @section('content')
- <body class="gray-bg">
- <div class="wrapper wrapper-content animated fadeInRight">
- <div class="row">
- <div class="col-sm-12">
- <div class="ibox float-e-margins">
- <div class="ibox-content">
- <form method="get" class="form-horizontal" id="form">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="nickname"><span
- class="red">* </span>标题:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control" id="title" name="title" autocomplete="off"
- value="{{$info->title??''}}">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="username_new"><span class="red">* </span>
- 内容:</label>
- <div class="col-sm-6">
- <input type="text" class="form-control" id="content" name="content"
- value="{{$info->content??''}}" autocomplete="off">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">图片:</label>
- <div class="col-sm-4">
- <button type="button" class="btn btn-primary" name="file_upload">文件上传
- </button>
- <input type="file" value="" style="display: none" name="uploadFile"
- data-for="logo_img">
- <img id="image" width="200px" src="{{$info->image??''}}">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="translate_content">详情:</label>
- <div class="col-sm-8">
- <script id="translate_content" name="details"
- type="text/plain">{!! $info->details??''!!}</script>
- </div>
- </div>
- <div class="form-group">
- <div class="col-sm-4 col-sm-offset-2">
- <button class="btn btn-primary" type="button" data-id="{{$info->id??0}}"
- id="save">
- 保存
- </button>
- <button class="btn btn-white" type="button" id="cancel">取消</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body>
- @endsection
- @section('footer')
- @include('vendor.ueditor.assets')
- <script src="{{asset('js/plugins/switchery/switchery.js')}}"></script>
- <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js"></script>
- <script>
- $(document).on('click', '#cancel', function () {
- tips.closeParentLayer();
- });
- var ue = UE.getEditor('content');
- ue.ready(function () {
- ue.setHeight(300);
- });
- var ueTranslate = UE.getEditor('translate_content');
- ueTranslate.ready(function () {
- ueTranslate.setHeight(300);
- });
- $(document).on('click', '[name=file_upload]', function () {
- $(this).next().trigger('click');
- });
- $(document).on('change', '[name=uploadFile]', function () {
- if (!$(this)[0].files[0]) {
- return;
- }
- var formData = new FormData();
- formData.append('file', $(this)[0].files[0]);
- var ln;
- $.ajax({
- url: '/admin/tool/upload',
- type: 'POST',
- cache: false,
- data: formData,
- processData: false,
- contentType: false,
- beforeSend: function () {
- ln = layer.load();
- },
- complete: function () {
- layer.close(ln);
- },
- success: function (result) {
- var data = result.data;
- $('#image').attr('src', data.file_url);
- },
- error: function (XMLHttpRequest) {
- if (XMLHttpRequest.status === 500) {
- layer.alert("异步请求失败", {icon: 5});
- return;
- }
- layer.alert(JSON.parse(XMLHttpRequest.responseText).message, {icon: 0});
- }
- });
- });
- $(document).on('click', '#save', function () {
- var data = tips.getFormValues('#form');
- data.image = $("#image").attr('src');
- var id = $(this).data('id');
- var url = '/admin/classroom/tool-update/' + id;
- var type = 'get';
- var ajaxConfig = {
- url: url,
- type: type,
- data: data,
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1500}, function () {
- tips.closeParentLayer();
- window.parent.tips.tableRefresh('#table');
- });
- }
- };
- tips.ajax(ajaxConfig);
- });
- </script>
- @endsection
|