123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <template>
- <div class="login-layout">
- <div class="login-content">
- <div class="header">
- <img src="/favicon.ico" />
- <p>实景三维</p>
- </div>
- <div class="body">
- <ui-input
- type="text"
- placeholder="请输入账号"
- v-model="username"
- style="width: 100%"
- />
- <br />
- <ui-input
- type="password"
- placeholder="请输入密码"
- v-model="password"
- style="width: 100%; margin-top: 20px"
- />
- <br />
- <ui-input
- type="checkbox"
- @click.stop
- label="记住密码"
- style="margin-top: 20px"
- :modelValue="mark"
- @update:modelValue="(select: any) => mark = select"
- />
- </div>
- <div class="bottom">
- <ui-button type="submit" @click="login(username, password)">登录</ui-button>
- </div>
- </div>
- </div>
- </template>
- <script lang="ts" setup>
- import { ref } from "vue";
- import { encodePwd } from "@/utils";
- import GAxios from "axios";
- import { setToken } from "@/api";
- import { Message } from "bill/expose-common";
- const username = ref(localStorage.getItem("fuse-username") || "");
- const password = ref(localStorage.getItem("fuse-password") || "");
- const mark = ref(!!localStorage.getItem("fuse-mark"));
- const login = (username: string, password: string) => {
- if (!username) {
- return Message.error("账号不能为空");
- }
- if (!password) {
- return Message.error("密码不能为空");
- }
- GAxios.post("/service/manage/login", {
- password: encodePwd(password),
- userName: username,
- username: username,
- }).then((res) => {
- if (res.data.code !== 0) {
- return Message.error(res.data.message);
- }
- setToken(res.data.data.token);
- setTimeout(() => {
- const p = new URLSearchParams(location.search);
- p.delete("token");
- location.search = "?" + p.toString();
- setTimeout(() => location.reload(), 100);
- }, 100);
- if (mark.value) {
- localStorage.setItem("fuse-username", username);
- localStorage.setItem("fuse-password", password);
- localStorage.setItem("fuse-mark", "1");
- } else {
- localStorage.removeItem("fuse-username");
- localStorage.removeItem("fuse-password");
- localStorage.removeItem("fuse-mark");
- }
- });
- };
- if (import.meta.env.DEV) {
- login("super-admin", "Aa123456");
- }
- </script>
- <style lang="scss" scoped>
- .login-layout {
- position: fixed;
- inset: 0;
- z-index: 99;
- background: url("/images/login-backimage.png") no-repeat center center;
- background-size: cover;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .login-content {
- width: 400px;
- .header {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- margin-bottom: 64px;
- img {
- width: 80px;
- height: 80px;
- margin-bottom: 10px;
- }
- p {
- font-weight: bold;
- font-size: 32px;
- color: #000000;
- line-height: 48px;
- letter-spacing: 12px;
- text-align: center;
- font-style: normal;
- text-transform: none;
- }
- }
- .body {
- margin-bottom: 48px;
- }
- }
- </style>
- <style lang="scss" scoped>
- .login-content {
- .ui-input,
- .ui-button {
- --colors-color: #d9d9d9;
- --base-border-color: #d9d9d9;
- --colors-content-color: #000000;
- --colors-primary-base: #d9d9d9;
- --colors-normal-back: #ffffff;
- --colors-primary-base: #0960bd;
- --color-main-normal: #0960bd;
- }
- .ui-button {
- color: #fff !important;
- border: 1px solid var(--color-main-normal) !important;
- background: var(--color-main-normal) !important;
- }
- }
- </style>
|