You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trustieforge/public/javascripts/wechat/wechat-dev.js

65 lines
1.5 KiB

/**
* Created by root on 3/25/16.
*/
$(document).ready(function(){
var bt=baidu.template;
bt.LEFT_DELIMITER='<!';
bt.RIGHT_DELIMITER='!>';
var apiUrl = '/api/v1/'
var setTemplate = function(data){
console.log(data);
var html=bt('t:result-list',{issues: data});
$('#container').prepend(html);
descToggle();
}
var loadDataFromServer = function(page){
$.ajax({
url: apiUrl + 'activities/' + page + "?openid=",
dataType: 'json',
success: function(data){
setTemplate(data.data);
},
error: function(xhr,status,err){
console.log(err);
}
})
};
loadDataFromServer(0);
var descToggle = function(){
var postWidth = $(".post-wrapper").width();
var titleWidth = postWidth - 80;
$(".post-title").css("maxWidth",titleWidth);
$(".post-all-content").each(function(){
var postHeight = $(this).height();
if (postHeight > 90){
$(this).parent().next().css("display","block");
$(this).parent().next().toggle(function(){
$(this).text("点击隐藏");
$(this).prev().css("height",postHeight);
},function(){
$(this).text("点击展开");
$(this).prev().css("height",90);
});
}
});
}
var timeSpilt = function(){
}
});