|
@@ -13,18 +13,20 @@
|
|
|
<el-upload
|
|
|
class="image-uploader"
|
|
|
:action="`${path}/fileUploadAndDownload/upload`"
|
|
|
+ :headers="{ 'x-token': token }"
|
|
|
:show-file-list="false"
|
|
|
:on-success="handleImageSuccess"
|
|
|
:before-upload="beforeImageUpload"
|
|
|
:multiple="false"
|
|
|
>
|
|
|
- <img v-if="imageUrl" :src="imageUrl" class="image" />
|
|
|
+ <img v-if="imageUrl" :src="path + imageUrl" class="image" />
|
|
|
<i v-else class="el-icon-plus image-uploader-icon"></i>
|
|
|
</el-upload>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
const path = process.env.VUE_APP_BASE_API;
|
|
|
+import { mapGetters } from "vuex";
|
|
|
import ImageCompress from "@/utils/image.js";
|
|
|
export default {
|
|
|
name: "upload-image",
|
|
@@ -51,6 +53,9 @@ export default {
|
|
|
path: path,
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...mapGetters("user", ["userInfo", "token"]),
|
|
|
+ },
|
|
|
methods: {
|
|
|
beforeImageUpload(file) {
|
|
|
let isRightSize = file.size / 1024 < this.fileSize;
|
|
@@ -97,4 +102,4 @@ export default {
|
|
|
height: 178px;
|
|
|
display: block;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|