Prechádzať zdrojové kódy

fix:fix:修改空壁纸的toast提示

zeng.chen 4 mesiacov pred
rodič
commit
71ce9979d2
1 zmenil súbory, kde vykonal 7 pridanie a 5 odobranie
  1. 7 5
      pages/piano/cropper/cropper.js

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

@@ -145,7 +145,8 @@ Page({
   },
   loadimage(e) {
     wx.hideLoading();
-    console.log('加载壁纸', e);
+    console.log('加载壁纸', e.detail.path);
+    this.data._imgTopPic = e.detail.path
     // this.cropper.imgReset();
   },
   clickcut(e) {
@@ -166,6 +167,8 @@ Page({
     let res = await uploadImage(url);
     // 服务器的走下载图片
     _this.data._imgTopPic = res.data;
+    console.log("添加图片2,", _this.data._imgTopPic.length)
+
     console.log("IOS的走下载图片", res)
     _this._downloadAndSaveFile(_this.data._imgTopPic)
   },
@@ -232,6 +235,7 @@ Page({
     //   return;
     // }
     let _imgTopPic = _this.data._imgTopPic ?? ""
+    console.log("长度:", _imgTopPic, _imgTopPic.length)
     if (_imgTopPic.length == 0) {
       wx.showToast({
         title: '壁纸不能为空',
@@ -255,9 +259,7 @@ Page({
     // 读取裁剪的jpg图片
     this.cropper.getImg((res) => {
       if (platform === 'ios') {
-        this.cropper.getImg((res) => {
-          _this._uploadImgIOS(res.url)
-        });
+        _this._uploadImgIOS(res.url)
       } else {
         _this.data._imgTopPic = res.url
         _this._uploadImage(res.url)
@@ -527,7 +529,6 @@ Page({
     });
   },
   hasImage(image) {
-    console.log("有图片", image.pic)
     let that = this;
     that.cropper.imgReset();
     // 有图片的进制缩放
@@ -536,6 +537,7 @@ Page({
       max_scale: 1,
     });
     that.data._imgTopPic = image.pic
+    console.log("有图片", image.pic, that.data._imgTopPic.length)
   },
   disconnectDevCallback() {
     route_util.goBackHomePage()