代码拉取完成,页面将自动刷新
<!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" />
<link rel="stylesheet" href="css/font-awesome.min.css">
<script src="js/jquery.min.js"></script>
<script src="js/handlebars.min.js"></script>
<script src="js/delayimg.js"></script>
<style type="text/css">
.mui-bar a {
color: black;
}
.mui-bar{
background-color: white;
}
.moments_img img {
opacity: 0;
transition: opacity .3s ease-in;
}
.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" style="margin-bottom: 10px;">
<div class="mui-loading">
<div class="mui-spinner">
</div>
</div>
</div>
</div>
<script type="text/template" id="tpl">
{{#if data}} {{#each data}}
<div class="moment_body" moments_id="{{moments_id}}">
<div class="per_info">
<span class="head_img">
<img id="avatar" src="{{avatarSrc user.avatar}}">
</span>
<p class="head_time">{{time}}</p>
<p class="head_nickname">{{user.nickname}}</p>
<p class="head_moments">{{user.sign}}</p>
</div>
<div class="con_moments">
<div class="my_moments">
{{content}}
</div>
{{#if pic}}
<div class="moments_img">
<img src="images/260.png" data-delay="{{picSrc pic}}">
</div>
{{/if}}
</div>
<button class="mui-btn mui-btn-danger del" style="margin-left: 20px;">删除</button>
<div class="end_achieve">
<span class="praise">
<span class="mui-icon fa fa-thumbs-o-up"></span> {{liked}}
</span>
<span class="other_comment">
<span class="mui-icon fa fa-commenting-o"></span> {{comment}}
</span>
</div>
<div class="clear" style="clear: both;"></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') + "Moments/lst";
var delUrl = localStorage.getItem('serverUrl') + "moments/del";
var uid = JSON.parse(localStorage.getItem('user')).uid;
mui.init();
mui.plusReady(function() {
getList("#list");
});
function getList(target) {
mui.post(listUrl, {
'uid': uid
}, function(data) {
if(data.code) {
addData(data, target);
delayimg.init({
throttle: 0,
offset: '300px'
})
} else {
mui.toast(data.msg);
}
}, 'json');
}
Handlebars.registerHelper('avatarSrc', function(path) {
return localStorage.getItem('imgUrl') + path;
});
Handlebars.registerHelper('picSrc', function(path) {
return localStorage.getItem('imgUrl') + path;
});
function addData(data, target) {
var tpl = $("#tpl").html();
var template = Handlebars.compile(tpl);
var html = template(data);
$(target).html(html);
}
mui("#list").on('tap', '.del', function() {
var btnArray = ['确认', '取消'];
var cur_moments = this;
mui.confirm('删除此动态?', '删除动态', btnArray, function(e) {
if(e.index == 0) {
var moments_id = $(cur_moments).parent().attr('moments_id');
mui.post(delUrl, {
'uid': uid,
'moments_id': moments_id
}, function(data) {
if(data.code) {
addData(data, '#list');
delayimg.render();
mui.toast(data.msg);
} else {
mui.toast(data.msg);
}
}, 'json');
} else {
return false;
}
});
});
mui(".mui-content").on('tap', '.con_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();
});
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。