|
|
@@ -0,0 +1,101 @@
|
|
|
+<script setup lang="ts">
|
|
|
+import {ref} from 'vue';
|
|
|
+import {ElInput, ElIcon, ElButton} from 'element-plus';
|
|
|
+import userIcon from '@assets/images/login/user.webp';
|
|
|
+import posswordIcon from '@assets/images/login/passowrd.webp';
|
|
|
+import enterpriseIcon from '@assets/images/login/enterprise.webp';
|
|
|
+import {PreviewOpen, PreviewCloseOne} from '@icon-park/vue-next';
|
|
|
+import {useToggle} from '@vueuse/core';
|
|
|
+import {RouterLink} from 'vue-router';
|
|
|
+import {useFieldItem} from './hooks';
|
|
|
+
|
|
|
+defineOptions({name: 'LoginInfo'});
|
|
|
+const active = ref(0);
|
|
|
+function onTabClick(value: number) {
|
|
|
+ active.value = value;
|
|
|
+}
|
|
|
+
|
|
|
+const [isPassword, togglePassword] = useToggle(true);
|
|
|
+const [remberPassword, toggleRemberPassword] = useToggle();
|
|
|
+const {value: nameValue, errorMessage: nameErrorMessage} = useFieldItem('name');
|
|
|
+const {value: passwordValue, errorMessage: passwordErrorMessage} =
|
|
|
+ useFieldItem('password');
|
|
|
+const {value: companyValue, errorMessage: companyErrorMessage} =
|
|
|
+ useFieldItem('company');
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <h2 class="login-title">Login</h2>
|
|
|
+ <div class="tab">
|
|
|
+ <span :class="{'tab-item-active': active === 0}" @click="onTabClick(0)">
|
|
|
+ 供应商管理
|
|
|
+ </span>
|
|
|
+ <span :class="{'tab-item-active': active === 1}" @click="onTabClick(1)">
|
|
|
+ 企业管理
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <i class="tab-indicator"></i>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="info">
|
|
|
+ <ElInput v-model="nameValue" name="userName" placeholder="用户名">
|
|
|
+ <template #prefix>
|
|
|
+ <img :src="userIcon" class="input-icon" />
|
|
|
+ </template>
|
|
|
+ </ElInput>
|
|
|
+ <p :class="['error-tip', {'error-top-hidden': !nameErrorMessage}]">
|
|
|
+ {{ nameErrorMessage }}
|
|
|
+ </p>
|
|
|
+
|
|
|
+ <ElInput
|
|
|
+ v-model="passwordValue"
|
|
|
+ name="password"
|
|
|
+ placeholder="密码"
|
|
|
+ :type="isPassword ? 'password' : 'text'"
|
|
|
+ >
|
|
|
+ <template #prefix>
|
|
|
+ <img :src="posswordIcon" class="input-icon" />
|
|
|
+ </template>
|
|
|
+ <template #suffix>
|
|
|
+ <ElIcon
|
|
|
+ :size="20"
|
|
|
+ class="password-icon"
|
|
|
+ @click="togglePassword(!isPassword)"
|
|
|
+ >
|
|
|
+ <PreviewOpen v-if="!isPassword" theme="filled" fill="#B6B6B6" />
|
|
|
+ <PreviewCloseOne v-if="isPassword" theme="filled" fill="#B6B6B6" />
|
|
|
+ </ElIcon>
|
|
|
+ </template>
|
|
|
+ </ElInput>
|
|
|
+ <p :class="['error-tip', {'error-top-hidden': !passwordErrorMessage}]">
|
|
|
+ {{ passwordErrorMessage }}
|
|
|
+ </p>
|
|
|
+
|
|
|
+ <ElInput v-model="companyValue" name="userName" placeholder="企业名称">
|
|
|
+ <template #prefix>
|
|
|
+ <img :src="enterpriseIcon" class="input-icon" />
|
|
|
+ </template>
|
|
|
+ </ElInput>
|
|
|
+ <p :class="['error-tip', {'error-top-hidden': !companyErrorMessage}]">
|
|
|
+ {{ companyErrorMessage }}
|
|
|
+ </p>
|
|
|
+
|
|
|
+ <div class="operation">
|
|
|
+ <span
|
|
|
+ :class="{'rember-password': remberPassword}"
|
|
|
+ @click="toggleRemberPassword(!remberPassword)"
|
|
|
+ >
|
|
|
+ 记住密码
|
|
|
+ </span>
|
|
|
+ <span>忘记密码</span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <ElButton native-type="submit" class="login-btn">登录</ElButton>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <RouterLink to="/" class="regist">申请成为供应商</RouterLink>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style scoped lang="css">
|
|
|
+@import './index.css';
|
|
|
+</style>
|