Commit 4805b4d6 by zhangle

refactor index page. add favorites function module

parent ad476b41
...@@ -93,27 +93,12 @@ ...@@ -93,27 +93,12 @@
<aside class="media-body"> <aside class="media-body">
<div class="app-panel col-md-2 text-center" <div class="app-panel col-md-2 text-center"
ng-repeat="app in visitedApps" ng-repeat="app in visitedApps"
ng-click="goToAppHomePage(app.appId)" ng-click="goToAppHomePage(app.appId)">
ng-mouseover="toggleOperationBtn(app)"
ng-mouseout="toggleOperationBtn(app)">
<div class="thumbnail hover"> <div class="thumbnail hover">
<h4 ng-bind="app.appId"></h4> <h4 ng-bind="app.appId"></h4>
<h5 ng-bind="app.name"></h5> <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> </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> </aside>
</section> </section>
</div> </div>
......
...@@ -8,7 +8,6 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi ...@@ -8,7 +8,6 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
$scope.getUserCreatedApps = getUserCreatedApps; $scope.getUserCreatedApps = getUserCreatedApps;
$scope.getUserFavorites = getUserFavorites; $scope.getUserFavorites = getUserFavorites;
$scope.addFavorite = addFavorite;
$scope.goToAppHomePage = goToAppHomePage; $scope.goToAppHomePage = goToAppHomePage;
$scope.goToCreateAppPage = goToCreateAppPage; $scope.goToCreateAppPage = goToCreateAppPage;
...@@ -102,22 +101,6 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi ...@@ -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() { function goToCreateAppPage() {
$window.location.href = "/app.html"; $window.location.href = "/app.html";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment