Add admin-frontend and user-frontend standalone projects, certification/invoice/discovery features, fix auth header and theme consistency
This commit is contained in:
+5
-199
@@ -1,207 +1,13 @@
|
||||
<template>
|
||||
<div class="app-wrapper">
|
||||
<div class="app-nav" id="appNav">
|
||||
<div class="app-nav-brand">TradeMate</div>
|
||||
<div
|
||||
v-for="(item, index) in navList"
|
||||
:key="index"
|
||||
class="app-nav-item"
|
||||
:class="{ active: currentIndex === index }"
|
||||
@click="switchTab(index)"
|
||||
>
|
||||
<span class="app-nav-icon">{{ item.icon }}</span>
|
||||
<span class="app-nav-text">{{ item.text }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<router-view />
|
||||
</div>
|
||||
<router-view />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
|
||||
const currentIndex = ref(0)
|
||||
|
||||
const navList = [
|
||||
{ pagePath: '/pages/index/index', text: '首页', icon: '🏠' },
|
||||
{ pagePath: '/pages/customers/customers', text: '客户', icon: '👥' },
|
||||
{ pagePath: '/pages/marketing/marketing', text: '营销', icon: '📢' },
|
||||
{ pagePath: '/pages/quotation/quotation', text: '报价', icon: '📄' },
|
||||
{ pagePath: '/pages/profile/profile', text: '我的', icon: '👤' },
|
||||
]
|
||||
|
||||
const updateCurrentIndex = () => {
|
||||
const hash = window.location.hash || ''
|
||||
for (let i = 0; i < navList.length; i++) {
|
||||
if (hash.includes(navList[i].pagePath)) {
|
||||
currentIndex.value = i
|
||||
return
|
||||
}
|
||||
}
|
||||
currentIndex.value = 0
|
||||
}
|
||||
|
||||
const switchTab = (index) => {
|
||||
if (currentIndex.value === index) return
|
||||
uni.switchTab({ url: navList[index].pagePath })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
updateCurrentIndex()
|
||||
window.addEventListener('hashchange', updateCurrentIndex)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('hashchange', updateCurrentIndex)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* Global reset */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html, body, #app {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Let uni-app pages scroll */
|
||||
uni-page {
|
||||
overflow-y: auto !important;
|
||||
}
|
||||
uni-page-body {
|
||||
overflow-y: auto !important;
|
||||
min-height: 100% !important;
|
||||
}
|
||||
|
||||
/* ===== Nav: hidden on mobile (uni-app default tab bar is used) ===== */
|
||||
.app-nav {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ===== Desktop responsive (≥1024px) ===== */
|
||||
@media (min-width: 1024px) {
|
||||
/* Sidebar nav */
|
||||
.app-nav {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 220px;
|
||||
height: 100vh;
|
||||
background: #fff;
|
||||
box-shadow: 4px 0 16px rgba(0,0,0,0.08);
|
||||
z-index: 999999;
|
||||
border-right: 1px solid #e0e0e0;
|
||||
padding-top: 24px;
|
||||
}
|
||||
|
||||
.app-nav-brand {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #1890ff;
|
||||
padding: 20px 24px 32px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.app-nav-item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
padding: 14px 24px;
|
||||
margin: 2px 12px;
|
||||
border-radius: 12px;
|
||||
gap: 14px;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.app-nav-item:hover {
|
||||
background: #f0f7ff;
|
||||
}
|
||||
|
||||
.app-nav-item.active {
|
||||
background: #e6f0ff;
|
||||
}
|
||||
|
||||
.app-nav-icon {
|
||||
font-size: 22px;
|
||||
line-height: 1;
|
||||
font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
|
||||
}
|
||||
|
||||
.app-nav-text {
|
||||
font-size: 15px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.app-nav-item.active .app-nav-text {
|
||||
color: #1890ff;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* Hide the built-in uni-app tab bar on desktop */
|
||||
uni-tabbar {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Sidebar — shift page content right */
|
||||
uni-page-body {
|
||||
margin-left: 220px !important;
|
||||
font-size: 16px !important;
|
||||
}
|
||||
|
||||
/* Remove the tab-bar-height bottom padding that uni-app adds for tab pages */
|
||||
.uni-app--showtabbar uni-page-wrapper:after {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Constrain + center page content */
|
||||
uni-page-body > view {
|
||||
max-width: 1200px !important;
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
padding: 40px 48px !important;
|
||||
}
|
||||
|
||||
/* Cards more breathing room */
|
||||
uni-page-body .card {
|
||||
padding: 32px !important;
|
||||
border-radius: 20px !important;
|
||||
}
|
||||
|
||||
/* Buttons: reasonable desktop sizing */
|
||||
uni-page-body button,
|
||||
uni-page-body .btn-primary,
|
||||
uni-page-body .btn-secondary,
|
||||
uni-page-body .uni-btn,
|
||||
uni-page-body [class*="btn-"] {
|
||||
min-width: 120px;
|
||||
padding: 12px 32px !important;
|
||||
font-size: 15px !important;
|
||||
}
|
||||
|
||||
/* Inputs */
|
||||
uni-page-body input,
|
||||
uni-page-body textarea,
|
||||
uni-page-body .uni-input-input {
|
||||
font-size: 15px !important;
|
||||
padding: 10px 16px !important;
|
||||
}
|
||||
|
||||
/* Fix floating AI assistant (clear sidebar) */
|
||||
.ai-float-btn {
|
||||
right: 40px !important;
|
||||
bottom: 40px !important;
|
||||
}
|
||||
.ai-dialog {
|
||||
right: 40px !important;
|
||||
bottom: 100px !important;
|
||||
}
|
||||
}
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body, #app { height: 100%; width: 100%; }
|
||||
uni-page { overflow-y: auto !important; }
|
||||
uni-page-body { overflow-y: auto !important; min-height: 100% !important; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user