You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
81
hyhproject/admin/view/wxtemplatemsgs/edit.html
Executable file
81
hyhproject/admin/view/wxtemplatemsgs/edit.html
Executable file
@@ -0,0 +1,81 @@
|
||||
{extend name="base" /}
|
||||
{block name="js"}
|
||||
<script src="__ADMIN__/wxtemplatemsgs/wxtemplatemsgs.js?v={$v}" type="text/javascript"></script>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<form autocomplete='off'>
|
||||
<input type='hidden' id='id' class='ipt' value="{$object['id']}"/>
|
||||
<input type='hidden' id='tplCode' class='ipt' value="{$object['tplCode']}"/>
|
||||
<table class='wst-form wst-box-top layui-form'>
|
||||
<tr>
|
||||
<th width='120'>发送时机:</th>
|
||||
<td>
|
||||
{volist name=':WSTDatas("TEMPLATE_WX")' id='vo'}
|
||||
{if $vo['dataVal']==$object['tplCode']}{$vo['dataName']}{/if}
|
||||
{/volist}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>模板ID:</th>
|
||||
<td>
|
||||
<input type='text' id='tplExternaId' class='ipt' style='width:70%' maxLength='200' value='{$object['tplExternaId']}'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>内容:</th>
|
||||
<td>
|
||||
<textarea id='tplContent' style='width:70%;height:100px;' class='ipt' maxLength='150'>{$object['tplContent']}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>是否开启:</th>
|
||||
<td>
|
||||
<input type="checkbox" {if $object['status']==1}checked{/if} value='1' class="ipt" id="isShow" name="seoMallSwitch" lay-skin="switch" lay-filter="isShow" lay-text="开启|关闭">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>参数设置:</th>
|
||||
<td>
|
||||
<div class='wst-toolbar'>
|
||||
<font color='red'>(双击表格修改参数及内容)</font>
|
||||
<button type="button" class='btn btn-success f-right' onclick='javascript:addNewRow()'><i class="fa fa-plus"></i>新增</button>
|
||||
<div style='clear:both;'></div>
|
||||
</div>
|
||||
<div id='paramGrid'>
|
||||
<table border='1' width='100%'>
|
||||
<tr>
|
||||
<td width='20%'>变量名</td>
|
||||
<td width='73%'>内容</td>
|
||||
<td width='50'>操作</td>
|
||||
</tr>
|
||||
<tbody id='paramlist'>
|
||||
</tbody>
|
||||
</table>
|
||||
<script id="paramjs" type="text/html">
|
||||
{{# for(var i = 0; i < d.length; i++){ }}
|
||||
<tr id='tr_{{i}}'>
|
||||
<td><input type="text" style="width:92%" id="fiedlCode_{{i}}" value='{{d[i].fieldCode}}'/></td>
|
||||
<td><input type="text" style="width:98%" id="fiedlVal_{{i}}" value='{{d[i].fieldVal}}'/></td>
|
||||
<td>
|
||||
<input type="button" value="删除" class="btn btn-danger" onclick="javascript:deleteRow({{i}})">
|
||||
</td>
|
||||
</tr>
|
||||
{{# } }}
|
||||
</script>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th valign="top">说明:</th>
|
||||
<td id='tplDesc'>{$object['tplDesc']}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' align='center' class='wst-bottombar'>
|
||||
<button type="button" class='btn btn-primary btn-mright' onclick='javascript:save(0)'><i class="fa fa-check"></i>保存</button>
|
||||
<button type="button" class='btn' onclick='javascript:history.go(-1)'><i class="fa fa-angle-double-left"></i>返回</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<script>$(function(){initParamGrid();})</script>
|
||||
{/block}
|
25
hyhproject/admin/view/wxtemplatemsgs/list.html
Executable file
25
hyhproject/admin/view/wxtemplatemsgs/list.html
Executable file
@@ -0,0 +1,25 @@
|
||||
{extend name="base" /}
|
||||
{block name="css"}
|
||||
<link rel="stylesheet" type="text/css" href="__ADMIN__/js/mmgrid/mmGrid.css?v={$v}" />
|
||||
{/block}
|
||||
{block name="js"}
|
||||
<script src="__ADMIN__/js/mmgrid/mmGrid.js?v={$v}" type="text/javascript"></script>
|
||||
<script src="__ADMIN__/wxtemplatemsgs/wxtemplatemsgs.js?v={$v}" type="text/javascript"></script>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<style>.body li{height:22px;}</style>
|
||||
<div id='alertTips' class='alert alert-success alert-tips fade in'>
|
||||
<div id='headTip' class='head'><i class='fa fa-lightbulb-o'></i>操作说明</div>
|
||||
<ul class='body'>
|
||||
<li>本功能使用微信公众号接口,需在注册并认证“服务号”,并获得模板消息的使用权限,<a class='wst-wiki' target='_blank' href='https://mp.weixin.qq.com/wiki'>微信公众平台文档</a>。</li>
|
||||
<li>本系统中的模板仅供参考,建议在公众平台模板库中选择“<strong>IT科技 互联网|电子商务 | IT科技 IT软件与服务</strong>”的行业,然后添加与本模板内容相同的模板。</li>
|
||||
<li>因微信对通知内容要求较严格,不支持营销、到期提醒类消息推送,详细规则<a class='wst-wiki' href='https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751288' target='_blank'>查看</a>。</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='wst-grid'>
|
||||
<div id="mmg" class="mmg layui-form"></div>
|
||||
<div id="pg" style="text-align: right;"></div>
|
||||
</div>
|
||||
<script>$(function(){initGrid();})</script>
|
||||
{/block}
|
||||
|
114
hyhproject/admin/view/wxtemplatemsgs/wxtemplatemsgs.js
Executable file
114
hyhproject/admin/view/wxtemplatemsgs/wxtemplatemsgs.js
Executable file
@@ -0,0 +1,114 @@
|
||||
var mmg;
|
||||
function initGrid(){
|
||||
var h = WST.pageHeight();
|
||||
var cols = [
|
||||
{title:'发送时机', name:'tplCode', width: 100},
|
||||
{title:'模板ID', name:'tplExternaId', width: 100},
|
||||
{title:'发送内容', name:'tplContent', width: 500},
|
||||
{title:'是否开启', name:'status',align:'center',width:50,renderer: function(val,item,rowIndex){
|
||||
return '<input type="checkbox" '+((item['status']==1)?"checked":"")+' name="isShow4" lay-skin="switch" lay-filter="isShow4" data="'+item['id']+'" lay-text="开启|关闭">';
|
||||
|
||||
}},
|
||||
{title:'操作', name:'' ,width:30, align:'center', renderer: function(val,item,rowIndex){
|
||||
var h="";
|
||||
if(WST.GRANT.XXMB_02)h += "<a class='btn btn-blue' href='javascript:toEdit(" + item['id'] + ")'><i class='fa fa-pencil'></i>编辑</a> ";
|
||||
return h;
|
||||
}}
|
||||
];
|
||||
|
||||
mmg = $('.mmg').mmGrid({height: h-165,indexCol: true, cols: cols,method:'POST',nowrap:true,
|
||||
url: WST.U('admin/wxtemplatemsgs/pageQuery'), fullWidthRows: true, autoLoad: true,
|
||||
plugins: [
|
||||
$('#pg').mmPaginator({})
|
||||
]
|
||||
});
|
||||
mmg.on('loadSuccess',function(){
|
||||
layui.form.render();
|
||||
layui.form.on('switch(isShow4)', function(data){
|
||||
var id = $(this).attr("data");
|
||||
if(this.checked){
|
||||
toggleIsShow(0,id);
|
||||
}else{
|
||||
toggleIsShow(1,id);
|
||||
}
|
||||
});
|
||||
})
|
||||
$('#headTip').WSTTips({width:90,height:35,callback:function(v){
|
||||
if(v){
|
||||
mmg.resize({height:h-165});
|
||||
}else{
|
||||
mmg.resize({height:h-87});
|
||||
}
|
||||
}});
|
||||
}
|
||||
function toggleIsShow(t,v){
|
||||
if(!WST.GRANT.DQGL_02)return;
|
||||
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
||||
$.post(WST.U('admin/TemplateMsgs/editiIsShow'),{id:v,status:t},function(data,textStatus){
|
||||
layer.close(loading);
|
||||
var json = WST.toAdminJson(data);
|
||||
if(json.status=='1'){
|
||||
WST.msg(json.msg,{icon:1});
|
||||
grid.reload();
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
function initParamGrid(){
|
||||
var loading = WST.msg('正在加载数据,请稍后...', {icon: 16,time:60000});
|
||||
var params = {parentId:$('#id').val()};
|
||||
$.post(WST.U('admin/wxtemplatemsgs/listQuery'),params,function(data,textStatus){
|
||||
layer.close(loading);
|
||||
var json = WST.toAdminJson(data);
|
||||
if(json.status=='1'){
|
||||
childrenNum = json.data?json.data.length:0;
|
||||
var gettpl = document.getElementById('paramjs').innerHTML;
|
||||
layui.laytpl(gettpl).render(json.data, function(html){
|
||||
$('#paramlist').html(html);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
var childrenNum = 0;
|
||||
function addNewRow(){
|
||||
var html = ['<tr id="tr_'+childrenNum+'">',
|
||||
'<td><input type="text" style="width:92%" id="fiedlCode_'+childrenNum+'"/></td>',
|
||||
'<td><input type="text" style="width:98%" id="fiedlVal_'+childrenNum+'"/></td>',
|
||||
'<td><input type="button" value="删除" class="btn btn-danger" onclick="javascript:deleteRow('+childrenNum+')"></td>',
|
||||
'</tr>'
|
||||
];
|
||||
$('#paramlist').append(html.join(''));
|
||||
childrenNum++;
|
||||
}
|
||||
function deleteRow(n){
|
||||
$('#tr_'+n).remove();
|
||||
}
|
||||
function toEdit(id){
|
||||
location.href = WST.U('admin/wxtemplatemsgs/toEdit','id='+id);
|
||||
}
|
||||
function save(type){
|
||||
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
||||
var params = WST.getParams('.ipt');
|
||||
params.num = childrenNum;
|
||||
for(var i=0;i<=params.num;i++){
|
||||
if($.trim($('#fiedlCode_'+i).val())!=''){
|
||||
params['code_'+i] = $('#fiedlCode_'+i).val();
|
||||
params['val_'+i] = $('#fiedlVal_'+i).val();
|
||||
}
|
||||
}
|
||||
$.post(WST.U('admin/wxtemplatemsgs/edit'),params,function(data,textStatus){
|
||||
layer.close(loading);
|
||||
var json = WST.toAdminJson(data);
|
||||
if(json.status=='1'){
|
||||
WST.msg("操作成功",{icon:1});
|
||||
location.href = WST.U('admin/wxtemplatemsgs/index','src='+type);
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user