Skip to content

uniapp 项目下使用render.js,在 web 上可以上传,但是在安卓下面报错,望解答,谢谢 #669

Closed
@encorehe

Description

@encorehe

以下为uniapp的项目代码
`


{{vsrc}}-{{ result }}

<view class="content" @click="test">




<script> export default { data(){ return { vsrc:'', result:'111' } }, methods:{ test: function () { var self = this; uni.chooseVideo({ sourceType: ['camera', 'album'], success: function (res) { self.src = res.tempFilePath; self.vsrc = res.tempFilePath; // self.ossUpload(res.tempFile,'aaa.mp4') // qiniu.ossUpload(res.tempFile,'aaa.mp4'); } }); }, getResult(res){ console.log('上传结果',res); this.result = res; } } } </script> <script module="qiniu" lang="renderjs"> import { createDirectUploadTask, createMultipartUploadV2Task, FileData } from 'qiniu-js'; export default { data() { return { title: 'Hello', src:'', progress:0, result:{} } }, onLoad() { }, methods: { sendDataToVue(event, ownerInstance) { console.log(event,ownerInstance); this.$ownerInstance.callMethod('getResult', { // 调用 Vue 组件中的方法 someData: this.result }); }, ossUpload(newValue, oldValue, ownerVm, vm){ let uptoken = 'bA5ywMRj7I2-6x1fPx2C4KQ4Vsz4cLt1Ce63aZ8o:Jrp2b40Znlja18ytBSFevdOY3tE=:eyJzY29wZSI6ImltYWdlcy1maWxlcy10ZXN0IiwiZGVhZGxpbmUiOjE3MjQxNDExMzd9'; const fileData = { type: 'file', data: newValue}; const self = this; const config = { tokenProvider:()=>{ return new Promise((resolve, reject)=>{ resolve(uptoken) }) } } const uploadTask = createMultipartUploadV2Task(fileData, config); // 设置进度回调函数 uploadTask.onProgress((progress, context) => { console.log('progress',JSON.stringify(progress)); self.progress = progress.percent; // 处理进度回调 }); // 设置完成回调函数 uploadTask.onComplete((result, context) => { // 处理完成回调 console.log(result,'result=>') self.result = result; self.sendDataToVue(result); }); // 设置错误回调函数 uploadTask.onError((error, context) => { console.log('error=>',666); // 处理错误回调 console.log( JSON.stringify(error),'error=>'); }); uploadTask.start(); } } } </script> <style> .content { display: flex; flex-direction: column; align-items: center; justify-content: center; } .logo { height: 200rpx; width: 200rpx; margin-top: 200rpx; margin-left: auto; margin-right: auto; margin-bottom: 50rpx; } .text-area { display: flex; justify-content: center; } .title { font-size: 36rpx; color: #8f8f94; } </style>

`
报错:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions