You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
100
hyhproject/admin/view/wxmenus/edit.html
Executable file
100
hyhproject/admin/view/wxmenus/edit.html
Executable file
@ -0,0 +1,100 @@
|
||||
{extend name="base" /}
|
||||
{block name="css"}
|
||||
<link rel="stylesheet" type="text/css" href="__STATIC__/plugins/webuploader/webuploader.css?v={$v}" />
|
||||
<style>
|
||||
body{overflow: hidden}
|
||||
</style>
|
||||
{/block}
|
||||
{block name="js"}
|
||||
<script src="__STATIC__/plugins/webuploader/webuploader.js?v={$v}" type="text/javascript" ></script>
|
||||
<script src="__ADMIN__/wxmenus/wxmenus.js?v={$v}" type="text/javascript"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
{if condition="$object['menuId'] !=0 "}
|
||||
WST.setValues({$object});
|
||||
{/if}
|
||||
$('#menuForm').validator({
|
||||
fields: {
|
||||
menuName: {
|
||||
tip: "请输入菜单名称",
|
||||
rule: '菜单名称:required;length[~16];'
|
||||
}
|
||||
},
|
||||
valid: function(form){
|
||||
var menuId = $('#menuId').val();
|
||||
toEdits(menuId);
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<div class="l-loading" style="display: block" id="wst-loading"></div>
|
||||
<form id="menuForm" autocomplete="off">
|
||||
<input type='hidden' id='menuId' name="menuId" value="{$menuId}" class='ipt'/>
|
||||
<input type='hidden' id='parentId' name="parentId" value="{$parentId}" class='ipt'/>
|
||||
<table class='wst-form wst-box-top'>
|
||||
<tr>
|
||||
<th width='150'>菜单名称<font color='red'>*</font>:</th>
|
||||
<td><input type="text" id='menuName' name='menuName' maxLength='20' style='width:300px;' class='ipt'/></td>
|
||||
</tr>
|
||||
<tr style="display:none;">
|
||||
<th>子菜单内容<font color='red'>*</font>:</th>
|
||||
<td>
|
||||
<label>
|
||||
<input type='radio' id="content" name='content' value='0' class='ipt' checked onclick="javascript:wayChange(1)">跳转网页
|
||||
</label>
|
||||
<label>
|
||||
<input type='radio' id="content" name='content' value='1' class='ipt' onclick="javascript:wayChange(0)">发送消息
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="urltext">
|
||||
<th>跳转网址:</th>
|
||||
<td><input type="text" id='menuUrl' name='menuUrl' maxLength='255' style='width:500px;' class='ipt' data-tip="输入网址时以http://或https://开头"/></td>
|
||||
</tr>
|
||||
<tr class="newstext" style="display:none;">
|
||||
<th></th>
|
||||
<td>
|
||||
<label>
|
||||
<input type='radio' name='material' value='1' checked onclick="javascript:matChange(1)">文字
|
||||
</label>
|
||||
<label>
|
||||
<input type='radio' name='material' value='2' onclick="javascript:matChange(2)">图片
|
||||
</label>
|
||||
<label>
|
||||
<input type='radio' name='material' value='3' onclick="javascript:matChange(3)">图文
|
||||
</label>
|
||||
<label>
|
||||
<input type='radio' name='material' value='4' onclick="javascript:matChange(4)">语音
|
||||
</label>
|
||||
<label>
|
||||
<input type='radio' name='material' value='5' onclick="javascript:matChange(5)">视频
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="newstext" style="display:none;">
|
||||
<th></th>
|
||||
<td>
|
||||
<div class="wst-view j-view" id="view1"><a href="javascript:void(0);" onclick="javascript:addMaterial(1);">选择文本</a></div>
|
||||
<div class="wst-view j-view" id="view2" style="display:none;"><a href="javascript:void(0);" onclick="javascript:addMaterial(2);">选择文本素材</a></div>
|
||||
<div class="wst-view j-view" id="view3" style="display:none;"><a href="javascript:void(0);" onclick="javascript:addMaterial(3);">选择图文素材</a></div>
|
||||
<div class="wst-view j-view" id="view4" style="display:none;"><a href="javascript:void(0);" onclick="javascript:addMaterial(4);">选择语音素材</a></div>
|
||||
<div class="wst-view j-view" id="view5" style="display:none;"><a href="javascript:void(0);" onclick="javascript:addMaterial(5);">选择视频素材</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="100">排序号<font color="red">*</font>:</th>
|
||||
<td><input type="text" id="menuSort" name="menuSort" class="ipt" style="width:60px;" onkeypress="return WST.isNumberKey(event);" onkeyup="javascript:WST.isChinese(this,1)" maxlength="10" value="0" aria-required="true" data-tip="请输入排序号"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' align='center'>
|
||||
<button type="submit" class="btn btn-primary btn-mright"><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>
|
||||
<div id='wxmenusBox' style='display:none'>
|
||||
</div>
|
||||
{/block}
|
41
hyhproject/admin/view/wxmenus/list.html
Executable file
41
hyhproject/admin/view/wxmenus/list.html
Executable file
@ -0,0 +1,41 @@
|
||||
{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/wstgridtree.js?v={$v}" type="text/javascript"></script>
|
||||
<script src="__ADMIN__/wxmenus/wxmenus.js?v={$v}" type="text/javascript"></script>
|
||||
<script>
|
||||
$(function(){initGrid();inView();})
|
||||
</script>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<style>
|
||||
html{height: 100%;}
|
||||
body{height: 100%;overflow:hidden}
|
||||
.mmGrid{border-bottom:0px}
|
||||
</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>本功能主要用于管理微信公众号菜单,使用前请先在微信认证平台中停用了微信公众号自定义菜单功能。</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="wst-toolbar">
|
||||
{if WSTGrant('WX_ZDYCD_01')}
|
||||
<button class="btn btn-success f-right" onclick='javascript:toEdit(0,0)'><i class='fa fa-plus'></i>新增</button>
|
||||
{/if}
|
||||
{if WSTGrant('WX_ZDYCD_00')}
|
||||
<button class="btn btn-success f-right" style="margin-right:10px;" onclick='javascript:adSynchro();'><i class='fa fa-cloud-upload'></i>同步到微信菜单</button>
|
||||
<button class="btn btn-success f-right" style="margin-right:10px;" onclick='javascript:wxSynchro();'><i class='fa fa-cloud-upload'></i>与微信菜单同步</button>
|
||||
{/if}
|
||||
<div style='clear:both'></div>
|
||||
</div>
|
||||
<div class="wst-views">
|
||||
<div class="reveal">
|
||||
<div class="revealt"></div>
|
||||
<div class="revealb"><i></i><div class="ui" id="list"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='mmGrid layui-form wst-maingr' id="maingrid"></div>
|
||||
{/block}
|
185
hyhproject/admin/view/wxmenus/wxmenus.js
Executable file
185
hyhproject/admin/view/wxmenus/wxmenus.js
Executable file
@ -0,0 +1,185 @@
|
||||
var grid;
|
||||
function initGrid(){
|
||||
grid = $('#maingrid').WSTGridTree({
|
||||
url:WST.U('admin/wxmenus/pageQuery'),
|
||||
pageSize:10000,
|
||||
pageSizeOptions:[10000],
|
||||
height:'99%',
|
||||
width:'100%',
|
||||
minColToggle:6,
|
||||
delayLoad :true,
|
||||
rownumbers:true,
|
||||
columns: [
|
||||
{ display: '分类名称',width:120,name: 'menuName', id:'menuId', align: 'left',isSort: false},
|
||||
{ display: '页面地址',name: 'menuUrl',isSort: false,
|
||||
render: function (rowdata){
|
||||
var m = "<div class='urled' style='word-wrap: break-word;padding:6px;'>"+rowdata.menuUrl+"</div>";
|
||||
return m;
|
||||
}},
|
||||
{ display: '类型', name: 'type',width: 100,isSort: false,
|
||||
render: function (rowdata){
|
||||
if(rowdata['menuType']==0)t = "";
|
||||
if(rowdata['menuType']==1)t = "点击推送";
|
||||
if(rowdata['menuType']==2)t = "跳转地址";
|
||||
if(rowdata['menuType']==3)t = "扫码推送";
|
||||
if(rowdata['menuType']==4)t = "扫码推送且弹出“消息接收中”提示框";
|
||||
if(rowdata['menuType']==5)t = "系统拍照发图";
|
||||
if(rowdata['menuType']==6)t = "拍照或者相册发图";
|
||||
if(rowdata['menuType']==7)t = "微信相册发图";
|
||||
if(rowdata['menuType']==8)t = "地理位置选择";
|
||||
if(rowdata['menuType']==9)t = "下发消息(除文本消息)";
|
||||
if(rowdata['menuType']==10)t = "图文消息地址";
|
||||
return t;
|
||||
}},
|
||||
{ display: '序号', name: 'menuSort',width: 80,isSort: false},
|
||||
{ display: '操作', name: 'op',width: 150,isSort: false,
|
||||
render: function (rowdata){
|
||||
var h = "";
|
||||
if(WST.GRANT.WX_ZDYCD_01)if(rowdata['parentId']==0)h += "<a class='btn btn-green' href='javascript:toEdit("+rowdata["menuId"]+",0)'><i class='fa fa-plus'></i>新增子菜单</a> ";
|
||||
if(WST.GRANT.WX_ZDYCD_02)h += "<a class='btn btn-blue' href='javascript:toEdit("+rowdata["parentId"]+","+rowdata["menuId"]+")'><i class='fa fa-pencil'></i>修改</a> ";
|
||||
if(WST.GRANT.WX_ZDYCD_03)h += "<a class='btn btn-red' href='javascript:toDel("+rowdata["parentId"]+","+rowdata["menuId"]+")'><i class='fa fa-trash-o'></i>删除</a> ";
|
||||
return h;
|
||||
}}
|
||||
]
|
||||
});
|
||||
}
|
||||
//与微信菜单同步
|
||||
function wxSynchro(){
|
||||
var box = WST.confirm({content:"您确定与微信菜单同步吗?",yes:function(){
|
||||
var loading = WST.msg('正在同步数据,请稍后...', {icon: 16,time:60000});
|
||||
$.post(WST.U('admin/wxmenus/synchroWx'),'',function(data,textStatus){
|
||||
layer.close(loading);
|
||||
var json = WST.toAdminJson(data);
|
||||
if(json.status=='1'){
|
||||
inView();
|
||||
WST.msg(json.msg,{icon:1});
|
||||
layer.close(box);
|
||||
grid.reload();
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}});
|
||||
}
|
||||
//同步到微信菜单
|
||||
function adSynchro(){
|
||||
var box = WST.confirm({content:"您确定同步到微信菜单吗?",yes:function(){
|
||||
var loading = WST.msg('正在同步数据,请稍后...', {icon: 16,time:60000});
|
||||
$.post(WST.U('admin/wxmenus/synchroAd'),'',function(data,textStatus){
|
||||
layer.close(loading);
|
||||
var json = WST.toAdminJson(data);
|
||||
if(json.status=='1'){
|
||||
WST.msg(json.msg,{icon:1});
|
||||
layer.close(box);
|
||||
grid.reload();
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}});
|
||||
}
|
||||
function toEdit(parentId,menuId){
|
||||
location.href=WST.U('admin/wxmenus/toEdit','menuId='+menuId+'&parentId='+parentId);
|
||||
}
|
||||
function wayChange(type){
|
||||
if(type==1){
|
||||
WST.showHide(1,'#urltext');
|
||||
WST.showHide('','.newstext');
|
||||
}else{
|
||||
WST.showHide('','#urltext');
|
||||
WST.showHide(1,'.newstext');
|
||||
}
|
||||
}
|
||||
function matChange(n){
|
||||
$("#view"+n).show().siblings('.j-view').hide();
|
||||
}
|
||||
//素材选择
|
||||
function addMaterial(n){
|
||||
var title = '选择文本素材';
|
||||
if(n==2)title= '选择图文素材';
|
||||
if(n==3)title= '选择图文素材';
|
||||
if(n==4)title= '选择语音素材';
|
||||
if(n==5)title= '选择视频素材';
|
||||
var box = WST.open({title:title,type:1,content:$('#wxmenusBox'),area: ['800px', '500px'],btn:['确定','取消'],yes:function(){
|
||||
}});
|
||||
}
|
||||
function toEdits(id){
|
||||
var params = WST.getParams('.ipt');
|
||||
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
||||
$.post(WST.U('admin/wxmenus/'+((id>0)?"edit":"add")),params,function(data,textStatus){
|
||||
layer.close(loading);
|
||||
var json = WST.toAdminJson(data);
|
||||
if(json.status=='1'){
|
||||
WST.msg(json.msg,{icon:1},function(){
|
||||
location.href=WST.U('admin/wxmenus/index');
|
||||
});
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
function toDel(pid,id){
|
||||
var box = WST.confirm({content:"您确定要删除该菜单吗?",yes:function(){
|
||||
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
||||
$.post(WST.U('admin/wxmenus/del'),{id:id},function(data,textStatus){
|
||||
layer.close(loading);
|
||||
var json = WST.toAdminJson(data);
|
||||
if(json.status=='1'){
|
||||
inView();
|
||||
WST.msg(json.msg,{icon:1});
|
||||
layer.close(box);
|
||||
grid.reload(pid);
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}});
|
||||
}
|
||||
function inView(){
|
||||
$.post(WST.U('admin/wxmenus/listQuery'),'',function(data,textStatus){
|
||||
var json = WST.toAdminJson(data);
|
||||
$("#list").html('');
|
||||
if(json && json.length>0){
|
||||
var html = [];
|
||||
for(var i=0;i<json.length;i++){
|
||||
var me = json[i];
|
||||
html.push('<div class="li" onclick="javascript:liSelected(this);">'+WST.cutStr(me.menuName,8));
|
||||
html.push('<div class="lis" style="display:none;">');
|
||||
if(me.listSon.length>0){
|
||||
for(var s=0;s<me.listSon.length;s++){
|
||||
html.push('<span class="list">'+WST.cutStr(me.listSon[s].menuName,8)+'</span>');
|
||||
}
|
||||
}
|
||||
html.push("</div>");
|
||||
html.push("</div>");
|
||||
}
|
||||
$("#list").html(html.join(""));
|
||||
}
|
||||
});
|
||||
}
|
||||
function liSelected(obj){
|
||||
$(obj).addClass('selected').children('.lis').show();
|
||||
$(obj).siblings().removeClass('selected').children('.lis').hide();
|
||||
}
|
||||
$(function(){
|
||||
var windowH = $(window).height();
|
||||
var windowW = $(window).width();
|
||||
$('.urled').css('width',windowW/4);
|
||||
if(windowH > 820){
|
||||
$('.wst-views').css('height',800);
|
||||
}else{
|
||||
$('.wst-views').css('height',windowH-35);
|
||||
}
|
||||
$('.wst-maingr').css('width',windowW-335);
|
||||
})
|
||||
$(window).resize(function(){
|
||||
var windowH = $(window).height();
|
||||
var windowW = $(window).width();
|
||||
$('.urled').css('width',windowW/4);
|
||||
if(windowH > 820){
|
||||
$('.wst-views').css('height',800);
|
||||
}else{
|
||||
$('.wst-views').css('height',windowH-35);
|
||||
}
|
||||
$('.wst-maingr').css('width',windowW-335);
|
||||
})
|
Reference in New Issue
Block a user