11@extends (' admin.layouts' )
22@section (' css' )
3+ <link href =" /assets/global/plugins/bootstrap-fileinput/bootstrap-fileinput.css" rel =" stylesheet" type =" text/css" />
34@endsection
45@section (' content' )
56 <!-- BEGIN CONTENT BODY -->
67 <div class =" page-content" style =" padding-top :0 ;" >
78 <!-- BEGIN PAGE BASE CONTENT -->
89 <div class =" row" >
910 <div class =" col-md-12" >
11+ @if (Session:: has (' successMsg' ) )
12+ <div class =" alert alert-success" >
13+ <button class =" close" data-close =" alert" ></button >
14+ {{ Session:: get (' successMsg' ) } }
15+ </div >
16+ @endif
1017 @if (Session:: has (' errorMsg' ) )
1118 <div class =" alert alert-danger" >
1219 <button class =" close" data-close =" alert" ></button >
2330 </div >
2431 <div class =" portlet-body form" >
2532 <!-- BEGIN FORM-->
26- <form action =" {{ url (' admin/addArticle' )} }" method =" post" enctype =" multipart/form-data" class =" form-horizontal" onsubmit = " return do_submit(); " >
33+ <form action =" {{ url (' admin/addArticle' )} }" method =" post" enctype =" multipart/form-data" class =" form-horizontal" >
2734 <div class =" form-body" >
2835 <div class =" form-group" >
29- <label for =" type" class =" control-label col-md-1 " >类型</label >
36+ <label for =" type" class =" control-label col-md-2 " >类型</label >
3037 <div class =" col-md-6" >
3138 <div class =" mt-radio-inline" >
3239 <label class =" mt-radio" >
4148 </div >
4249 </div >
4350 <div class =" form-group" >
44- <label class =" control-label col-md-1 " >标题</label >
51+ <label class =" control-label col-md-2 " >标题</label >
4552 <div class =" col-md-6" >
4653 <input type =" text" class =" form-control" name =" title" id =" title" placeholder =" " autofocus required >
4754 <input type =" hidden" name =" _token" value =" {{ csrf_token ()} }" >
4855 </div >
4956 </div >
5057 <div class =" form-group" >
51- <label class =" control-label col-md-1 " >简介</label >
58+ <label class =" control-label col-md-2 " >简介</label >
5259 <div class =" col-md-6" >
5360 <input type =" text" class =" form-control" name =" summary" id =" summary" placeholder =" " >
5461 </div >
5562 </div >
5663 <div class =" form-group" >
57- <label class =" control-label col-md-1 " >排序</label >
64+ <label class =" control-label col-md-2 " >排序</label >
5865 <div class =" col-md-6" >
5966 <input type =" text" class =" form-control" name =" sort" id =" sort" value =" 0" required />
6067 <span class =" help-block" > 值越高显示时越靠前 </span >
6168 </div >
6269 </div >
6370 <div class =" form-group" >
64- <label class =" control-label col-md-1" >内容</label >
71+ <label class =" control-label col-md-2" >LOGO</label >
72+ <div class =" col-md-6" >
73+ <div class =" fileinput fileinput-new" data-provides =" fileinput" >
74+ <div class =" fileinput-new thumbnail" style =" width : 200px ; height : 150px ;" >
75+ <img src =" /assets/images/noimage.png" alt =" " /> </div >
76+ <div class =" fileinput-preview fileinput-exists thumbnail" style =" max-width : 200px ; max-height : 150px ;" > </div >
77+ <div >
78+ <span class =" btn default btn-file" >
79+ <span class =" fileinput-new" > 选择 </span >
80+ <span class =" fileinput-exists" > 更换 </span >
81+ <input type =" file" name =" logo" id =" logo" >
82+ </span >
83+ <a href =" javascript:;" class =" btn red fileinput-exists" data-dismiss =" fileinput" > 移除 </a >
84+ </div >
85+ </div >
86+ <span class =" help-block" > 推荐尺寸:100x75 </span >
87+ </div >
88+ </div >
89+ <div class =" form-group" >
90+ <label class =" control-label col-md-2" >内容</label >
6591 <div class =" col-md-10" >
6692 <script id =" editor" type =" text/plain" style =" height :400px ;" ></script >
6793 </div >
6894 </div >
6995 </div >
7096 <div class =" form-actions" >
7197 <div class =" row" >
72- <div class =" col-md-12 " >
98+ <div class =" col-md-offset-2 col-md-10 " >
7399 <button type =" submit" class =" btn green" >提 交</button >
74100 </div >
75101 </div >
86112 <!-- END CONTENT BODY -->
87113@endsection
88114@section (' script' )
115+ <script src =" /assets/global/plugins/bootstrap-fileinput/bootstrap-fileinput.js" type =" text/javascript" ></script >
89116 <script src =" /js/ueditor/ueditor.config.js" type =" text/javascript" charset =" utf-8" ></script >
90117 <script src =" /js/ueditor/ueditor.all.js" type =" text/javascript" charset =" utf-8" ></script >
91118
102129 });
103130
104131 // ajax同步提交
105- function do_submit () {
106- var _token = ' {{ csrf_token ()} }' ;
107- var title = $ (' #title' ).val ();
108- var type = $ (" input:radio[name='type']:checked" ).val ();
109- var author = $ (' #author' ).val ();
110- var summary = $ (' #summary' ).val ();
111- var content = UE .getEditor (' editor' ).getContent ();
112- var sort = $ (' #sort' ).val ();
132+ {{-- function do_submit() {--}}
133+ {{-- var _token = '{{csrf_token()}}';--}}
134+ {{-- var title = $('#title').val();--}}
135+ {{-- var type = $("input:radio[name='type']:checked").val();--}}
136+ {{-- var author = $('#author').val();--}}
137+ {{-- var summary = $('#summary').val();--}}
138+ {{-- var content = UE.getEditor('editor').getContent();--}}
139+ {{-- var sort = $('#sort').val();--}}
113140
114- $ .ajax ({
115- type: " POST" ,
116- url: " {{ url (' admin/addArticle' )} }" ,
117- async: false ,
118- data: {_token: _token, title: title, type: type, author: author, summary: summary, content: content, sort: sort},
119- dataType: ' json' ,
120- success : function (ret ) {
121- layer .msg (ret .message , {time: 1000 }, function () {
122- if (ret .status == ' success' ) {
123- window .location .href = ' {{ url (' admin/articleList' )} }' ;
124- }
125- });
126- }
127- });
141+ {{-- $.ajax({--}}
142+ {{-- type: "POST",--}}
143+ {{-- url: "{{url('admin/addArticle')}}",--}}
144+ {{-- async: false,--}}
145+ {{-- data: {_token:_token, title: title, type:type, author:author, summary:summary, content:content, sort:sort},--}}
146+ {{-- dataType: 'json',--}}
147+ {{-- success: function (ret) {--}}
148+ {{-- layer.msg(ret.message, {time:1000}, function() {--}}
149+ {{-- if (ret.status == 'success') {--}}
150+ {{-- window.location.href = '{{url('admin/articleList')}}';--}}
151+ {{-- } --} }
152+ {{-- });--}}
153+ {{-- } --} }
154+ {{-- });--}}
128155
129- return false ;
130- }
156+ {{-- return false;--}}
157+ {{-- } --} }
131158 </script >
132159@endsection
0 commit comments