mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-14 05:16:47 +08:00
init
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
import {watch, ref} from "vue";
|
||||
import {boeRequest} from "@/api/request";
|
||||
import {BASE, GET_USER_LIST} from "@/api/ThirdApi";
|
||||
|
||||
export function useImage(src) {
|
||||
return new URL(`../assets/image/${src}`, import.meta.url).href
|
||||
}
|
||||
@@ -10,4 +14,14 @@ export function setCookie(name, value, perpetual) {
|
||||
|
||||
export function getCookie(name) {
|
||||
return document.cookie?.split(";").find(e => e.includes(name)).replace(`${name}=`, '') || ''
|
||||
}
|
||||
|
||||
export function useUserInfoAvatar(id) {
|
||||
const avatar = ref(import.meta.env.DEV ? `${BASE}/upload` : '')
|
||||
watch(id, () => {
|
||||
id.value && boeRequest(GET_USER_LIST, {id: id.value}).then(res => {
|
||||
avatar.value = avatar.value + res.result.userInfoList[0].avatar
|
||||
})
|
||||
})
|
||||
return avatar
|
||||
}
|
||||
Reference in New Issue
Block a user