123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- <script setup>
- import { ref, unref } from 'vue';
- import { useRouter } from 'vue-router';
- import { NButton } from 'naive-ui';
- import { SvgIcon } from '@/components';
- import { useUserStore } from '@/stores/modules/userStore';
- import { userApi } from '@/api/user';
- const router = useRouter();
- const userStore = useUserStore();
- const errorMsg = ref('');
- const loading = ref(false);
- const loginFormData = ref({
- username: '',
- password: ''
- })
- const handleSubmit = async () => {
- const { username, password } = unref(loginFormData);
- if (!username) {
- return errorMsg.value = '请输入用户名称'
- }
- if (!password) {
- return errorMsg.value = '请输入登录密码'
- }
- loading.value = true;
- setTimeout(() => {
- loading.value = false;
- if ( username !== 'admin' || password !== 'admin123' ) {
- return errorMsg.value = '账号或者密码输入有误'
- }
- errorMsg.value = '';
- router.push("/");
- localStorage.setItem("isLogin", new Date().getTime());
- }, 1 * 1000)
- // try {
- // loading.value = true;
- // const { token } = await userApi.postLogin({ username, password, type: 0 });
- // userStore.setUserInfo({ token });
- // const { user } = await userApi.getUserInfo();
- // errorMsg.value = '';
- // userStore.setUserInfo({ ...user });
- // router.push("/");
- // }
- // catch (error) {
- // errorMsg.value = error.msg;
- // }
- // finally {
- // loading.value = false;
- // }
- }
- </script>
- <template>
- <div class="login-viewport">
- <div class="tips-wrapper">
- <ul class="tips-inner">
- <li class="title">LibraAI 智能体运营平台<br />锡林浩特污水处理厂</li>
- <li class="sub-title">使命重在担当,实干铸就未来</li>
- </ul>
- </div>
- <div class="login-wrapper">
- <div class="login-form w-[442px] h-[454px]">
- <p class="title pl-[2px] mb-[30px] text-[28px] text-[#fff] leading-[40px] font-bold">欢迎登录</p>
- <div class="form-inner w-full">
- <ul class="form-inp-list">
- <li class="inp-item-inner">
- <input type="text" placeholder="请输入用户名称" v-model="loginFormData.username">
- </li>
- <li class="inp-item-inner">
- <input type="password" placeholder="请输入登录密码" v-model="loginFormData.password">
- </li>
- </ul>
- <div class="waring-feedback h-[32px] text-[12px] text-[#FF7152]">
- <p class="flex items-center justify-center h-full space-x-[8px] bg-[#FFF1F0]" v-show="errorMsg">
- <SvgIcon name="login-warning-tips"></SvgIcon>
- <span>{{ errorMsg }}</span>
- </p>
- </div>
- </div>
- <NButton block color="#2454FF" size="large" :loading="loading" @click="handleSubmit">登 录</NButton>
- </div>
- </div>
- </div>
- </template>
- <style scoped lang="scss">
- .login-viewport {
- position: relative;
- @include flex(x, center, between);
- height: 100vh;
- background: url("@/assets/images/login/bg-login-xlht2.png") center center no-repeat;
- background-size: cover;
- overflow: hidden;
- min-width: 1100px;
- .tips-wrapper {
- position: relative;
- width: 100%;
- height: 100%;
- .tips-inner {
- position: absolute;
- top: 102px;
- left: 74px;
- line-height: 46px;
- color: #fff;
- .title {
- font-size: 36px;
- font-family: AlimamaShuHeiTi;
- }
- .sub-title {
- font-size: 24px;
- }
- }
- }
- .login-wrapper {
- @include flex(x, center, center);
- width: 562px;
- height: 100%;
- flex-shrink: 0;
- background: rgba(20, 28, 36, 0.60);
- backdrop-filter: blur(12px);
- }
- .logo {
- @include flex(x, center, center);
- .text {
- font-size: 11px;
- font-family: AlimamaShuHeiTi;
- font-weight: bold;
- line-height: 12px;
- }
- }
- .login-form {
- @include flex(y, start, between);
- padding: 40px 40px;
- .form-inp-list {
- width: 100%;
- margin-bottom: 8px;
- .inp-item-inner {
- border-radius: 2px;
- overflow: hidden;
- input {
- width: 100%;
- padding: 16px 20px;
- background: #F2F4F9;
- font-size: 16px;
- line-height: 22px;
- color: #1A2029;
- outline: none;
- &::placeholder {
- color: #989EA7;
- }
- }
- &:nth-child(1) {
- margin-bottom: 18px;
- }
- }
- }
- }
- }
- .n-button {
- height: 54px;
- font-size: 18px;
- &:hover {
- background: #1d43cc;
- }
- }
- </style>
|