136 lines
4.9 KiB
Plaintext
136 lines
4.9 KiB
Plaintext
@page
|
|
@model YBDevice.NWeb.Pages.MiniProgram.TplModel
|
|
@{
|
|
}
|
|
<div class="layui-card">
|
|
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
|
|
<div class="layui-form-item">
|
|
<div class="layui-inline">
|
|
<div class="layui-input-inline">
|
|
<input type="text" class="layui-input" name="title" id="title" placeholder="请输入模板标题" />
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<button class="btn btn-primary btn-lg js-search" type="button">查询</button>
|
|
<button class="btn btn-primary btn-lg js-sync" type="button">同步</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-card-body">
|
|
<table class="layui-table" id="list" lay-filter="list">
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<script type="text/html" id="optpl">
|
|
<a href="#" title="设置内容" class="js-set" data-id="{{d.id}}">设置</a>
|
|
{{# if(d.isselected){ }}
|
|
<a href="#" title="取消" class="js-select" data-status="0" data-id="{{d.id}}">取消</a>
|
|
{{# }else{ }}
|
|
<a href="#" title="选择" class="js-select" data-status="1" data-id="{{d.id}}">选择</a>
|
|
{{# } }}
|
|
</script>
|
|
@section Scripts
|
|
{
|
|
<script type="text/javascript">
|
|
layui.use(['common'], function () {
|
|
var common = layui.common;
|
|
common.initTable({
|
|
url: '/api/official/GetSubscribeTplList?id='+'@Model.mid'
|
|
, method: 'post'
|
|
, cols: [[
|
|
{
|
|
field: 'title', title: '标题'
|
|
},
|
|
{
|
|
field: 'pritmplid', title: '模板ID'
|
|
},
|
|
{
|
|
field: 'example', title: '内容'
|
|
},
|
|
{
|
|
field: 'keywords', title: '关键字'
|
|
}
|
|
,
|
|
{
|
|
field: 'isselected', title: '状态', templet: function (d) {
|
|
var html = "";
|
|
if (!d.isselected) {
|
|
html = "<span class='text-red'>未选";
|
|
}else{
|
|
html = "<span class='text-green'>已选";
|
|
}
|
|
return html+"</span>";
|
|
}
|
|
},
|
|
{
|
|
title: '操作', templet:'#optpl'
|
|
}
|
|
]]
|
|
});
|
|
$(".js-search").on("click", function () {
|
|
common.reloadtable("list", {
|
|
where: {
|
|
queryParam: [{
|
|
"Name": 'title',
|
|
"Type": QueryCond.Like,
|
|
"Value": $("#title").val()
|
|
}]
|
|
}
|
|
});
|
|
});
|
|
|
|
$(".js-sync").on("click", function () {
|
|
common.confirm("确定开始同步模板?", function () {
|
|
common.ajax({
|
|
url: "/api/official/gettemplatelist?id=" + '@Model.mid',
|
|
success: function (res) {
|
|
if (res.code == 0) {
|
|
common.info(res.message,function(){
|
|
$(".js-search").trigger("click");
|
|
});
|
|
} else {
|
|
common.alert(res.message);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
$("body").on("click",".js-set",function () {
|
|
var id = $(this).data('id');
|
|
common.dialog({
|
|
content:"/MiniProgram/TplSet?id="+id,
|
|
title:"模板内容"
|
|
});
|
|
});
|
|
$("body").on("click",".js-select",function () {
|
|
var id = $(this).data('id');
|
|
var status=$(this).data("status");
|
|
var msg="确定使用此模板?";
|
|
var isselected = true;
|
|
if(status == 0){
|
|
msg="确定取消此模板?";
|
|
isselected=false;
|
|
}
|
|
common.confirm(msg, function () {
|
|
common.ajax({
|
|
url: "/api/official/settplasmessage",
|
|
type:"post",
|
|
data:{
|
|
id:id,
|
|
isselected:isselected
|
|
},
|
|
success: function (res) {
|
|
if (res.code == 0) {
|
|
common.info(res.message,function(){
|
|
$(".js-search").trigger("click");
|
|
});
|
|
} else {
|
|
common.alert(res.message);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
} |