5***@qq.com
5***@qq.com
  • 发布:2021-05-17 17:43
  • 更新:2021-05-17 18:05
  • 阅读:369

华为nova6 (5G)

分类:uni-app

安装app之后,无法选择视频上传,直接拍摄的可以上传成功,华为mate 40 Pro正常

2021-05-17 17:43 负责人:无 分享
已邀请:
5***@qq.com

5***@qq.com (作者) - 简洁,敏捷,高效,复用,自律

一个打开系统视频时,部分无法预览;还有一部分是选择系统内的视频,无法上传

5***@qq.com

5***@qq.com (作者) - 简洁,敏捷,高效,复用,自律

  chooseVideo() {  
        // 上传视频  
        uni.chooseVideo({  
          maxDuration: 30,  
          count: 1,  
          sourceType: ['camera', 'album'],  
          success: res => {  
            uni.showLoading({  
              title: '加载中'  
            });  

            this.paths = res.tempFilePath;  
            // let fileExtension = res.name.substring(res.name.lastIndexOf('.') + 1);  
            // let fileExtension  
            // if (res.name) {  
            //   fileExtension = res.name.substring(res.name.lastIndexOf(".") + 1);  
            //   fileExtension = fileExtension.toLowerCase();  
            // } else {  
            //   fileExtension = res.tempFilePath.substring(res.tempFilePath.lastIndexOf(".") + 1);  
            //   fileExtension = fileExtension.toLowerCase();  
            // }  
            // if (fileExtension == '3gp' || fileExtension == 'mp4' || fileExtension == 'rmvb' || fileExtension ==  
            //   'mov' || fileExtension == 'avi' || fileExtension == 'm4v') {  
            let that = this;  
            let as = myapi.newuploads;  
            // console.log(as);  
            uni.uploadFile({  
              url: that.$http.config.baseURL + myapi.newuploads +  
                '?AttachmentLevel=2&AttachmentType=3', //仅为示例,非真实的接口地址  
              filePath: res.tempFilePath,  
              name: 'file',  
              formData: {  
                'user': 'test'  
              },  
              success: (res) => {  
                let data = JSON.parse(res.data)  
                if (data.ResultCode == 200) {  
                  uni.hideLoading();  
                  uni.showToast({  
                    title: '上传成功!',  
                    icon: 'none',  
                    duration: 2000  
                  });  
                  let imgd = data.DataList  
                  that.videoList.push({  
                    Id: imgd.Id,  
                    FileUrl: this.$http.config.baseURL2 + imgd.FileUrl  
                  })  
                } else {  
                  uni.hideLoading();  
                  uni.showToast({  
                    title: ErrorMsg,  
                    icon: 'none',  
                    duration: 2000  
                  });  
                }  
              },  
              fail: (res) => {  
                uni.hideLoading();  
                uni.showToast({  
                  title: '上传错误',  
                  icon: 'none',  
                  duration: 2000  
                });  
              },  
            });  

            // that.$http.upload(myapi.newuploads, {  
            //     filePath: res.tempFilePath,  
            //     name: 'file',  
            //     params: {  
            //       AttachmentLevel: 2,  
            //       AttachmentType: 3  
            //     },  
            //   })  
            //   .then(res => {  
            //     if (res.data.ResultCode == 200) {  
            //       uni.hideLoading();  
            //       uni.showToast({  
            //         title: '上传成功!',  
            //         icon: 'none',  
            //         duration: 2000  
            //       });  
            //       let imgd = res.data.DataList  
            //       that.videoList.push({  
            //         Id: imgd.Id,  
            //         FileUrl: this.$http.config.baseURL2 + imgd.FileUrl  
            //       })  
            //     } else {  
            //       uni.showToast({  
            //         title: res.ErrorMsg,  
            //         icon: 'none',  
            //         duration: 2000  
            //       });  
            //     }  

            //   })  
            //   .catch(err => {  
            //     this.errs = JSON.stringify(err);  
            //     // console.log(err);  
            //   });  

            // } else {  
            //   uni.showToast({  
            //     title: '暂不支持该格式文件',  
            //     icon: 'none',  
            //     duration: 2000  
            //   });  
            // }  
          },  
          fail: () => {  
            // uni.showToast({  
            //   title: '视频错误',  
            //   icon: 'none',  
            //   duration: 2000  
            // });  
          },  
        });  
      }

该问题目前已经被锁定, 无法添加新回复