1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- @extends('admin/site/side_layout')
- @section('right')
- <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">
- <div id="readDiv">
- <p id="preview">
- </p>
- <button type="button" onclick="units.changeMode('edit')" class="btn btn-success">编辑模式</button>
- </div>
- <form method="get" class="form-horizontal" id="form" style="display: none">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="content">备注:</label>
- <div class="col-sm-8">
- <!-- 编辑器容器 -->
- <script id="content" name="content"
- type="text/plain">{!! $data->content??'' !!}</script>
- </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 type="button" class="btn btn-success" onclick="units.changeMode('read')">阅读模式</button>--}}
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- @endsection
- @section('footer_extend')
- @include('vendor.ueditor.assets')
- <script>
- var ue = UE.getEditor('content');
- ue.ready(function () {
- ue.setHeight(300);
- });
- setTimeout(function () {
- $("#preview").html(ue.getContent())
- }, 1000);
- var units = {
- save: function (id) {
- var data = tips.getFormValues('#form');
- var ajaxConfig = {
- url: '/admin/sites/{{$siteId}}/articles-note',
- type: 'post',
- data: data,
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1000}, function () {
- units.changeMode('read')
- });
- }
- };
- tips.ajax(ajaxConfig);
- },
- changeMode:function (mode) {
- if(mode==='edit') {
- $("#readDiv").hide();
- $("#form").show();
- } else {
- $("#preview").html(ue.getContent());
- $("#readDiv").show();
- $("#form").hide();
- }
- }
- };
- </script>
- @endsection
|