收藏
回答

errMsg: "getImageInfo:fail invalid 保存图片就报这个错?

老哥们帮忙看下是哪里有问题,感激

var e = getApp();


require("../../utils/request.js");


Page({
    data: {
        isIPX: e.isIPX,
        imgsrc: "",
        sys: wx.getSystemInfoSync()
    },
    onLoad: function(e) {
        var t = this, s = t.data, i = s.isIPX, a = s.customStyle;
        if (e.src) {
            var o = e.src.split("q70")[0].slice(-4), n = decodeURIComponent(e.src.replace(o"w1080"));
            -1 != n.indexOf("mi-img"&& (n = n.replace("mi-img""xiaomi")), t.setData({
                imgsrc: n
            });
        }
        i ? t.setData({
            customStyle: a + "top:88rpx;"
        }) : t.setData({
            customStyle: a + "top:40rpx;"
        });
    },
    inSeeImg: function() {
        var e = this.data.imgsrc;
        wx.previewImage({
            current: e,
            urls: [ e ]
        });
    },
    inToPage: function() {
        wx.navigateTo({
            url: "/pages/index/index"
        });
    },
    inDowmImg: function(e) {
        var t = this.data.imgsrc;
        wx.showLoading({
            title: "保存中...",
            mask: !0
            
        }), wx.getImageInfo({
            src: "https://" + t.replace(t.split(".market")[0], "f6"),
            success: function(e) {
                wx.hideLoading();
                var t = e.path;
                wx.saveImageToPhotosAlbum({
                    filePath: e.path,
                    success: function(e) {
                        wx.showToast({
                            title: "保存成功",
                            icon: "none"
                        });
                    },
                    fail: function(e) {
                        wx.hideLoading(), wx.showModal({
                            content: "授权后才能下载到本地,是否授权?",
                            success: function(e) {
                                e.confirm && wx.openSetting({
                                    success: function(e) {
                                        e.authSetting["scope.writePhotosAlbum"&& wx.saveImageToPhotosAlbum({
                                            filePath: t,
                                            success: function(e) {
                                                wx.showToast({
                                                    title: "保存成功",
                                                    icon: "none"
                                                });
                                            }
                                        });
                                    }
                                });
                            }
                        });
                    }
                });
            }
        });
    },
    onShareAppMessage: function() {
        var e = this.data.imgsrc;
        return {
            title: "这张壁纸喜欢吗?",
            imageUrl: e,
            path: "pages/see-img/see-img?src=" + encodeURIComponent(e)
        };
    }
});
回答关注问题邀请回答
收藏

2 个回答

  • Demons
    Demons
    2022-07-01

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2022-07-01
    有用
    回复 1
    • 陈年风褛
      陈年风褛
      2022-09-26
      预览到手机上关了授权也能保存成功咋回事,
      2022-09-26
      回复
  • Humbert Humbert
    Humbert Humbert
    2022-07-01

    这个js看不出的话 我可以提供下源码 也是网上下载


    2022-07-01
    有用
    回复
登录 后发表内容