189 lines
3.4 KiB
Vue
189 lines
3.4 KiB
Vue
<template>
|
|
<view class="app">
|
|
<view class="title">
|
|
账号登录
|
|
</view>
|
|
<view class="loginphone">
|
|
<input class="phone" type="text" placeholder="手机号码" maxlength="11" v-model="phonenumber" />
|
|
</view>
|
|
<view class="logincode loginphone" style="top: 40%;">
|
|
<u-input class='code phone' placeholder="密码" maxlength="10" v-model="password" type="password"
|
|
:border="true" :password-icon="true" />
|
|
</view>
|
|
<view class="forget" @tap='forgetpassword'>
|
|
忘记密码
|
|
</view>
|
|
<!-- <u-checkbox-group>
|
|
<u-checkbox v-model="checked" shape="circle">记住密码</u-checkbox>
|
|
</u-checkbox-group> -->
|
|
<view class="loginbtn" @tap='pwdlogin'>
|
|
登录
|
|
</view>
|
|
<view class="loginbtn" style="top: 65%; color: #969394;background-color: #ffffff;" @tap='goregister'>
|
|
注册
|
|
</view>
|
|
<u-toast ref="uToast" />
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import {
|
|
appLogin
|
|
} from '../../api/login/index.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
checked: false,
|
|
phonenumber: '',
|
|
password: '',
|
|
userId:'',
|
|
};
|
|
},
|
|
//获取到传值
|
|
|
|
onLoad(options) {
|
|
console.log(options)
|
|
},
|
|
methods: {
|
|
|
|
//密码登录
|
|
pwdlogin() {
|
|
var that = this
|
|
appLogin(this.phonenumber, this.password).then(res => {
|
|
console.log(res)
|
|
if (res.code == 200) {
|
|
this.$refs.uToast.show({
|
|
title: '登录成功',
|
|
type: 'success',
|
|
url: '/pages/homepage/homepage',
|
|
duration: '1500'
|
|
})
|
|
|
|
uni.setStorage({
|
|
key:'phonenumber',
|
|
data:that.phonenumber
|
|
})
|
|
uni.setStorage({
|
|
key:'password',
|
|
data:that.password
|
|
})
|
|
} else {
|
|
console.log(res)
|
|
this.$refs.uToast.show({
|
|
title: res.msg,
|
|
type: 'error'
|
|
})
|
|
}
|
|
|
|
})
|
|
},
|
|
//跳转注册页
|
|
goregister() {
|
|
uni.navigateTo({
|
|
url: '/pages/register/register'
|
|
})
|
|
},
|
|
forgetpassword() {
|
|
uni.navigateTo({
|
|
url: '/pages/forgotPassword/forgotPassword'
|
|
})
|
|
},
|
|
},
|
|
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.app {
|
|
font-family: DengXian;
|
|
color: #C3C1C1;
|
|
font-weight: 400;
|
|
height: 100vh;
|
|
|
|
.forget {
|
|
position: absolute;
|
|
top: 53%;
|
|
left: 70%;
|
|
color: #46ABD7;
|
|
|
|
}
|
|
|
|
.loginbtn {
|
|
width: 80%;
|
|
height: 100rpx;
|
|
text-align: center;
|
|
line-height: 100rpx;
|
|
background: #4C7BC9;
|
|
border-radius: 51rpx;
|
|
font-size: 41rpx;
|
|
color: #FFFFFF;
|
|
position: absolute;
|
|
top: 58%;
|
|
left: 10%;
|
|
|
|
}
|
|
|
|
// ::v-deep .u-checkbox {
|
|
// margin-top: 345%;
|
|
// margin-left: 50%;
|
|
// font-size: 32rpx;
|
|
// color: #BFBFBF;
|
|
// }
|
|
|
|
.loginphone {
|
|
background-color: #fff;
|
|
width: 80%;
|
|
height: 150rpx;
|
|
position: absolute;
|
|
left: 10%;
|
|
top: 23%;
|
|
|
|
input {
|
|
font-size: 45rpx;
|
|
color: #000000;
|
|
}
|
|
|
|
::v-deep .uni-input-placeholder {
|
|
padding-left: 40rpx;
|
|
font-size: 41rpx;
|
|
font-weight: 400;
|
|
color: #C3C1C1;
|
|
}
|
|
|
|
.phone {
|
|
padding-left: 40rpx;
|
|
height: 150rpx;
|
|
box-shadow: 0px 9px 31px 9px rgba(0, 0, 0, 0.03);
|
|
}
|
|
}
|
|
|
|
.logincode {
|
|
position: absolute;
|
|
left: 10%;
|
|
|
|
::v-deep .u-input {
|
|
border: 0;
|
|
}
|
|
|
|
::v-deep .u-input__input {
|
|
padding-left: 20rpx;
|
|
color: #000000;
|
|
font-size: 42rpx;
|
|
font-weight: 400;
|
|
height: 100%;
|
|
// line-height: 150rpx;
|
|
}
|
|
}
|
|
|
|
.title {
|
|
height: 50rpx;
|
|
font-size: 52rpx;
|
|
font-weight: bold;
|
|
color: #000000;
|
|
line-height: 44rpx;
|
|
position: absolute;
|
|
top: 13%;
|
|
left: 13%;
|
|
}
|
|
}
|
|
</style>
|