-- 用户头像

This commit is contained in:
yuping
2022-12-22 13:03:17 +08:00
parent 4ca82e4333
commit 1b55af84e3
4 changed files with 11 additions and 9 deletions

View File

@@ -32,16 +32,17 @@
</router-link> </router-link>
</div> --> </div> -->
<main style="z-index: 2"> <main style="z-index: 2">
<router-view /> <router-view/>
</main> </main>
</div> </div>
</template> </template>
<script setup> <script setup>
import { boeRequest } from "@/api/request"; import {boeRequest} from "@/api/request";
import { GET_USER_INFO } from "@/api/ThirdApi"; import {GET_USER_INFO} from "@/api/ThirdApi";
import { useStore } from "vuex"; import {useStore} from "vuex";
import { onMounted } from "vue"; import {onMounted} from "vue";
import router from "@/router"; import router from "@/router";
console.log("版本0.9.3------------"); console.log("版本0.9.3------------");
const store = useStore(); const store = useStore();
onMounted(() => { onMounted(() => {
@@ -50,6 +51,7 @@ onMounted(() => {
function getUserInfo() { function getUserInfo() {
boeRequest(GET_USER_INFO).then((res) => { boeRequest(GET_USER_INFO).then((res) => {
res.result.avatar = import.meta.env.VITE_BOE_API_URL + '/upload' + (res.result.avatar ? res.result.avatar : '/800e23f7-b58c-4192-820d-0c6a2b7544cc.png')
store.commit("SET_USER", res.result); store.commit("SET_USER", res.result);
}); });
} }
@@ -59,7 +61,7 @@ function getUserInfo() {
// font-family: MicrosoftYaHei, Microsoft YaHei, Avenir, Helvetica, Arial, // font-family: MicrosoftYaHei, Microsoft YaHei, Avenir, Helvetica, Arial,
// sans-serif; // sans-serif;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
Microsoft YaHei, Arial, sans-serif; Microsoft YaHei, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
color: #2c3e50; color: #2c3e50;

View File

@@ -21,7 +21,7 @@ export function useUserInfo(id) {
watch(id, () => { watch(id, () => {
id.value && boeRequest(GET_USER_LIST, {id: id.value}).then(res => { id.value && boeRequest(GET_USER_LIST, {id: id.value}).then(res => {
userInfo.value = res.result.userInfoList[0] userInfo.value = res.result.userInfoList[0]
userInfo.value.avatar = `/upload${userInfo.value.avatar}` userInfo.value.avatar = `${import.meta.env.VITE_BOE_API_URL}/upload${userInfo.value.avatar?userInfo.value.avatar:'/800e23f7-b58c-4192-820d-0c6a2b7544cc.png'}`
}) })
}) })
return userInfo return userInfo

View File

@@ -143,7 +143,7 @@
</div> </div>
<!-- todo #路径详情 个人信息缺少img和介绍--> <!-- todo #路径详情 个人信息缺少img和介绍-->
<div class="teacheritem" :style="{ 'border-bottom': '1px solid rgba(56, 125, 247, 0.2)' }"> <div class="teacheritem" :style="{ 'border-bottom': '1px solid rgba(56, 125, 247, 0.2)' }">
<img class="peopleimg" :src="`/upload${userInfo.avatar}`" /> <img class="peopleimg" :src="userInfo.avatar" />
<div style="margin-left: 17px"> <div style="margin-left: 17px">
<div class="teacherName"> <div class="teacherName">
<div style="margin-right: 5px"> <div style="margin-right: 5px">

View File

@@ -191,7 +191,7 @@
class="teacheritem" class="teacheritem"
:style="{ 'border-bottom': '1px solid rgba(56, 125, 247, 0.2)' }" :style="{ 'border-bottom': '1px solid rgba(56, 125, 247, 0.2)' }"
> >
<img class="peopleimg" :src="`/upload${userInfo.avatar}`"/> <img class="peopleimg" :src="userInfo.avatar"/>
<div style="margin-left: 17px"> <div style="margin-left: 17px">
<div class="teacherName"> <div class="teacherName">
<div style="margin-right: 5px"> <div style="margin-right: 5px">