File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
web/src/components/upload Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1313 <el-upload
1414 class =" image-uploader"
1515 :action =" `${path}/fileUploadAndDownload/upload`"
16+ :headers =" { 'x-token': token }"
1617 :show-file-list =" false"
1718 :on-success =" handleImageSuccess"
1819 :before-upload =" beforeImageUpload"
2526</template >
2627<script >
2728const path = process .env .VUE_APP_BASE_API ;
29+ import { mapGetters } from " vuex" ;
2830import ImageCompress from " @/utils/image.js" ;
2931export default {
3032 name: " upload-image" ,
@@ -51,6 +53,9 @@ export default {
5153 path: path,
5254 };
5355 },
56+ computed: {
57+ ... mapGetters (" user" , [" userInfo" , " token" ]),
58+ },
5459 methods: {
5560 beforeImageUpload (file ) {
5661 let isRightSize = file .size / 1024 < this .fileSize ;
@@ -65,7 +70,7 @@ export default {
6570 // this.imageUrl = URL.createObjectURL(file.raw);
6671 const { data } = res;
6772 if (data .file ) {
68- this .$emit (" change" , data .file .url );
73+ this .$emit (" change" , this . path + data .file .url );
6974 }
7075 },
7176 },
@@ -97,4 +102,4 @@ export default {
97102 height : 178px ;
98103 display : block ;
99104}
100- </style >
105+ </style >
You can’t perform that action at this time.
0 commit comments