Compare commits

...

2 Commits

  1. 54
      package1/ieBrowser/profileSetup.vue

54
package1/ieBrowser/profileSetup.vue

@ -159,19 +159,55 @@
this.form.anonymousName = this.nameSeeds[Math.floor(Math.random() * this.nameSeeds.length)]
},
chooseAvatar() {
uni.chooseImage({
let that = this;
uni.chooseMedia({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: async (res) => {
const filePath = res.tempFilePaths && res.tempFilePaths[0]
if (!filePath) return
const result = await tui.uploadFile('/upload/file', filePath)
const url = typeof result === 'string' ? result : (result.url || result.fileUrl || result.path || result.fullPath || result)
if (url && typeof url === 'string') this.form.avatarUrl = url
mediaType: ['image'],
sourceType: ['camera', 'album'],
camera: 'back',
success(res) {
that.upLoadFile(res.tempFiles[0].tempFilePath)
},
fail() {
uni.hideLoading();
}
})
},
async upLoadFile(path) {
let that = this;
uni.showLoading({
title: '加载中...',
mask: true
})
let hiver_token = uni.getStorageSync("hiver_token")
await uni.uploadFile({
url: that.tui.interfaceUrl() + '/upload/file',
filePath: path,
name: 'file',
header: {
"content-type": "multipart/form-data",
'accessToken': hiver_token
},
formData: {},
success: (uploadFileRes) => {
let path = JSON.parse(uploadFileRes.data)
this.form.avatarUrl = path.result
},
fail: (err) => {
uni.hideLoading();
uni.showToast({
title: JSON.stringify(err),
icon: 'none'
})
}
});
await setTimeout(res => {
that.parentId = ''
// uni.hideLoading();
}, 1000)
},
validateStep() {
if (this.step === 2 && !this.form.anonymousName.trim()) {
uni.showToast({ title: '先起一个昵称吧', icon: 'none' })

Loading…
Cancel
Save