| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>编辑欢迎语</title>
- <link rel="shortcut icon" href="favicon.ico">
- <link href="__CSS__/bootstrap.min.css?v=3.3.6" rel="stylesheet">
- <link href="__CSS__/font-awesome.min.css?v=4.4.0" rel="stylesheet">
- <link href="__CSS__/animate.min.css" rel="stylesheet">
- <link href="__JS__/layui/css/layui.css" rel="stylesheet">
- <link href="__CSS__/style.min.css?v=4.1.0" rel="stylesheet">
- <script charset="utf-8" src="__EDIT__/kindeditor-min.js"></script>
- <script charset="utf-8" src="__EDIT__/lang/zh_CN.js"></script>
- <script>
- KindEditor.ready(function(K) {
- K.each({
- 'plug-align' : {
- name : '对齐方式',
- method : {
- 'justifyleft' : '左对齐',
- 'justifycenter' : '居中对齐',
- 'justifyright' : '右对齐'
- }
- },
- 'plug-order' : {
- name : '编号',
- method : {
- 'insertorderedlist' : '数字编号',
- 'insertunorderedlist' : '项目编号'
- }
- },
- 'plug-indent' : {
- name : '缩进',
- method : {
- 'indent' : '向右缩进',
- 'outdent' : '向左缩进'
- }
- }
- },function( pluginName, pluginData ){
- var lang = {};
- lang[pluginName] = pluginData.name;
- KindEditor.lang( lang );
- KindEditor.plugin( pluginName, function(K) {
- var self = this;
- self.clickToolbar( pluginName, function() {
- var menu = self.createMenu({
- name : pluginName,
- width : pluginData.width || 100
- });
- K.each( pluginData.method, function( i, v ){
- menu.addItem({
- title : v,
- checked : false,
- iconClass : pluginName+'-'+i,
- click : function() {
- self.exec(i).hideMenu();
- }
- });
- })
- });
- });
- });
- K.create('#contentqq', {
- themeType : 'qq',
- items : [
- 'bold','italic','underline','fontname','fontsize','forecolor','hilitecolor','plug-align','plug-order','plug-indent','link'
- ]
- });
- });
- </script>
- </head>
- <body class="gray-bg">
- <div class="wrapper wrapper-content animated fadeInRight">
- <div class="row">
- <div class="col-sm-8">
- <div class="ibox float-e-margins">
- <div class="ibox-title">
- <h5>编辑欢迎语</h5>
- </div>
- <div class="ibox-content">
- <form class="form-horizontal m-t layui-form" id="commentForm" method="post" action="{:url('system/editWelcome')}">
- <input type="hidden" name="id" value="{$replySystem['id']}"/>
- <div class="form-group" style="display: flex">
- <label style="margin-left: 40px; line-height: 2.5;">排序:</label>
- <div class="input-group col-sm-4">
- <input class="form-control" name="sort" required="" aria-required="true" value="{$replySystem['sort']}"/>
- </div>
- </div>
- <div class="form-group">
- <label style="margin-left: 40px">欢迎语:</label>
- <div class="input-group col-sm-4" style="margin-top: 10px; margin-left: 40px">
- <textarea id="contentqq" name="word" style="width:700px;height:200px;visibility:hidden;">{$replySystem['word']}</textarea>
- </div>
- </div>
- <div class="form-group">
- <div style="margin-left: 40px; margin-top: 20px;">
- <button class="btn btn-primary" type="submit">提交</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script src="__JS__/jquery.min.js?v=2.1.4"></script>
- <script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
- <script src="__JS__/content.min.js?v=1.0.0"></script>
- <script src="__JS__/plugins/validate/jquery.validate.min.js"></script>
- <script src="__JS__/plugins/validate/messages_zh.min.js"></script>
- <script src="__JS__/plugins/layer/layer.min.js"></script>
- <script src="__JS__/layui/layui.js"></script>
- <script src="__JS__/jquery.form.js"></script>
- <script src="/static/customer/js/md5.js"></script>
- <script type="text/javascript">
- let config = {
- socket: '{$socket}',
- };
- let date = new Date(new Date().setHours(0, 0, 0, 0)) / 1000;
- let getLocation = window.location.href;
- let host = getLocation.split('/admin')[0];
- //let apiToken = hex_md5('customer-service'+date+host);
- let apiToken = hex_md5('customer-service'+host);
- const myHost = "http://" + window.location.host;
- layui.use(['form', 'upload'], function(){
- var form = layui.form;
- });
- var index = '';
- function showStart(){
- index = layer.load(0, {shade: false});
- return true;
- }
- function showSuccess(res){
- let socket = new WebSocket('ws://' + config.socket+'?apiToken=' + apiToken);
- socket.onopen = function(res) {
- console.log('握手成功');
- socket.send(JSON.stringify({
- type: 'updatecache',
- data: {dtype: ''},
- }));
- };
- layer.ready(function(){
- layer.close(index);
- if(1 == res.code){
- layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
- window.location.href = myHost + '/admin/system/welcoming';
- });
- }else if(111 == res.code){
- window.location.reload();
- }else{
- layer.msg(res.msg, {anim: 6});
- }
- });
- }
- $(document).ready(function(){
- // 添加管理员
- var options = {
- beforeSubmit:showStart,
- success:showSuccess
- };
- $('#commentForm').submit(function(){
- $(this).ajaxSubmit(options);
- return false;
- });
- });
- // 表单验证
- $.validator.setDefaults({
- highlight: function(e) {
- $(e).closest(".form-group").removeClass("has-success").addClass("has-error")
- },
- success: function(e) {
- e.closest(".form-group").removeClass("has-error").addClass("has-success")
- },
- errorElement: "span",
- 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(){
- var form = layui.form;
- form.on('select(group)', function(value){
- $("#groups_id").val(value.value);
- });
- form.on('select(robotgroups)', function(value){
- $("#robotgroups_id").val(value.value);
- });
- });
- </script>
- </body>
- </html>
|