• 微信小程序长按不能识别二维码/保存图片


    在小程序里面长按图片只能识别小程序的太阳码(就是小程序码),其他的包括普通二维码,企业微信码都是不能识别的。

    包括小程序普通的页面和小程序的webview以及imgpreview,都只能识别小程序码。

    微信小程序获取当前路径信息

     let pages = getCurrentPages();
                let currPage = null;
                if (pages.length) {
                  currPage = pages[pages.length - 1];
                }
    cosole.log(currPage)
     

    微信下载文件:

    wx.downloadFile({   //通过微信的下载接口,下载网络文件
          url: 'https://hj.hj088.cn/carlsberg/miniapp/scene/code2.jpg',
          success (res) {   //res.tempFilePath是下载好的本地路径,可以用来预览下载好的东西或者保存文件到手机
            console.log(res);
            if(res.statusCode === 200){
              wx.saveImageToPhotosAlbum({   //下载的如果是图片,要调用这个方法才能保存的手机相册
                filePath: res.tempFilePath,
                success: function(data) {
                  wx.showToast({
                    title: "保存成功",
                    icon: "success",
                    duration: 2000
                  });
                },
                fail: function(err) {
                  console.log(err);
                },
                complete(res) {
                  console.log(res);
                }
              });
    
              // wx.saveFile({   //下载的如果不是图片而已word之类的文档,要用这个方法保存到手机,文档的话还可以调用wx.openDocument方法来打开预览
              //   tempFilePath: res.tempFilePath,
              //   success:() => {
              //    wx.showToast({
              //      title: '保存成功',
              //      type:'success'
              //    })
              //   }
              // })
            }
          }
        })
  • 相关阅读:
    Codeforces Round #603 (Div. 2)
    【bzoj1997】[Hnoi2010]Planar(平面图+2-sat)
    【poj3207】Ikki's Story IV
    【HDU1814】Peaceful Commission(2-sat+暴力染色)
    Educational Codeforces Round 77 (Rated for Div. 2)
    【hdu3311】Dig The Wells(斯坦纳树+dp)
    [USACO3.3] A Game
    [TJOI2013] 单词
    [USACO3.3] Home on the Range
    [NOI2011] 阿狸的打字机
  • 原文地址:https://www.cnblogs.com/haqiao/p/14119183.html
Copyright © 2020-2023  润新知