baimeng 9 years ago
parent
commit
d6bf16ba44

+ 43 - 4
wl/platforms/android/assets/www/js/controllers/account.js

xqd xqd xqd xqd
@@ -18,7 +18,6 @@
                     $state.go('wl.goods');
                 }
             }, function (erro) {
-                debugger;
                 msg.hide();
                 // msg.error(erro.data.message);
                 msg.error(erro.data.message);
@@ -65,7 +64,7 @@
             }
             if ($scope.vm.password !== $scope.vm.password1) {
                 msg.text('密码前后输入不一致');
-                return;
+                return;  
             }
             msg.loading('请稍等...');
             userService.register({
@@ -95,7 +94,7 @@
             }
             $scope.vm.waitSeconds = "正在发送";
             userService.getVerifyCode($scope.vm.mobile).then(function (result) {
-                wait(30);
+                wait(60);
             }, function (erro) {
                 wait(0);
                 msg.error(erro);
@@ -115,7 +114,47 @@
             }, 1000);
         };
     }]);
-    app.controller('forgetPasswordCtrl', ["$scope", function ($scope) {
+    app.controller('forgetPasswordCtrl', ["$scope", "util", 'userService', '$timeout', function ($scope, util, userService, $timeout) {
+        $scope.vm = {
+            mobile: '',
+            code: '',
+            password: '',
+            password1:'',
+            waitSeconds: "获取验证码"
+        };
+        $scope.getVerifyCode = function () {
+            
+            if (!util.isMobile($scope.vm.mobile)) {
+                msg.text('请输入正确的手机号', true);
+                return;
+            }
+            $scope.vm.waitSeconds = "正在发送";
+            userService.getVerifyCode($scope.vm.mobile).then(function (result) {
+                wait(60);
+            }, function (erro) {
+                wait(0);
+                msg.error(erro);
+            });
+        }
+        $scope.reset = function () {
+            if ($scope.vm.password != $scope.vm.password1) {
+                msg.text('密码前后输入不一致');
+                return;
+            }
 
+        }
+        var wait = function (seconds) {
+            if (seconds > 0) {
+                $scope.vm.waitSeconds = "" + seconds + "秒";
+                $scope.vm.enableSend = false;
+            } else {
+                $scope.vm.waitSeconds = "获取验证码";
+                $scope.vm.enableSend = true;
+            }
+            $timeout(function () {
+                if (seconds >= 1)
+                    wait(seconds - 1);
+            }, 1000);
+        };
     }]);
 })(angular.module('app.controllers'));

+ 12 - 1
wl/platforms/android/assets/www/js/controllers/my.js

xqd xqd
@@ -245,6 +245,7 @@
             page: 0,
             pageSize: 10,
         }
+        $scope.shouldShowDelete = false;
         $scope.items = [];
         $scope.load = function (init) {
             if (init) {
@@ -266,10 +267,20 @@
                 msg.error(erro.data.message);
             });
         }
-        
+        $scope.close = function () {
+            $scope.shouldShowDelete = true;
+        }
         $scope.detail = function (item) {
             $state.go('wl.my_message_detail', { item: item });
         }
+        $scope.closeItem = function (item, $index) {
+            $scope.items.splice($index, 1);
+            item.state = 10;
+            myService.updateMessage(item).then(function () {
+            }, function (erro) {
+                msg.error(erro.data.message);
+            });
+        }
         $scope.load(true);
     }]);
     app.controller('myMessageDetailCtrl', ['$scope', '$stateParams', function ($scope, $stateParams) {

+ 43 - 4
wl/www/js/controllers/account.js

xqd xqd xqd xqd
@@ -18,7 +18,6 @@
                     $state.go('wl.goods');
                 }
             }, function (erro) {
-                debugger;
                 msg.hide();
                 // msg.error(erro.data.message);
                 msg.error(erro.data.message);
@@ -65,7 +64,7 @@
             }
             if ($scope.vm.password !== $scope.vm.password1) {
                 msg.text('密码前后输入不一致');
-                return;
+                return;  
             }
             msg.loading('请稍等...');
             userService.register({
@@ -95,7 +94,7 @@
             }
             $scope.vm.waitSeconds = "正在发送";
             userService.getVerifyCode($scope.vm.mobile).then(function (result) {
-                wait(30);
+                wait(60);
             }, function (erro) {
                 wait(0);
                 msg.error(erro);
@@ -115,7 +114,47 @@
             }, 1000);
         };
     }]);
-    app.controller('forgetPasswordCtrl', ["$scope", function ($scope) {
+    app.controller('forgetPasswordCtrl', ["$scope", "util", 'userService', '$timeout', function ($scope, util, userService, $timeout) {
+        $scope.vm = {
+            mobile: '',
+            code: '',
+            password: '',
+            password1:'',
+            waitSeconds: "获取验证码"
+        };
+        $scope.getVerifyCode = function () {
+            
+            if (!util.isMobile($scope.vm.mobile)) {
+                msg.text('请输入正确的手机号', true);
+                return;
+            }
+            $scope.vm.waitSeconds = "正在发送";
+            userService.getVerifyCode($scope.vm.mobile).then(function (result) {
+                wait(60);
+            }, function (erro) {
+                wait(0);
+                msg.error(erro);
+            });
+        }
+        $scope.reset = function () {
+            if ($scope.vm.password != $scope.vm.password1) {
+                msg.text('密码前后输入不一致');
+                return;
+            }
 
+        }
+        var wait = function (seconds) {
+            if (seconds > 0) {
+                $scope.vm.waitSeconds = "" + seconds + "秒";
+                $scope.vm.enableSend = false;
+            } else {
+                $scope.vm.waitSeconds = "获取验证码";
+                $scope.vm.enableSend = true;
+            }
+            $timeout(function () {
+                if (seconds >= 1)
+                    wait(seconds - 1);
+            }, 1000);
+        };
     }]);
 })(angular.module('app.controllers'));

+ 12 - 1
wl/www/js/controllers/my.js

xqd xqd
@@ -245,6 +245,7 @@
             page: 0,
             pageSize: 10,
         }
+        $scope.shouldShowDelete = false;
         $scope.items = [];
         $scope.load = function (init) {
             if (init) {
@@ -266,10 +267,20 @@
                 msg.error(erro.data.message);
             });
         }
-        
+        $scope.close = function () {
+            $scope.shouldShowDelete = true;
+        }
         $scope.detail = function (item) {
             $state.go('wl.my_message_detail', { item: item });
         }
+        $scope.closeItem = function (item, $index) {
+            $scope.items.splice($index, 1);
+            item.state = 10;
+            myService.updateMessage(item).then(function () {
+            }, function (erro) {
+                msg.error(erro.data.message);
+            });
+        }
         $scope.load(true);
     }]);
     app.controller('myMessageDetailCtrl', ['$scope', '$stateParams', function ($scope, $stateParams) {

+ 7 - 0
wl/www/js/services/myservice.js

xqd
@@ -35,6 +35,13 @@
                     method: "get"
                 })
             },
+            updateMessage:function (model) {
+                return $http({
+                    url: config.server + 'api/messages/'+model.id,
+                    method: "post",
+                    data: model
+                })
+            },
             listOrders: function (filter) {
                 return $http({
                     url: config.server + 'api/user/orders?include=message,user&page=' + filter.page,

+ 4 - 4
wl/www/js/services/userservice.js

xqd
@@ -9,10 +9,10 @@
                 })
             },
             getVerifyCode: function (mobile) {
-                return new Promise(function (resolve, reject) {
-                    resolve('123456');
-                   // reject('654878');
-                 });
+                return $http({
+                    url: config.server + 'api/auth/code?phone=' + mobile,
+                    method: "get" 
+                })
             },
             update:function (model) {
                 return $http({

+ 8 - 8
wl/www/templates/account/forgetPassword.html

xqd
@@ -1,23 +1,23 @@
 <ion-view view-title="找回密码">
     <ion-content>
         <div class="list">
+            <div class="item item-input">
+                <input type="text" ng-model="vm.mobile" placeholder="注册手机">
+                <button ng-click="getVerifyCode()" class="button button-assertive" style="margin-right:5px">{{vm.waitSeconds}}</button>
+            </div>
             <label class="item item-input">
-                <input type="text" placeholder="注册手机">
-                <button type="submit" class="button button-assertive" style="margin-right:5px">获取验证码</button>
+                <input type="text"  ng-model="vm.code" placeholder="手机验证码">
             </label>
             <label class="item item-input">
-                <input type="text" placeholder="手机验证码">
+                <input type="text"  ng-model="vm.password" placeholder="输入新密码">
             </label>
             <label class="item item-input">
-                <input type="text" placeholder="输入新密码">
-            </label>
-            <label class="item item-input">
-                <input type="text" placeholder="再次输入密码">
+                <input type="text"  ng-model="vm.password1" placeholder="再次输入密码">
             </label>
 
         </div>
         <div class="padding">
-            <button class="button button-block button-positive">重置密码</button>
+            <button ng-click="reset()" class="button button-block button-positive">重置密码</button>
         </div>
     </ion-content>
 </ion-view>

+ 25 - 10
wl/www/templates/my/message.html

xqd
@@ -1,27 +1,42 @@
 <ion-view view-title="我的发布">
+    <ion-nav-bar class="bar-positive nav-bar-container" nav-bar-transition="ios" nav-bar-direction="exit" nav-swipe="">
+        <ion-nav-back-button>
+        </ion-nav-back-button>
+        <ion-nav-buttons side="right">
+            <button class="button  button-clear icon-left ion-ios-trash-outline" ng-click="close()">关闭
+            </button>
+        </ion-nav-buttons>
+    </ion-nav-bar>
     <ion-content>
         <!--下拉刷新-->
         <ion-refresher pulling-text="下拉刷新" on-refresh="load(true)">
         </ion-refresher>
-        <div class="list" >
-            <div ng-repeat="item in items">
-                <a class="item" ng-if="item.type==1" ng-click="detail(item)">
+        <ion-list  show-delete="shouldShowDelete">
+            <div   ng-repeat="item in items">
+                <ion-item class="item" ng-if="item.type==1" ng-click="detail(item)">
                     <h2>【{{item.begin_address | shortAddress}}】-【{{item.end_address | shortAddress}}】</h2>
                     <p>
                         <span style="float:left"><b style="color:orangered">¥{{item.price}}</b><em style="padding-left:3px;font-size:0.75em">起</em></span>
                         <span style="float:right">途经:{{item.midway_address | shortAddress}}</span>
                     </p>
                     <p><span style="float:left">联系人:{{item.contact_name}}</span> <span style="float:right">电话:{{item.contact_phone}}</span></p>
-                </a>
-                <a class="item item-thumbnail-left" ng-if="item.type==2" ng-click="detail(item)">
+                    <ion-delete-button class="ion-minus-circled"
+                                       ng-click="closeItem(item,$index)">
+                    </ion-delete-button>
+                </ion-item>
+                <ion-item class="item item-thumbnail-left" ng-if="item.type==2" ng-click="detail(item)">
                     <img ng-src="{{item.truck.data.photo | truckPhoto}}" />
                     <h2 style="white-space:normal">【{{item.begin_address | shortAddress}}】-【{{item.end_address | shortAddress}}】<span style="color:gray;">({{item.title}})</span></h2>
                     <p><span style="float:left"><b style="color:orangered">¥{{item.price}}</b><em style="padding-left:3px;font-size:0.75em">起</em></span></p>
                     <p><span style="float:left">联系人:{{item.contact_name}}</span> <span style="float:right">电话:{{item.contact_phone}}</span></p>
-                </a>
+                    <ion-delete-button class="ion-minus-circled"
+                                       ng-click="closeItem(item,$index)">
+                    </ion-delete-button>
+                </ion-item>
+              
             </div>
-        </div>
-        <!--上拉更多-->
-        <ion-infinite-scroll ng-if="filter.hasMore" on-infinite="load(false)" distance="10%"></ion-infinite-scroll>
-    </ion-content>
+            </ion-list>
+    <!--上拉更多-->
+    <ion-infinite-scroll ng-if="filter.hasMore" on-infinite="load(false)" distance="10%"></ion-infinite-scroll>
+</ion-content>
 </ion-view>