Преглед изворни кода

更新 首页路由;分享功能

wzh пре 3 година
родитељ
комит
2e01cd5a29

+ 3 - 1
miniprogram/app.js

@@ -31,6 +31,8 @@ App({
     wx.cloud.init({
       traceUser: true
     })
-    this.globalData = {}
+    this.globalData = {
+      maintab: 1
+    }
   },
 })

+ 16 - 4
miniprogram/pages/index/index.js

@@ -4,6 +4,7 @@ import {
   postApi
 } from "../../apis/api"
 import cloudApi from "../../apis/cloudApi"
+const app = getApp()
 Page({
   data: {
     indexInfo: {},
@@ -52,9 +53,20 @@ Page({
 
   },
   goTo(e) {
-    let url = e.currentTarget.dataset.url
-    wx.navigateTo({
-      url
-    })
+    let {
+      url,
+      maintab
+    } = e.currentTarget.dataset
+    app.globalData.maintab = maintab
+    if (maintab) {
+      wx.switchTab({
+        url
+      })
+    } else {
+      wx.navigateTo({
+        url
+      })
+    }
+
   },
 })

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

@@ -19,19 +19,19 @@
   </view>
   <view class="tools">
     <view class="df">
-      <view bindtap="goTo" class="go-to" data-url="/pages/voyageManage/myDaily/myDaily">
+      <view bindtap="goTo" data-maintab="{{2}}" class="go-to" data-url="/pages/voyageManage/voyageManage">
         <image src="../../images/camera.png"></image>
         <view>日报</view>
         <view class="badge">{{indexInfo.dayReportNum}}</view>
       </view>
-      <view bindtap="goTo" class="go-to" data-url="/pages/voyageManage/myVoyages/myVoyages">
+      <view bindtap="goTo" data-maintab="{{1}}" class="go-to" data-url="/pages/voyageManage/voyageManage">
         <image src="../../images/ship.png"></image>
         <view>卸货</view>
         <view class="badge">{{indexInfo.discVoyageNum}}</view>
       </view>
     </view>
     <view class="df">
-      <view bindtap="goTo" class="go-to" data-url="/pages/voyageManage/myBills/myBills">
+      <view bindtap="goTo" data-maintab="{{3}}" class="go-to" data-url="/pages/voyageManage/voyageManage">
         <image src="../../images/bills.png"></image>
         <view>单据</view>
         <view class="badge">{{indexInfo.billNum}}</view>

+ 6 - 18
miniprogram/pages/sharePage/sharePage.js

@@ -4,7 +4,7 @@ import {
 } from "../../apis/api"
 Page({
   data: {
-    isLogin: false,
+    isLogin: true,
     id: '',
     tab: 2,
     shipDischargeCurrentPage: 1,
@@ -257,8 +257,9 @@ Page({
   },
 
 
-  onShareAppMessage() {
-    let id = wx.getStorageSync('voyageDetailId')
+  onShareAppMessage: (e) => {
+    console.log(e)
+    let id = this.data.voyageId
     return {
       title: '真实 实时 精准',
       path: `/pages/sharePage/sharePage?id=${id}`
@@ -340,21 +341,8 @@ Page({
     this.setData({
       id
     })
-    let loginAccountId = wx.getStorageSync('loginAccountId')
-    if (loginAccountId) {
-      this.setData({
-        isLogin: true
-      })
-      if ((wx.getStorageSync('isClient') && wx.getStorageSync('sharePermission') || !(wx.getStorageSync('isClient')))) {
-        this.getNewDetail()
-        this.getVoyageDetail()
-      } else {
-        wx.showToast({
-          icon: "none",
-          title: '暂无查看权限'
-        })
-      }
-    }
+    this.getNewDetail()
+    this.getVoyageDetail()
 
   },
 })

+ 6 - 2
miniprogram/pages/voyageManage/myDaily/examine/examine.js

@@ -66,6 +66,10 @@ Page({
     })
   },
   onShareAppMessage() {
-
-  }
+    let id = this.data.voyageId
+    return {
+      title: '真实 实时 精准',
+      path: `/pages/sharePage/sharePage?id=${id}`
+    }
+  },
 })

+ 2 - 3
miniprogram/pages/voyageManage/myDaily/examine/examine.wxml

@@ -6,12 +6,11 @@
     <view bindtap="checkMedia" data-audit="{{2}}" class="next">不通过</view>
   </view>
   <view class="df aic jscb">
-    <view class="next">分享航次照片</view>
-    <view class="next">分享航行报告</view>
+    <button style="width: 300rpx;line-height: 80rpx;padding: 0;font-weight: 400;" open-type="share" data-type="{{1}}" class="next">分享航行报告</button>    <button style="width: 300rpx;line-height: 80rpx;padding: 0;font-weight: 400;" open-type="share" data-type="{{2}}" class="next">分享航行报告</button>
   </view>
 </block>
 <block wx:if="{{trans=='卸货中'}}">
   <view class="df aic jcc">
-    <view class="next">分享卸货报告</view>
+    <button style="width: 300rpx;line-height: 80rpx;padding: 0;font-weight: 400;" open-type="share" data-type="{{3}}" class="next">分享卸货报告</button>
   </view>
 </block>

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

@@ -158,6 +158,9 @@ Page({
   },
   onLoad() {},
   onShow() {
+    this.setData({
+      maintab: app.globalData.maintab
+    })
     this.getList()
   }
 })

+ 0 - 1
miniprogram/pages/voyages/detail/detail.js

@@ -371,7 +371,6 @@ Page({
   async updateVoyage() {
     for (let i of this.data.voyageDetails) {
       Object.keys(i).forEach(function (key) {
-        console.log(i[key])
         if ((typeof i[key]) == 'string') {
           i[key] = i[key].replaceAll('-', '/')
           if (i[key].length == 10) i[key] = i[key] + " 00:00:00"

+ 7 - 0
project.private.config.json

@@ -22,6 +22,13 @@
           "query": "voyageId=170&portId=1",
           "launchMode": "default",
           "scene": null
+        },
+        {
+          "name": "",
+          "pathName": "pages/voyageManage/myDaily/examine/examine",
+          "query": "id=170&trans=%E8%BF%90%E8%BE%93%E4%B8%AD",
+          "launchMode": "default",
+          "scene": null
         }
       ]
     }