Browse Source

todo 轨迹

wzh 3 years ago
parent
commit
dd57a9df08

+ 1 - 1
miniprogram/apis/apiConfig.js

@@ -1,5 +1,5 @@
 let v = wx.getAccountInfoSync()
-let apiUrl = `${v.miniProgram.envVersion == 'release'?'https://interface.huihenduo.com.cn/hhd-pat-cargo-app/':'https://interface.huihenduo.com.cn/hhd-pat-cargo-app-dev/'}`
+let apiUrl = `${v.miniProgram.envVersion == 'release'?'https://interface.huihenduo.com.cn/hhd-pat-cargo-app-dev/':'https://interface.huihenduo.com.cn/hhd-pat-cargo-app-dev/'}`
 
 function api(url, data, method) {
   return new Promise((resolve, reject) => {

+ 62 - 5
miniprogram/components/voyages/voyages.js

@@ -13,11 +13,51 @@ Component({
     term: '',
     status: 1,
     currentPage: 1,
-    size: 10,
-    list: []
+    size: 20,
+    list: [],
+    total: 0,
+    bottomText: '点击或滑动加载更多...'
   },
   methods: {
     async getVoyageList() {
+      let cargoOwnerId = wx.getStorageSync('cargoOwnerId')
+      if (!cargoOwnerId) {
+        this.setData({
+          list: [{
+            shipName: '体验船舶#1',
+            loadPort: '南京',
+            dischargeProt: "小池",
+            cargo: '石油焦',
+            tons: '10000',
+          }, {
+            shipName: '体验船舶#2',
+            loadPort: '小池',
+            dischargeProt: "武汉",
+            cargo: '豆粕',
+            tons: '15000',
+          }, {
+            shipName: '体验船舶#3',
+            loadPort: '北仑港',
+            dischargeProt: "小池",
+            cargo: '煤炭',
+            tons: '25000',
+          }, {
+            shipName: '体验船舶#4',
+            loadPort: '张家港',
+            dischargeProt: "汉口",
+            cargo: '玉米',
+            tons: '15000',
+          }, {
+            shipName: '体验船舶#5',
+            loadPort: '武汉',
+            dischargeProt: "小池",
+            cargo: '大豆',
+            tons: '3000',
+          }],
+          total: 1
+        })
+        return
+      }
       let res = await postApi('/voyage/list', {
         cargoOwnerId: wx.getStorageSync('cargoOwnerId'),
         term: this.data.term,
@@ -27,11 +67,13 @@ Component({
       })
       if (res.data.status == 0) {
         this.setData({
-          list: res.data.result
+          list: res.data.result,
+          total: res.data.total
         })
       } else {
         this.setData({
-          list: []
+          list: [],
+          total: 0,
         })
       }
     },
@@ -42,17 +84,32 @@ Component({
       this.setData({
         status,
         currentPage: 1,
-        size: 10
+        size: 20,
+        total: 0
       })
       this.getVoyageList()
     },
     goToDetail(e) {
+      let cargoOwnerId = wx.getStorageSync('cargoOwnerId')
+
+      if (!cargoOwnerId) {
+        wx.showToast({
+          icon: "none",
+          title: '为了保证数据安全,请注册或登录',
+        })
+        return
+      }
       let {
         id
       } = e.currentTarget.dataset
       wx.navigateTo({
         url: `/pages/voyages/detail/detail?id=${id}`,
       })
+    },
+    scrollList() {
+      if (this.data.total == 0 || this.data.total < this.data.size * this.data.currentPage) return
+      this.data.currentPage += 1
+      this.getVoyageList()
     }
   }
 })

+ 2 - 1
miniprogram/components/voyages/voyages.wxml

@@ -1,4 +1,4 @@
-<input model:value="{{term}}" class="p10 m30a search" type="text" placeholder="搜索船舶信息" />
+<input disabled="{{true}}" model:value="{{term}}" class="p10 m30a search" type="text" placeholder="搜索船舶信息" />
 <view class="df aic jcsa tabs">
   <view class="tabsview" bindtap="changeStatus" data-status="{{1}}" style="color:{{status==1?'#0d8fcc':''}};border-bottom:{{status==1?'4rpx solid #0d8fcc':''}}">运输中</view>
   <view class="tabsview" bindtap="changeStatus" data-status="{{2}}" style="color:{{status==2?'#0d8fcc':''}};border-bottom:{{status==2?'4rpx solid #0d8fcc':''}}">卸货中</view>
@@ -10,4 +10,5 @@
     <view class="col-3">{{item.cargo}}</view>
     <view class="col-4">{{item.tons}}</view>
   </view>
+  <view bindtap="scrollList" class="bottom-text">{{total==0?'暂无数据':(total>size*currentPage?bottomText:'已加载完毕')}}</view>
 </scroll-view>

+ 12 - 3
miniprogram/components/voyages/voyages.wxss

@@ -39,8 +39,9 @@
 }
 
 .tabsview {
-  width: 100rpx;
+  width: 160rpx;
   height: 60rpx;
+  text-align: center;
 }
 
 .p10 {
@@ -52,7 +53,7 @@
 }
 
 .list {
-  padding: 20rpx;
+  padding: 30rpx;
   font-size: 28rpx;
 }
 
@@ -66,9 +67,17 @@
 
 
 .col-3 {
-  width: 10vw;
+  width: 15vw;
 }
 
 .col-4 {
   width: 10vw;
+}
+
+.bottom-text {
+  text-align: center;
+  padding-top: 30rpx;
+  padding-bottom: 50rpx;
+  font-size: 26rpx;
+  color: #777;
 }

+ 5 - 8
miniprogram/pages/index/index.js

@@ -12,7 +12,6 @@ Page({
     let res = await postApi('/voyage/index', {
       cargoOwnerId: wx.getStorageSync('cargoOwnerId')
     })
-    console.log(res)
     this.setData({
       indexInfo: res.data.result
     })
@@ -20,17 +19,15 @@ Page({
   forbidTouchMove() {
 
   },
-  onLoad() {
+  onShow() {
     let cargoOwnerId = wx.getStorageSync('cargoOwnerId')
     if (cargoOwnerId) {
       this.getIndexInfo()
-      const child = this.selectComponent('.voyages');
-      child.getVoyageList()
-    } else {
-      wx.redirectTo({
-        url: '/pages/login/login',
+      this.setData({
+        cargoOwnerId
       })
     }
-
+    const child = this.selectComponent('.voyages');
+    child.getVoyageList()
   }
 })

+ 4 - 4
miniprogram/pages/index/index.wxml

@@ -3,21 +3,21 @@
     <view class="block-line df aic">
       <view>
         <view>运输中船舶数量</view>
-        <view>{{indexInfo.transShipCount}}</view>
+        <view>{{cargoOwnerId?indexInfo.transShipCount:'*****'}}</view>
       </view>
       <view>
         <view>卸货中船舶数量</view>
-        <view>{{indexInfo.dischargeShipCount}}</view>
+        <view>{{cargoOwnerId?indexInfo.dischargeShipCount:'*****'}}</view>
       </view>
     </view>
     <view class="block-line df aic">
       <view>
         <view>在卸吨位</view>
-        <view>{{indexInfo.dischargeTons}}/{{indexInfo.totalDischargeTons}}</view>
+        <view>{{cargoOwnerId?indexInfo.dischargeTons:'*****'}}/{{cargoOwnerId?indexInfo.totalDischargeTons:'*****'}}</view>
       </view>
       <view>
         <view>已完成卸货吨位</view>
-        <view>{{indexInfo.finshDischargeTons}}</view>
+        <view>{{cargoOwnerId?indexInfo.finshDischargeTons:'*****'}}</view>
       </view>
     </view>
   </view>

+ 3 - 0
miniprogram/pages/login/login.js

@@ -27,5 +27,8 @@ Page({
     wx.switchTab({
       url: '/pages/index/index',
     })
+  },
+  onShow() {
+    wx.hideHomeButton()
   }
 })

+ 6 - 4
miniprogram/pages/login/login.wxml

@@ -1,5 +1,7 @@
-<view style="margin-top: 12vh;font-size: 50rpx;color: #333;text-align: center;">汇很多运输管家先行版
+<image style="margin:0 auto;display:block;width: 400rpx;margin-top: 10vh;height: 140rpx;" mode="aspectFit" src="https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/%E6%B1%87%E5%BE%88%E5%A4%9Alogo-%E5%B7%A6%E5%8F%B3.png?sign=fcd18f89de727b0193395cd2d44a730a&t=1647417257"></image>
+<view style="margin-top: 100rpx;font-size: 50rpx;color: #333;text-align: center;">汇很多运输管家先行版
 </view>
-<!-- <PhoneButton type="primary">登录/注册</PhoneButton>
-<button bindtap="goExp">去体验</button> -->
-<view style="position: absolute;bottom: 20vh;width: 100%;"><button type="primary" bindtap="testLogin">测试登录</button></view>
+<view class="df jcc" style="position:absolute;bottom: 15vh;width: 100%;">
+  <PhoneButton type="primary">登录/注册</PhoneButton>
+</view>
+<!-- <button bindtap="goExp">去体验</button> -->

+ 12 - 10
miniprogram/pages/me/me.js

@@ -6,24 +6,26 @@ import {
 import cloudApi from "../../apis/cloudApi"
 Page({
   data: {
-    cargoOwnerCompany:'',
-    loginName:'',
-    loginPhone:'',
-    logoSrc:'',
+    cargoOwnerCompany: '',
+    loginName: '',
+    loginPhone: '',
+    logoSrc: '',
   },
   async getCargoOwnerInfo() {
-   
+
   },
-  onLoad() {
+  onShow() {
     let cargoOwnerCompany = wx.getStorageSync('cargoOwnerCompany')
     let loginName = wx.getStorageSync('loginName')
     let loginPhone = wx.getStorageSync('loginPhone')
-    let logoSrc = wx.getStorageSync('logoSrc')
+    let logo = wx.getStorageSync('logo')
+    let cargoOwnerId = wx.getStorageSync('cargoOwnerId')
     this.setData({
       cargoOwnerCompany,
-loginName,
-loginPhone,
-logoSrc
+      loginName,
+      loginPhone,
+      logo,
+      cargoOwnerId
     })
   }
 })

+ 3 - 1
miniprogram/pages/me/me.json

@@ -1,3 +1,5 @@
 {
-  "usingComponents": {}
+  "usingComponents": {
+    "PhoneButton": "/components/getPhoneButton/getPhoneButton"
+  }
 }

+ 26 - 15
miniprogram/pages/me/me.wxml

@@ -1,17 +1,28 @@
-<view class="mt50 mb50 tac">
-  {{cargoOwnerCompany}} - logo
-</view>
-<view class="mb50 tac">
-  {{cargoOwnerCompany}}
-</view>
-<view class="mb50 tac">
-  {{loginName}}
-</view>
+<block wx:if="{{cargoOwnerId}}">
+  <view class=" mtv10 mbv10 tac">
+    <image style="width: 20vw;height: 20vh;" mode="aspectFit" src="{{logo}}"></image>
+  </view>
+  <view class=" mtv10  tac">
+    {{cargoOwnerCompany}}
+  </view>
+  <view class=" mtv10  tac">
+    {{loginName}}
+  </view>
 
-<view class="mb50 tac">
-  {{loginPhone}}
-</view>
+  <view class=" mtv10 tac">
+    {{loginPhone}}
+  </view>
 
-<view class="mb50 tac">
-  欢迎使用 汇很多科技 小程序
-</view>
+  <view class=" mtv10  tac">
+    欢迎使用 汇很多科技 小程序
+  </view>
+</block>
+<block wx:else>
+  <image style="margin:0 auto;display:block;width: 400rpx;margin-top: 10vh;height: 140rpx;" mode="aspectFit" src="https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/%E6%B1%87%E5%BE%88%E5%A4%9Alogo-%E5%B7%A6%E5%8F%B3.png?sign=fcd18f89de727b0193395cd2d44a730a&t=1647417257"></image>
+  <view style="margin-top: 100rpx;font-size: 50rpx;color: #333;text-align: center;">汇很多运输管家先行版
+  </view>
+  <view class="df jcc" style="position:absolute;bottom: 15vh;width: 100%;">
+    <PhoneButton type="primary">登录/注册</PhoneButton>
+  </view>
+  <!-- <button bindtap="goExp">去体验</button> -->
+</block>

+ 8 - 0
miniprogram/pages/me/me.wxss

@@ -1,4 +1,12 @@
 /* pages/me/me.wxss */
 page {
   background: #fff;
+}
+
+.mtv10 {
+  margin-top: 10vh;
+}
+
+.mbv10 {
+  margin-bottom: 10vh;
 }