| @layout("/common/_container.html"){ | 
| <style> | 
|     .newWidth, .single-line{ | 
|         max-width:350px !important;display: initial !important; | 
|     } | 
| </style> | 
| <div class="row"> | 
|     <div class="col-sm-12"> | 
|         <div class="ibox float-e-margins"> | 
|             <div class="ibox-content"> | 
|                 <div class="row row-lg"> | 
|                     <div class="col-sm-12"> | 
|                         <div class="tabs-container"> | 
|                             <ul class="nav nav-tabs"> | 
|                                 <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">添加常见问题</a></li> | 
|                             </ul> | 
|                             <div class="tab-content"> | 
|                                 <div id="tab-1" class="tab-pane active"> | 
|                                     <div class="panel-body"> | 
|                                         <label  class="label1" for="questionTitle">*问题标题:</label> | 
|                                         <input class="textarea" type="text" id="questionTitle" placeholder="请输入问题标题"> | 
|                                         <div> | 
|                                         <label for="editor_1">*答复内容:</label> | 
|                                         <textarea id="editor_1" type="text/plain" style="width:1200px;height:400px;"></textarea> | 
|                                         </div> | 
|   | 
|                                         <label for="sort">*排   序:</label> | 
|                                         <input  type="text" id="sort" placeholder="请输入排序"><span>   数字越大,权重越大</span> | 
|                                         <div class="row btn-group-m-t"> | 
|                                             <div class="col-sm-10 col-sm-offset-5"> | 
|                                                 <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="add();" /> | 
|                                                 <#button btnCss="info" name="关闭" id="close" icon="fa-check"  clickFun="closeD();" /> | 
|                                             </div> | 
|                                         </div> | 
|                                     </div> | 
|                                 </div> | 
|   | 
|                             </div> | 
|                         </div> | 
|                     </div> | 
|                 </div> | 
|             </div> | 
|         </div> | 
|     </div> | 
| </div> | 
| <script type="text/javascript"> | 
|     /** | 
|      * 关闭此对话框 | 
|      */ | 
|     function closeD(){ | 
|         console.log("关闭"); | 
|         parent.layer.close(window.parent.TQuestion.layerIndex); | 
|     } | 
|     const data1 = { | 
|         content:"", | 
|         sort:null, | 
|         answer:"" | 
|     }; | 
|     var editor_1 = null; | 
|     $(function () { | 
|         //初始化编辑器 | 
|         editor_1 = UE.getEditor('editor_1'); | 
|   | 
|     }); | 
|     function add(){ | 
|         const input1 = document.getElementById('questionTitle'); | 
|         const value1 = input1.value; | 
|         const input2 = document.getElementById('sort'); | 
|         const value2 = input2.value; | 
|   | 
|         if (editor_1.getContent() === ""){ | 
|             Feng.error("答复内容不能为空!"); | 
|             return; | 
|         }if (value1 === ""){ | 
|             Feng.error("问题标题不能为空!"); | 
|             return; | 
|         }if (value2 === ""){ | 
|             Feng.error("排序不能为空!"); | 
|             return; | 
|         } | 
|         data1.content = value1; | 
|         data1.sort =  value2; | 
|         data1.answer =editor_1.getContent(); | 
|         submitData(data1); | 
|     } | 
|     function submitData(data) { | 
|         $.ajax({ | 
|             url: Feng.ctxPath + "/tQuestion/addQuestion", | 
|             type: "POST", | 
|             contentType: "application/json", // 设置请求头的 Content-Type | 
|             data: JSON.stringify(data), // 将数据转换为 JSON 字符串 | 
|             success: function(response) { | 
|                 Feng.success("添加成功!"); | 
|                 window.parent.TQuestion.table.refresh(); | 
|                 closeD(); | 
|                 }, | 
|             error: function(xhr, status, error) { | 
|                 var errorMessage = xhr.responseText ? xhr.responseText : "添加失败!"; | 
|                 Feng.error(errorMessage); | 
|             } | 
|         }); | 
|     } | 
| </script> | 
| @} |