فهرست منبع

更新 文案;数据获取逻辑

wangzhihui 3 سال پیش
والد
کامیت
7a59e92221
2فایلهای تغییر یافته به همراه34 افزوده شده و 10 حذف شده
  1. 27 10
      miniprogram/pages/shipOwnerManage/shipOwnerList/shipOwnerList.js
  2. 7 0
      miniprogram/pages/voyageManage/voyageManage.js

+ 27 - 10
miniprogram/pages/shipOwnerManage/shipOwnerList/shipOwnerList.js

@@ -12,16 +12,29 @@ Page({
     currentLetter: ''
   },
   async getShipOwnerList(type) {
+    if (!wx.getStorageSync('loginAccountId')) {
+      wx.showToast({
+        title: '尚未登录',
+        icon: "error"
+      })
+      return
+    }
     let res = await postApi('/ship/list', {
       loginAccountId: wx.getStorageSync('loginAccountId'),
       term: this.data.term
     })
     if (type) wx.stopPullDownRefresh()
-    let shipOwnerList = res.data.result
-    shipOwnerList.push(shipOwnerList.shift())
-    this.setData({
-      shipOwnerList
-    })
+    if (res.data.status == 0) {
+      let shipOwnerList = res.data.result
+      shipOwnerList.push(shipOwnerList.shift())
+      this.setData({
+        shipOwnerList
+      })
+    } else {
+      this.setData({
+        shipOwnerList: []
+      })
+    }
   },
   call(e) {
     wx.makePhoneCall({
@@ -29,6 +42,13 @@ Page({
     })
   },
   addShipOwner() {
+    if (!wx.getStorageSync('loginAccountId')) {
+      wx.showToast({
+        title: '尚未登录',
+        icon: "error"
+      })
+      return
+    }
     wx.navigateTo({
       url: '../addShipOnwer/addShipOnwer',
     })
@@ -39,7 +59,7 @@ Page({
     })
   },
   onLoad() {
-    this.getShipOwnerList()
+
   },
   onPullDownRefresh() {
     this.setData({
@@ -48,9 +68,6 @@ Page({
     this.getShipOwnerList(1)
   },
   onShow() {
-    if (wx.getStorageSync('apiStatus') == "success") {
-      this.getShipOwnerList()
-      wx.removeStorageSync('apiStatus')
-    }
+    this.getShipOwnerList()
   }
 })

+ 7 - 0
miniprogram/pages/voyageManage/voyageManage.js

@@ -47,6 +47,13 @@ Page({
     this.getList()
   },
   async getList(isScroll) {
+    if (!wx.getStorageSync('loginAccountId')) {
+      wx.showToast({
+        title: '尚未登录',
+        icon: "error"
+      })
+      return
+    }
     this.setData({
       isFreshing: true
     })