index.vue 4.1 KB
Newer Older
芊里 已提交
1
<template>
L
23  
linju 已提交
2
	<view class="wrap">
L
213  
linju 已提交
3
		<view class="wrap-content">
芊里 已提交
4
			<view class="content">
L
linju 已提交
5
				<!-- 顶部文字 -->
芊里 已提交
6
				<text class="content-top-title">登陆后即可展示自己</text>
芊里 已提交
7
				<login-ikonw class="login-iknow" :link="link" text="登录即表示同意用户协议和隐私政策"></login-ikonw>
L
linju 已提交
8
				<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
芊里 已提交
9 10 11
				<uni-forms ref="form" :value="formData" :rules="rules">
					<uni-forms-item name="phone">
						<uni-easyinput type="number" class="phone-input-box" :inputBorder="false"
芊里 已提交
12 13 14 15 16 17 18
							v-model="formData.phone" maxlength="11" placeholder="请输入手机号">
							<!-- 当前仅支持中国大陆手机号 -->
							<!-- <template slot="left">
								<picker mode="selector" :range="phoneArea" @change="selectPhoneArea">
									<text class="phone-area" @click="selectPhoneArea">{{currenPhoneArea}}</text>
								</picker>
							</template> -->
芊里 已提交
19 20 21 22
						</uni-easyinput>
					</uni-forms-item>
					<button class="send-btn-box" :disabled="!canGetShortMsg" :type="canGetShortMsg?'primary':'default'"
						@click="sendShortMsg">获取短信验证码</button>
L
123  
linju 已提交
23 24 25
				</uni-forms>

				<!-- tip -->
芊里 已提交
26
				<text class="tip-text">未注册的手机号验证通过后将自动注册</text>
L
linju 已提交
27 28

				<!-- 其他登录方式 -->
L
23  
linju 已提交
29
				<!-- <view class="auth-box" v-if="loginList.includes('password')">
芊里 已提交
30
					<text class="login-text" hover-class="hover" @click="toPwdLogin">密码登录</text>
L
23  
linju 已提交
31 32
					<text class="login-text" hover-class="hover" @click="openLoginList">其他登录方式</text>
				</view> -->
L
linju 已提交
33
			</view>
芊里 已提交
34
		</view>
L
linju 已提交
35
		<!-- 登录按钮弹窗 -->
芊里 已提交
36
		<login-action-sheet ref="loginActionSheet"></login-action-sheet>
L
123  
linju 已提交
37
		<uni-quick-login ref="uniQuickLogin"></uni-quick-login>
芊里 已提交
38 39 40
	</view>
</template>

L
23  
linju 已提交
41 42 43
<script>	
var univerify_first,currentWebview;//是否一键登陆优先
import baseappConfig from '@/baseapp.config.js';
L
123  
linju 已提交
44
	import mixin from '../../common/loginPage.mixin.js';
L
12  
linju 已提交
45
	var currentPage;
L
123  
linju 已提交
46
	export default {
芊里 已提交
47
		mixins:[mixin],
芊里 已提交
48
		data() {
芊里 已提交
49
			return {
芊里 已提交
50
				phoneArea: ['+86'],
L
23  
linju 已提交
51 52
				currenPhoneArea: '+86',
				// loginList:[]
L
linju 已提交
53
			}
L
23  
linju 已提交
54 55 56 57 58 59 60 61 62 63 64
		},
		onLoad(e) {
			// this.loginList = baseappConfig.router.login
			univerify_first = e.univerify_first
			//#ifdef APP-PLUS
			if(univerify_first){
				const pages = getCurrentPages();
				currentWebview = pages[pages.length - 1].$getAppWebview();
				currentWebview.setStyle({
					"top":"2000px"
				})
L
21  
linju 已提交
65
			}
L
23  
linju 已提交
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
			//#endif
		},
		onReady() {
			//#ifdef APP-PLUS
			if(univerify_first){
				console.log('开始一键登陆');
				setTimeout(()=>{
					this.$refs.uniQuickLogin.login('univerify')
				},100)
				setTimeout(() => {
					currentWebview.setStyle({
						titleNView:{
							autoBackButton:true,
							backgroundColor:"#FFFFFF"
						}
					})
					currentWebview.setStyle({
						"top":"0"
					})
				}, 1500);
			}
			//#endif
		},
L
linju 已提交
89 90
		computed: {
			canGetShortMsg() {
91
				return this.isPhone;
芊里 已提交
92 93
			}
		},
L
linju 已提交
94
		methods: {
L
123  
linju 已提交
95 96 97 98
			selectPhoneArea(event) {
				uni.showToast({
					title: '当前仅支持中国大陆手机号',
					icon: 'none'
芊里 已提交
99 100
				});
				// this.currenPhoneArea = this.phoneArea[event.detail.value];
L
linju 已提交
101 102 103 104
			},
			sendShortMsg() {
				/**
				 * 发送验证吗
105
				 */
L
123  
linju 已提交
106
				uni.showLoading();
L
123  
linju 已提交
107 108 109 110 111 112 113
				uni.navigateTo({
					url: './phone-code?phoneNumber=' + this.formData.phone + '&phoneArea=' +
						this.currenPhoneArea,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
L
linju 已提交
114 115 116
			},
			/**
			 * 去密码登录页
芊里 已提交
117
			 */
L
linju 已提交
118 119
			toPwdLogin() {
				uni.navigateTo({
L
23  
linju 已提交
120
					url: '../pwd-login/pwd-login'
L
linju 已提交
121 122 123 124
				})
			},
			openLoginList() {
				this.$refs.loginActionSheet.open();
L
12  
linju 已提交
125 126 127
			},
			back() {
				uni.navigateBack()
芊里 已提交
128 129 130 131 132
			}
		}
	}
</script>

芊里 已提交
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
<style>
	@import url("../../common/loginPage.css");

	.content-top-title {
		text-align: center;
	}

	.login-iknow {
		justify-content: center;
	}

	.phone-area {
		/* #ifdef APP-NVUE */
		border-right-width: 1rpx;
		border-right-color: #d7d9d8;
		/* #endif */
		/* #ifndef APP-NVUE */
		border-right: 1rpx solid #d7d9d8;
		/* #endif */
L
linju 已提交
152
	}
L
123  
linju 已提交
153
</style>