Przeglądaj źródła

feature:修改上传服务器图片的问题

zeng.chen 6 miesięcy temu
rodzic
commit
1414b15c34

+ 3 - 3
devices/ble_manager.js

@@ -105,9 +105,9 @@ class bleManager {
               temp.mac = temp.advertisData ? hex_util.buf2hex(temp.advertisData) : '';
               temp.mac2 = that.ab2hex(temp.advertisData ?? "")
 
-              if (that.testData(temp)) {
-                return
-              }
+              // if (that.testData(temp)) {
+              //   return
+              // }
               console.log("2222:", temp.mac, ":", temp.mac2, ":", temp.deviceId, temp, temp.connectable);
 
               // if ((temp.deviceId === "07:F6:F4:66:FB:FA")) {

+ 5 - 9
pages/piano/cropper/cropper.js

@@ -508,11 +508,6 @@ Page({
     _this.data._imgNext = 0
     wx.hideLoading()
     if (showToast) {
-      // todo 测试注释的
-      // wx.showModal({
-      //   title: '壁纸上传失败了',
-      //   showCancel: false
-      // })
       wx.showToast({
         title: '发送图片失败',
         icon: 'error'
@@ -525,6 +520,7 @@ Page({
     });
   },
   hasImage(image) {
+    console.log("有图片", image.pic)
     let that = this;
     that.cropper.imgReset();
     // 有图片的进制缩放
@@ -558,17 +554,18 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
+    let _this = this;
 
     this.cropper = this.selectComponent("#image-cropper");
     this.cropper.imgReset();
     let image = options.param
     let json = JSON.parse(image)
-    console.log("裁剪页:", image)
+    console.log("裁剪页:", json)
     let topImg = json.topImg ?? {}
-    let deviceId = json.deviceId;
+    let deviceId = json.deviceId ?? "";
     _this.data._deviceId = deviceId
     if (topImg.pic) {
-      this.hasImage(json)
+      this.hasImage(topImg)
     } else {
       console.log("没有图片")
       this.checkAndRequestImagePermission()
@@ -577,7 +574,6 @@ Page({
     //   scr:json,
     // })
 
-    let _this = this;
     EventManager.addNotification(CmdEvent.eventName, function (event) {
       let name = event.cmdEvent;
       let value = event.wallpaper;

+ 1 - 0
request/imageRequest.js

@@ -5,6 +5,7 @@ module.exports = {
 
     // 上传图片到服务器
     uploadImage: (filePath, formData = {}) => {
+        var Authorization = "";
         try {
             var value = wx.getStorageSync('token') || "";
             if (!strings.isEmpty(value)) {