Merge pull request 'fix:上传存图片路径之前取的缓存接口getUserProfile(),并且去掉前缀dev-api保证图片回显;' (#139) from yangws into main
Reviewed-on: #139
This commit is contained in:
commit
71fe8a0a8f
|
@ -29,7 +29,7 @@
|
||||||
@command="handleCommand"
|
@command="handleCommand"
|
||||||
>
|
>
|
||||||
<div class="avatar-wrapper">
|
<div class="avatar-wrapper">
|
||||||
<img :src="userStore.user.avatar" class="user-avatar" style="float: left" />
|
<img :src="dev_api + userStore.user.avatar" class="user-avatar" style="float: left" />
|
||||||
<div style="margin-top: 18px; font-size: 0.8em">{{ userStore.user.nickName }}</div>
|
<div style="margin-top: 18px; font-size: 0.8em">{{ userStore.user.nickName }}</div>
|
||||||
</div>
|
</div>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
|
@ -62,6 +62,7 @@ const { ipcRenderer } = window.electron || {}
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const currentRoute = ref('')
|
const currentRoute = ref('')
|
||||||
|
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
|
||||||
|
|
||||||
const handleOutLink = (path, type) => {
|
const handleOutLink = (path, type) => {
|
||||||
if (!path) return
|
if (!path) return
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<!-- 裁剪+效果 -->
|
<!-- 裁剪+效果 -->
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="box_1">
|
<div class="box_1">
|
||||||
<img :src="filePath" ref="image" />
|
<img :src="dev_api + filePath" ref="image" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--裁剪完的图片-->
|
<!--裁剪完的图片-->
|
||||||
|
@ -60,6 +60,7 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props, context) {
|
setup(props, context) {
|
||||||
|
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
|
||||||
|
|
||||||
// 原生上传的文件
|
// 原生上传的文件
|
||||||
const uploadImg = (e) => {
|
const uploadImg = (e) => {
|
||||||
|
@ -163,7 +164,7 @@ export default {
|
||||||
// 页面刷新自动执行
|
// 页面刷新自动执行
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.filePath) {
|
if (props.filePath) {
|
||||||
dataFile.image.src = props.filePath;
|
dataFile.image.src = dev_api.value + props.filePath;
|
||||||
copper();
|
copper();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -175,6 +176,7 @@ export default {
|
||||||
uploadImg,
|
uploadImg,
|
||||||
upLoading,
|
upLoading,
|
||||||
cancle,
|
cancle,
|
||||||
|
dev_api
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="user-info-head" @click="editCropper()">
|
<div class="user-info-head" @click="editCropper()">
|
||||||
<img :src="options.img" title="点击上传头像" class="img-circle img-lg" />
|
<img :src="dev_api + options.img" title="点击上传头像" class="img-circle img-lg" />
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-model="open"
|
v-model="open"
|
||||||
append-to-body
|
append-to-body
|
||||||
|
@ -28,6 +28,7 @@ const userStore = useUserStore()
|
||||||
|
|
||||||
const open = ref(false)
|
const open = ref(false)
|
||||||
const visible = ref(false)
|
const visible = ref(false)
|
||||||
|
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
|
||||||
|
|
||||||
//图片裁剪数据
|
//图片裁剪数据
|
||||||
const options = reactive({
|
const options = reactive({
|
||||||
|
@ -56,7 +57,7 @@ function uploadImg(data) {
|
||||||
formData.append('avatarfile', data)
|
formData.append('avatarfile', data)
|
||||||
uploadAvatar(formData).then((response) => {
|
uploadAvatar(formData).then((response) => {
|
||||||
open.value = false
|
open.value = false
|
||||||
options.img = import.meta.env.VITE_APP_BASE_API + response.imgUrl
|
options.img = response.imgUrl
|
||||||
userStore.user.avatar = options.img
|
userStore.user.avatar = options.img
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '上传成功',
|
message: '上传成功',
|
||||||
|
|
Loading…
Reference in New Issue