You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
77
hyhproject/wechat2/view/default/users/messages/list.html
Executable file
77
hyhproject/wechat2/view/default/users/messages/list.html
Executable file
@ -0,0 +1,77 @@
|
||||
{extend name="default/base" /}
|
||||
{block name="title"}我的消息 - {__block__}{/block}
|
||||
{block name="css"}
|
||||
<link rel="stylesheet" href="__WECHAT__/css/messages.css?v={$v}">
|
||||
{/block}
|
||||
{block name="header"}
|
||||
<div id="info_list">
|
||||
<header style="background:#ffffff;" class="ui-header ui-header-positive ui-border-b wst-header">
|
||||
<i class="ui-icon-return" onclick="location.href='{:url('wechat/users/index')}'"></i><h1>我的消息</h1>
|
||||
</header>
|
||||
{/block}
|
||||
{block name="footer"}
|
||||
<div class="ui-loading-wrap wst-Load" id="Load">
|
||||
<i class="ui-loading"></i>
|
||||
</div>
|
||||
<footer class="ui-footer wst-footer-btns" style="height:45px; border-top: 1px solid #e0e0e0;" id="footer">
|
||||
<div class="wst-toTop" id="toTop">
|
||||
<i class="wst-toTopimg"><span>顶部</span></i>
|
||||
</div>
|
||||
|
||||
<div class="ui-row-flex ui-whitespace">
|
||||
<div class="ui-col ui-col-2 favorite-tc">
|
||||
<label class="ui-checkbox" style="margin-left:5px;">
|
||||
<input class="sactive" type="checkbox" onclick="javascript:checkAll(this);">
|
||||
</label>
|
||||
全选
|
||||
</div>
|
||||
|
||||
<div class="ui-col">
|
||||
<div class="ui-btn-wrap f-btn">
|
||||
<button class="ui-btn ui-btn-danger del-btn" onclick="toDelMsg()">
|
||||
删除消息
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<input type="hidden" name="" value="" id="currPage" autocomplete="off">
|
||||
<input type="hidden" name="" value="" id="totalPage" autocomplete="off">
|
||||
<script type="text/html" id="msgList">
|
||||
{{# for(var i=0; i<d.length; i++){ }}
|
||||
<li>
|
||||
<label class="ui-checkbox msg-chk">
|
||||
<input class="active" type="checkbox" msgId="{{d[i].id}}" >
|
||||
</label>
|
||||
<div class="ui-list-info" onclick="javascript:getMsgDetails({{d[i].id}});">
|
||||
<h5 class="ui-nowrap">
|
||||
<span class="{{(d[i].msgStatus == 0)?'wst-info_ico':'wst-info_ico1' }} j-icon_{{d[i].id}}"></span>{{d[i].msgContent}}</h5>
|
||||
</div>
|
||||
</li>
|
||||
<div class="wst-Line"></div>
|
||||
{{# } }}
|
||||
</script>
|
||||
<section class="ui-container info-prompt">
|
||||
<ul class="ui-list ui-list-text wst-info_content" id="info-list">
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
<div id="info_details" style="display:none;">
|
||||
<header style="background:#ffffff;" class="ui-header ui-header-positive ui-border-b wst-header">
|
||||
<i class="ui-icon-return" onclick="javascript:returnInfo()"></i><h1>消息详情</h1>
|
||||
</header>
|
||||
<section class="ui-container">
|
||||
<div class="ui-whitespace detail-time"><span class="wst-info_detime"></span></div>
|
||||
<div class="ui-whitespace"><span class="wst-info_decontent"></span></div>
|
||||
</section>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="include"}
|
||||
{include file="default/dialog" /}<!-- 对话框模板 -->
|
||||
{/block}
|
||||
{block name="js"}
|
||||
<script type='text/javascript' src='__ROOT__/hyhproject//wechat/view/default/users/messages/messages.js?v={$v}'></script>
|
||||
{/block}
|
103
hyhproject/wechat2/view/default/users/messages/messages.js
Executable file
103
hyhproject/wechat2/view/default/users/messages/messages.js
Executable file
@ -0,0 +1,103 @@
|
||||
//消息列表
|
||||
function getMessages(){
|
||||
$('#Load').show();
|
||||
loading = true;
|
||||
var param = {};
|
||||
param.pagesize = 12;
|
||||
param.page = Number( $('#currPage').val() ) + 1;
|
||||
$.post(WST.U('wechat/messages/pageQuery'), param, function(data){
|
||||
var json = WST.toJson(data);
|
||||
var mhtml = '';
|
||||
if(json && json.Rows && json.Rows.length>0){
|
||||
var gettpl = document.getElementById('msgList').innerHTML;
|
||||
laytpl(gettpl).render(json.Rows, function(html){
|
||||
$('#info-list').append(html);
|
||||
});
|
||||
$('#currPage').val(json.CurrentPage);
|
||||
$('#totalPage').val(json.TotalPage);
|
||||
|
||||
}else{
|
||||
mhtml += '<div class="wst-prompt-icon"><img src="'+ window.conf.WECHAT +'/img/nothing-message.png"></div>';
|
||||
mhtml += '<div class="wst-prompt-info">';
|
||||
mhtml += '<p>对不起,没有相关消息。</p>';
|
||||
mhtml += '</div>';
|
||||
$('.info-prompt').append(mhtml);
|
||||
}
|
||||
loading = false;
|
||||
$('#Load').hide();
|
||||
});
|
||||
}
|
||||
//返回消息列表
|
||||
function returnInfo(){
|
||||
$('#info_details').hide();
|
||||
$('#info_list').show();
|
||||
}
|
||||
|
||||
// 全选
|
||||
function checkAll(obj){
|
||||
var chk = $(obj).attr('checked');
|
||||
$('.active').each(function(k,v){
|
||||
$(this).prop('checked',chk);
|
||||
});
|
||||
}
|
||||
//消息详情
|
||||
function getMsgDetails(id){
|
||||
$('#info_list').hide();
|
||||
$('#info_details').show();
|
||||
$('.j-icon_'+id).addClass('wst-info_ico1').removeClass('wst-info_ico');
|
||||
$.post(WST.U('wechat/messages/getById'), {msgId:id}, function(data){
|
||||
var json = WST.toJson(data);
|
||||
if(json){
|
||||
$('.wst-info_detime').html(json.createTime);
|
||||
$('.wst-info_decontent').html(json.msgContent);
|
||||
}
|
||||
json = null;
|
||||
});
|
||||
}
|
||||
var msgIdsToDel=new Array();//要删除的消息的id 数组
|
||||
//去删除商城消息
|
||||
function toDelMsg(){
|
||||
var msgIds = new Array();
|
||||
$('.active').each(function(k,v){
|
||||
if($(this).attr('checked')){
|
||||
msgIds.push($(this).attr('msgid'));
|
||||
}
|
||||
});
|
||||
msgIdsToDel = msgIds;
|
||||
if(msgIds.join(',')==''){
|
||||
WST.msg('请选择要删除的消息','info');
|
||||
return false;
|
||||
}
|
||||
WST.dialog('确定要删除选中的消息吗?','delMsg()');
|
||||
}
|
||||
var vn ='';
|
||||
//删除商城消息
|
||||
function delMsg(){
|
||||
WST.dialogHide('prompt');
|
||||
$.post(WST.U('wechat/messages/del'), {ids:msgIdsToDel}, function(data){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
WST.msg(json.msg,'success');
|
||||
$('#currPage').val(0)
|
||||
$('#info-list').html(' ');
|
||||
getMessages();
|
||||
}else{
|
||||
WST.msg(json.msg,'warn');
|
||||
}
|
||||
});
|
||||
}
|
||||
var currPage = totalPage = 0;
|
||||
var loading = false;
|
||||
$(document).ready(function(){
|
||||
getMessages();
|
||||
$(window).scroll(function(){
|
||||
if (loading) return;
|
||||
if ((5 + $(window).scrollTop()) >= ($(document).height() - screen.height)) {
|
||||
currPage = Number( $('#currPage').val() );
|
||||
totalPage = Number( $('#totalPage').val() );
|
||||
if( totalPage > 0 && currPage < totalPage ){
|
||||
getMessages();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user