实现方法
一、html部分改造
文件路径:apps/admin/view/default/content/content.html
1.搜索【内容标题】,大致在195行,内容修改为:
<div class="layui-form-item"> <label class="layui-form-label">内容标题 <span class="layui-text-red">*</span></label> <div class="layui-input-inline" style="width:80%;"> <input type="text" name="title" id="title" required lay-verify="required" placeholder="请输入内容标题" class="LayUI-input"> </div> <div class="layui-form-mid layui-word-aux" id="email_msg">*</div> </div>
2.页面底部{include file='common/ueditor.html'}内容前增加如下代码:
<script> $(document).ready(function() { $("input").blur(function() { var $parent = $(this).parent(); $parent.find(".formtips").remove(); if ($(this).is("#title")) { var title = this.value; if (title == "") { $("#email_msg").html("<span class='reg-error' style='display: inline;'>标题不能为空!</span>") } else { $.ajax({ url:"admin.php?p=/Content/checktitle/", data:{ "formcheck":'{$formcheck}', "mcode":{$get.mcode}, "title":title, }, type:"POST", dataType:"json", success:function (data) { if (data.data =="有重复") { $("#email_msg").html("<a style='color:red'>"+data.data+"</a>"); }else { $("#email_msg").html("<span style='color:#08a600'>"+data.data+"</span>") } } }) } } }); }); </script>
二、PHP部分改造
文件路径:apps/admin/controller/content/ContentController.php
页面中增加如下代码即可:
版权所有,付费文档禁止转载。
为保证教程的实用性及扩大知识面覆盖,如果您有相似问题而未解决,可联系在线客服免费技术支持。