| xqd
@@ -55,10 +55,9 @@
|
|
|
}
|
|
|
$scope.data = {};
|
|
|
$scope.load(true);
|
|
|
- //$scope.$on('$ionicView.enter', function () {
|
|
|
-
|
|
|
-
|
|
|
- //});
|
|
|
+ $scope.$on('$ionicView.leave', function () {
|
|
|
+ $scope.popover.hide();
|
|
|
+ });
|
|
|
}]);
|
|
|
|
|
|
app.controller('dreamDetailCtrl', ["$scope", "$state", "msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams", "$ionicModal", "$timeout", "$ionicScrollDelegate", "$interval"
|
| xqd
@@ -73,11 +72,12 @@
|
|
|
$scope.dream = result.data.data
|
|
|
console.log();
|
|
|
var date = new Date();
|
|
|
- var inter = (date.getTime() - new Date($scope.dream.created_at).getTime())/1000
|
|
|
+ var inter = (date.getTime() - new Date($scope.dream.created_at.replace(/-/g, "/")).getTime()) / 1000
|
|
|
+
|
|
|
leftTimer($scope.dream.time-inter);
|
|
|
$scope.multi = {
|
|
|
a: $scope.dream.a,
|
|
|
- b: new Date($scope.dream.created_at),
|
|
|
+ b: new Date($scope.dream.created_at.replace(/-/g, "/")),
|
|
|
c: $scope.dream.c,
|
|
|
result: 1,
|
|
|
promise:null,
|
| xqd
@@ -120,6 +120,10 @@
|
|
|
}
|
|
|
$scope.timer = '';
|
|
|
var leftTimer = function (countDown) {
|
|
|
+ if (isNaN(countDown)) {
|
|
|
+ $scope.timer = '结束';
|
|
|
+ return;
|
|
|
+ }
|
|
|
var day=parseInt(countDown/(24*60*60));
|
|
|
var h=parseInt(countDown/(60*60)%24);
|
|
|
var m=parseInt(countDown/60%60);
|
| xqd
@@ -151,7 +155,8 @@
|
|
|
}
|
|
|
//实时计算支持乘数
|
|
|
$scope.calcmultiplier = function () {
|
|
|
- $scope.multi.promise=$interval(function () {
|
|
|
+ $scope.multi.promise = $interval(function () {
|
|
|
+
|
|
|
var date = new Date();
|
|
|
var inter = date.getTime() - $scope.multi.b.getTime();
|
|
|
var minutes = Math.floor(inter / (60 * 1000));
|
| xqd
@@ -221,26 +226,26 @@
|
|
|
}
|
|
|
|
|
|
$scope.replay = function ($event, name) {
|
|
|
+
|
|
|
+ //$event.stopPropagation();
|
|
|
$scope.input.focus = true;
|
|
|
- //$event.stopPropagation();
|
|
|
- $scope.input.placeholder = "回复" + name;
|
|
|
-
|
|
|
- $scope.vm.title='';
|
|
|
+ $scope.input.placeholder = "回复" + name;
|
|
|
+ $scope.vm.title='';
|
|
|
}
|
|
|
$scope.comment = function(){
|
|
|
// $event.stopPropagation();
|
|
|
- $scope.input.placeholder = "评论";
|
|
|
+ //$scope.input.placeholder = "评论";
|
|
|
$scope.input.focus = true;
|
|
|
$scope.vm.title='';
|
|
|
}
|
|
|
$scope.submitComment = function(id){
|
|
|
- $scope.input.placeholder = "评论";
|
|
|
+ // $scope.input.placeholder = "评论";
|
|
|
var data = {
|
|
|
id:id,
|
|
|
- content:vm.comment,
|
|
|
+ content:$scope.vm.comment,
|
|
|
};
|
|
|
homeService.add_comment(data).then(function(){
|
|
|
- $scope.vm.comment = '' ;
|
|
|
+ $scope.vm.comment = '' ;
|
|
|
$scope.load(id);
|
|
|
$scope.closeModal();
|
|
|
})
|
| xqd
@@ -296,13 +301,16 @@
|
|
|
}]);
|
|
|
app.controller('searchCtrl', ["$scope","homeService", "$state", "msg", "$ionicTabsDelegate", "$ionicNavBarDelegate"
|
|
|
, function ($scope,homeService, $state, msg, $ionicTabsDelegate, $ionicNavBarDelegate) {
|
|
|
- $scope.isResult = false;
|
|
|
- $scope.index = 0;
|
|
|
- $scope.vm = {
|
|
|
- keyword : ""
|
|
|
- }
|
|
|
+
|
|
|
$scope.showMore = function (keyword,index) {
|
|
|
+ if(!keyword)return;
|
|
|
$scope.index = index;
|
|
|
+ // $scope.vm.keyword = keyword;
|
|
|
+ homeService.search(keyword).then(function(result){
|
|
|
+ $scope.isResult = true;
|
|
|
+ $scope.dream_infos = result.data.data.dream_infos;
|
|
|
+ $scope.user_infos = result.data.data.user_infos;
|
|
|
+ });
|
|
|
}
|
|
|
$scope.search = function (keyword) {
|
|
|
$scope.vm.keyword = keyword;
|
| xqd
@@ -312,10 +320,21 @@
|
|
|
$scope.user_infos = result.data.data.user_infos;
|
|
|
});
|
|
|
}
|
|
|
+ $scope.toDetail = function (id) {
|
|
|
+ $state.go('app.home_dreamdetail',{id:id});
|
|
|
+ };
|
|
|
+ $scope.toUser = function (id) {
|
|
|
+ $state.go('app.home_dreamdetail',{id:id});
|
|
|
+ };
|
|
|
|
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
|
+ $scope.isResult = false;
|
|
|
+ $scope.index = 0;
|
|
|
+ $scope.vm = {
|
|
|
+ keyword : ""
|
|
|
+ }
|
|
|
$ionicTabsDelegate.showBar(false);
|
|
|
- $ionicNavBarDelegate.showBackButton(false);
|
|
|
+ // $ionicNavBarDelegate.showBackButton(false);
|
|
|
homeService.search('').then(function(result){
|
|
|
$scope.hot_searches = result.data.data.hot_searches;
|
|
|
$scope.history_searches = result.data.data.history_searches;
|
| xqd
@@ -342,9 +361,9 @@
|
|
|
$scope.dreams = result.data.data;
|
|
|
});
|
|
|
});
|
|
|
- $scope.toDetail = function (id) {
|
|
|
- $state.go('app.home_dreamdetail',{id:id});
|
|
|
- };
|
|
|
+ $scope.toDetail = function (id) {
|
|
|
+ $state.go('app.home_dreamdetail',{id:id});
|
|
|
+ };
|
|
|
|
|
|
}]);
|
|
|
|