| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <template>
- <main>
- <section>
- <header>
- <img src="@/assets/login.png" />
- <p>欢迎使用</p>
- </header>
- <p>账号登录</p>
- <section>
- <p>账号</p>
- <div>
- <a-input placeholder="请输入手机号" :style="{ width: '250px', height: '40px' }" v-model="username">
- </a-input>
- </div>
- </section>
- <section>
- <p>密码</p>
- <div>
- <a-input-password
- placeholder="请输入手机号"
- :style="{ width: '250px', height: '40px' }"
- v-model="password"
- >
- </a-input-password>
- </div>
- </section>
- <section><p style="cursor: pointer" @click="goRegister">去注册</p></section>
- <div @click="login">登录</div>
- </section>
- </main>
- </template>
- <script>
- import { defineComponent, ref, inject } from "vue";
- export default defineComponent({
- components: {},
- props: [],
- setup() {
- const { ajax, helper } = inject("$global");
- const username = ref("user");
- const password = ref("123");
- const login = async () => {
- const result = await ajax.user.login(username.value, password.value);
- if (result) {
- helper.write("userName", result.nickname || result.username);
- helper.write("token", result.access_token);
- helper.goLink("/");
- }
- };
- const goRegister = () => {
- helper.goLink("register");
- };
- return {
- login,
- username,
- password,
- goRegister
- };
- }
- });
- </script>
- <style scoped>
- main {
- width: 100vw;
- height: 100vh;
- align-items: center;
- justify-content: center;
- display: flex;
- position: relative;
- > p {
- position: absolute;
- bottom: 30px;
- color: rgba(153, 153, 153, 1);
- font-size: 14px;
- }
- > section {
- width: 640px;
- border-radius: 12px;
- background-color: rgba(255, 255, 255, 0.52);
- box-shadow: 0px 2px 20px -2px rgba(0, 0, 0, 0.1);
- border: 1px solid rgba(187, 187, 187, 1);
- > header {
- height: 130px;
- background-color: rgba(65, 95, 235, 0.05);
- position: relative;
- img {
- height: 130px;
- position: absolute;
- top: 0;
- right: 0;
- }
- p {
- height: 130px;
- line-height: 130px;
- position: absolute;
- left: 30px;
- z-index: 2;
- color: rgba(51, 51, 51, 1);
- font-size: 36px;
- font-weight: bold;
- }
- }
- > p {
- text-align: center;
- &:nth-child(2) {
- margin: 60px 0 10px 0;
- color: rgba(16, 16, 16, 1);
- font-size: 28px;
- font-weight: bold;
- }
- &:nth-child(3) {
- color: rgba(102, 102, 102, 1);
- font-size: 18px;
- }
- }
- > section {
- display: flex;
- justify-content: center;
- margin-top: 20px;
- > p {
- display: flex;
- align-items: center;
- margin-right: 10px;
- }
- }
- > div {
- width: 332px;
- height: 40px;
- border-radius: 4px;
- background-color: rgba(64, 95, 234, 1);
- color: rgba(255, 255, 255, 1);
- font-size: 14px;
- text-align: center;
- box-shadow: 0px 2px 6px -2px rgba(64, 95, 234, 0.53);
- line-height: 40px;
- border: 1px solid rgba(64, 95, 234, 1);
- margin: 30px auto;
- cursor: pointer;
- &:hover {
- background-color: rgba(64, 95, 234, 0.8);
- }
- }
- > span {
- display: block;
- widows: 100%;
- text-align: center;
- margin-bottom: 30px;
- }
- }
- }
- </style>
|