浏览代码

修改图片上传接口返回的参数

reghao 3 年之前
父节点
当前提交
4f54702014
共有 3 个文件被更改,包括 4 次插入4 次删除
  1. 2 2
      src/components/setting/user-head-setting.vue
  2. 1 1
      src/views/mblog/mblog.vue
  3. 1 1
      src/views/studio/upload.vue

+ 2 - 2
src/components/setting/user-head-setting.vue

@@ -98,7 +98,7 @@ export default {
       const formData = new FormData()
       formData.append('videoFileId', 'test')
       formData.append('file', this.avatarFile)
-      fetch(`//file.reghao.cn/api/file/upload/video/cover`, {
+      fetch(`//file.reghao.cn/api/file/upload/image`, {
         headers: {
           'X-XSRF-TOKEN': this.$cookies.get('XSRF-TOKEN')
         },
@@ -108,7 +108,7 @@ export default {
       }).then(response => response.json())
         .then(json => {
           if (json.code === 0) {
-            this.userInfo.avatarUrl = json.data.originalUrl
+            this.userInfo.avatarUrl = json.data.imageUrl
             this.message = '上传成功,请点击保存,保存头像设置!'
             this.showMessage = true
           } else {

+ 1 - 1
src/views/mblog/mblog.vue

@@ -216,7 +216,7 @@ export default {
           onload(response) {
             const resp = JSON.parse(response)
             if (resp.code === 0) {
-              imgFileIds.push(resp.data.imageUploadId)
+              imgFileIds.push(resp.data.imageFileId)
             } else {
               if (resp.msg != null) {
                 this.message = '上传文件出现异常,请重新上传!' + resp.msg

+ 1 - 1
src/views/studio/upload.vue

@@ -342,7 +342,7 @@ export default {
           if (json.code === 0) {
             this.message = '封面已上传'
             this.showMessage = true
-            this.videoPost.coverFileId = json.data.imageUploadId
+            this.videoPost.coverFileId = json.data.imageFileId
             this.videoPost.imageUrl = json.data.imageUrl
           } else {
             this.message = '上传失败,请重试!' + json.message