首页
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m37s

This commit is contained in:
youzi 2024-12-26 20:07:27 +08:00
parent 37f969c4e6
commit 5a386f8a66
3 changed files with 85 additions and 33 deletions

View File

@ -10,11 +10,11 @@
<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">
<MdMenu /> <MdMenu />
</n-icon> </n-icon>
<div class="right flex items-center">
<div class="wea text-white md:hidden"> <div class="wea text-white md:hidden">
<wea /> <wea />
</div> </div>
<div class="right flex items-center">
<div v-if="!userinfo" class="login mx-8"> <div v-if="!userinfo" class="login mx-8">
<n-button color="#8a2be2" size="small" @click="goLogin">登录</n-button> <n-button color="#8a2be2" size="small" @click="goLogin">登录</n-button>
</div> </div>
@ -22,10 +22,10 @@
<n-dropdown :options="userOp" @select="handleSelect" :show-arrow="true"> <n-dropdown :options="userOp" @select="handleSelect" :show-arrow="true">
<div class="uinfo mx-8 text-white flex items-center"> <div class="uinfo mx-8 text-white flex items-center">
<div class="ava flex items-center justify-center"> <div class="ava flex items-center justify-center">
<n-avatar round size="medium" :src="userinfo.avaUrl" /> <n-avatar round size="small" :src="userinfo.avaUrl" />
</div> </div>
<div class="ml-2"></div> <div class="ml-2"></div>
<n-button text class="userinfo"> <n-button text class="userinfo text-pp-500">
{{ userinfo.nickname }} {{ userinfo.nickname }}
</n-button> </n-button>
</div> </div>
@ -162,13 +162,13 @@ function goConsole() {
.boxxx { .boxxx {
background: transparent url("../assets/cstyle/花边.png") no-repeat center center/100% 100% !important; background: transparent url("../assets/cstyle/花边.png") no-repeat center center/100% 100% !important;
} }
.ava { .ava {
// background-color: red ; // background-color: red ;
background: transparent url("../assets/cstyle/中秋节中国风边框3.png") no-repeat center center/100% 100% !important; background: transparent url("../assets/cstyle/中秋节中国风边框3.png") no-repeat center center/100% 100% !important;
border-radius: 50%; border-radius: 50%;
width: 40px;
height: 40px;
} }
.login { .login {
:deep(.n-button) { :deep(.n-button) {
background-color: @purple; background-color: @purple;
@ -176,13 +176,8 @@ function goConsole() {
} }
} }
:deep(.orange) {
color: #ffa500;
font-size: 24px;
}
:deep(.menu-item) { :deep(.menu-item) {
color: @orange !important; color: rgb(73, 117, 104) !important;
} }
:deep(.router-link-active) { :deep(.router-link-active) {

View File

@ -34,7 +34,7 @@ function getH() {
<style scoped lang="less"> <style scoped lang="less">
.boxx { .boxx {
background: transparent url('../assets/bg/06.jpeg') no-repeat center center !important; background: transparent url('../assets/bg/07.jpeg') no-repeat center center !important;
} }
// :deep(.n-layout-header) { // :deep(.n-layout-header) {

View File

@ -6,7 +6,7 @@
<div class="w-[200px] my-4" v-for="(i, ii) in navList"> <div class="w-[200px] my-4" v-for="(i, ii) in navList">
<n-button @click="link(i.menuLink)" class="btn w-full hover:text-[white]" type="primary" ghost> <n-button @click="link(i.menuLink)" class="btn w-full hover:text-[white]" type="primary" ghost>
<template #icon> <template #icon>
<img v-if="!i.exp" width="20" height="20" class="mr-2" :src="i.menuIcon" alt="" @error="i.exp = true"> <img v-if="!i.exp" width="20" height="20" class="mr-2" :src="'https://favicon.im/' + i.menuLink.split('/')[2]" alt="" @error="i.exp = true">
<div :style="{ backgroundColor: i.color }" <div :style="{ backgroundColor: i.color }"
class="w-[20px] h-[20px] text-[12px] text-[white] rounded-full flex justify-center items-center" class="w-[20px] h-[20px] text-[12px] text-[white] rounded-full flex justify-center items-center"
v-else>{{ i.menuName[0] }}</div> v-else>{{ i.menuName[0] }}</div>
@ -15,7 +15,7 @@
</n-button> </n-button>
</div> </div>
<div class="w-[200px] my-4"> <div class="w-[200px] my-4">
<n-button @click="addMenu" class="btn w-full hover:text-[white]" type="primary" ghost> <n-button @click="addMenu" class="btn w-full text-2xl hover:text-[white]" type="primary" ghost>
+ +
</n-button> </n-button>
</div> </div>
@ -24,11 +24,36 @@
</n-scrollbar> </n-scrollbar>
</n-card> </n-card>
<n-modal v-model:show="showModal">
<n-card class="w-1/4">
<div class="title text-3xl text-center my-8 text-pp-700">
添加菜单
</div>
<n-form :model="formData" ref="formRef" label-width="80" label-placement="left">
<n-form-item-row class="mt-4" path="menuName">
<n-input v-model:value="formData.menuName" placeholder="导航名称" />
</n-form-item-row>
<n-form-item-row class="mt-4" path="menuLink">
<n-input v-model:value="formData.menuLink" placeholder="导航链接" />
</n-form-item-row>
<n-form-item-row v-if="formData.menuLink" class="mt-4">
<img class="mx-auto" width="20" height="20" :src="'https://favicon.im/' + formData.menuLink.split('/')[2]"
alt="" />
</n-form-item-row>
<n-form-item-row class="mt-4">
<n-button class="w-2/5 ml-[5%]" @click="onCancel">取消</n-button>
<n-button class="w-2/5 ml-[10%]" type="primary" @click="onSubmit">立即创建</n-button>
</n-form-item-row>
</n-form>
</n-card>
</n-modal>
</div> </div>
</template> </template>
<script setup> <script setup>
import { onMounted } from 'vue'; import { onMounted, reactive } from 'vue';
import cookie from "vue-cookies"; import cookie from "vue-cookies";
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -43,6 +68,12 @@ const userinfo = cookie.get("userinfo");
const router = useRouter() const router = useRouter()
const fullPath = router.currentRoute.value.fullPath const fullPath = router.currentRoute.value.fullPath
const { push } = router; const { push } = router;
const showModal = ref(false)
const formData = reactive({
menuName: "",
menuLink: "",
menuIcon:"#"
})
//mark method //mark method
async function getNav() { async function getNav() {
let res = {} let res = {}
@ -59,7 +90,9 @@ async function getNav() {
} }
function addMenu() { function addMenu() {
if (!!token && !!userinfo) {} if (!!token && !!userinfo) {
showModal.value = true
}
else { else {
$dialog.success({ $dialog.success({
title: "该功能能需要登录账号", title: "该功能能需要登录账号",
@ -78,6 +111,30 @@ function addMenu() {
} }
} }
async function onSubmit() {
if (!formData.menuName) {
$msg.error("请输入导航名称");
return
}
if (!formData.menuLink) {
$msg.error('请输入导航链接');
return
}
const res = await $http.nav.addMenu(formData)
if (res.code == 1) {
$msg.success(res.msg);
onCancel()
getNav()
}
else {
$msg.error(res.msg);
}
}
function onCancel() {
formData.menuName = ""
formData.menuLink = ""
showModal.value = false
}
function link(url) { function link(url) {
window.open(url, "_blank") window.open(url, "_blank")
} }