开发者您好!我遇到一个问题,域名配置好了,但是出现的错误提示如下:WAServiceMainContext.js?t=wechat&s=1677134885751&v=2.30.2:1 Error: uploadFile:fail Error: getaddrinfo ENOTFOUND file-uninjwtyrm-mp-aecb2fa6-39c1-4b92-b8ce-9ef005486527.oss-cn-zhangjiakou.aliyuncs.com。
烦请解答!谢谢!
程序源码 如下:
<button class="avatar-wrapper action-btn btn-margin" open-type="chooseAvatar"
@chooseavatar="onChooseAvatar">
选择头像
</button>
<button class="action-btn btn-primary btn-margin" @click="shareFc()">保存头像</button>
<button open-type="share" class="action-btn share-btn">发给朋友</button>
methods: {
async onChooseAvatar(e) {
let avatarUrl = e.detail.avatarUrl
//const avatarTemp = await this.getTempFile(avatarUrl)
const url = await this.uploadFile(avatarUrl, '用户头像' + this.formatDate() + '.jpg')
this.avatarImage = url;
let userInfo = {
avatarImage: this.avatarImage
}
uni.setStorageSync('user_info', userInfo);
this.init();
this.postUserInfo('微信用户', this.avatarImage, 'createImages');
},
getTempFile(str) {
let that = this
var manager = wx.getFileSystemManager()
return new Promise((resolve,reject) => {
manager.readFile({
filePath: str,
success(res) {
resolve(res.data)
}
})
})
},
async uploadFile(filePath, fileName) {
const result = await uniCloud.uploadFile({
filePath: filePath,
cloudPath: fileName
});
return result.fileID
},
}