accountpassword.vue 5.1 KB
<template>
	<view class="content">
		<view class="logo">
			<image src="../../static/choujiang.png" mode=""></image>
		</view>
		<view class="loginbox">
			<view class="loginboxitem flex">
				<view class="boxitemleft">
					<image src="../../static/phone.png" mode=""></image>
				</view>
				<view class="boxitemright">
					<input type="number" value="" placeholder="请输入手机号" placeholder-class="enter" @input="enterphone" />
				</view>
			</view>
			<view class="loginboxitem flextwo">
				<view class="flex">
					<view class="boxitemleft">
						<image src="../../static/card.png" mode=""></image>
					</view>
					<view class="boxitemright">
						<input type="password" value="" placeholder="请输入密码" placeholder-class="enter" @input="entercode" />
					</view>
				</view>
				<!-- <view class="cardyan" @click="getcode" v-if="disable==false">{{time}}</view>
				<view class="cardyan" v-else>{{time}}</view> -->

				<!-- <view class="cardyan"  @click="getcode">{{time}}</view> -->
			</view>
			<button class="loginbtn" @click="login">登录</button>
			<view class="loginword">
				登录即表示同意 <text class="xieyi" @click="xieyi" :data-type="1">用户协议</text>和<text class="xieyi" @click="xieyi" :data-type="2">隐私协议</text>

				
				<view class="phonecode" @click="loginindex">短信验证码登录</view>
				<view class="title">快捷登录</view>
				<view class='btnbottom'>
					<view class="btnimgwei">
						<image src="../../static/weixin.png" mode=""></image>
					</view>
					微信登录
				</view>
				<view class='btnbottom'>
					<view class="btnimgwei">
						<image src="../../static/zhifubao.png" mode=""></image>
					</view>
					支付宝登录
				</view>
			</view>
			<view class="password flexthree">
				<view class="passwordleft" @click="forgetmima">忘记密码?</view>
				<view class="shuxian">|</view>
				<view class="passwordleft" @click="register">立即注册</view>
			</view>
		</view>
		<view class="register" v-if="tipsone">
			<view class="loginwrap">
				<view class="tip">温馨提示</view>
				<view class="zhanghaoone">该账号已在登录中,继续登录将导致</view>
				<view class="zhanghaotwo">登录中用户下线。</view>
				<view class="tipbtn flexone">
					<view class="tipbtnleft">取消</view>
					<view class="tipbtnright">继续登录</view>
				</view>
			</view>
		</view>
		<view class="register" v-if="tipstwo">
			<view class="loginwrap">
				<view class="tip">温馨提示</view>
				<view class="zhanghaoone">该账号已在其他设备登录</view>
				<view class="tipbtn flexthree">
					<view class="tipbtnright" @click="sure">确认</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import app from "../../App.vue";
	var interval = null;
	export default {

		data() {
			return {
				tipstwo: false,
				tipsone: false,
				phone: '',
				code: ''
			}
		},
		methods: {
			// 输入手机号
			enterphone(e) {
				this.phone = e.detail.value
			},
			// 输入验证码
			entercode(e) {
				this.code = e.detail.value;
				
			},
			// 获取验证码
		
			// 登录
			login() {
				let that = this;
				if (that.phone == '') {
					uni.showToast({
						title: "请输入手机号",
						icon: 'none'
					})
					return false
				}
				if (!(/^1[3456789]\d{9}$/.test(that.phone))) {
					wx.showToast({
						title: '请输入正确手机号',
						icon: 'none'
					})
					return false;
				}

				if (that.code == '') {
					uni.showToast({
						title: "请输入密码",
						icon: 'none'
					})
					return false
				}
				var url = 'user/login1';
				var params = {
					mobile:that.phone,
					password:that.code,
					third_id:''
				}
				console.log('1222',params)
				app.post(url, params,"post").then((res) => {
					console.log(res,'37443');
					uni.showToast({
						title:"登录成功",
						icon:'none'
					})
					uni.setStorageSync("token",res.data.data.token);
					setTimeout(function() {
						uni.navigateTo({
							url:'/pages/homepage/homepage'
						})
					}, 1500);
				}).catch((err) => {
					console.log(err)
					
					console.log(err.data)
					uni.showToast({
						title:err.msg,
						icon:'none'
					})
				})
			},
			// 短信验证码登录
			loginindex(){
				uni.navigateTo({
					url:'/pages/login/loginindex'
				})
			},
			// 注册
			register(){
				uni.navigateTo({
					url:'/pages/login/register'
				})
			},

			sure() {
				// this.tipstwo = false
			},

			xieyi(e) {
				let type = e.currentTarget.dataset.type;
				if (type == 1) {
					uni.navigateTo({
						url: '/pages/login/xieyi?type=' + type
					})
				} else {
					uni.navigateTo({
						url: '/pages/login/xieyi?type=' + type
					})
				}

			},
			forgetmima() {
				uni.navigateTo({
					url: '/pages/login/forgetmima'
				})
			},

		},

		onLaunch: function() {
			console.log('App Launch,app启动')
		},
		onShow: function() {

		},
		onHide: function() {
			console.log('App Hide,app不再展现在前台')
		},
		onLoad() {


		},
		onReachBottom() {

		},
	}
</script>

<style>
	@import url('../../base/login');

	page {
		overflow-y: hidden;
	}

	.loginbtn {
		margin-top: 62rpx;
	}
</style>