From 16173245cacd79918897f713762ca41a35324f2d Mon Sep 17 00:00:00 2001 From: congzc Date: Fri, 7 Apr 2023 18:11:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=9B=BE=E7=89=87=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E8=B7=A8=E5=9F=9F,=E5=9B=BE=E7=89=87=E8=BD=AC?= =?UTF-8?q?=E4=B8=BA=E4=BA=8C=E8=BF=9B=E5=88=B6=E6=9C=AA=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/editModel.js | 14 +++++++------- src/components/CutImg.vue | 39 ++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/api/editModel.js b/src/api/editModel.js index 0d869b7..ce6a7cb 100644 --- a/src/api/editModel.js +++ b/src/api/editModel.js @@ -1,15 +1,15 @@ import request from '@/utils/request' - - +// https://smapitest.malls.iformall.com/C/api/upload/awsImgUpload +// https://smapitest.malls.iformall.com/C/api/ /** * @description 试听MP3 * @returns id */ - export function videoDetial(id) { - return request({ - url: `/api/userVideo/videoDetial?videoId=${id}`, - method: 'get', - }) +export function videoDetial(id) { + return request({ + url: `/api/userVideo/videoDetial?videoId=${id}`, + method: 'get', + }) } /** * @description 上传背景图 diff --git a/src/components/CutImg.vue b/src/components/CutImg.vue index 6da0cf4..4dffa1d 100644 --- a/src/components/CutImg.vue +++ b/src/components/CutImg.vue @@ -128,25 +128,28 @@ export default { // let formData = new FormData() this.loadingShow = true console.log(this.option) - // const AccessToken = localStorage.getItem - // this.$axios({ - // method: 'post', - // url: `https://smapitest.malls.iformall.com/C/api/upload/awsImgUpload`, - // headers: { - // 'Content-Type': 'application/json;charset=UTF-8', - // token: AccessToken, - // 'Access-Control-Allow-Credentials': true - // }, - // data: this.option.img - // }).then((res) => { - // console.log(res) - // this.loadingShow = false - // this.showCropper = false - // Toast.success('上传成功') - // }) - this.pushImg({ file: this.option.img }) + const AccessToken = localStorage.getItem('AccessToken') + this.$axios({ + method: 'post', + url: `https://smapitest.malls.iformall.com/C/api/upload/awsImgUpload`, + headers: { + // 'Content-Type': 'application/json;charset=UTF-8', + 'content-type': 'multipart/form-data', + token: AccessToken, + 'Access-Control-Allow-Credentials': true + }, + data: { file: this.option.img } + }).then((res) => { + console.log(res) + this.loadingShow = false + this.showCropper = false + Toast.success('上传成功') + }) + // this.pushImg({ file: this.option.img }) + // this.pushImg({ file: require('../assets/icon/icon-yes.png') }) this.$refs.cropper.getCropBlob((data) => { + console.log(data, 'blob') // let blob = window.URL.createObjectURL(data) // console.log(blob) // formData.append('File', data, this.imageFileName) @@ -175,9 +178,7 @@ export default { // 上传图片 async pushImg(data) { try { - console.log(data) const res = await awsImgUpload(data) - this.loadingShow = false this.showCropper = false Toast.success('上传成功')