提交 4805b4d6 编写于 作者: Z zhangle

refactor index page. add favorites function module

上级 ad476b41
......@@ -93,27 +93,12 @@
<aside class="media-body">
<div class="app-panel col-md-2 text-center"
ng-repeat="app in visitedApps"
ng-click="goToAppHomePage(app.appId)"
ng-mouseover="toggleOperationBtn(app)"
ng-mouseout="toggleOperationBtn(app)">
ng-click="goToAppHomePage(app.appId)">
<div class="thumbnail hover">
<h4 ng-bind="app.appId"></h4>
<h5 ng-bind="app.name"></h5>
<p class="operate-panel" ng-show="app.showOperationBtn">
<button class="btn btn-default btn-xs" title="收藏"
ng-click="addFavorite(app.appId);$event.stopPropagation();">
<img src="img/unlike.png" class="i-15">
</button>
</p>
</div>
</div>
<!--<div class="col-md-2 text-center" ng-repeat="appId in visitedApps"-->
<!--ng-click="goToAppHomePage(appId)">-->
<!--<div class="thumbnail hover cursor-pointer">-->
<!--<h4 ng-bind="appId"></h4>-->
<!--</div>-->
<!--</div>-->
</aside>
</section>
</div>
......
......@@ -8,7 +8,6 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
$scope.getUserCreatedApps = getUserCreatedApps;
$scope.getUserFavorites = getUserFavorites;
$scope.addFavorite = addFavorite;
$scope.goToAppHomePage = goToAppHomePage;
$scope.goToCreateAppPage = goToCreateAppPage;
......@@ -102,22 +101,6 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
}
function addFavorite(appId) {
var favorite = {
userId: $scope.userId,
appId: appId
};
FavoriteService.addFavorite(favorite)
.then(function (result) {
$scope.favoriteId = result.id;
toastr.success("收藏成功");
reload();
}, function (result) {
toastr.error(AppUtil.errorMsg(result), "收藏失败");
})
};
function goToCreateAppPage() {
$window.location.href = "/app.html";
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册