仿照微信写的uni-app项目

登录布局

路由搭建

{
			"path": "pages/index/index",
			"style": {
				"navigationBarTitleText": "uni-app",
				"app-plus":{
					"titleNView":false
				}
			}
		},
		{
			"path": "pages/index/login",
			"style": {
				"navigationBarTitleText": "uni-app",
				"app-plus":{
					"titleNView":false
				}
			}
		}

第一个页面 代码

<template>
	<view class="login">
		<image src="../../static/logo.png" mode="" class="logo"></image>
		<view class="username">
			<text class="icon text-50 margin-right-20">{{$store.icon.my}} </text>
			<input type="text" maxlength="15" value="123456" class="account" />
		</view>
		<view class="username">
			<text class="icon text-50 margin-right-20">{{$store.icon.mobilefill}} </text>
			<input type="password" maxlength="15" class="account" placeholder="请输入手机号"/>
		</view>
		<view class="username">
			<text class="icon text-50 margin-right-20">{{$store.icon.noticefill}} </text>
			<input type="password" maxlength="15" class="account" placeholder="请输入验证码"/>
			<button type="primary" style="border-radius: 50rpx;">获取验证码</button>
		</view>
		<button type="primary" class="logobtn">登录</button>
		<view class="qiehuan">
			<text class="ziti" @tap="changelogin">切换登录方式</text>
			<text class="ziti">注册新账户</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		onLoad() {

		},
		methods: {
		// 点击切换登录方式
		changelogin() {
			uni.showActionSheet({
				itemList: ['用户登录', '邮箱登录'],
				success({
					tapIndex
				}) {
					uni.navigateTo({
						url:'./index'
					})
				}
			});
		}
		},
	}
</script>

<style scoped lang="scss">
	.login {
		justify-content: center;
		align-items: center;
		width: 700rpx;

		.logo {
			width: 150rpx;
			height: 150rpx;
			margin-top: 200rpx;
			margin-bottom: 100rpx;
		}

		.username {
			flex-direction: row;
			width: 550rpx;
			background-color: #FFFFFF;
			margin-left: 100rpx;
			padding: 20rpx;
			border-color: #C0C0C0;
			border-width: 1rpx;
			border-style: solid;
			border-radius: 5rpx;
			.account {
				flex: 1;
			}
		}
		.logobtn{
			width: 550rpx;
			margin-left: 100rpx;
			margin-top: 50rpx;
			text-align: center;
			background-color: green;
		}
		.qiehuan {
			margin-left: 100rpx;
			width: 550rpx;
			flex-direction: row;
			justify-content: space-between;
			margin-top: 10px;
		
			.ziti {
				font-size: 25rpx;
				color: #999999;
			}
		}
	}
</style>

第二个页面 代码

<template>
	<view class="login">
		<image src="../../static/logo.png" mode="" class="logo"></image>
		<view class="username">
			<text class="icon text-50 margin-right-20">{{$store.icon.my}} </text>
			<input type="text" maxlength="15" class="account" placeholder="请输入用户名" />
		</view>
		<view class="username">
			<text class="icon text-50 margin-right-20">{{$store.icon.lock}} </text>
			<input type="password" maxlength="15" class="account" placeholder="请输入密码" />
		</view>
		<button type="primary" class="logobtn">登录</button>
		<view class="qiehuan">
			<text class="ziti" @tap="changelogin">切换登录方式</text>
			<text class="ziti">注册新账户</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		onLoad() {

		},
		methods: {
			// 点击切换登录方式
			changelogin() {
				uni.showActionSheet({
					itemList: ['手机登录', '邮箱登录'],
					success({
						tapIndex
					}) {
						uni.navigateTo({
							url:'./login'
						})
					}
				});
			}
		},
	}
</script>

<style scoped lang="scss">
	.login {
		justify-content: center;
		align-items: center;
		width: 700rpx;

		.logo {
			width: 150rpx;
			height: 150rpx;
			margin-top: 200rpx;
			margin-bottom: 100rpx;
		}

		.username {
			flex-direction: row;
			width: 550rpx;
			background-color: #FFFFFF;
			margin-left: 100rpx;
			padding: 20rpx;
			border-color: #C0C0C0;
			border-width: 1rpx;
			border-style: solid;
			border-radius: 5rpx;

			.account {
				flex: 1;
			}
		}

		.logobtn {
			width: 550rpx;
			margin-left: 100rpx;
			margin-top: 50rpx;
			text-align: center;
			background-color: green;
		}

		.qiehuan {
			margin-left: 100rpx;
			width: 550rpx;
			flex-direction: row;
			justify-content: space-between;
			margin-top: 10px;

			.ziti {
				font-size: 25rpx;
				color: #999999;
			}
		}
	}
</style>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值