|
@@ -189,7 +189,7 @@ export default {
|
|
|
mixins: [userMixin],
|
|
mixins: [userMixin],
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- imgOssUrl: '',
|
|
|
|
|
|
|
+ imgOssUrl: null,
|
|
|
imgHeaders: {
|
|
imgHeaders: {
|
|
|
Authorization: ''
|
|
Authorization: ''
|
|
|
},
|
|
},
|
|
@@ -230,20 +230,10 @@ export default {
|
|
|
this.imgOssUrl = resData.ossUrl
|
|
this.imgOssUrl = resData.ossUrl
|
|
|
this.imgHeaders.Authorization = 'Bearer ' + resData.token
|
|
this.imgHeaders.Authorization = 'Bearer ' + resData.token
|
|
|
} else {
|
|
} else {
|
|
|
- this.$notify({
|
|
|
|
|
- title: '提示',
|
|
|
|
|
- message: '获取 OSS 服务器地址失败, 暂时无法上传文件',
|
|
|
|
|
- type: 'error',
|
|
|
|
|
- duration: 3000
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ this.$message.error(res.msg)
|
|
|
}
|
|
}
|
|
|
}).catch(error => {
|
|
}).catch(error => {
|
|
|
- this.$notify({
|
|
|
|
|
- title: '提示',
|
|
|
|
|
- message: error.message,
|
|
|
|
|
- type: 'warning',
|
|
|
|
|
- duration: 3000
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ this.$message.error(error.message)
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
@@ -251,6 +241,11 @@ export default {
|
|
|
methods: {
|
|
methods: {
|
|
|
// ****************************************************************************************************************
|
|
// ****************************************************************************************************************
|
|
|
beforeAvatarUpload(file) {
|
|
beforeAvatarUpload(file) {
|
|
|
|
|
+ if (this.imgOssUrl === null) {
|
|
|
|
|
+ this.$message.error('没有可上传的 OSS 地址!')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const isJPG = file.type === 'image/jpeg'
|
|
const isJPG = file.type === 'image/jpeg'
|
|
|
const isLt2M = file.size / 1024 / 1024 < 2
|
|
const isLt2M = file.size / 1024 / 1024 < 2
|
|
|
if (!isJPG) {
|
|
if (!isJPG) {
|
|
@@ -267,7 +262,7 @@ export default {
|
|
|
this.coverUrl = URL.createObjectURL(file.raw)
|
|
this.coverUrl = URL.createObjectURL(file.raw)
|
|
|
|
|
|
|
|
const avatar = {}
|
|
const avatar = {}
|
|
|
- avatar.channelId = this.imgData.channelCode
|
|
|
|
|
|
|
+ avatar.channelCode = this.imgData.channelCode
|
|
|
avatar.uploadId = resData.uploadId
|
|
avatar.uploadId = resData.uploadId
|
|
|
updateAvatar(avatar).then(resp => {
|
|
updateAvatar(avatar).then(resp => {
|
|
|
if (resp.code === 0) {
|
|
if (resp.code === 0) {
|