<!DOCTYPE html><html><head> <title>管理员列表 - 后台管理系统</title> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"> <link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"> <script type="text/javascript" src="/static/layui/layui.js"></script> <style type="text/css"> .header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;} .header div{border-bottom:solid 2px #009688;margin-top: 8px;} .header button{float:right;margin-top:-5px;} </style></head><body style="padding:10px; box-sizing: border-box;"><form class="layui-form"> <div class="layui-form-item"> <label class="layui-form-label">文章标题</label> <div class="layui-input-inline"> <input type="text" class="layui-input" name="textname" > </div> </div> <div class="layui-form-item"> <label class="layui-form-label">文章简介</label> <div class="layui-input-inline"> <textarea name="text" required lay-verify="required" placeholder="请输入" class="layui-textarea"></textarea> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">文章封面</label> <div class="layui-input-inline"> <button type="button" class="layui-btn layui-btn-fluid" id="up_test_img">上传图片</button> </div> <div class="layui-form-mid layui-word-aux">支持png,jpg,gif</div> </div> <div class="layui-form-item"> <label class="layui-form-label">封面预览</label> <div class="layui-input-block"> <div class="layui-upload-list" id="srcimg" style="width:90%;float:left;"></div> </div> </div> <!--基本信息 end--> <div class="layui-form-item"> <label class="layui-form-label">文章详情</label> <div class="layui-input-block"> <textarea id="content" name="content" style="display: none;" value=""></textarea> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">状态</label> <div class="layui-input-block"> <input type="radio" name="status" value="1" title="开启" checked=""> <input type="radio" name="status" value="0" title="禁用"> </div> </div></form><div class="layui-form-item"> <div class="layui-input-block"> <button type="button" class="layui-btn" onclick="save()">保存</button> </div></div><script type="text/javascript"> layui.use(['layer','form','upload','laydate','layedit','element'],function(){ form = layui.form; layer = layui.layer; $ = layui.jquery; var element = layui.element; var layedit = layui.layedit; layedit.build('content',{ height: 300, //设置编辑器高度 }); upload = layui.upload; upload.render({ elem: "#up_test_img", url: "/admin/upload/upload_img", multiple: true, done: function(res,title){ if(res.code > 0){ return layer.msg("上传失败," res.msg); }else{ $("#srcimg").append('<div class="upload_pic_li" style="position:relative; width:100px; float:left; margin:0 10px 10px 0"><img style="width:100px;height:100px;" src="' res.url '" class="layui-upload-img" onmouseover="show_img(this)" onmouseleave="hide_img()"><input type="hidden" name="test_img" value="' res.data '"/><a class="close-img" href="javascript:;" onclick="deleteImage(\'' res.data '\',this);return false;"></a></div>'); , type: 'post' , ,accept: 'image' , acceptMime: 'image/* ' , , , exts: 'jpg|png|gif|bmp|jpeg' , , size: '10240' , , , devmode: true , , codeConfig: { , , , } hide: true, //Whether to display the encoding language selection box default: 'javascript' //hide The default language format for True}, Tool: ['Strong' // bold, 'italic' // oblique body, 'underline' // underline, 'del' // delete line, '|' // segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, segmentation line, dividing line, segmentation line, segmentation line, segmentation, 'left' //Left alignment ,'center' // Center alignment ,'right' // right-aligned ,'image' //Insert picture , , ,'help' //Help , , , ] , ,height: 300, //Set editor height , }); var index = laidedit.build('content',{ ,height: 300, //Set editor height , }) ; //Create the editor //Synchronize the value to the text field when submitting form.verify({ }); }); function save(){ // Synchronize the content of the rich text editor $.post("/admin/text/textadd",$('form').serialize(),function (res){ if (res.code ==0){ layer.msg(res.msg,{'icon':1}) setTimeout(function (){ parent.window.location.reload(); else .msg,{'icon':2}); ,'json');