Skip to content

Commit d796a39

Browse files
author
奇淼(piexlmax
authored
Merge pull request #299 from tingfeng-key/patch-1
Update image.vue
2 parents e102f82 + e19bda9 commit d796a39

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

web/src/components/upload/image.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@
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"
1920
:multiple="false"
2021
>
21-
<img v-if="imageUrl" :src="imageUrl" class="image" />
22+
<img v-if="imageUrl" :src="path + imageUrl" class="image" />
2223
<i v-else class="el-icon-plus image-uploader-icon"></i>
2324
</el-upload>
2425
</div>
2526
</template>
2627
<script>
2728
const path = process.env.VUE_APP_BASE_API;
29+
import { mapGetters } from "vuex";
2830
import ImageCompress from "@/utils/image.js";
2931
export 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;
@@ -97,4 +102,4 @@ export default {
97102
height: 178px;
98103
display: block;
99104
}
100-
</style>
105+
</style>

0 commit comments

Comments
 (0)