艺易修小程序24.08.21
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

159 lines
2.9 KiB

<template>
<view class="content">
<view class="topBox">
<h3 class="title">登录</h3>
<h3>欢迎使用xx报修</h3>
</view>
<view class="inputBox">
<view class="ipt">
<h4>手机号</h4>
<input v-model="form.account" type="text" value="" placeholder="请输入手机号" />
</view>
<view class="ipt">
<h4>密码</h4>
<input v-model="form.password" type="password" value="" placeholder="请输入密码" />
</view>
<button @click="login" class="loginBtn">登录</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
form: {
account: '',
password: ''
}
}
},
methods: {
//登录
login() {
if(this.form.account.trim() == ''){
return uni.showToast({
icon: 'none',
title: '请填写手机号'
})
}
if(this.form.password.trim() == ''){
return uni.showToast({
icon: 'none',
title: '请填写密码'
})
}
this.$api('loginLogin', this.form, res => {
if (res.code == 200) {
uni.setStorageSync('token', res.result.token);
uni.setStorageSync('userInfo', JSON.stringify(res.result.userInfo));
this.$store.commit('setUserInfo',res.result.userInfo)
uni.switchTab({
url: '/pages/repair/repair'
})
}
})
}
}
}
</script>
<style scoped>
.content {
height: 100vh;
/* 微信小程序不允许使用本地图片 */
/* background: url("@/static/login/bj.jpg") no-repeat center; */
/* 所以这里我把背景图片上传在阿里云oss.下面这个地址是阿里云oss图片地址 */
background: url("https://tennis-oss.xzaiyp.top/2024-09-02/0030f0ef-4270-47dc-a870-b24bffb6ce28.jpg") no-repeat center;
background-size: cover;
}
.topBox {
font-size: 34rpx;
color: #fff;
padding: 80rpx 50rpx;
}
.topBox .title {
font-size: 45rpx;
}
h3 {
margin-bottom: 10rpx;
}
.inputBox {
position: fixed;
bottom: 0;
left: 0;
width: 750rpx;
height: 85vh;
background-color: #fff;
border-top-left-radius: 40rpx;
border-top-right-radius: 40rpx;
padding: 60rpx;
box-sizing: border-box;
}
.ipt {
margin-bottom: 50rpx;
}
.ipt h4 {
margin-bottom: 20rpx;
font-size: 36rpx;
color: #333;
}
.ipt input {
border-bottom: 1px solid #dedede;
padding-bottom: 20rpx;
font-size: 28rpx;
}
.loginBtn {
margin-top: 20rpx;
line-height: 85rpx;
text-align: center;
background: #3c9cff;
border-radius: 40rpx;
color: #fff;
margin-top: 50rpx;
}
.registerBtn {
margin-top: 20rpx;
line-height: 85rpx;
text-align: center;
border-radius: 40rpx;
color: #ccc;
margin-top: 50rpx;
border: none;
}
.tipbox {
position: fixed;
bottom: 120rpx;
left: 50%;
transform: translate(-50%, -120px);
}
.otherUser {
margin-top: 30rpx;
display: flex;
justify-content: center;
}
.txt {
font-size: 28rpx;
color: #969696;
}
.otherUser .uni-icons {
margin-left: 20rpx;
}
</style>