123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- @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">
- @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="type_id">资源类型:</label>
- <div class="col-sm-8 ">
- <select class="form-control" id="type" name="type_id" id="type_id">
- <option value="">请选择资源类型</option>
- @foreach ($assetTypes as $item)
- <option value="{{$item->id}}"
- @if(($data->type_id??null)==$item->id) selected @endif>
- {{$item->title}}
- </option>
- @endforeach
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">请选择文件:</label>
- <div class="col-sm-6">
- {{--<input type="file" id="up_file">--}}
- <input type="file" id="upload_file" class="form-control" >
- <input class="form-control" title="" type="text" id="original_name" value="{{$data->original_name??''}}" disabled style="margin-top: 10px">
- <input type="hidden" id="file_url" value="{{$data->file_url??''}}">
- </div>
- <div class="col-sm-4">
- <button class="btn btn-info btn-sm" type="button" onclick="units.fileUpload()">上传
- </button>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="describe">描述:</label>
- <div class="col-sm-8">
- <textarea class="form-control" id="describe" name="describe"
- rows="3">{{$data->describe??''}}</textarea>
- </div>
- </div>
- <div class="hr-line-dashed"></div>
- <div class="form-group">
- <div class="col-sm-4 col-sm-offset-2">
- <button class="btn btn-primary" type="button"
- onclick="units.save({{$data->id??0}})">
- 保存
- </button>
- <button class="btn btn-white closeLayer" type="button">取消</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body>
- @endsection
- @section('footer')
- <script>
- var units = {
- save: function (id) {
- var url = '/admin/school/assets/' + id;
- var data = tips.getFormValues('#form');
- data.original_name = $("#original_name").val();
- data.file_url = $("#file_url").val();
- var ajaxConfig = {
- url: url,
- type: 'post',
- data: data,
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1000}, function () {
- tips.closeParentLayer();
- window.parent.tips.tableRefresh('#table');
- });
- }
- };
- tips.ajax(ajaxConfig);
- },
- fileUpload: function () {
- var config = {
- url: '/admin/tool/upload?notAsset=1'
- };
- config.success = function (result) {
- $("#file_url").val(result.data.file_url);
- $("#original_name").val(result.data.original_name);
- layer.msg(result.message, {icon: 6, time: 1500});
- };
- tips.fileUpload($("#upload_file"), config);
- }
- };
- </script>
- @endsection
|