初始化项目
This commit is contained in:
145
attractor-ui/pages/login.vue
Normal file
145
attractor-ui/pages/login.vue
Normal file
@@ -0,0 +1,145 @@
|
||||
<template>
|
||||
<view class="login-page">
|
||||
<view class="hero">
|
||||
<image class="logo" src="/static/images/app_icon_pack_schemeA_tealLogo/master_1024.png" mode="aspectFit" />
|
||||
<text class="title">Attractor 登录</text>
|
||||
<text class="sub">手机号一键登录,新用户自动注册</text>
|
||||
</view>
|
||||
|
||||
<view class="form-card">
|
||||
<view class="input-row">
|
||||
<uni-icons type="phone" size="18" color="#0f7f7a"></uni-icons>
|
||||
<input
|
||||
v-model="mobile"
|
||||
class="input"
|
||||
type="number"
|
||||
maxlength="11"
|
||||
placeholder="请输入手机号"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="hint-row">
|
||||
<text class="hint">验证码已内置:666666(测试阶段)</text>
|
||||
</view>
|
||||
|
||||
<button class="login-btn" @click="handleMobileLogin">登录 / 自动注册</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getToken } from '@/utils/auth'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
mobile: ''
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
if (getToken()) {
|
||||
this.$tab.reLaunch('/pages/devices/devices')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleMobileLogin() {
|
||||
const mobile = (this.mobile || '').trim()
|
||||
if (!/^1\d{10}$/.test(mobile)) {
|
||||
this.$modal.msgError('请输入正确的11位手机号')
|
||||
return
|
||||
}
|
||||
|
||||
this.$modal.loading('登录中,请稍候...')
|
||||
this.$store.dispatch('MobileLogin', mobile).then(() => {
|
||||
return this.$store.dispatch('GetInfo')
|
||||
}).then(() => {
|
||||
this.$modal.closeLoading()
|
||||
this.$tab.reLaunch('/pages/devices/devices')
|
||||
}).catch(() => {
|
||||
this.$modal.closeLoading()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.login-page {
|
||||
min-height: 100vh;
|
||||
background: #f4f7f8;
|
||||
padding: 40rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.hero {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-top: 80rpx;
|
||||
margin-bottom: 36rpx;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin-top: 16rpx;
|
||||
font-size: 38rpx;
|
||||
font-weight: 700;
|
||||
color: #0f172a;
|
||||
}
|
||||
|
||||
.sub {
|
||||
margin-top: 6rpx;
|
||||
font-size: 24rpx;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.form-card {
|
||||
background: #ffffff;
|
||||
border: 1rpx solid #e7eeef;
|
||||
border-radius: 20rpx;
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.input-row {
|
||||
height: 82rpx;
|
||||
border: 1rpx solid #bfe9e7;
|
||||
background: #f2fbfa;
|
||||
border-radius: 14rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
padding: 0 16rpx;
|
||||
}
|
||||
|
||||
.input {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #0f172a;
|
||||
}
|
||||
|
||||
.hint-row {
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.hint {
|
||||
font-size: 22rpx;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
margin-top: 22rpx;
|
||||
height: 82rpx;
|
||||
line-height: 82rpx;
|
||||
border-radius: 14rpx;
|
||||
border: 1rpx solid #bfe9e7;
|
||||
background: #1f9f9a;
|
||||
color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user