代码拉取完成,页面将自动刷新
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link href="css/mui.min.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="css/moments.css" />
<script src="js/jquery.min.js"></script>
<script src="js/handlebars.min.js"></script>
<style type="text/css">
.mui-bar a {
color: black;
}
.mui-bar {
background-color: white;
}
.mui-loading {
margin-top: 60%;
}
.mui-spinner {
width: 30px;
height: 30px;
}
</style>
</head>
<body>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">我的评论</h1>
</header>
<div class="mui-content">
<div id="list">
<div class="mui-loading">
<div class="mui-spinner">
</div>
</div>
</div>
</div>
<script type="text/template" id="tpl">
{{#if this}} {{#each this}}
<div class="moment_body" moments_id={{pivot.moments_id}}>
<div class="per_info">
<span class="head_img">
<img src="{{avatar}}">
</span>
<p class="head_delete" comment_id={{pivot.comment_id}}>删除</p>
<p class="head_nickname">{{nickname}}</p>
<p class="head_input_time">{{pivot.time}}</p>
</div>
<div class="my_comment">
{{pivot.content}}
</div>
<div class="related-moments mui-ellipsis" style="background: whitesmoke;width: 90%;">
{{content}}
</div>
</div>
{{/each}} {{else}}
<p style="text-align: center;margin-top: 60%;font-size: 23px;">暂无记录</p>
{{/if}}
</script>
<script src="js/mui.min.js"></script>
<script type="text/javascript">
var listUrl = localStorage.getItem('serverUrl') + 'user/getCommentList';
var delUrl = localStorage.getItem('serverUrl') + 'comment/del';
var user = JSON.parse(localStorage.getItem('user'));
mui.init();
mui.plusReady(function() {
getCommentList();
});
function getCommentList() {
mui.post(listUrl, {
'uid': user.uid,
}, function(data) {
addData(data, '#list');
}, 'json');
}
Handlebars.registerHelper('avatar', function(status) {
if(user.avatar)
return localStorage.getItem('imgUrl') + user.avatar;
else
return 'images/60x60.gif';
});
Handlebars.registerHelper('nickname', function(status) {
return user.nickname;
});
function addData(data, target) {
var tpl = $("#tpl").html();
var template = Handlebars.compile(tpl);
var html = template(data);
$(target).html(html);
}
mui(".mui-content").on('tap', '.related-moments', function() {
var moments_id = $(this).parent().attr('moments_id');
var detail = plus.webview.create(
'moments-detail.html',
'moments-detail', {
top: '0px',
bottom: '0px',
}, {
moments_id: moments_id
}
);
//显示原生等待框,加载详情页面
plus.nativeUI.showWaiting();
});
mui(".mui-content").on('tap', '.head_delete', function() {
var cur_comment = this;
mui.confirm('删除此评论?', '删除评论', ['确定', '取消'], function(e) {
if(e.index == 0) {
var comment_id = cur_comment.getAttribute('comment_id');
mui.post(delUrl, {
'comment_id': comment_id
}, function(data) {
if(data.code) {
mui.toast(data.msg);
getCommentList();
} else {
mui.toast(data.msg);
getCommentList();
}
}, 'json');
} else {
return false;
}
});
});
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。