Commit 266a6f4e by qinjianhui

feat: 项目搭建

parent 83348034
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
}
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
declare module 'vue' {
export interface GlobalComponents {
ElButton: typeof import('element-plus/es')['ElButton']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElInput: typeof import('element-plus/es')['ElInput']
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
NavMenu: typeof import('./src/components/navMenu.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
}
......@@ -2,9 +2,10 @@
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
<link ref="icon" type="image/x-icon" href="/favicon.ico"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>九猫工厂管理</title>
<title>九猫-工厂端</title>
</head>
<body>
<div id="app"></div>
......
......@@ -9,7 +9,9 @@
"preview": "vite preview"
},
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
"axios": "^1.6.7",
"element-plus": "^2.6.0",
"pinia": "^2.1.7",
"vue": "^3.4.19",
"vue-router": "^4.3.0"
......@@ -18,6 +20,9 @@
"@vitejs/plugin-vue": "^5.0.4",
"sass": "^1.71.1",
"typescript": "^5.2.2",
"unplugin-auto-import": "^0.17.5",
"unplugin-icons": "^0.18.5",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.1.4",
"vue-tsc": "^1.8.27"
}
......
<template>
<RouterView />
<el-config-provider size="small" :zIndex="1000">
<RouterView />
</el-config-provider>
</template>
<script setup lang="ts"></script>
<style lang="scss">
body {
margin: 0;
}
html,
body,
#app {
width: 100%;
height: 100%;
}
div {
box-sizing: border-box;
}
</style>
......@@ -2,5 +2,5 @@ import axios from './axios'
import { LoginReq, LoginResp } from '@/types/api/auth'
export function loginApi(data: LoginReq) {
return axios.post<LoginReq, LoginResp>('/login', data)
return axios.post<never, LoginResp>('/login', data)
}
<template>
<div class="nav-menu">
<div class="header-logo">
<img src="../assets/images/factory-logo.png" alt="logo" />
</div>
<!-- 导航栏 -->
</div>
</template>
<script setup lang="ts"></script>
<style lang="scss" scoped>
.nav-menu {
height: 60px;
background-color: #001529;
display: flex;
align-items: center;
padding: 0 40px;
}
.el-menu-demo {
flex: 1;
height: 100%;
border-bottom: none;
}
</style>
import { createRouter, createWebHistory } from 'vue-router'
import Login from '@/views/Login.vue'
import Reset from '@/views/Reset.vue'
import Home from '@/views/Home.vue'
import Dashboard from '@/views/Dashboard.vue'
const router = createRouter({
history: createWebHistory(),
routes: [
{
path: '/',
component: Home
}
]
redirect: '/user/login',
component: Home,
children: [
{
path: '/dashboard',
component: Dashboard,
},
],
},
// 登录
{
path: '/user/login',
component: Login,
},
{
path: '/user/reset',
component: Reset,
},
],
})
// router.beforeEach((to, from, next) => {
// })
export default router
import { User } from '..'
export interface LoginReq {
username: string
factoryNumber: string
iphone: string
password: string
}
......
<template>
<div class="dashboard">概览页面</div>
</template>
<script setup></script>
<style lang="scss" scoped>
.dashboard {
height: calc(100vh - 60px - 20px);
}
</style>
\ No newline at end of file
<template>
<div>我是首页</div>
<div class="home">
<!-- 顶部导航栏 -->
<navMenu></navMenu>
<div class="container">
<RouterView></RouterView>
</div>
</div>
</template>
<script setup lang="ts">
import useAppStore from '@/store/app'
import navMenu from '@/components/navMenu.vue'
const appStore = useAppStore()
const a = appStore.user
console.log(a)
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.home {
height: 100%;
display: flex;
flex-direction: column;
}
.container {
flex: 1;
padding: 10px;
}
</style>
import { defineConfig } from 'vite'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
plugins: [vue(), AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
})],
resolve: {
alias: { '@': '/src' },
},
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment