uploadLocal: function () {
let content = this.data.content
wx.chooseMessageFile({
count: 1,
type: 'file',
success(res) {
let audioBase64=wx.getFileSystemManager().readFileSync(res.tempFiles[0].path, "base64");
manager.uploadLocalFile({
content: content,
audioBase64: audioBase64
})
}
})
}
报错:
{"Error":{"Code":"InvalidParameter","Message":"Url key and value should be splited by `=`."},"RequestId":"70ed5f88-ce79-438a-ba63-71516b797e72"}
根据这个错误描述没搞明白代码哪里有问题,望指教。
补充:发现第一次上传会报这个错,第二次上传就正常了。。。
最新补充:
找到原因是:上传本地文件,未初始化值,所以报上面的错。
在上传文件前,先调用manager.start()初始化参数值是可以的,不过此方法是录音方法,如果调用此方法后,上传本地文件评测后会调用多次评测。
各位大佬知道有什么方法可以不调用manager.start()方法来初始化参数值么?
manager.start({
content: this.data.content,
evalMode: this.data.evalMode,
scoreCoeff: this.data.scoreCoeff,
serverType: this.data.serverType,
storageMode: this.data.storageMode,
soeAppId: this.data.soeAppId,
textMode: this.data.textMode,
duration: this.data.duration
})
已解决,实际上可以直接在上传方法中传参数。谢谢各位大佬的关注。
uploadLocal: function () { let data = this.data; wx.chooseMessageFile({ count: 1, type: 'file', success(res) { manager.uploadLocalFile({ content: data.content, evalMode: data.evalMode, scoreCoeff: data.scoreCoeff, serverType: data.serverType, storageMode: data.storageMode, soeAppId: data.soeAppId, textMode: data.textMode, duration: data.duration, voiceFileType: 3, timeoutData: 5000, audioBase64: wx.getFileSystemManager().readFileSync(res.tempFiles[0].path, "base64") }) } }) }