
<template>
	<view class="content">
		<button type="default" @click="login">登录</button>
	</view>
</template>

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

		},
		methods: {
			login(){
				uni.login({
					provider: 'univerify',
					univerifyStyle: { 
						fullScreen: true,
						authButton: {
							normalColor	: "#c82626",
							borderRadius: 0
						},
						buttons: {
							list: [{
								provider : "微信",
								iconPath : "/static/icons/wechat.png"
							}]
						},
						otherLoginButton: {
							borderColor	: "#c82626",
							title		: "其他手机号码登录",
							borderRadius: 0,
							textColor	: "#c82626"
						},
						privacyTerm: {
							privacyItems: [{
								url		: "https://baidu.com",
								title	: "用户服务协议"
							}]
						}
					},
					success	: auth => {
						uniCloud.callFunction({
							name: "phone-login",
							data: {
								access_token: auth.authResult.access_token,
								openid		: auth.authResult.openid
							}
						}).then(res=>{
							console.log(res)
						}).catch(err=>{
							console.log(err)
						})
					},
					fail	: err => {
						console.log(err)
					}
				})
			}
		}
	}
</script>

<style>
	
</style>
