Refactor API requests and update global methods

This commit is contained in:
wangqiao
2025-08-24 16:46:10 +08:00
parent 366b48188d
commit 9bc983793f
4 changed files with 25 additions and 22 deletions

View File

@ -37,7 +37,7 @@
</div>
<div class="absolute right-[10px] flex items-center">
<div class="h-[36px] w-[36px] border-rd-[50%] bg-[#F5F5F5] text-center line-height-[44px]">
<img v-if="!isLogin" src="~/assets/images/user.png" alt="" srcset="" class="h-[19px] w-[17px]" />
<img v-if="!isLogin" src="~/assets/images/user.png" alt="" srcset="" class="h-[19px] w-[17px] relative top-[7px] left-[10px]" />
<img v-else :src="userStore.userInfoRes.avatar" alt="" srcset="" class="h-[19px] w-[17px] rd-[50%]" />
</div>
<span v-if="!isLogin" class="ml-[14px] cursor-pointer text-[14px] text-[#1A65FF] font-normal" @click="handleLogin">立即登录</span>
@ -69,8 +69,7 @@
import { Search } from '@element-plus/icons-vue'
import useUserStore from '~/store/user'
const userStore = useUserStore()
const { $openLogin } = useNuxtApp()
const app = useNuxtApp()
const props = defineProps({
active: {
@ -174,7 +173,7 @@
}
}
const handleLogin = () => {
// $openLogin()
app?.$openLogin() // 调用全局方法
}
const handleCommand = (command: string) => {
if (command === '退出') {