parent
b1791f4531
commit
ada15b4212
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
app.filter('safeHtml', function ($sce) {
|
||||
app.filter('safeHtml', ['$sce',function ($sce) {
|
||||
return function (input) {
|
||||
return $sce.trustAsHtml(input);
|
||||
}
|
||||
});
|
||||
}]);
|
@ -1,57 +0,0 @@
|
||||
/**
|
||||
* 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 loadDataFromServer = function(id, page){
|
||||
getOpenId(function(openid){
|
||||
$.ajax({
|
||||
url: apiUrl + 'activities',
|
||||
data: {openid: openid, page: page},
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
success: function(data){
|
||||
setTemplate(data.data, data.all_count, data.count, data.page);
|
||||
},
|
||||
error: function(xhr,status,err){
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
};
|
||||
var setTemplate = function(data, all_count, count, page){
|
||||
console.log(data);
|
||||
var html=bt('t:result-list',{activities: data, all_count: all_count, count: count, page: page});
|
||||
if (page == 0) {
|
||||
$('#container').prepend(html);
|
||||
} else {
|
||||
$("#more_activities").remove();
|
||||
$('#container').append(html);
|
||||
}
|
||||
descToggle();
|
||||
};
|
||||
//内容全部显示与部分隐藏
|
||||
var descToggle = function(){
|
||||
$(".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);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
loadDataFromServer(8686, 0);
|
||||
});
|
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd public/javascripts/wechat && gulp && gulp minify
|
Loading…
Reference in new issue