| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <template>
- <view class="normal-login-container">
- <view class="logo-content align-center justify-center flex">
- <image style="width: 200rpx;height: 200rpx;"
- src="https://50006360.s21i.huaweicloudsite.cn/4/ABUIABAEGAAg6PTOtwYohbu8vAIw8AM4gAI.png" mode="widthFix">
- </image>
- <text class="title">OA移动端登录</text>
- </view>
- <view class="login-form-content">
- <view class="input-item flex align-center">
- <view class="iconfont icon-user icon"></view>
- <input v-model="loginForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />
- </view>
- <view class="input-item flex align-center">
- <view class="iconfont icon-password icon"></view>
- <input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
- </view>
- <view class="action-btn">
- <button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>
- </view>
- </view>
- </view>
- </template>
- <script setup lang="ts">
- import { ref } from 'vue'
- import { useUserStore } from '@/store/user.js'
- import $modal from '@/plugins/modal.js'
- import $tab from '@/plugins/tab.js'
- const userStore = useUserStore()
- const loginForm = ref({
- username: '',
- password: ''
- })
- function handleLogin() {
- const username = loginForm.value.username
- const password = loginForm.value.password
- if (username === "") {
- $modal.msgError("请输入您的账号")
- } else if (password === "") {
- $modal.msgError("请输入您的密码")
- } else {
- $modal.loading("登录中,请耐心等待...")
- // TEST: 测试登录接口
- userStore.Login(loginForm.value).then(() => {
- $modal.closeLoading()
- loginSuccess()
- })
- }
- }
- function loginSuccess() {
- userStore.GetInfo()
- $tab.reLaunch('/pages/message/index')
- }
- </script>
- <style lang="scss">
- @import "@/static/scss/colorui.css";
- @import '@/static/font/iconfont.css';
- page {
- background-color: #ffffff;
- }
- .normal-login-container {
- width: 100%;
- .logo-content {
- width: 100%;
- font-size: 21px;
- text-align: center;
- padding-top: 45%;
- image {
- border-radius: 4px;
- }
- .title {
- margin-left: 10px;
- }
- }
- .login-form-content {
- text-align: center;
- margin: 20px auto;
- margin-top: 15%;
- width: 80%;
- .input-item {
- margin: 20px auto;
- background-color: #f5f6f7;
- height: 45px;
- border-radius: 20px;
- .icon {
- font-size: 38rpx;
- margin-left: 10px;
- color: #999;
- }
- .input {
- width: 100%;
- line-height: 20px;
- text-align: left;
- padding-left: 15px;
- }
- }
- .login-btn {
- margin-top: 40px;
- height: 45px;
- border-radius: 20px;
- }
- }
- }
- </style>
|