YanaDH 7 jaren geleden
bovenliggende
commit
c96ec728ac

+ 32 - 17
miaomiao/www/js/controllers/home.js

xqd xqd xqd xqd
@@ -873,7 +873,6 @@
         , function ($scope, $state,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams, $ionicModal, $timeout, $ionicScrollDelegate, $interval) {
             var id = $stateParams.id;
             $scope.items = $stateParams.items;
-            $scope.dream_id = $scope.items.near_dream.id;
                 $scope.$on('$ionicView.beforeEnter', function () {
                 $ionicTabsDelegate.showBar(false);
             });
@@ -897,13 +896,29 @@
                 $state.go("app.shareDream",{item:$scope.user});
             };
             $scope.toDetail = function (dream_id) {
-                $state.go('app.home_dreamdetail',{id:dream_id});
+                if($scope.items.near_dream==null){
+                    msg.alert("当前梦想","该用户没有当前梦想");
+                }
+                if($scope.items.near_dream!=null){
+                    var dream_id = $scope.items.near_dream.id;
+                    $state.go('app.home_dreamdetail',{id:dream_id});
+                }
             };
             $scope.toOldDream = function(){
-                $state.go("app.oldDream",{user_id:$scope.items.user.id});
+                if($scope.items.dreams.length==0){
+                    msg.alert("曾经的梦想","该用户没有曾经的梦想");
+                }
+                if($scope.items.dreams.length!=0){
+                    $state.go("app.oldDream",{user_id:$scope.items.user.id});
+                }
             };
             $scope.toSupportDream = function(){
-                $state.go("app.supportDream",{user_id:$scope.items.user.id});
+                if($scope.items.sup_dreams.length==0){
+                    msg.alert("支持的梦想","该用户没有支持的梦想");
+                }
+                if($scope.items.sup_dreams.length!=0){
+                    $state.go("app.supportDream",{user_id:$scope.items.user.id});
+                }
             };
             $scope.collectionDream = function(is_collection){
                 homeService.collectionDream(id,is_collection).then(function(result){
@@ -975,12 +990,7 @@
         $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(keyword);
         };
         $scope.search = function (keyword) {
             $scope.vm.keyword = keyword;
@@ -990,19 +1000,24 @@
                 $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_userDetail',{id:id});
-        };
+            $scope.toUserDetail = function (id) {
+                homeService.toUserDetail(id).then(function(result){
+                    $scope.items = result.data.data;
+                    $state.go('app.home_userDetail',{id:id,items:$scope.items});
+                },function(error){
+                    //msg.error(msg.data.error)
+                })
+            };
+            $scope.toDetail = 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);
             homeService.search('').then(function(result){

+ 147 - 28
miaomiao/www/js/controllers/my.js

xqd xqd xqd xqd xqd xqd
@@ -100,13 +100,57 @@
             }
 
      }]);
-    app.controller('aboutMiaoCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
-        , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
-
+    app.controller('aboutMiaoCtrl', ["$scope","$ionicTabsDelegate","$timeout", "$state", "myService", "msg","storage"
+        , function ($scope,$ionicTabsDelegate,$timeout, $state,myService, msg, storage) {
+           /* $scope.$on('$ionicView.beforeEnter', function () {
+                $scope.payExplain();
+            });
+            $scope.payExplain = function(){
+                myService.payExplain().then(function(result){
+                    $scope.items = result.data.data;
+                },function(error){
+                    msg.error(error.data.message)
+                })
+            };*/
         }]);
-    app.controller('withdrawCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
-        , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
+    app.controller('withdrawCtrl', ["$scope","$ionicTabsDelegate","$timeout", "$state", "myService", "msg","storage"
+        , function ($scope,$ionicTabsDelegate, $timeout,$state,myService, msg, storage) {
+            $scope.vm={
+                pay:"",
+                cash:""
+            };
+            $scope.$on("$ionicView.enter",function(){
+                myService.showAccount().then(function(result){
+                    var items = result.data.data;
+                    $scope.pays=[];
+                    angular.forEach(items,function(item){
+                        var value=item.bank_name+"(";
+                        var len=item.bank_number.length;
+                        var txt1=item.bank_number.substr(0,len-4).replace(/\d+/g,'**');
+                        var txt2=item.bank_number.substr(len-4,4);
+                        value=value+txt1+txt2+")";
+                        $scope.pays.push({id:item.id,value:value});
+                    })
+                },function(error){
+                    msg.error(error.data.message)
+                })
+            });
+            $scope.withdraw = function(){
+                var data = {
+                    data:{
+                        bank_id:$scope.vm.pay.id,
+                        cash:$scope.vm.cash
+                    }
+                };
+                myService.withdraw(data).then(function(result){
+                    msg.text("提现申请已提交");
+                    $timeout(function () {
+                        $state.go("app.my");
+                    },1000);
+                },function(error){
 
+                })
+            }
         }]);
     app.controller('payoutCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
         , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
@@ -114,15 +158,43 @@
         }]);
     app.controller('payExplainCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
         , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
-
+            $scope.$on('$ionicView.beforeEnter', function () {
+                $scope.payExplain();
+            });
+            $scope.payExplain = function(){
+                myService.payExplain().then(function(result){
+                    $scope.items = result.data.data;
+                },function(error){
+                    msg.error(error.data.message)
+                })
+            };
         }]);
     app.controller('explainCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
         , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
 
         }]);
-    app.controller('contactCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
-        , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
-
+    app.controller('contactCtrl', ["$scope","$ionicTabsDelegate", "$timeout","$state", "myService", "msg","storage"
+        , function ($scope,$ionicTabsDelegate, $timeout,$state,myService, msg, storage) {
+            $scope.vm={
+                content:"",
+                email:""
+            };
+            $scope.contact = function(){
+                var data={
+                    data:{
+                        content:$scope.vm.content,
+                        email:$scope.vm.email
+                    }
+                };
+                myService.contact(data).then(function(result){
+                    msg.text("发送成功");
+                    $timeout(function(){
+                        $state.go("app.my");
+                    },1000);
+                },function(error){
+                    msg.error(error.data.message);
+                })
+            }
         }]);
     app.controller('attentionCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
         , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
@@ -168,17 +240,30 @@
                 $event.stopPropagation();
                 $scope.toshare = true;
             };
-            $scope.shareDream = function(){
-                $state.go("app.my_shareDream",{item:$scope.user});
-            };
             $scope.toDetail = function (dream_id) {
-                $state.go('app.my_dreamdetail',{id:dream_id});
+                if($scope.items.near_dream==null){
+                    msg.alert("当前梦想","该用户没有当前梦想");
+                }
+                if($scope.items.near_dream!=null){
+                    var dream_id = $scope.items.near_dream.id;
+                    $state.go('app.home_dreamdetail',{id:dream_id});
+                }
             };
             $scope.toOldDream = function(){
-                $state.go("app.myOldDream");
+                if($scope.items.dreams.length==0){
+                    msg.alert("曾经的梦想","该用户没有曾经的梦想");
+                }
+                if($scope.items.dreams.length!=0){
+                    $state.go("app.oldDream",{user_id:$scope.items.user.id});
+                }
             };
             $scope.toSupportDream = function(){
-                $state.go("app.mySupportDream",{user_id:$scope.items.user.id});
+                if($scope.items.sup_dreams.length==0){
+                    msg.alert("支持的梦想","该用户没有支持的梦想");
+                }
+                if($scope.items.sup_dreams.length!=0){
+                    $state.go("app.supportDream",{user_id:$scope.items.user.id});
+                }
             };
             $scope.collectionDream = function(is_collection){
                 homeService.collectionDream(id,is_collection).then(function(result){
@@ -336,8 +421,23 @@
         , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
             $scope.$on('$ionicView.beforeEnter', function () {
                 $ionicTabsDelegate.showBar(false);
+                $scope.showAccount();
             });
-
+            $scope.showAccount = function(){
+                myService.showAccount().then(function(result){
+                    $scope.items = result.data.data;
+                },function(error){
+                    msg.error(error.data.message);
+                })
+            };
+            $scope.destroyAccount = function(id){
+                myService.destroyAccount(id).then(function(result){
+                    msg.text("删除成功");
+                    $scope.showAccount();
+                },function(error){
+                    msg.error(error.data.message);
+                })
+            }
         }]);
     app.controller('my_account_addCtrl', ["$scope","common","$ionicTabsDelegate", "$state", "myService", "msg"
         , function ($scope,common,$ionicTabsDelegate, $state, myService, msg) {
@@ -354,6 +454,7 @@
                     console.log('图片选择失败');
                 });
             };
+            $scope.imgs=[];
             $scope.deletefile = function (file) {
                 var index = $scope.imgs.indexOf(file);
                 $scope.imgs.splice(index, 1);
@@ -361,28 +462,46 @@
                 })
             };
             $scope.vm={
-                name:'',
-                about:'',
-                coin:''
+                bank_name:'',
+                bank_number:'',
+                bank_phone:'',
+                bank_user:''
             };
-            $scope.add = function () {
+            $scope.addAccount = function () {
                 var data = {
-                    pics: $scope.imgs,
-                    video:$scope.video.server,
-                    name: $scope.vm.name,
-                    about: $scope.vm.about,
-                    days: 21, //默认21
-                    coin: $scope.vm.coin
+                    data:{
+                        bank_name:$scope.vm.bank_name,
+                        bank_number:$scope.vm.bank_number,
+                        bank_phone:$scope.vm.bank_phone,
+                        bank_user:$scope.vm.bank_user
+                    }
                 };
                 msg.loading('保存中...');
-                dreamService.addDream(data).then(function (result) {
+                myService.addAccount(data).then(function (result) {
                     msg.hide();
-                    $state.go('app.home');
+                    $state.go('app.my_account');
                 }, function (error) {
                     msg.hide();
                     msg.error(error.data.message);
                 });
             };
+            $scope.addQrcode = function(){
+                var data = {
+                    data:{
+                        bank_name:$scope.vm.bank_name,
+                        //bank_number:$scope.imgs
+                        bank_number:"https://www.baidu.com/img/bd_logo1.png"
+                    }
+                };
+                myService.addQrcode(data).then(function(result){
+                    msg.text("添加成功",true);
+                    $timeout(function () {
+                        $state.go("app.my_account");
+                    }, 1000);
+                },function(error){
+                    msg.error(error.data.message);
+                })
+            }
 
         }]);
     app.controller('messageCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"

+ 47 - 0
miaomiao/www/js/services/myservice.js

xqd
@@ -93,7 +93,54 @@
                     url:config.server + "api/user/show?user_id=" + id ,
                     method:"get"
                 })
+            },
+            addAccount:function(data){
+                return $http({
+                    url:config.server + "api/my/bank/create",
+                    method:"post",
+                    data:data
+                })
+            },
+            showAccount:function(){
+                return $http({
+                    url:config.server + "api/my/bank/list",
+                    method:"get"
+                })
+            },
+            destroyAccount:function(id){
+                return $http({
+                    url:config.server + "api/my/bank/delete?id=" + id ,
+                    method:"get"
+                })
+            },
+            withdraw:function(data){
+                return $http({
+                    url:config.server + "api/my/cash",
+                    method:"post",
+                    data:data
+                })
+            },
+            contact:function(data){
+                return $http({
+                    url:config.server + "api/my/suggest",
+                    method:"post",
+                    data:data
+                })
+            },
+            payExplain:function(){
+                return $http({
+                    url:config.server + "api/my/pay/article",
+                    method:"get"
+                })
+            },
+            addQrcode:function(data){
+                return $http({
+                    url:config.server + "api/my/bank/img",
+                    method:"post",
+                    data:data
+                })
             }
+
         };
     }]);
 })(angular.module('app.services'));

+ 8 - 11
miaomiao/www/templates/home/search.html

xqd xqd xqd
@@ -8,7 +8,7 @@
     <ion-nav-buttons side="right">
         <button class="button button-calm button-right" style="margin-top: 1px; font-size: 16px" ng-click="$ionicGoBack()">取消</button>
     </ion-nav-buttons>
-     <ion-content class="padding">
+     <ion-content>
          <div class="list" style="margin-bottom: 50px" ng-if="!isResult">
              <div class="item" style="padding:10px;font-size:1rem; margin-top: 20px; color: #373737">热门搜索</div>
              <div class="item calm search-hot">
@@ -28,18 +28,18 @@
                  <div class="item dream_item" style="color: #A7A7A7">
                      用户
                  </div>
-                 <div class="item sarch-item dream_item" ng-repeat="user_info in user_infos" ng-if="$index<3" ng-click="toUser(user_info.id)">
+                 <div class="item sarch-item dream_item" ng-repeat="user_info in user_infos" ng-if="$index<3" ng-click="toUserDetail(user_info.id)">
                      <img ng-src="{{user_info.avatar}}" />  
                      <span style="padding:5px;">{{user_info.nickname}}</span>
                  </div>
                  <div class="item" style="text-align:center;color:#00C3DA;font-size:1rem;padding:10px;" ng-click="showMore(vm.keyword,1)" ng-if="user_infos.length>=3">查看更多</div>
              </div>
-             <p style="background: #FAFAFA; height: 1rem"></p>
+             <p ng-if="user_infos.length!=0" style="background: #FAFAFA; height: 1rem"></p>
              <div class="list padding">
                  <div class="item dream_item" style="color: #A7A7A7">
                      梦想
                  </div>
-                 <div class="item item-thumbnail-left dream_item" ng-repeat="dreamsarch-item_info in dream_infos" ng-if="$index<3" ng-click="toDetail(dream_info.id)">
+                 <div class="item item-thumbnail-left dream_item" ng-repeat="dream_info in dream_infos" ng-if="$index<3" ng-click="toDetail(dream_info.id)">
                      <img ng-src="{{dream_info.img.pic}}" />
                      <h2>{{dream_info.name}}</h2>
                      <p style="white-space:normal">{{dream_info.about}}</p>
@@ -83,15 +83,12 @@
                  </div>
              </div>
              <div ng-if="index==1" class="list more-userlist">
-                 <div class="item sarch-item" ng-repeat="user_info in user_infos"  ng-click="toUser(user_info.id)">
+                 <div class="item sarch-item" ng-repeat="user_info in user_infos" ng-click="toUserDetail(user_info.id)">
                      <img ng-src="{{user_info.avatar}}" />
                      <span style="padding:5px;">{{user_info.nickname}}</span>
-                     <span class="level">Lv.3</span>
-                     <img ng-src="img/king.png" class="imgitem" />
-                     <img ng-src="img/king.png" class="imgitem" />
-                     <img ng-src="img/king.png" class="imgitem" />
-                     <img ng-src="img/king.png" class="imgitem" />
-                     <img ng-src="img/king.png" class="imgitem" />
+                     <span style="color:#B6B6B6; font-size: 0.9em">
+                         {{user_info.signture}}
+                     </span>
                  </div>
              </div>
              <div ng-if="index==2" class="list more-userlist">

+ 2 - 2
miaomiao/www/templates/my/aboutMiao.html

xqd
@@ -1,5 +1,5 @@
 <ion-view view-title="关于瞄喵">
-    <ion-content style="color: #F2F2F2;">
-        1.测试文本
+    <ion-content>
+       {{items.value}}
     </ion-content>
 </ion-view>

+ 3 - 3
miaomiao/www/templates/my/contact.html

xqd
@@ -3,19 +3,19 @@
         <div class="addcontent list">
             <div class="item" style="color: #7B7B7B">请输入您的问题</div>
             <div class="item itemjs">
-                <textarea rows="7" cols="50" ng-model="vm.about" style="border: 1px solid #D7D7D7;padding: 10px;width: 98%;"></textarea>
+                <textarea rows="7" cols="50" ng-model="vm.content" style="border: 1px solid #D7D7D7;padding: 10px;width: 98%;"></textarea>
             </div>
             <div class="item" style="color: #7B7B7B">您的收件邮箱</div>
             <div class="item item-input-inset itemjs">
                 <label class="item-input-wrapper" style="background: #fff; border: 1px solid #D7D7D7; margin: 0 12px 0 5px">
-                    <input type="text" ng-model="vm.name">
+                    <input type="text" ng-model="vm.email">
                 </label>
             </div>
         </div>
         <div class="padding">
             <div class="row">
                 <div class="col">
-                    <button type="submit"  class="button button-block button-calm" style="border-radius: 30px" ng-click="add()">
+                    <button type="submit"  class="button button-block button-calm" style="border-radius: 30px" ng-click="contact()">
                         提交
                     </button>
                 </div>

+ 4 - 4
miaomiao/www/templates/my/my-account-add.html

xqd xqd
@@ -30,13 +30,13 @@
                                     <option value="邮政储蓄" >邮政储蓄
                                     </option>
                                 </select>
-                                <input  type="text" ng-model="vm.bank_name" placeholder="银行名称/支付宝">
+                                <input  type="text" ng-model="vm.bank_name" placeholder="银行名称/支付宝" disabled style="background: #fff">
                             </div>
                             <div class="item item-input" style="border-bottom: 1px solid #DDDDDD">
-                                <input  type="text" ng-model="vm.bank_user"  placeholder="姓名">
+                                <input  type="text" ng-model="vm.bank_number"  placeholder="账号">
                             </div>
                             <div class="item item-input" style="border-bottom: 1px solid #DDDDDD">
-                                <input  type="text" ng-model="vm.bank_number"  placeholder="账号">
+                                <input  type="text" ng-model="vm.bank_user"  placeholder="姓名">
                             </div>
                             <div class="item item-input" style="border-bottom: 1px solid #DDDDDD">
                                 <input  type="number" ng-model="vm.bank_phone"  placeholder="手机号">
@@ -57,7 +57,7 @@
                                 <span class="input-label">
                                     选择类型
                                 </span>
-                                <select ng-model="vm.type">
+                                <select ng-model="vm.bank_name">
                                     <option value="1">微信二维码
                                     </option>
                                     <option value="2">支付宝二维码

+ 3 - 33
miaomiao/www/templates/my/my-account.html

xqd xqd
@@ -1,17 +1,13 @@
 <ion-view view-title="我的账号">
-   <!-- <ion-nav-buttons side="left">
-        <button class="button button-icon button-clear ion-navicon" menu-toggle="left"></button>
-    </ion-nav-buttons>-->
     <ion-nav-buttons side="right">
         <button class="button button-icon icon ion-ios-plus-outline light" ui-sref="app.my_account_add" style="box-shadow:none; padding-bottom: 20px"></button>
     </ion-nav-buttons>
-    <ion-content>
+    <ion-content overflow-scroll="true" style="overflow: auto">
         <!--下拉刷新-->
         <ion-refresher pulling-text="下拉刷新" on-refresh="load(true)">
         </ion-refresher>
-        <!--<div ng-repeat="item in items">
-            <div class="list card list-inset" style="margin: 15px">
-                <div class="item">
+            <div class="list" ng-repeat="item in items">
+                <div class="item" style="border-bottom: 1px solid #E6E6E6">
                     <div ng-if="!item.qrcode">
                         <p style="font-weight:bold">{{item.bank_name}}</p>
                         <p >账号:{{item.bank_number}}</p>
@@ -26,32 +22,6 @@
                     </button>
                 </div>
             </div>
-        </div>-->
-                <div>
-                    <div class="list">
-                        <div class="item" style="border-bottom: 1px solid #E6E6E6">
-                            <div style="float:left;">
-                                <p style="font-weight:bold">建行</p>
-                                <p >账号:sdgasgs</p>
-                                <p >手机:18328067000</p>
-                            </div>
-                            <div ng-click="destroyAccount(item.id)" style="float:right; background: #F2F2F2; margin-top: 20px; padding: 5px 10px">
-                                删除
-                            </div>
-                        </div>
-                        <div class="item" style="border-bottom: 1px solid #E6E6E6">
-                            <div style="float:left;">
-                                <p style="font-weight:bold">支付宝二维码</p>
-                                <img ng-src="{{ item.qrcode | qrcode}}" style="max-width: 70px; height: 70px; width: 70px"/>
-                            </div>
-                            <div ng-click="destroyAccount(item.id)" style="float:right; background: #F2F2F2; margin-top: 35px; padding: 5px 10px">
-                                删除
-                            </div>
-                        </div>
-                    </div>
-                </div>
-
-
         <!--上拉更多-->
         <ion-infinite-scroll ng-if="filter.hasMore" on-infinite="load(false)" distance="10%"></ion-infinite-scroll>
     </ion-content>

+ 2 - 2
miaomiao/www/templates/my/payExplain.html

xqd
@@ -1,5 +1,5 @@
 <ion-view view-title="支付说明">
-    <ion-content style="color: #F2F2F2;">
-        1.测试文本
+    <ion-content class="padding" style="color: red">
+        <div ng-bind-html="items.value | trustHtml"></div>
     </ion-content>
 </ion-view>

+ 4 - 14
miaomiao/www/templates/my/withdraw.html

xqd
@@ -1,30 +1,20 @@
 <ion-view view-title="选择提现方式" >
     <ion-content>
         <div class="list myprofile">
-            <label class="item item-input ">
-                <span class="input-label">提现金额</span>
-                <input name="signture" style="text-align: right" type="text" placeholder="请输入提现金额" ng-model="vm.nickname">
-            </label>
             <label class="item item-select item-select-width">
              <span class="input-label">
                  提现到
              </span>
-                <select name="pay" ng-model="vm.pay">
-                    <option value="0">支付宝</option>
-                    <option value="1">微信</option>
+                <select name="pay" ng-model="vm.pay" ng-options="pay.value for pay in pays track by pay.id" >
                 </select>
             </label>
             <label class="item item-input ">
-                <span class="input-label">账号</span>
-                <input name="signture" style="text-align: right" type="text" placeholder="请输入账号" ng-model="vm.signture">
-            </label>
-            <label class="item item-input ">
-                <span class="input-label">手机号</span>
-                <input name="work" style="text-align: right" type="text" placeholder="请输入手机号" ng-model="vm.phone">
+                <span class="input-label">提现金额</span>
+                <input name="signture" style="text-align: right" type="text" placeholder="请输入提现金额" ng-model="vm.cash">
             </label>
         </div>
         <div class="padding">
-            <button class="button button-block button-calm" ng-click="saveMaterial()">
+            <button class="button button-block button-calm" ng-click="withdraw()">
                 提交
             </button>
         </div>