|
|
@@ -20,18 +20,21 @@
|
|
|
<h5>编辑智能问答</h5>
|
|
|
</div>
|
|
|
<div class="ibox-content">
|
|
|
- <form class="form-horizontal m-t layui-form" id="commentForm" method="post" action="{:url('robot/editWord')}">
|
|
|
+ <form class="form-horizontal m-t layui-form" id="commentForm" method="post"
|
|
|
+ action="{:url('robot/editWord')}">
|
|
|
<input type="hidden" name="robot_id" value="{$info['robot_id']}"/>
|
|
|
<div class="form-group">
|
|
|
<label class="col-sm-3 control-label">问题:</label>
|
|
|
<div class="input-group col-sm-4">
|
|
|
- <textarea class="form-control" name="robot_name" required="" aria-required="true" style="width: 400px;height: 38px;resize:none">{$info['robot_name']}</textarea>
|
|
|
+ <textarea class="form-control" id="robot_name" name="robot_name" required=""
|
|
|
+ aria-required="true" style="width: 400px;height: 38px;resize:none">{$info['robot_name']}</textarea>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
<label class="col-sm-3 control-label">答案:</label>
|
|
|
<div class="input-group col-sm-4">
|
|
|
- <textarea class="form-control" name="robot_content" required="" aria-required="true" style="width: 400px;height: 150px;resize:none">{$info['robot_content']}</textarea>
|
|
|
+ <textarea class="form-control" id="robot_content" name="robot_content" required=""
|
|
|
+ aria-required="true" style="width: 400px;height: 150px;resize:none">{$info['robot_content']}</textarea>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!--<div class="form-group">
|
|
|
@@ -102,43 +105,72 @@
|
|
|
<script src="__JS__/plugins/layer/layer.min.js"></script>
|
|
|
<script src="__JS__/layui/layui.js"></script>
|
|
|
<script src="__JS__/jquery.form.js"></script>
|
|
|
+
|
|
|
+<script charset="utf-8" src="__EDIT__/kindeditor-min.js"></script>
|
|
|
+<script charset="utf-8" src="__EDIT__/lang/zh_CN.js"></script>
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
<script type="text/javascript">
|
|
|
+ var edit1, edit2;
|
|
|
+ KindEditor.ready(function (K) {
|
|
|
+ edit1 = K.create('#robot_name', {
|
|
|
+ themeType: 'qq',
|
|
|
+ items: [
|
|
|
+ 'bold', 'italic', 'underline', 'fontname', 'fontsize', 'forecolor', 'hilitecolor', 'plug-align', 'plug-order', 'plug-indent', 'link'
|
|
|
+ ]
|
|
|
+ });
|
|
|
+
|
|
|
+ edit2 = K.create('#robot_content', {
|
|
|
+ themeType: 'qq',
|
|
|
+ items: [
|
|
|
+ 'bold', 'italic', 'underline', 'fontname', 'fontsize', 'forecolor', 'hilitecolor', 'plug-align', 'plug-order', 'plug-indent', 'link'
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
const myHost = "http://" + window.location.host;
|
|
|
|
|
|
- layui.use(['form', 'upload'], function(){
|
|
|
+ layui.use(['form', 'upload'], function () {
|
|
|
var form = layui.form;
|
|
|
});
|
|
|
|
|
|
var index = '';
|
|
|
- function showStart(){
|
|
|
+
|
|
|
+ function showStart() {
|
|
|
index = layer.load(0, {shade: false});
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- function showSuccess(res){
|
|
|
+ function showSuccess(res) {
|
|
|
|
|
|
- layer.ready(function(){
|
|
|
+ layer.ready(function () {
|
|
|
layer.close(index);
|
|
|
- if(1 == res.code){
|
|
|
- layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
|
|
|
+ if (1 == res.code) {
|
|
|
+ layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function () {
|
|
|
window.location.href = myHost + '/admin/robot/index';
|
|
|
});
|
|
|
- }else if(111 == res.code){
|
|
|
+ } else if (111 == res.code) {
|
|
|
window.location.reload();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
layer.msg(res.msg, {anim: 6});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- $(document).ready(function(){
|
|
|
+ $(document).ready(function () {
|
|
|
// 添加管理员
|
|
|
var options = {
|
|
|
- beforeSubmit:showStart,
|
|
|
- success:showSuccess
|
|
|
+ beforeSubmit: showStart,
|
|
|
+ success: showSuccess
|
|
|
};
|
|
|
|
|
|
- $('#commentForm').submit(function(){
|
|
|
+ $('#commentForm').submit(function () {
|
|
|
+ $("#robot_name").val(edit1.html());
|
|
|
+ $("#robot_content").val(edit2.html());
|
|
|
+
|
|
|
$(this).ajaxSubmit(options);
|
|
|
return false;
|
|
|
});
|
|
|
@@ -146,31 +178,33 @@
|
|
|
|
|
|
// 表单验证
|
|
|
$.validator.setDefaults({
|
|
|
- highlight: function(e) {
|
|
|
+ highlight: function (e) {
|
|
|
$(e).closest(".form-group").removeClass("has-success").addClass("has-error")
|
|
|
},
|
|
|
- success: function(e) {
|
|
|
+ success: function (e) {
|
|
|
e.closest(".form-group").removeClass("has-error").addClass("has-success")
|
|
|
},
|
|
|
errorElement: "span",
|
|
|
- errorPlacement: function(e, r) {
|
|
|
+ errorPlacement: function (e, r) {
|
|
|
e.appendTo(r.is(":radio") || r.is(":checkbox") ? r.parent().parent().parent() : r.parent())
|
|
|
},
|
|
|
errorClass: "help-block m-b-none",
|
|
|
validClass: "help-block m-b-none"
|
|
|
});
|
|
|
|
|
|
- layui.use(['form', 'upload'], function(){
|
|
|
+ layui.use(['form', 'upload'], function () {
|
|
|
var form = layui.form;
|
|
|
|
|
|
- form.on('select(group)', function(value){
|
|
|
+ form.on('select(group)', function (value) {
|
|
|
$("#groups_id").val(value.value);
|
|
|
});
|
|
|
|
|
|
- form.on('select(robotgroups)', function(value){
|
|
|
+ form.on('select(robotgroups)', function (value) {
|
|
|
$("#robotgroups_id").val(value.value);
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|