首页更新

This commit is contained in:
heixinyouzi 2024-11-07 17:02:32 +08:00
parent 9a1cf9dd53
commit d3086e38cf
7 changed files with 28 additions and 19 deletions

BIN
src/assets/youzi_title.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
src/assets/柚子娘.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

View File

@ -1,6 +1,10 @@
<template> <template>
<div class="box flex justify-between items-center md:py-1" ref="menuH"> <div class="box flex justify-between items-center md:py-1 h-[50px]" ref="menuH">
<div class="md:hidden"> <div class="md:hidden flex items-center">
<div class="logo ml-8 mr-20 flex items-center" @click="toHome">
<img class="rounded-full" src="@/assets/柚子娘.jpg" width="40" alt="">
<img src="@/assets/youzi_title.png" width="200" height="50" alt="">
</div>
<n-menu v-model:value="activeKey" :options="menuInfo.options" mode="horizontal" /> <n-menu v-model:value="activeKey" :options="menuInfo.options" mode="horizontal" />
</div> </div>
<n-icon size="30" class="menuIcon ml-2 hidden md:block text-pp-500" @click="active = true"> <n-icon size="30" class="menuIcon ml-2 hidden md:block text-pp-500" @click="active = true">
@ -94,7 +98,7 @@ menuInfo.menuList.forEach((i, idx) => {
activeKey.value = idx + 1 + ""; activeKey.value = idx + 1 + "";
} }
}); });
const homeItem = ref(null)
onMounted(() => { onMounted(() => {
// console.log(5555, setMenu); // console.log(5555, setMenu);
setMenuH(menuH.value.clientHeight); setMenuH(menuH.value.clientHeight);
@ -103,6 +107,12 @@ onMounted(() => {
function goLogin() { function goLogin() {
push("/login"); push("/login");
} }
function toHome() {
push("/home");
const i = document.querySelector(".n-menu-item .n-menu-item-content-header");
i.click();
}
function handleSelect(k) { function handleSelect(k) {
switch (k) { switch (k) {
case "logout": case "logout":

View File

@ -1,18 +1,16 @@
import orange from "@/icon/orange.svg";
import { NIcon } from "naive-ui";
import { RouterLink } from "vue-router"; import { RouterLink } from "vue-router";
const menuInfo = { const menuInfo = {
options: [ options: [
{ // {
label: () => "", // label: () => "",
key: "0", // key: "0",
disabled: true, // disabled: true,
icon: () => h(NIcon, { class: "orange" }, { default: () => h(orange) }), // icon: () => h(NIcon, { class: "orange" }, { default: () => h(orange) }),
}, // },
{ {
key: "1", key: "1",
label: () => h(RouterLink, { to: "/home", class: "menu-item font-[500] text-lg" }, { default: () => "首页" }), label: () => h(RouterLink, { ref:"homeItem",to: "/home", class: "menu-item font-[500] text-lg" }, { default: () => "首页" }),
}, },
{ {
key: "2", key: "2",

View File

@ -4,7 +4,7 @@
<n-layout> <n-layout>
<n-layout has-sider> <n-layout has-sider>
<n-layout-content class="sm:w-[90vh] w-[70%]" :content-style="{ height: `calc(100vh - ${size.menuH}px)`,backgroundColor:'#f1f2f3' }"> <n-layout-content class="sm:w-[90vh] w-[70%]" :content-style="{ height: `calc(100vh - ${size.menuH}px)`,backgroundColor:'#f1f2f3' }">
<n-scrollbar class="pt-6" trigger="hover" :style="{ height: `calc(100vh - ${size.menuH}px)` }"> <n-scrollbar class="" trigger="hover" :style="{ height: `calc(100vh - ${size.menuH}px)` }">
<search></search> <search></search>
<NavMenu /> <NavMenu />
</n-scrollbar> </n-scrollbar>

View File

@ -13,13 +13,14 @@
</div> </div>
</template> </template>
<div class="flex flex-wrap items-center"> <div class="flex flex-wrap items-center">
<div class="w-[200px] mr-20 mt-6" v-for="j in i.children"> <div class="w-[200px] mr-20 mt-6" v-for="(j,ii) in i.children">
<n-popover trigger="hover" animated :delay="1000" width="trigger"> <n-popover trigger="hover" animated :delay="1000" width="trigger">
<template #trigger> <template #trigger>
<div> <div>
<n-button @click="link(j.menuLink)" class="btn w-full hover:bg-pp-500 hover:text-[white]" type="primary" ghost> <n-button @click="link(j.menuLink)" class="btn w-full hover:bg-pp-500 hover:text-[white]" type="primary" ghost>
<template #icon> <template #icon>
<img width="20" height="20" class="mr-2" :src="j.menuIcon" alt=""> <img v-if="!j.exp" width="20" height="20" class="mr-2" :src="j.menuIcon" alt="" @error="navList[idx].children[ii].exp=true">
<div :style="{backgroundColor:j.color}" class="w-[20px] h-[20px] text-[12px] text-[white] rounded-full flex justify-center items-center" v-else>{{ j.menuName[0] }}</div>
</template> </template>
{{ j.menuName }} {{ j.menuName }}
</n-button> </n-button>

View File

@ -33,20 +33,20 @@
import phone2qq from './component/phone2qq.vue'; import phone2qq from './component/phone2qq.vue';
import qq2phone from './component/qq2phone.vue'; import qq2phone from './component/qq2phone.vue';
//mark data //mark data
const comp = ref(null); const comp = ref(markRaw(qq2phone),);
const title = ref(''); const title = ref('QQ号查手机号');
const widgets = ref([{ const widgets = ref([{
name: 'qq2phone', name: 'qq2phone',
comp: markRaw(qq2phone), comp: markRaw(qq2phone),
title: 'QQ号查手机号', title: 'QQ号查手机号',
desc: "请勿乱用,打扰别人生活!", desc: "请勿乱用,打扰别人生活!",
show: false show: true
}, { }, {
name: 'phone2qq', name: 'phone2qq',
comp: markRaw(phone2qq), comp: markRaw(phone2qq),
title: '手机号查QQ号', title: '手机号查QQ号',
desc: "请勿乱用,打扰别人生活!", desc: "请勿乱用,打扰别人生活!",
show: false show: true
}]); }]);