Browse Source

添加登录页

feature/debug
zhangjiming 5 months ago
parent
commit
fe51239458
  1. 185
      package-lock.json
  2. 1
      package.json
  3. 1
      src/App.vue
  4. BIN
      src/assets/bg.jpg
  5. 1
      src/assets/icon_logo.svg
  6. 1
      src/assets/icon_pwd.svg
  7. 1
      src/assets/icon_user.svg
  8. 3
      src/main.ts
  9. 74
      src/router/index.ts
  10. 9
      src/views/Index.vue
  11. 95
      src/views/Login.vue

185
package-lock.json

@ -11,6 +11,7 @@
"@vueuse/rxjs": "^12.5.0",
"axios": "^1.7.9",
"dayjs": "^1.11.13",
"element-plus": "^2.9.5",
"pinia": "^2.3.0",
"ramda": "^0.30.1",
"rxjs": "^7.8.1",
@ -519,6 +520,24 @@
"node": ">=6.9.0"
}
},
"node_modules/@ctrl/tinycolor": {
"version": "3.6.1",
"resolved": "https://registry.npmmirror.com/@ctrl/tinycolor/-/tinycolor-3.6.1.tgz",
"integrity": "sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA==",
"license": "MIT",
"engines": {
"node": ">=10"
}
},
"node_modules/@element-plus/icons-vue": {
"version": "2.3.1",
"resolved": "https://registry.npmmirror.com/@element-plus/icons-vue/-/icons-vue-2.3.1.tgz",
"integrity": "sha512-XxVUZv48RZAd87ucGS48jPf6pKu0yV5UCg9f4FFwtrYxXOwWuVJo6wOvSLKEoMQKjv8GsX/mhP6UsC1lRwbUWg==",
"license": "MIT",
"peerDependencies": {
"vue": "^3.2.0"
}
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.24.2",
"resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.24.2.tgz",
@ -944,6 +963,31 @@
"node": ">=18"
}
},
"node_modules/@floating-ui/core": {
"version": "1.6.9",
"resolved": "https://registry.npmmirror.com/@floating-ui/core/-/core-1.6.9.tgz",
"integrity": "sha512-uMXCuQ3BItDUbAMhIXw7UPXRfAlOAvZzdK9BWpE60MCn+Svt3aLn9jsPTi/WNGlRUu2uI0v5S7JiIUsbsvh3fw==",
"license": "MIT",
"dependencies": {
"@floating-ui/utils": "^0.2.9"
}
},
"node_modules/@floating-ui/dom": {
"version": "1.6.13",
"resolved": "https://registry.npmmirror.com/@floating-ui/dom/-/dom-1.6.13.tgz",
"integrity": "sha512-umqzocjDgNRGTuO7Q8CU32dkHkECqI8ZdMZ5Swb6QAM0t5rnlrN3lGo1hdpscRd3WS8T6DKYK4ephgIH9iRh3w==",
"license": "MIT",
"dependencies": {
"@floating-ui/core": "^1.6.0",
"@floating-ui/utils": "^0.2.9"
}
},
"node_modules/@floating-ui/utils": {
"version": "0.2.9",
"resolved": "https://registry.npmmirror.com/@floating-ui/utils/-/utils-0.2.9.tgz",
"integrity": "sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg==",
"license": "MIT"
},
"node_modules/@isaacs/cliui": {
"version": "8.0.2",
"resolved": "https://registry.npmmirror.com/@isaacs/cliui/-/cliui-8.0.2.tgz",
@ -1070,6 +1114,17 @@
"dev": true,
"license": "MIT"
},
"node_modules/@popperjs/core": {
"name": "@sxzz/popperjs-es",
"version": "2.11.7",
"resolved": "https://registry.npmmirror.com/@sxzz/popperjs-es/-/popperjs-es-2.11.7.tgz",
"integrity": "sha512-Ccy0NlLkzr0Ex2FKvh2X+OyERHXJ88XJ1MXtsI9y9fGexlaXaVTPzBCRBwIxFkORuOb+uBqeu+RqnpgYTEZRUQ==",
"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/popperjs"
}
},
"node_modules/@rollup/pluginutils": {
"version": "5.1.4",
"resolved": "https://registry.npmmirror.com/@rollup/pluginutils/-/pluginutils-5.1.4.tgz",
@ -1393,6 +1448,21 @@
"dev": true,
"license": "MIT"
},
"node_modules/@types/lodash": {
"version": "4.17.15",
"resolved": "https://registry.npmmirror.com/@types/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-w/P33JFeySuhN6JLkysYUK2gEmy9kHHFN7E8ro0tkfmlDOgxBDzWEZ/J8cWA+fHqFevpswDTFZnDx+R9lbL6xw==",
"license": "MIT"
},
"node_modules/@types/lodash-es": {
"version": "4.17.12",
"resolved": "https://registry.npmmirror.com/@types/lodash-es/-/lodash-es-4.17.12.tgz",
"integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==",
"license": "MIT",
"dependencies": {
"@types/lodash": "*"
}
},
"node_modules/@types/node": {
"version": "22.10.7",
"resolved": "https://registry.npmmirror.com/@types/node/-/node-22.10.7.tgz",
@ -1552,6 +1622,12 @@
"@types/rx-lite": "*"
}
},
"node_modules/@types/web-bluetooth": {
"version": "0.0.16",
"resolved": "https://registry.npmmirror.com/@types/web-bluetooth/-/web-bluetooth-0.0.16.tgz",
"integrity": "sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==",
"license": "MIT"
},
"node_modules/@vant/popperjs": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/@vant/popperjs/-/popperjs-1.3.0.tgz",
@ -1904,6 +1980,42 @@
}
}
},
"node_modules/@vueuse/core": {
"version": "9.13.0",
"resolved": "https://registry.npmmirror.com/@vueuse/core/-/core-9.13.0.tgz",
"integrity": "sha512-pujnclbeHWxxPRqXWmdkKV5OX4Wk4YeK7wusHqRwU0Q7EFusHoqNA/aPhB6KCh9hEqJkLAJo7bb0Lh9b+OIVzw==",
"license": "MIT",
"dependencies": {
"@types/web-bluetooth": "^0.0.16",
"@vueuse/metadata": "9.13.0",
"@vueuse/shared": "9.13.0",
"vue-demi": "*"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vueuse/core/node_modules/@vueuse/shared": {
"version": "9.13.0",
"resolved": "https://registry.npmmirror.com/@vueuse/shared/-/shared-9.13.0.tgz",
"integrity": "sha512-UrnhU+Cnufu4S6JLCPZnkWh0WwZGUp72ktOF2DFptMlOs3TOdVv8xJN53zhHGARmVOsz5KqOls09+J1NR6sBKw==",
"license": "MIT",
"dependencies": {
"vue-demi": "*"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vueuse/metadata": {
"version": "9.13.0",
"resolved": "https://registry.npmmirror.com/@vueuse/metadata/-/metadata-9.13.0.tgz",
"integrity": "sha512-gdU7TKNAUVlXXLbaF+ZCfte8BjRJQWPCa2J55+7/h+yDtzw3vOoGQDRXzI6pyKyo6bXFT5/QoPE4hAknExjRLQ==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vueuse/rxjs": {
"version": "12.5.0",
"resolved": "https://registry.npmmirror.com/@vueuse/rxjs/-/rxjs-12.5.0.tgz",
@ -2006,6 +2118,12 @@
"dev": true,
"license": "MIT"
},
"node_modules/async-validator": {
"version": "4.2.5",
"resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-4.2.5.tgz",
"integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==",
"license": "MIT"
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
@ -2465,6 +2583,32 @@
"dev": true,
"license": "ISC"
},
"node_modules/element-plus": {
"version": "2.9.5",
"resolved": "https://registry.npmmirror.com/element-plus/-/element-plus-2.9.5.tgz",
"integrity": "sha512-r+X79oogLbYq8p9L5f9fHSHhUFNM0AL72aikqiZVxSc2/08mK6m/PotiB9e/D90QmWTIHIaFnFmW65AcXmneig==",
"license": "MIT",
"dependencies": {
"@ctrl/tinycolor": "^3.4.1",
"@element-plus/icons-vue": "^2.3.1",
"@floating-ui/dom": "^1.0.1",
"@popperjs/core": "npm:@sxzz/popperjs-es@^2.11.7",
"@types/lodash": "^4.14.182",
"@types/lodash-es": "^4.17.6",
"@vueuse/core": "^9.1.0",
"async-validator": "^4.2.5",
"dayjs": "^1.11.13",
"escape-html": "^1.0.3",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"lodash-unified": "^1.0.2",
"memoize-one": "^6.0.0",
"normalize-wheel-es": "^1.2.0"
},
"peerDependencies": {
"vue": "^3.2.0"
}
},
"node_modules/emoji-regex": {
"version": "9.2.2",
"resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-9.2.2.tgz",
@ -2545,6 +2689,12 @@
"node": ">=6"
}
},
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
"license": "MIT"
},
"node_modules/estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/estree-walker/-/estree-walker-2.0.2.tgz",
@ -3177,6 +3327,29 @@
"dev": true,
"license": "MIT"
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"license": "MIT"
},
"node_modules/lodash-es": {
"version": "4.17.21",
"resolved": "https://registry.npmmirror.com/lodash-es/-/lodash-es-4.17.21.tgz",
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==",
"license": "MIT"
},
"node_modules/lodash-unified": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/lodash-unified/-/lodash-unified-1.0.3.tgz",
"integrity": "sha512-WK9qSozxXOD7ZJQlpSqOT+om2ZfcT4yO+03FuzAHD0wF6S0l0090LRPDx3vhTTLZ8cFKpBn+IOcVXK6qOcIlfQ==",
"license": "MIT",
"peerDependencies": {
"@types/lodash-es": "*",
"lodash": "*",
"lodash-es": "*"
}
},
"node_modules/lru-cache": {
"version": "5.1.1",
"resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-5.1.1.tgz",
@ -3196,6 +3369,12 @@
"@jridgewell/sourcemap-codec": "^1.5.0"
}
},
"node_modules/memoize-one": {
"version": "6.0.0",
"resolved": "https://registry.npmmirror.com/memoize-one/-/memoize-one-6.0.0.tgz",
"integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==",
"license": "MIT"
},
"node_modules/memorystream": {
"version": "0.3.1",
"resolved": "https://registry.npmmirror.com/memorystream/-/memorystream-0.3.1.tgz",
@ -3377,6 +3556,12 @@
"node": ">=0.10.0"
}
},
"node_modules/normalize-wheel-es": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/normalize-wheel-es/-/normalize-wheel-es-1.2.0.tgz",
"integrity": "sha512-Wj7+EJQ8mSuXr2iWfnujrimU35R2W4FAErEyTmJoJ7ucwTn2hOUSsRehMb5RSYkxXGTM7Y9QpvPmp++w5ftoJw==",
"license": "BSD-3-Clause"
},
"node_modules/npm-normalize-package-bin": {
"version": "4.0.0",
"resolved": "https://registry.npmmirror.com/npm-normalize-package-bin/-/npm-normalize-package-bin-4.0.0.tgz",

1
package.json

@ -14,6 +14,7 @@
"@vueuse/rxjs": "^12.5.0",
"axios": "^1.7.9",
"dayjs": "^1.11.13",
"element-plus": "^2.9.5",
"pinia": "^2.3.0",
"ramda": "^0.30.1",
"rxjs": "^7.8.1",

1
src/App.vue

@ -4,7 +4,6 @@ import HeaderBar from "@/components/HeaderBar.vue";
</script>
<template>
<HeaderBar />
<RouterView />
</template>

BIN
src/assets/bg.jpg

After

Width: 3211  |  Height: 1855  |  Size: 125 KiB

1
src/assets/icon_logo.svg
File diff suppressed because it is too large
View File

1
src/assets/icon_pwd.svg

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="39" height="47" viewBox="0 0 39 47"><defs><linearGradient x1="0.08627337217330933" y1="1" x2="1.0173453092575073" y2="1" id="master_svg0_38_4269"><stop offset="17.200195789337158%" stop-color="#0657C0" stop-opacity="1"/><stop offset="100%" stop-color="#096AE0" stop-opacity="1"/></linearGradient></defs><g><path d="M35.5405,20.2107C35.1423,20.2107,32.9024,20.2358,32.4793,20.2358L32.4793,13.132C32.4793,5.25279,27.4269,0.025013,19.5373,0C11.6477,0,6.49585,5.50293,6.49585,13.132L6.49585,20.1607C6.22208,20.1607,3.35992,20.1857,3.11104,20.1857C1.21953,20.1857,0,21.8116,0,23.5625L0,43.5482C0,45.5242,1.04531,47,3.06126,47L35.6401,47C37.208,47,39,45.5742,39,42.9979L39,24.0128C39,22.0617,38.3529,20.2107,35.5405,20.2107ZM23.843,38.1453C23.843,40.6216,21.9017,42.6227,19.5124,42.6227C17.1232,42.6227,15.1819,40.6216,15.1819,38.1453L15.1819,38.0703C15.1819,36.4194,16.053,34.9686,17.3472,34.1932L17.3472,25.9388C17.3472,24.7632,18.268,24.6381,19.4129,24.6381C20.5578,24.6381,21.6777,24.7632,21.6777,25.9388L21.6777,34.1932C22.9719,34.9686,23.843,36.4194,23.843,38.0703L23.843,38.1453ZM28.1985,20.1607L10.8513,20.1607L10.8513,11.1559C10.8513,6.82863,15.6548,4.47738,19.2636,4.47738L20.06,4.47738C23.6688,4.47738,28.1985,6.65354,28.1985,11.1559L28.1985,20.1607Z" fill="url(#master_svg0_38_4269)" fill-opacity="1"/></g></svg>

1
src/assets/icon_user.svg

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="44" height="44" viewBox="0 0 44 44"><defs><linearGradient x1="0.08627337217330933" y1="1" x2="1.0173453092575073" y2="1" id="master_svg0_38_4269"><stop offset="17.200195789337158%" stop-color="#0657C0" stop-opacity="1"/><stop offset="100%" stop-color="#096AE0" stop-opacity="1"/></linearGradient></defs><g><path d="M44,42.1755C44,33.2115,37.6644,25.5962,28.9173,22.9149C32.3178,20.6779,34.5707,16.849,34.5707,12.5019C34.5707,5.60577,28.9332,0,22,0C15.0668,0,9.42933,5.60577,9.42933,12.4966C9.42933,16.8438,11.6822,20.6726,15.0827,22.9096C6.33558,25.5962,0,33.2062,0,42.1755L0,44L44,44L44,42.2019L44,42.1755Z" fill="url(#master_svg0_38_4269)" fill-opacity="1"/></g></svg>

3
src/main.ts

@ -4,6 +4,8 @@ import "./assets/main.css";
import { createApp } from "vue";
import { createPinia } from "pinia";
import Vant from "vant";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import App from "./App.vue";
import router from "./router";
import "vant/lib/index.css";
@ -13,6 +15,7 @@ const app = createApp(App);
app.use(createPinia());
app.use(router);
app.use(Vant);
app.use(ElementPlus);
app.mount("#app");

74
src/router/index.ts

@ -1,33 +1,47 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/HomeView.vue";
import Login from "@/views/Login.vue";
import Index from "@/views/Index.vue";
import EnvironmentView from "../views/EnvironmentView.vue";
import SprayView from "../views/SprayView.vue";
import PrintView from "../views/PrintView.vue";
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'home',
component: HomeView,
},
{
path: '/environment',
name: 'environment',
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import('../views/EnvironmentView.vue'),
},
{
path: '/spray',
name: 'spray',
component: () => import('../views/SprayView.vue'),
},
{
path: '/print',
name: 'print',
component: () => import('../views/PrintView.vue'),
}
],
})
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: "/",
component: Index,
redirect: "/home",
children: [
{
path: "/home",
name: "home",
component: HomeView,
},
{
path: "/environment",
name: "environment",
component: EnvironmentView,
},
{
path: "/spray",
name: "spray",
component: SprayView,
},
{
path: "/print",
name: "print",
component: PrintView,
},
],
},
{
path: "/login",
name: "login",
component: Login,
},
],
});
export default router
export default router;

9
src/views/Index.vue

@ -0,0 +1,9 @@
<template>
<HeaderBar />
<RouterView />
</template>
<script setup lang="ts">
import { RouterLink, RouterView } from "vue-router";
import HeaderBar from "@/components/HeaderBar.vue";
</script>

95
src/views/Login.vue

@ -0,0 +1,95 @@
<template>
<div class="relative bg-[url(@/assets/bg.jpg)] bg-cover h-[100vh]">
<figure
class="absolute w-[480px] top-1/2 -translate-y-1/2 right-12 rounded-xl"
style="
background: linear-gradient(180deg, rgba(250, 252, 255, 0.51) 0%, rgba(255, 255, 255, 0.52) 100%);
backdrop-filter: blur(92px);
">
<div class="flex flex-col justify-center items-center px-[60px] pt-10 pb-4">
<img :src="logo" class="h-[30px]" alt="" />
<el-form :model="form" :rules="rules" ref="formRef" style="width: 100%">
<div class="text-xl text-primary mb-6 mt-[38px]">用户名</div>
<el-form-item prop="username">
<el-input
v-model="form.username"
placeholder="请输入用户名"
prefix-icon="userIconSvg"
style="width: 100%; height: 60px; font-size: 22px"
size="large">
<template #prefix>
<img :src="userIconSvg" alt="" class="w-[19px]" />
</template>
</el-input>
</el-form-item>
<div class="text-xl text-primary mb-6">密码</div>
<el-form-item prop="password">
<el-input
v-model="form.password"
placeholder="请输入密码"
prefix-icon="pwdIconSvg"
type="password"
style="width: 100%; height: 60px; font-size: 22px"
size="large">
<template #prefix>
<img :src="pwdIconSvg" alt="" class="w-[19px]" />
</template>
</el-input>
</el-form-item>
<el-form-item>
<el-button
style="
width: 100%;
margin-top: 24px;
height: 60px;
font-size: 24px;
border-radius: 6px;
background: linear-gradient(90deg, #0657c0 24%, #096ae0 101%);
"
type="primary"
@click="loginHandle"
:loading="loading"
native-type="submit"
>登录</el-button
>
</el-form-item>
</el-form>
<span class="text-[#8799AA] mt-6">TRYSMET(BEJING) TECHNOLOGY CO.,LTD.</span>
</div>
</figure>
</div>
</template>
<script setup lang="ts">
import logo from "@/assets/icon_logo.svg";
import userIconSvg from "@/assets/icon_user.svg";
import pwdIconSvg from "@/assets/icon_pwd.svg";
import { ref } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const form = ref({
username: "",
password: "",
});
const formRef = ref();
const rules = {
username: [
{ required: true, message: "请输入用户名", trigger: "blur" },
{ min: 3, max: 20, message: "长度在 3 到 20 个字符", trigger: "blur" },
],
password: [
{ required: true, message: "请输入密码", trigger: "blur" },
{ min: 3, max: 20, message: "长度在 3 到 20 个字符", trigger: "blur" },
],
};
const loading = ref(false);
function loginHandle() {
router.push("/home");
}
</script>
<style lang="scss" scoped></style>
Loading…
Cancel
Save