Mike 8 gadi atpakaļ
vecāks
revīzija
27abca1206

+ 1 - 0
miaomiao/www/css/style.css

xqd
@@ -372,6 +372,7 @@ padding-right:3px;
 }
     .hdcontent .slt {
         width:30%;
+        max-height:65px; 
         float:left;
         margin:5px;
     }

+ 4 - 2
miaomiao/www/js/config/config.js

xqd
@@ -1,7 +1,9 @@
 (function (app) {
     //全局配置 
     app.constant("config", {
-        server: 'http://localhost:8092/',
-        imgServer: 'http://localhost:8092/api/attachment/download/'
+        // server: 'http://localhost:8092/',
+        // imgServer: 'http://localhost:8092/api/attachment/download/'
+        server: 'http://q8.9026.com/',
+        imgServer: 'http://q8.9026.com/api/attachment/download/'
     });
 })(angular.module('app'));

+ 251 - 258
miaomiao/www/js/controllers/home.js

xqd xqd xqd xqd xqd
@@ -1,231 +1,231 @@
 (function (app) {
     app.controller('homeCtrl', ["$scope", "$http", 'config', "$state", "msg", "$ionicPopover", "homeService"
         , function ($scope, $http, config, $state, msg, $ionicPopover, homeService) {
-            $scope.type = 'hot';//tab切换
-            $ionicPopover.fromTemplateUrl('my-popover.html', {
-                scope: $scope
-            }).then(function (popover) {
-                $scope.popover = popover;
-            });
-            $scope.openPopover = function ($event) {
-                $scope.popover.show($event);
-            };
-            $scope.closePopover = function () {
-                $scope.popover.hide();
-            };
-            $scope.changetype = function (type) {
-                $scope.type = type;
-                $scope.load(true);
-            }
-            $scope.toDetail = function (id) {
-                $state.go('app.home_dreamdetail',{id:id});
-            };
-            $scope.filter = {
-                hasMore: false,
-                pageIndex: 1,
-                pageSize: 20,
+        $scope.type = 'hot';//tab切换
+        $ionicPopover.fromTemplateUrl('my-popover.html', {
+            scope: $scope
+        }).then(function (popover) {
+            $scope.popover = popover;
+        });
+        $scope.openPopover = function ($event) {
+            $scope.popover.show($event);
+        };
+        $scope.closePopover = function () {
+            $scope.popover.hide();
+        };
+        $scope.changetype = function (type) {
+            $scope.type = type;
+            $scope.load(true);
+        }
+        $scope.toDetail = function (id) {
+            $state.go('app.home_dreamdetail',{id:id});
+        };
+        $scope.filter = {
+            hasMore: false,
+            pageIndex: 1,
+            pageSize: 20,
+        }
+        $scope.index = {
+            banner: [],
+            users: [],
+            dreams:[]
+        };
+        $scope.load = function (init) {
+            if (init) {
+                $scope.filter.pageIndex = 1;
+                $scope.index.dreams = [];
             }
-            $scope.index = {
-                banner: [],
-                users: [],
-                dreams:[]
-            };
-            $scope.load = function (init) {
+            msg.loading();
+            homeService.index($scope.type, $scope.filter.pageIndex).then(function (result) {
+                msg.hide();
+                $scope.index.banners = result.data.data.banners;
+                $scope.index.users = result.data.data.users;
+                $scope.filter.pageIndex++;
+                var more = (result.data.data.dreams.data.length >= $scope.filter.pageSize);
+                $scope.filter.hasMore = more;
+                $scope.index.dreams = $scope.index.dreams.concat(result.data.data.dreams.data);
                 if (init) {
-                    $scope.filter.pageIndex = 1;
-                    $scope.index.dreams = [];
+                    $scope.$broadcast('scroll.refreshComplete');
+                } else {
+                    $scope.$broadcast('scroll.infiniteScrollComplete');
                 }
-                msg.loading();
-                homeService.index($scope.type, $scope.filter.pageIndex).then(function (result) {
-                    msg.hide();
-                    $scope.index.banners = result.data.data.banners;
-                    $scope.index.users = result.data.data.users;
-                    $scope.filter.pageIndex++;
-                    var more = (result.data.data.dreams.data.length >= $scope.filter.pageSize);
-                    $scope.filter.hasMore = more;
-                    $scope.index.dreams = $scope.index.dreams.concat(result.data.data.dreams.data);
-                    if (init) {
-                        $scope.$broadcast('scroll.refreshComplete');
-                    } else {
-                        $scope.$broadcast('scroll.infiniteScrollComplete');
-                    }
-                }, function (error) {
-                    msg.hide();
-                });
-            }
-            $scope.data = {};
-            $scope.load(true);
-            //$scope.$on('$ionicView.enter', function () {
-              
+            }, function (error) {
+                msg.hide();
+            });
+        }
+        $scope.data = {};
+        $scope.load(true);
+        //$scope.$on('$ionicView.enter', function () {
           
-            //});
-        }]);
+      
+        //});
+    }]);
 
     app.controller('dreamDetailCtrl', ["$scope", "$state", "msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams", "$ionicModal", "$timeout", "$ionicScrollDelegate", "$interval"
         , function ($scope, $state, msg, common, config, homeService, $ionicTabsDelegate, $stateParams, $ionicModal, $timeout, $ionicScrollDelegate, $interval) {
-            var id = $stateParams.id;
-            id=5;
-            $scope.load = function (id) {
-                msg.loading();
-                homeService.dreamDetail(id).then(function (result) {
-                    msg.hide();
-                    console.log(result);
-                    $scope.dream = result.data.data
-                    console.log();
-                    var date = new Date();
-                    var inter = (date.getTime() - new Date($scope.dream.created_at).getTime())/1000
-                    leftTimer($scope.dream.time-inter);
-                    $scope.multi = {
-                        a: $scope.dream.a,
-                        b: new Date($scope.dream.created_at),
-                        c: $scope.dream.c,
-                        result: 1,
-                        promise:null,
-                    }
-                    $scope.calcmultiplier();
-                }, function (error) {
-                    msg.hide();
-                });
-            }
+        var id = $stateParams.id;
+        id=5;
+        $scope.load = function (id) {
+            msg.loading();
+            homeService.dreamDetail(id).then(function (result) {
+                msg.hide();
+                console.log(result);
+                $scope.dream = result.data.data
+                console.log();
+                var date = new Date();
+                var inter = (date.getTime() - new Date($scope.dream.created_at).getTime())/1000
+                leftTimer($scope.dream.time-inter);
+                $scope.multi = {
+                    a: $scope.dream.a,
+                    b: new Date($scope.dream.created_at),
+                    c: $scope.dream.c,
+                    result: 1,
+                    promise:null,
+                }
+                $scope.calcmultiplier();
+            }, function (error) {
+                msg.hide();
+            });
+        }
 
-            $scope.type = 1;//tab切换
-            $scope.tosupport = false;
-            $scope.support = function ($event) { 
-                $event.stopPropagation();
-                $scope.tosupport = true;
-                $scope.vm.coin = 0;
-                $scope.index = 0;
-            }
-            $scope.cancelSupport = function () {
-                $scope.tosupport = false;
-            }
-            $scope.changeType = function (type) {
-                $ionicScrollDelegate.scrollTop(true);
-                $scope.type = type;
-            }
+        $scope.type = 1;//tab切换
+        $scope.tosupport = false;
+        $scope.support = function ($event) { 
+            $event.stopPropagation();
+            $scope.tosupport = true;
+            $scope.vm.coin = 0;
             $scope.index = 0;
-            $scope.$on('$ionicView.beforeEnter', function () {
-                $scope.load(id);
-                $ionicTabsDelegate.showBar(false);
-            });
-            $scope.$on('$ionicView.leave', function () {
-                $ionicTabsDelegate.showBar(true);
-                if($scope.multi.promise)$interval.cancel($scope.multi.promise);
-                if($scope.leftTimer)$interval.cancel($scope.leftTimer);
-            });
+        }
+        $scope.cancelSupport = function () {
+            $scope.tosupport = false;
+        }
+        $scope.changeType = function (type) {
+            $ionicScrollDelegate.scrollTop(true);
+            $scope.type = type;
+        }
+        $scope.index = 0;
+        $scope.$on('$ionicView.beforeEnter', function () {
+            $scope.load(id);
+            $ionicTabsDelegate.showBar(false);
+        });
+        $scope.$on('$ionicView.leave', function () {
+            $ionicTabsDelegate.showBar(true);
+            if($scope.multi.promise)$interval.cancel($scope.multi.promise);
+            if($scope.leftTimer)$interval.cancel($scope.leftTimer);
+        });
 
-            $scope.vm = {
-                coin:"",
-                title:""
+        $scope.vm = {
+            coin:"",
+            title:""
+        }
+        $scope.timer = '';
+        var leftTimer = function (countDown) {
+            var day=parseInt(countDown/(24*60*60));
+            var h=parseInt(countDown/(60*60)%24);
+            var m=parseInt(countDown/60%60);
+            var s=parseInt(countDown%60); 
+            $scope.timer=(h<10?'0'+h:h)+'时'+(m<10?'0'+m:m)+'分'+(s<10?'0'+s:s)+'秒';
+            if(day>0) $scope.timer = day+'天'+ $scope.timer;
+            
+            if($scope.leftTimer)$interval.cancel($scope.leftTimer);
+            $scope.leftTimer = $interval(function () {
+                if (countDown >= 1) leftTimer(countDown - 1);
+            },1000);
+            if(countDown<=0){
+              $scope.timer='结束'; 
             }
-            $scope.timer = '';
-            var leftTimer = function (countDown) {
-                var day=parseInt(countDown/(24*60*60));
-                var h=parseInt(countDown/(60*60)%24);
-                var m=parseInt(countDown/60%60);
-                var s=parseInt(countDown%60); 
-                $scope.timer=(h<10?'0'+h:h)+'时'+(m<10?'0'+m:m)+'分'+(s<10?'0'+s:s)+'秒';
-                if(day>0) $scope.timer = day+'天'+ $scope.timer;
-                
-                if($scope.leftTimer)$interval.cancel($scope.leftTimer);
-                $scope.leftTimer = $interval(function () {
-                    if (countDown >= 1) leftTimer(countDown - 1);
-                },1000);
-                if(countDown<=0){
-                  $scope.timer='结束'; 
+        }
+        $scope.changeIndex = function (index) {
+            $scope.index = index;
+            $scope.vm.coin = index*5;
+        }
+        //实时排行
+        $scope.sort = {
+            first: 'img/demo/head5.jpg',
+            second: 'img/demo/head6.jpg',
+            third: 'img/demo/head7.jpg',
+            slide: ''
+        }
+        $scope.vidEnded = function () {
+            alert('播放完毕');
+        }
+        //实时计算支持乘数
+        $scope.calcmultiplier = 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));
+                var number = $scope.multi.a * minutes + $scope.multi.c;//js浮点运算会失真,根据muti.a的可能值范围,比如乘以100再除以100
+                if (number<=1) {
+                    number = 1;
                 }
+                $scope.multi.result = Math.round(number * 100) / 100;
+            },1000);
+            //  点击支持取消   $interval.cancel($scope.multi.promise); 获取数据后重新开始执行
+        }
+        $scope.supportDream = function (data) {
+            if(!$scope.vm.coin){
+                msg.error("请选择梦想币数量!");
+                return ;
             }
-            $scope.changeIndex = function (index) {
-                $scope.index = index;
-                $scope.vm.coin = index*5;
-            }
-            //实时排行
-            $scope.sort = {
-                first: 'img/demo/head5.jpg',
-                second: 'img/demo/head6.jpg',
-                third: 'img/demo/head7.jpg',
-                slide: ''
-            }
-            $scope.vidEnded = function () {
-                alert('播放完毕');
-            }
-            //实时计算支持乘数
-            $scope.calcmultiplier = 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));
-                    var number = $scope.multi.a * minutes + $scope.multi.c;//js浮点运算会失真,根据muti.a的可能值范围,比如乘以100再除以100
-                    if (number<=1) {
-                        number = 1;
-                    }
-                    $scope.multi.result = Math.round(number * 100) / 100;
-                },1000);
-                //  点击支持取消   $interval.cancel($scope.multi.promise); 获取数据后重新开始执行
-            }
-            $scope.supportDream = function (data) {
-                if(!$scope.vm.coin){
-                    msg.error("请选择梦想币数量!");
-                    return ;
-                }
-                var data = {
-                    id:id,
-                    coin:$scope.vm.coin
-                };
+            var data = {
+                id:id,
+                coin:$scope.vm.coin
+            };
 
-                homeService.supportDream(data).then(function(result){
-                    $scope.tosupport = false;
+            homeService.supportDream(data).then(function(result){
+                $scope.tosupport = false;
 
-                    $scope.load(id);
-                    //
-                    //测试动画切换
-                    $scope.sort.first = 'img/demo/head7.jpg';
-                    $scope.sort.second = 'img/demo/head6.jpg';
-                    $scope.sort.third = 'img/demo/head5.jpg';
-                    $scope.sort.slide1 = 'list-grow-animation';
-                    $scope.sort.slide2 = 'slide-in-both-ways';
-                    $scope.sort.slide3 = 'bounce-animation';
-                    $interval.cancel($scope.multi.promise);
-                })
-            };
+                $scope.load(id);
+                //
+                //测试动画切换
+                $scope.sort.first = 'img/demo/head7.jpg';
+                $scope.sort.second = 'img/demo/head6.jpg';
+                $scope.sort.third = 'img/demo/head5.jpg';
+                $scope.sort.slide1 = 'list-grow-animation';
+                $scope.sort.slide2 = 'slide-in-both-ways';
+                $scope.sort.slide3 = 'bounce-animation';
+                $interval.cancel($scope.multi.promise);
+            })
+        };
 
-            $scope.collectionDream = function(is_collection){
-                homeService.collectionDream(id,is_collection).then(function(result){
-                    $scope.dream.is_collection=result.data.data;
-                })
-            }
+        $scope.collectionDream = function(is_collection){
+            homeService.collectionDream(id,is_collection).then(function(result){
+                $scope.dream.is_collection=result.data.data;
+            })
+        }
 
-             $scope.add = function(is_collection){
-                var data = {
-                    id:id,
-                    title:$scope.vm.title,
-                    // pics:$scope.vm.content,
-                };
-                homeService.add_interaction(data).then(function(){
-                    $scope.load(id);
-                    $scope.closeModal();
-                })
-            }
+         $scope.add = function(is_collection){
+            var data = {
+                id:id,
+                title:$scope.vm.title,
+                pics:$scope.imgs,
+            };
+            homeService.add_interaction(data).then(function(){
+                $scope.load(id);
+                $scope.closeModal();
+            })
+        }
 
-            $scope.showText = function(){ 
-                $scope.aboutStyle = {
-                    "white-space" : "normal"
-                  }
-                $scope.ionDownStyle = {
-                    "display" : "none"
-                }
-            }
-            $scope.input = {
-                placeholder: '评论',
-                focus:false
+        $scope.showText = function(){ 
+            $scope.aboutStyle = {
+                "white-space" : "normal"
+              }
+            $scope.ionDownStyle = {
+                "display" : "none"
             }
-         
-            $scope.replay = function ($event, name) {
-                $scope.input.focus = true;
-            //$event.stopPropagation();
-            $scope.input.placeholder = "回复" + name;
-            
-            $scope.vm.title='';
+        }
+        $scope.input = {
+            placeholder: '评论',
+            focus:false
+        }
+     
+        $scope.replay = function ($event, name) {
+            $scope.input.focus = true;
+        //$event.stopPropagation();
+        $scope.input.placeholder = "回复" + name;
+        
+        $scope.vm.title='';
         }
         $scope.comment = function(){
           //  $event.stopPropagation();
@@ -233,13 +233,14 @@
             $scope.input.focus = true;
             $scope.vm.title='';
         }
+        $scope.imgs = new Array();
         $scope.addpict = function () {
-            $scope.imgs=new Array();
             common.chooseImage().then(function (img) {
                 common.uploadFiles(img,1).then(function (result) {
                     var response = JSON.parse(result.response);
                     var file = response.data.file;
                     $scope.imgs.push(config.imgServer+file);
+                    console.log(JSON.stringify(config.imgServer+file));
                 }, function (error) {
                     msg.error('图片上传失败');
                 });
@@ -257,11 +258,7 @@
 
           $scope.openRechargeModal = function() {
             $scope.rechagemodal.show();
-            $scope.rvm={
-                dream:'',
-                about:'',
-                money:''
-            };
+            $scope.vm.money = '';
           };
           $scope.closeRechargeModal = function() {
             $scope.rechagemodal.hide();
@@ -275,13 +272,9 @@
           });
           $scope.openModal = function() {
             $scope.modal.show();
-            $scope.ivm={
-                dream:'',
-                about:'',
-                money:''
-            };
-            $scope.iimgServer = config.imgServer;
-            $scope.iimgs = [];
+            $scope.vm.title = '';
+            $scope.imgServer = config.imgServer;
+            $scope.imgs = [];
           };
           $scope.closeModal = function() {
             $scope.modal.hide();
@@ -293,50 +286,50 @@
         }]);
     app.controller('searchCtrl', ["$scope","homeService", "$state", "msg", "$ionicTabsDelegate", "$ionicNavBarDelegate"
         , function ($scope,homeService, $state, msg, $ionicTabsDelegate, $ionicNavBarDelegate) {
-            $scope.index = 0;
-            $scope.index1 = 0;
-            $scope.vm = {
-                keywords : ""
-            }
+        $scope.index = 0;
+        $scope.index1 = 0;
+        $scope.vm = {
+            keywords : ""
+        }
+        $scope.ismore = true;
+        $scope.selectHot = function (index) {
+            $scope.index = index;
+        }
+        $scope.selectHistory = function (index) {
+            $scope.index1 = index;
+        }
+        $scope.showMore = function () {
             $scope.ismore = true;
-            $scope.selectHot = function (index) {
-                $scope.index = index;
-            }
-            $scope.selectHistory = function (index) {
-                $scope.index1 = index;
-            }
-            $scope.showmore = function () {
-                $scope.ismore = true;
-            }
-            $scope.keychange = function () {
-                $scope.ismore = false;
-            }
-            $scope.type = 1;
-            $scope.changetype = function (type) {
-                $scope.type = type;
-            }
-            $scope.$on('$ionicView.beforeEnter', function () {
-                $ionicTabsDelegate.showBar(false);
-                $ionicNavBarDelegate.showBackButton(false);
-            });
-            $scope.$on('$ionicView.leave', function () {
-                $ionicTabsDelegate.showBar(true);
-            });
-            $scope.searchContent = function ()
-            {
-                homeService.searchContent($scope.vm.keywords).then(function(result){
+        }
+        $scope.keyChange = function () {
+            $scope.ismore = false;
+        }
+        $scope.type = 1;
+        $scope.changeType = function (type) {
+            $scope.type = type;
+        }
+        $scope.$on('$ionicView.beforeEnter', function () {
+            $ionicTabsDelegate.showBar(false);
+            $ionicNavBarDelegate.showBackButton(false);
+        });
+        $scope.$on('$ionicView.leave', function () {
+            $ionicTabsDelegate.showBar(true);
+        });
+        $scope.searchContent = function ()
+        {
+            homeService.searchContent($scope.vm.keywords).then(function(result){
 
-                },function(error){
+            },function(error){
 
-                });
-            };
-        }]);
+            });
+        };
+    }]);
     app.controller('interactionAddCtrl', ["$scope","homeService", "$state", "msg","config","common", "$ionicTabsDelegate", "$ionicNavBarDelegate"
         , function ($scope,homeService, $state, msg,config,common, $ionicTabsDelegate, $ionicNavBarDelegate) {
-            $scope.$on('$ionicView.beforeEnter', function () {
-             
-                
-            }); 
+        $scope.$on('$ionicView.beforeEnter', function () {
+         
+            
+        }); 
 
     }]);
     app.controller('homeDreamsCtrl', ["$scope", "$state", "myService", "msg"

+ 2 - 2
miaomiao/www/templates/home/dream-detail.html

xqd
@@ -161,8 +161,8 @@
             </div>
             <div class="item">上传图片,让别人更好的了解你的梦想</div>
             <div class="item itemjs">
-                <a ng-repeat="item in iimgs" ng-click="showImages(iimgServer+item)" class="img-file-up">
-                    <b style="background-image:url({{iimgServer+item}});"><em ng-click="deletefile(item)" class="ion-ios-close-outline"></em></b>
+                <a ng-repeat="item in imgs" ng-click="showImages(imgServer+item)" class="img-file-up">
+                    <b style="background-image:url({{imgServer+item}});"><em ng-click="deletefile(item)" class="ion-ios-close-outline"></em></b>
                 </a>
                 <a class="btn-file-up" ng-click="addpict()"><i class="ion-image"></i>添加图片</a>
             </div>

+ 4 - 4
miaomiao/www/templates/home/search.html

xqd xqd xqd
@@ -2,7 +2,7 @@
     <ion-nav-buttons side="primary">
         <lable class="item item-input" style="width:315px">
             <i class="icon ion-search placeholder-icon" ng-click="searchContent()"></i>
-            <input type="text" style="width: 100%" placeholder="搜索内容" ng-change="keychange()" ng-model="vm.keywords">
+            <input type="text" style="width: 100%" placeholder="搜索内容" ng-change="keyChange()" ng-model="vm.keywords">
         </lable>
         <button class="button button-calm" style="width: 30%; padding: 0;" ng-click="$ionicGoBack()">取消</button>
     </ion-nav-buttons>
@@ -72,7 +72,7 @@
                      <span style="padding:5px;">哈哈瞄瞄酱</span>
                      <span class="level">Lv.3</span>
                  </div>
-                 <div class="item" style="text-align:center;color:#FF4B82;font-size:1.1rem;padding:10px;" ng-click="showmore()">更多>></div>
+                 <div class="item" style="text-align:center;color:#FF4B82;font-size:1.1rem;padding:10px;" ng-click="showMore()">更多>></div>
                  <div class="item item-divider">
                      梦想
                  </div>
@@ -114,10 +114,10 @@
          <div ng-if="ismore">
              <div class="tabs-striped tabs-top">
                  <div class="tabs" style="top:0">
-                     <a ng-class="type==1?'tab-item active':'tab-item'" ng-click="changetype(1)">
+                     <a ng-class="type==1?'tab-item active':'tab-item'" ng-click="changeType(1)">
                          用户
                      </a>
-                     <a ng-class="type==2?'tab-item active':'tab-item'" ng-click="changetype(2)">
+                     <a ng-class="type==2?'tab-item active':'tab-item'" ng-click="changeType(2)">
                         梦想
                      </a>
                  </div>