baimeng 9 yıl önce
ebeveyn
işleme
4fbc9c502a

+ 1 - 1
wl/config.xml

xqd
@@ -61,5 +61,5 @@
   <plugin name="cordova-plugin-camera" version="2.2.0" />
   <plugin name="cordova-plugin-compat" version="1.0.0" />
   <plugin name="cordova-plugin-alipay" version="1.0.0" />
-  
+  <plugin name="cordova-plugin-appversion" version="1.0.0" />
 </widget>

+ 2 - 2
wl/www/css/style.css

xqd
@@ -29,10 +29,10 @@
 .list-set-arrow .item-arrow-no, .item-arrow-no { background-image: none; padding-right: 15px; }
 
 .item-arrow-no .badge { right: 15px; }
-.list-user-set .item.item-icon-left { padding: 12px 16px 12px 54px; border-color: #EEE; }
+.list-user-set .item.item-icon-left { padding: 22px 16px 22px 54px; border-color: #EEE; }
 .list-user-set .item.item-icon-left i img { margin-top: 6px; }
 .list-user-set.list-set-arrow .item, .list-user-set .item.item-set-arrow { padding-right: 30px; }
-.i-user-phone, .i-user-info, .i-user-message, .i-user-order, .i-user-passsword, .i-user-set,.i-user-car { background: no-repeat center/32px auto; width: 32px; height:32px; position: absolute; left: 11px; top: 6px; vertical-align: middle; }
+.i-user-phone, .i-user-info, .i-user-message, .i-user-order, .i-user-passsword, .i-user-set,.i-user-car { background: no-repeat center/32px auto; width: 32px; height:32px; position: absolute; left: 11px; top: 15px; vertical-align: middle; }
 .item-icon-left i img { width: 32px; height: 32px; margin-top: 10px; }
 
 .i-user-info { background-image: url(../img/icon/i_user_info.png) }

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

xqd xqd xqd xqd
@@ -1,5 +1,11 @@
 (function (app) {
-    app.controller('myCtrl', ["$scope","$state", function ($scope,$state) {
+    app.controller('myCtrl', ["$scope", "$state", 'userService', 'msg', function ($scope, $state, userService,msg) {
+        $scope.user = {};
+        userService.getUser().then(function (result) {
+            $scope.user = result.data.data;
+        }, function (erro) {
+            msg.error(erro.data.message);
+        });
         $scope.toProfile = function () {
             $state.go('wl.my_profile');
         }
@@ -40,6 +46,10 @@
             $scope.modal1.remove();
             $scope.modal2.remove();
         });
+        $scope.appversion = '1.0.0';
+        if (!!window.AppVersion) {
+            $scope.appversion = AppVersion.version;
+        }
     }]);
     app.controller('mySetPasswordCtrl', ['$scope', '$state', function ($scope,$state) {
         $scope.vm = {
@@ -180,6 +190,22 @@
         $scope.detail = function (item) {
             $state.go('wl.my_truck_add', {item:item});
         }
+        $scope.delete = function (item, $event) {
+            $event.stopPropagation();
+            msg.confirm('删除提示', '确定删除?').then(function (res) {
+                if (res) {
+                    msg.loading('删除中...');
+                    myService.deleteTruck(item.id).then(function (result) {
+                        msg.hide();
+                    }, function (erro) {
+                        msg.hide();
+                        msg.error(erro.data.message);
+                    })
+                } else {
+
+                }
+            });
+        }
         $scope.load(true);
     }]);
     app.controller('myTruckAddCtrl', ['$scope', 'myService', 'msg', '$state', '$stateParams', function ($scope, myService, msg, $state, $stateParams) {
@@ -218,6 +244,10 @@
                 msg.error(erro.data.message);
             });
         }
+        //上传图片
+        $scope.setPhoto = function () {
+
+        }
      
     }]);
     app.controller('myTruckDetailCtrl', ['$scope', function ($scope) {

+ 8 - 1
wl/www/js/filters/filter.js

xqd
@@ -31,7 +31,14 @@
             return input;
         };
     });
-
+    module.filter('truckPhoto', function () {
+        return function (input) {
+            if (!input || input.length === 0) {
+                return "img/demo/defaultcar.png";
+            }
+            return input;
+        };
+    });
     module.filter('shortAddress', function () {
         return function (input) {
             if (!input) return input;

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

xqd xqd
@@ -4,7 +4,7 @@
             //我的车辆信息
             listTrucks: function (model) {
                 return $http({
-                    url: config.server + 'api/user/trucks',
+                    url: config.server + 'api/user/trucks?page='+model.page,
                     method: "get"
                 })
             },
@@ -16,6 +16,12 @@
                     data: model
                 })
             },
+            deleteTruck:function (id) {
+                return $http({
+                    url: config.server + 'api/trucks/' + id,
+                    method: "delete"
+                })
+            },
             listMessages: function () {
                 return $http({
                     url: config.server + 'api/user/messages',

+ 6 - 0
wl/www/js/services/userservice.js

xqd
@@ -27,6 +27,12 @@
                 //    // reject('654878');
                 //});
             },
+            getUser:function () {
+                return $http({
+                    url: config.server + 'api/user',
+                    method: "get"
+                })
+            },
             isLogin: function () {
                 return !util.empty(data.get("token")) && data.getObject("user");
             },

+ 6 - 6
wl/www/templates/my/index.html

xqd
@@ -2,17 +2,17 @@
     <ion-content class="app-content app-user-content">
         <div class="user-box">
             <a  class="user-photo">
-              <img ng-src="img/photo_default_turquoise.jpg"  />
+              <img ng-src="{{user.avatar | avator}}"  />
             </a>
             
             <div class="user-info" ng-click="toProfile()">
-                <a >  <p><span>酉水东流</span></p>  </a>
+                <a >  <p><span>{{user.phone}}</span></p>  </a>
             </div>
             <div class="msg-user">
-                <a class="msg-item"><b>¥20,000</b><span>我的余额</span></a>
-                <a class="msg-item"><b>3辆</b><span>我的车辆</span></a>
-                <a class="msg-item"><b>10条</b><span>我的发布</span></a>
-                <a class="msg-item"><b>5笔</b><span>我的订单</span></a>
+                <a class="msg-item"><b style="color:red">¥{{user.money_balance}}</b><span>我的余额</span></a>
+                <a class="msg-item"><b>{{user.trucks_count}}辆</b><span>我的车辆</span></a>
+                <a class="msg-item"><b>{{user.messages_count}}条</b><span>我的发布</span></a>
+                <a class="msg-item"><b>{{user.orders_count}}笔</b><span>我的订单</span></a>
             </div>
         </div>
         <div class="list list-user-set list-set-arrow">

+ 2 - 2
wl/www/templates/my/setting.html

xqd xqd
@@ -7,7 +7,7 @@
             
             <div class="user-info">
                 <div><span style="color: #444;">掌上物流网</span></div>
-                <div><span style="color: #444;">版本V1.0.0</span></div>
+                <div><span style="color: #444;">版本V{{appversion}}</span></div>
             </div>
         </div>
         <div class="list">
@@ -17,7 +17,7 @@
             </label>
             <label class="item item-input " ng-click="openModal1()">
                 <span class="input-label">法律条文
-                </span></a>
+                </span> 
             </label>
         </div>
          <div class="padding">

+ 5 - 0
wl/www/templates/my/truck-add.html

xqd
@@ -4,6 +4,11 @@
             <div class="item item-divider">
                 您的车辆
             </div>
+            <a class="item item-avatar-right item-arrow-no" ng-click="setPhoto()">
+                <img ng-src="{{vm.photo | truckPhoto}}" />
+                <h2>上传照片</h2>
+                <p>图片</p>
+            </a>
             <a class="item item-input">
                 <span class="input-label">名称<span class="mustfill">*</span></span>
                 <input style="text-align:right" ng-model="vm.name" type="text" placeholder="名称">

+ 10 - 3
wl/www/templates/my/truck.html

xqd
@@ -11,9 +11,16 @@
         <ion-refresher pulling-text="下拉刷新" on-refresh="load(true)">
         </ion-refresher>
         <div class="list">
-            <a class="item"  ng-repeat="item in items" ng-click="detail(item)">
-             名称:{{item.name}},车牌:{{item.truck_no}}
-            </a>
+            <div class="item item-thumbnail-left" ng-repeat="item in items" ng-click="detail(item)">
+                <img ng-src="{{item.photo | truckPhoto}}">
+                <p>车牌号:{{item.truck_no}}</p>
+                <p>类型:{{item.type}}</p>
+                <p>车长:{{item.length}}(米)</p>
+                <p>载重:{{item.load_weight}}(吨)</p>
+                <button class="button button-stable" ng-click="delete(item,$event)" style="float:right;margin-top:-70px">
+                    删除
+                </button>
+            </div>
          </div>
         <!--上拉更多-->
         <ion-infinite-scroll ng-if="filter.hasMore" on-infinite="load(false)" distance="10%"></ion-infinite-scroll>