setup_weixin.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. {{template "main" .}}
  2. <!-- Navbar -->
  3. <nav class="main-header navbar navbar-expand navbar-white navbar-light">
  4. <!-- Left navbar links -->
  5. <ul class="navbar-nav">
  6. <li class="nav-item">
  7. <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
  8. </li>
  9. <li class="nav-item d-none d-sm-inline-block">
  10. <a href="/setup/weixin" class="nav-link">设置</a>
  11. </li>
  12. </ul>
  13. </nav>
  14. <!-- /.navbar -->
  15. <!-- Content Wrapper. Contains page content -->
  16. <div class="content-wrapper">
  17. <!-- Content Header (Page header) -->
  18. <section class="content-header">
  19. <div class="container-fluid">
  20. <div class="row mb-2">
  21. <div class="col-sm-6">
  22. <h1>默认企业微信机器人配置</h1>
  23. </div>
  24. </div>
  25. </div><!-- /.container-fluid -->
  26. </section>
  27. <!-- Main content -->
  28. <section class="content">
  29. <!-- Default box -->
  30. <div class="card">
  31. <div class="card-header">
  32. <h3 class="card-title"></h3>
  33. <div class="card-tools">
  34. <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
  35. <i class="fas fa-minus"></i>
  36. </button>
  37. <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
  38. <i class="fas fa-times"></i>
  39. </button>
  40. </div>
  41. </div>
  42. <div class="card-body">
  43. <form class="form-horizontal" method="POST" action="##" enctype="multipart/form-data" onsubmit="return false" id="formtpl">
  44. <input type="hidden" name="id" value="{{.Template.Id}}">
  45. <div class="row">
  46. <div class="col-12">
  47. <!-- text input -->
  48. <div class="form-group">
  49. <label>*名称</label>
  50. <input type="text" id="name" name="name" class="form-control" value="{{.Template.Tplname}}">
  51. </div>
  52. </div>
  53. </div>
  54. <br />
  55. <div class="row">
  56. <div class="col-sm-6">
  57. <!-- text input -->
  58. <div class="form-group">
  59. <label id="typestr">默认微信机器人地址</label>
  60. <input type="text" id="purl" class="form-control" name="purl" value="">
  61. </div>
  62. </div>
  63. <div id="Pat" class="col-sm-6">
  64. <!-- text input -->
  65. <div class="form-group">
  66. <label id="typestr">@某人</label>
  67. <input type="text" id="pat" class="form-control" name="pat" value="" placeholder="钉钉@使用的是手机号码,企业微信机器人@使用的是用户帐号,飞书V2 @使用的是用户Email邮箱">
  68. </div>
  69. </div>
  70. </div>
  71. <br />
  72. <div class="text-right">
  73. <a class="btn btn-app bg-success" onclick="savetpl();">
  74. <i class="fas fa-save"></i> 保存
  75. </a>
  76. </div>
  77. </form>
  78. </div>
  79. <!-- /.card-body -->
  80. <div class="card-footer">
  81. 特别提醒:自定义模板仅支持 /prometheusalert 接口,其他接口均为固定模版接口,不支持自定义模板
  82. </div>
  83. <!-- /.card-footer-->
  84. </div>
  85. <!-- /.card -->
  86. </section>
  87. <!-- /.content -->
  88. </div>
  89. <!-- /.content-wrapper -->
  90. {{template "endhtml"}}
  91. <script>
  92. function savetpl(){
  93. var uname=document.getElementById("name");
  94. if (uname.value.length==0){
  95. alert('模版名称不能为空');
  96. return
  97. };
  98. var ucontent=document.getElementById("content");
  99. if (ucontent.value.length==0){
  100. alert('模版内容不能为空');
  101. return
  102. };
  103. $.ajax({
  104. type: "POST",
  105. dataType: "json",
  106. url: '{{ urlfor "MainController.AddTplx"}}',
  107. data: $('#formtpl').serialize(),
  108. success: function (result) {
  109. console.log(result);
  110. if (result == null) {
  111. alert("保存成功!");
  112. } else {
  113. alert("保存失败!");
  114. };
  115. },
  116. });
  117. }
  118. </script>
  119. {{template "jshtml"}}