通知模板ui优化
This commit is contained in:
@@ -349,6 +349,7 @@ func (j *Job) Run() {
|
||||
err := json.Unmarshal([]byte(content), ¶m)
|
||||
if err != nil {
|
||||
fmt.Println("发送信息错误", err)
|
||||
return
|
||||
}
|
||||
|
||||
notify.SendSmsToChan(phone, param)
|
||||
|
||||
@@ -69,13 +69,13 @@ func NotifyTplAdd(obj *NotifyTpl) (int64, error) {
|
||||
}
|
||||
|
||||
func NotifyTplGetByTplType(tpl_type int, typestr string) (NotifyTpl, error) {
|
||||
var list NotifyTpl
|
||||
err := orm.NewOrm().QueryTable(TableName("notify_tpl")).Filter("type", typestr).Filter("tpl_type", tpl_type).Filter("status", 1).Limit(1).One(&list)
|
||||
var obj NotifyTpl
|
||||
err := orm.NewOrm().QueryTable(TableName("notify_tpl")).Filter("type", typestr).Filter("tpl_type", tpl_type).Filter("status", 1).Limit(1).One(&obj)
|
||||
if err != nil {
|
||||
return list, err
|
||||
return obj, err
|
||||
}
|
||||
|
||||
return list, nil
|
||||
return obj, nil
|
||||
}
|
||||
|
||||
func NotifyTplGetById(id int) (*NotifyTpl, error) {
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mw200">模板类型</label>
|
||||
<div class="layui-input-inline mw400">
|
||||
<input type="radio" name="tpl_type" lay-verify="type" value="0" title="邮箱" checked>
|
||||
<input type="radio" name="tpl_type" lay-verify="type" value="1" title="短信" >
|
||||
<input type="radio" name="tpl_type" lay-verify="type" value="2" title="钉钉" >
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="0" title="邮箱" checked>
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="1" title="短信" >
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="2" title="钉钉" >
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux"></div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-item J_title">
|
||||
<label class="layui-form-label mw200">模板标题</label>
|
||||
<div class="layui-input-inline mw400">
|
||||
<input type="text" name="title" id="title" autocomplete="off"
|
||||
@@ -96,6 +96,15 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
form.on('radio(tpl_type)', function (data) {
|
||||
if (data.value == 0){
|
||||
$(".J_title").show()
|
||||
} else {
|
||||
$(".J_title").hide()
|
||||
$("#title").val("")
|
||||
}
|
||||
});
|
||||
|
||||
//但是,如果你的HTML是动态生成的,自动渲染就会失效
|
||||
//因此你需要在相应的地方,执行下述方法来手动渲染,跟这类似的还有 element.init();
|
||||
form.render();
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label mw200">模板类型</label>
|
||||
<div class="layui-input-inline mw400">
|
||||
<input type="radio" name="tpl_type" lay-verify="type" value="0" title="邮箱" {{if eq .notifyTpl.tpl_type 0}}checked{{end}}>
|
||||
<input type="radio" name="tpl_type" lay-verify="type" value="1" title="短信" {{if eq .notifyTpl.tpl_type 1}}checked{{end}}>
|
||||
<input type="radio" name="tpl_type" lay-verify="type" value="2" title="钉钉" {{if eq .notifyTpl.tpl_type 2}}checked{{end}}>
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="0" title="邮箱" {{if eq .notifyTpl.tpl_type 0}}checked{{end}}>
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="1" title="短信" {{if eq .notifyTpl.tpl_type 1}}checked{{end}}>
|
||||
<input type="radio" name="tpl_type" lay-filter="tpl_type" lay-verify="type" value="2" title="钉钉" {{if eq .notifyTpl.tpl_type 2}}checked{{end}}>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux"></div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-item J_title" {{if ne .notifyTpl.tpl_type 0}}style="display: none"{{end}}>
|
||||
<label class="layui-form-label mw200">模板标题</label>
|
||||
<div class="layui-input-inline mw400">
|
||||
<input type="text" name="title" id="title" autocomplete="off"
|
||||
@@ -96,6 +96,15 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
form.on('radio(tpl_type)', function (data) {
|
||||
if (data.value == 0){
|
||||
$(".J_title").show()
|
||||
} else {
|
||||
$(".J_title").hide()
|
||||
$("#title").val("")
|
||||
}
|
||||
});
|
||||
|
||||
//但是,如果你的HTML是动态生成的,自动渲染就会失效
|
||||
//因此你需要在相应的地方,执行下述方法来手动渲染,跟这类似的还有 element.init();
|
||||
form.render();
|
||||
|
||||
Reference in New Issue
Block a user