123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- {{template "main" .}}
- <!-- Navbar -->
- <nav class="main-header navbar navbar-expand navbar-white navbar-light">
- <!-- Left navbar links -->
- <ul class="navbar-nav">
- <li class="nav-item">
- <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
- </li>
- <li class="nav-item d-none d-sm-inline-block">
- <a href="/setup/weixin" class="nav-link">设置</a>
- </li>
- </ul>
- </nav>
- <!-- /.navbar -->
- <!-- Content Wrapper. Contains page content -->
- <div class="content-wrapper">
- <!-- Content Header (Page header) -->
- <section class="content-header">
- <div class="container-fluid">
- <div class="row mb-2">
- <div class="col-sm-6">
- <h1>默认企业微信机器人配置</h1>
- </div>
- </div>
- </div><!-- /.container-fluid -->
- </section>
- <!-- Main content -->
- <section class="content">
- <!-- Default box -->
- <div class="card">
- <div class="card-header">
- <h3 class="card-title"></h3>
- <div class="card-tools">
- <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
- <i class="fas fa-minus"></i>
- </button>
- <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
- <i class="fas fa-times"></i>
- </button>
- </div>
- </div>
- <div class="card-body">
- <form class="form-horizontal" method="POST" action="##" enctype="multipart/form-data" onsubmit="return false" id="formtpl">
- <input type="hidden" name="id" value="{{.Template.Id}}">
-
-
- <div class="row">
- <div class="col-12">
- <!-- text input -->
- <div class="form-group">
- <label>*名称</label>
- <input type="text" id="name" name="name" class="form-control" value="{{.Template.Tplname}}">
- </div>
- </div>
- </div>
-
- <br />
- <div class="row">
- <div class="col-sm-6">
- <!-- text input -->
- <div class="form-group">
- <label id="typestr">默认微信机器人地址</label>
- <input type="text" id="purl" class="form-control" name="purl" value="">
- </div>
- </div>
- <div id="Pat" class="col-sm-6">
- <!-- text input -->
- <div class="form-group">
- <label id="typestr">@某人</label>
- <input type="text" id="pat" class="form-control" name="pat" value="" placeholder="钉钉@使用的是手机号码,企业微信机器人@使用的是用户帐号,飞书V2 @使用的是用户Email邮箱">
- </div>
- </div>
- </div>
- <br />
- <div class="text-right">
- <a class="btn btn-app bg-success" onclick="savetpl();">
- <i class="fas fa-save"></i> 保存
- </a>
- </div>
- </form>
- </div>
- <!-- /.card-body -->
- <div class="card-footer">
- 特别提醒:自定义模板仅支持 /prometheusalert 接口,其他接口均为固定模版接口,不支持自定义模板
- </div>
- <!-- /.card-footer-->
- </div>
- <!-- /.card -->
- </section>
- <!-- /.content -->
- </div>
- <!-- /.content-wrapper -->
- {{template "endhtml"}}
- <script>
- function savetpl(){
- var uname=document.getElementById("name");
- if (uname.value.length==0){
- alert('模版名称不能为空');
- return
- };
- var ucontent=document.getElementById("content");
- if (ucontent.value.length==0){
- alert('模版内容不能为空');
- return
- };
- $.ajax({
- type: "POST",
- dataType: "json",
- url: '{{ urlfor "MainController.AddTplx"}}',
- data: $('#formtpl').serialize(),
- success: function (result) {
- console.log(result);
- if (result == null) {
- alert("保存成功!");
- } else {
- alert("保存失败!");
- };
- },
- });
- }
- </script>
- {{template "jshtml"}}
|