uniapp兼容小程序下拉彈框形式展示數據


goCamera: function() {
    let that = this
    // #ifdef  APP-PLUS
    uni.chooseImage({
     count: 1, //默認9
     sizeType: ['compressed'], //可以指定是原圖還是壓縮圖,默認二者都有
     sourceType: ['album', 'camera'], //從相冊選擇
     success: function(res) {
      console.log(res,"app")
      console.log(res.tempFilePaths);
      // debugger
      that.shop.img = res.tempFilePaths[0]
      console.log(that.shop.img)
       that.url = res.tempFilePaths[0]
      const tempFilePaths = res.tempFilePaths;
      

     }
    });
    // #endif
    // #ifdef  MP-WEIXIN
    wx.showActionSheet({
     itemList: ['拍照', '從相冊中選擇'],
     success(res) {
      console.log(res.tapIndex,"weixin")
      let sourceType = 'camera'
      if (res.tapIndex == 0) {
       sourceType = 'camera'
      } else if (res.tapIndex == 1) {
       sourceType = 'album'
      }
      wx.chooseImage({
       count: 1,
       sizeType: ['compressed'],
       sourceType: [sourceType],
       success: function(res) {
        console.log(res.tempFilePaths)
        const tempFilePaths = res.tempFilePaths[0]
         that.url = res.tempFilePaths[0]
         console.log(that.url)
        // uni.uploadFile({
        //  url: http.baseUrl + '/uploads/upload-supplier-shop-head-portrait/' + uni.getStorageSync('shopId'),
        //  methods: "post",
        //  filePath: tempFilePaths,
        //  name: 'upload',
        //  success: function(uploadFileRes) {
        //   console.log(JSON.parse(uploadFileRes.data).data);
        //   // _this.imgList = [..._this.imgList, uploadFileRes.data]
        //   that.shopDetail.shopHeadImgUrl = JSON.parse(uploadFileRes.data).data
        //  }
        // });
        // this.tui.href('../cropper-default?src=' + that.url);
        console.log("yaotiaole")
        uni.navigateTo({
         url:"./cropper-default?src=" + that.url +"&uploadtype=touxiang&shopId=" + that.shopId + "&shopName=" + that.shopName + "&sourceType=" + sourceType ,
         success: (r) => {
          console.log(r)
         }
        })
       },
      })
     },
    })
  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM