Ver Fonte

更新 资源地址

wzg há 2 anos atrás
pai
commit
ecaf4fa8b6

+ 23 - 22
miniprogram/pages/share/share.js

@@ -1,31 +1,32 @@
 // pages/share/share.js
 Page({
   data: {
-    shareImageUrl: '',
+    shareImageUrl: "",
     markers: [],
-    logoUrl: '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'
+    logoUrl:
+      "https://frontend-1255802371.cos.ap-shanghai.myqcloud.com/miniapp-static/%E6%B1%87%E5%BE%88%E5%A4%9Alogo-%E5%B7%A6%E5%8F%B3.png",
   },
   onLoad: function (options) {
-    let {
-      latitude,
-      longitude
-    } = options
-    let markers = [{
-      id: 999,
-      latitude: '32.001233',
-      longitude: '120.5475',
-      iconPath: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/red-circle.png?sign=6d208881376358fb4111aa6d7f1a7846&t=1647934972",
-      height: 20,
-      width: 20
-    }]
-    markers[0].latitude = latitude
-    markers[0].longitude = longitude
-
-
+    let { latitude, longitude } = options;
+    let markers = [
+      {
+        id: 999,
+        latitude: "32.001233",
+        longitude: "120.5475",
+        iconPath:
+          "https://frontend-1255802371.cos.ap-shanghai.myqcloud.com/miniapp-static/red-circle.png?sign=6d208881376358fb4111aa6d7f1a7846&t=1647934972",
+        height: 20,
+        width: 20,
+      },
+    ];
+    markers[0].latitude = latitude;
+    markers[0].longitude = longitude;
 
     this.setData({
       markers,
-      shareImageUrl: (options.shareImageUrl.replace(/qwerdfb000mmmccc/g, '?')).replace(/mmmcccqwerdfb/g, '=')
-    })
-  }
-})
+      shareImageUrl: options.shareImageUrl
+        .replace(/qwerdfb000mmmccc/g, "?")
+        .replace(/mmmcccqwerdfb/g, "="),
+    });
+  },
+});

+ 71 - 67
miniprogram/pages/takeBill/takeBill.js

@@ -1,125 +1,129 @@
-import {
-  uploadFile
-} from "../../utils/upload"
+import { uploadFile } from "../../utils/upload";
 Page({
   data: {
-    avatar: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/avatar-icon.jpg?sign=f5c66c94d189436f82353eb48cb01f08&t=1634538864",
-    cameraIcon: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/camera-icon.png?sign=11a65871a2800cd04ecaa8991687fccd&t=1634607415",
-    newCameraIcon: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/camera.png?sign=ad0fe8bead6a46cb20f45f792d4bed67&t=1645502416",
+    avatar:
+      "https://frontend-1255802371.cos.ap-shanghai.myqcloud.com/miniapp-static/avatar-icon.jpg?sign=f5c66c94d189436f82353eb48cb01f08&t=1634538864",
+    cameraIcon:
+      "https://frontend-1255802371.cos.ap-shanghai.myqcloud.com/miniapp-static/camera-icon.png?sign=11a65871a2800cd04ecaa8991687fccd&t=1634607415",
+    newCameraIcon:
+      "https://frontend-1255802371.cos.ap-shanghai.myqcloud.com/miniapp-static/camera.png?sign=ad0fe8bead6a46cb20f45f792d4bed67&t=1645502416",
     userName: "",
     phone: "",
     shipName: "",
     shipMmsi: "",
     authModal: false,
     modalText: "位置",
-    cw: '',
-    ch: '',
+    cw: "",
+    ch: "",
     disabled: false,
-    imgCache:''
+    imgCache: "",
   },
   takeBill() {
-    if (this.data.disabled) return
+    if (this.data.disabled) return;
     wx.showLoading({
-      title: '正在上传...',
-    })
-    this.data.disabled = true
-    const ctx = wx.createCameraContext()
+      title: "正在上传...",
+    });
+    this.data.disabled = true;
+    const ctx = wx.createCameraContext();
     ctx.takePhoto({
-      quality: 'high',
+      quality: "high",
       success: (res) => {
-        let src = res.tempImagePath
-        let ch = res.height * 2
-        let cw = res.width * 2
+        let src = res.tempImagePath;
+        let ch = res.height * 2;
+        let cw = res.width * 2;
         wx.getImageInfo({
           src,
-          success: e => {
+          success: (e) => {
             this.setData({
               ch,
-              cw
-            })
+              cw,
+            });
             const query = wx.createSelectorQuery();
-            query.select('#myCanvas').node().exec((res) => {
-              const canvas = res[0].node;
-              const ctx = canvas.getContext('2d');
-              const img = canvas.createImage();
-              let h = ch / 2
-              let w = cw / 2
-              canvas.height = h * 0.85
-              canvas.width = w * 0.9
-              img.src = src
-              img.onload = () => {
-                ctx.drawImage(img, -w * 0.05, -h * 0.05);
-              }
-              this.saveImg(src)
-            })
-          }
-        })
-
-      }
-    })
+            query
+              .select("#myCanvas")
+              .node()
+              .exec((res) => {
+                const canvas = res[0].node;
+                const ctx = canvas.getContext("2d");
+                const img = canvas.createImage();
+                let h = ch / 2;
+                let w = cw / 2;
+                canvas.height = h * 0.85;
+                canvas.width = w * 0.9;
+                img.src = src;
+                img.onload = () => {
+                  ctx.drawImage(img, -w * 0.05, -h * 0.05);
+                };
+                this.saveImg(src);
+              });
+          },
+        });
+      },
+    });
   },
   goBack() {
     wx.switchTab({
-      url: '/pages/takePhoto/takePhoto',
-    })
+      url: "/pages/takePhoto/takePhoto",
+    });
   },
   async saveImg(src) {
     const query = wx.createSelectorQuery();
     const canvas = await new Promise((resolve, reject) => {
-      query.select('#myCanvas')
+      query
+        .select("#myCanvas")
         .fields({
           node: true,
-          size: true
+          size: true,
         })
         .exec(async (res) => {
           resolve(res[0].node);
-        })
+        });
     });
 
     wx.canvasToTempFilePath({
       canvas,
-      success: async e => {
+      success: async (e) => {
         // let path = e.tempFilePath
         // wx.navigateTo({
         //   url: `/pages/takeBill/success/success?src=${src}&path=${path}`
         // })
         // return
         this.setData({
-          imgCache:e.tempFilePath
-        })
+          imgCache: e.tempFilePath,
+        });
         let res = await uploadFile(e.tempFilePath, {
           type: 0,
-          userId: wx.getStorageSync('userId'),
+          userId: wx.getStorageSync("userId"),
           // userId: 89,
-          location: ''
-        })
+          location: "",
+        });
         wx.hideLoading({
           success: (res) => {},
-        })
+        });
         wx.showToast({
           title: res.msg,
-        })
+        });
         setTimeout(() => {
-          this.data.disabled = false
-          this.goBack()
-        }, 1000)
+          this.data.disabled = false;
+          this.goBack();
+        }, 1000);
       },
       fail(res) {
-        console.log('fail');
-      }
-    })
+        console.log("fail");
+      },
+    });
   },
 
   onLoad() {
-    let userName = wx.getStorageSync('userName')
-    let userId = wx.getStorageSync('userId')
-    let phone = wx.getStorageSync('phone')
-    let shipId = wx.getStorageSync('shipId')
+    let userName = wx.getStorageSync("userName");
+    let userId = wx.getStorageSync("userId");
+    let phone = wx.getStorageSync("phone");
+    let shipId = wx.getStorageSync("shipId");
     this.setData({
       userName,
       phone,
       userId,
-      shipId
-    })
-  }
-})
+      shipId,
+    });
+  },
+});

+ 3 - 3
miniprogram/pages/takePhoto/takePhoto.js

@@ -5,11 +5,11 @@ Page({
   data: {
     sign: "https://frontend-1255802371.cos.ap-shanghai.myqcloud.com/sign.png",
     avater_exp:
-      "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/avatar-icon.jpg?sign=f5c66c94d189436f82353eb48cb01f08&t=1634538864",
+      "https://frontend-1255802371.cos.ap-shanghai.myqcloud.com/miniapp-static/avatar-icon.jpg?sign=f5c66c94d189436f82353eb48cb01f08&t=1634538864",
     cameraIcon:
-      "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/camera-icon.png?sign=11a65871a2800cd04ecaa8991687fccd&t=1634607415",
+      "https://frontend-1255802371.cos.ap-shanghai.myqcloud.com/miniapp-static/camera-icon.png?sign=11a65871a2800cd04ecaa8991687fccd&t=1634607415",
     newCameraIcon:
-      "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/camera.png?sign=ad0fe8bead6a46cb20f45f792d4bed67&t=1645502416",
+      "https://frontend-1255802371.cos.ap-shanghai.myqcloud.com/miniapp-static/camera.png?sign=ad0fe8bead6a46cb20f45f792d4bed67&t=1645502416",
     userName: "",
     phone: "",
     shipName: "",

+ 13 - 22
miniprogram/pages/takePhoto/takePhoto.wxss

@@ -5,11 +5,11 @@
   height: 35vh;
   padding-top: 154rpx;
   background-size: contain;
-  background: green
+  background: green;
 }
 
 .exp {
-  background: url(https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/sea-bgd.jpeg?sign=f138978877f53ccdc48937c58811659b&t=1634539269)
+  background: url(https://frontend-1255802371.cos.ap-shanghai.myqcloud.com/miniapp-static/sea-bgd.jpeg?sign=f138978877f53ccdc48937c58811659b&t=1634539269);
 }
 
 .sign {
@@ -56,15 +56,12 @@
 
 .text {
   font-size: 30rpx;
-  font-family: PingFangSC-Medium,
-    PingFang SC;
+  font-family: PingFangSC-Medium, PingFang SC;
   font-weight: 500;
-  color: #FFFFFF;
+  color: #ffffff;
   margin-top: 30rpx;
 }
 
-
-
 .camera-icon {
   display: block;
   width: 234rpx;
@@ -86,7 +83,7 @@
 .modal {
   width: 557rpx;
   height: 274rpx;
-  background: #FFFFFF;
+  background: #ffffff;
   border-radius: 16rpx;
   margin: 548rpx auto;
   padding-top: 55rpx;
@@ -96,8 +93,7 @@
   width: 100%;
   text-align: center;
   font-size: 36rpx;
-  font-family: PingFangSC-Medium,
-    PingFang SC;
+  font-family: PingFangSC-Medium, PingFang SC;
   font-weight: 500;
   color: #333333;
   -webkit-text-stroke: 1rpx #979797;
@@ -106,13 +102,12 @@
 .auth-btn {
   width: 350rpx;
   height: 69rpx;
-  background: #0094FE;
+  background: #0094fe;
   border-radius: 8rpx;
   font-size: 36rpx;
-  font-family: PingFangSC-Regular,
-    PingFang SC;
+  font-family: PingFangSC-Regular, PingFang SC;
   font-weight: 400;
-  color: #FFFFFF;
+  color: #ffffff;
   line-height: 69rpx;
   margin: 0 auto;
   margin-top: 55rpx;
@@ -141,14 +136,12 @@
   font-size: 42rpx;
 }
 
-
 .ship-name,
 .ship-mmsi {
   width: 153rpx;
   height: 36rpx;
   font-size: 30rpx;
-  font-family: PingFangSC-Regular,
-    PingFang SC;
+  font-family: PingFangSC-Regular, PingFang SC;
   font-weight: 400;
   color: #333333;
   line-height: 36rpx;
@@ -165,18 +158,16 @@
   padding-left: 20rpx;
 }
 
-
 .submit {
   margin: 130rpx auto;
   width: 80%;
   height: 80rpx;
-  background: #0094FE;
+  background: #0094fe;
   border-radius: 4rpx;
   font-size: 34rpx;
-  font-family: PingFangSC-Regular,
-    PingFang SC;
+  font-family: PingFangSC-Regular, PingFang SC;
   font-weight: 400;
-  color: #FFFFFF;
+  color: #ffffff;
   text-align: center;
   line-height: 80rpx;
   border-radius: 40rpx;