uni-id-pages-fab-login.vue 15.3 KB
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1 2 3 4
<template>
	<view>
		<view class="fab-login-box">
			<view class="item" v-for="(item,index) in servicesList" :key="index"
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
5
				@click="item.path?toPage(item.path):login_before(item.id,false)">
DCloud_JSON's avatar
DCloud_JSON 已提交
6 7 8 9 10 11 12 13 14
				<image class="logo" :src="item.logo" mode="scaleToFill"></image>
				<text class="login-title">{{item.text}}</text>
			</view>
		</view>
	</view>
</template>
<script>
	import config from '@/uni_modules/uni-id-pages/config.js'
	//前一个窗口的页面地址。控制点击切换快捷登录方式是创建还是返回
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
15
	import {store,mutations} from '@/uni_modules/uni-id-pages/common/store.js'
C
chenruilong 已提交
16
	let allServicesList = []
DCloud_JSON's avatar
DCloud_JSON 已提交
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
	export default {
		computed: {
			agreements() {
				if (!config.agreements) {
					return []
				}
				let {
					serviceUrl,
					privacyUrl
				} = config.agreements
				return [{
						url: serviceUrl,
						title: "用户服务协议"
					},
					{
						url: privacyUrl,
						title: "隐私政策条款"
					}
				]
			},
			agree: {
C
chenruilong 已提交
38
				get() {
雪洛's avatar
雪洛 已提交
39
					return this.getParentComponent().agree
DCloud_JSON's avatar
DCloud_JSON 已提交
40
				},
C
chenruilong 已提交
41
				set(agree) {
雪洛's avatar
雪洛 已提交
42
					return this.getParentComponent().agree = agree
DCloud_JSON's avatar
DCloud_JSON 已提交
43 44 45
				}
			}
		},
C
chenruilong 已提交
46 47
		data() {
			return {
DCloud_JSON's avatar
DCloud_JSON 已提交
48 49 50
				servicesList: [{
						"id": "username",
						"text": "账号登录",
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
51
						"logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/user.png",
DCloud_JSON's avatar
DCloud_JSON 已提交
52 53 54 55 56
						"path": "/uni_modules/uni-id-pages/pages/login/login-withpwd"
					},
					{
						"id": "smsCode",
						"text": "短信验证码",
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
57
						"logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/sms.png",
DCloud_JSON's avatar
DCloud_JSON 已提交
58 59 60 61 62
						"path": "/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=smsCode"
					},
					{
						"id": "weixin",
						"text": "微信登录",
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
63 64 65
						"logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/weixin.png",
					},
					// #ifndef MP-WEIXIN
DCloud_JSON's avatar
DCloud_JSON 已提交
66 67 68
					{
						"id": "apple",
						"text": "苹果登录",
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
69
						"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/apple.png",
DCloud_JSON's avatar
DCloud_JSON 已提交
70 71 72 73
					},
					{
						"id": "univerify",
						"text": "一键登录",
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
74
						"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/univerify.png",
DCloud_JSON's avatar
DCloud_JSON 已提交
75 76 77 78
					},
					{
						"id": "taobao",
						"text": "淘宝登录", //暂未提供该登录方式的接口示例
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
79
						"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/taobao.png",
DCloud_JSON's avatar
DCloud_JSON 已提交
80 81 82 83
					},
					{
						"id": "facebook",
						"text": "脸书登录", //暂未提供该登录方式的接口示例
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
84
						"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/facebook.png",
DCloud_JSON's avatar
DCloud_JSON 已提交
85 86 87 88
					},
					{
						"id": "alipay",
						"text": "支付宝登录", //暂未提供该登录方式的接口示例
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
89
						"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/alipay.png",
DCloud_JSON's avatar
DCloud_JSON 已提交
90 91 92 93
					},
					{
						"id": "qq",
						"text": "QQ登录", //暂未提供该登录方式的接口示例
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
94
						"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/qq.png",
DCloud_JSON's avatar
DCloud_JSON 已提交
95 96 97 98
					},
					{
						"id": "google",
						"text": "谷歌登录", //暂未提供该登录方式的接口示例
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
99
						"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/google.png",
DCloud_JSON's avatar
DCloud_JSON 已提交
100 101 102 103
					},
					{
						"id": "douyin",
						"text": "抖音登录", //暂未提供该登录方式的接口示例
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
104
						"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/douyin.png",
DCloud_JSON's avatar
DCloud_JSON 已提交
105 106 107 108
					},
					{
						"id": "sinaweibo",
						"text": "新浪微博", //暂未提供该登录方式的接口示例
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
109 110 111
						"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/sinaweibo.png",
					}
					// #endif
DCloud_JSON's avatar
DCloud_JSON 已提交
112 113 114 115 116 117 118 119 120
				],
				univerifyStyle: { //一键登录弹出窗的样式配置参数
					"fullScreen": true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。
					"backgroundColor": "#ffffff", // 授权页面背景颜色,默认值:#ffffff
					"buttons": { // 自定义登录按钮
						"iconWidth": "45px", // 图标宽度(高度等比例缩放) 默认值:45px
						"list": []
					},
					"privacyTerms": {
C
chenruilong 已提交
121 122 123 124 125
						"defaultCheckBoxState": false, // 条款勾选框初始状态 默认值: true
						"textColor": "#BBBBBB", // 文字颜色 默认值:#BBBBBB
						"termsColor": "#5496E3", //  协议文字颜色 默认值: #5496E3
						"prefix": "我已阅读并同意", // 条款前的文案 默认值:“我已阅读并同意”
						"suffix": "并使用本机号码登录", // 条款后的文案 默认值:“并使用本机号码登录”
DCloud_JSON's avatar
DCloud_JSON 已提交
126 127 128 129 130 131 132 133 134 135 136 137 138 139
						"privacyItems": []
					}
				}
			}
		},
		watch: {
			agree(agree) {
				this.univerifyStyle.privacyTerms.defaultCheckBoxState = agree
			}
		},
		async created() {
			let servicesList = this.servicesList
			let loginTypes = config.loginTypes

DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
140
			servicesList = servicesList.filter(item => {
C
chenruilong 已提交
141

DCloud_JSON's avatar
DCloud_JSON 已提交
142
				// #ifndef APP
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
143
				//非app端去掉apple登录
DCloud_JSON's avatar
DCloud_JSON 已提交
144 145 146
				if (item.id == 'apple') {
					return false
				}
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
147
				// #endif
C
chenruilong 已提交
148

DCloud_JSON's avatar
DCloud_JSON 已提交
149
				// #ifdef APP
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
150
				//去掉非ios系统上的apple登录
DCloud_JSON's avatar
DCloud_JSON 已提交
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
				if (item.id == 'apple' && uni.getSystemInfoSync().osName != 'ios') {
					return false
				}
				// #endif

				return loginTypes.includes(item.id)
			})
			//处理一键登录
			if (loginTypes.includes('univerify')) {
				this.univerifyStyle.privacyTerms.privacyItems = this.agreements
				//设置一键登录功能底下的快捷登录按钮
				servicesList.forEach(({
					id,
					logo,
					path
				}) => {
					if (id != 'univerify') {
						this.univerifyStyle.buttons.list.push({
							"iconPath": logo,
							"provider": id,
							path //路径用于点击快捷按钮时判断是跳转页面
						})
					}
				})
			}
			//	console.log(servicesList);

			//去掉当前页面对应的登录选项
			this.servicesList = servicesList.filter(item => {
				let path = item.path ? item.path.split('?')[0] : '';
				return path != this.getRoute(1)
			})
		},
		methods: {
雪洛's avatar
雪洛 已提交
185 186 187 188
			getParentComponent(){
				// #ifndef H5
				return this.$parent;
				// #endif
C
chenruilong 已提交
189

雪洛's avatar
雪洛 已提交
190 191 192 193
				// #ifdef H5
				return this.$parent.$parent;
				// #endif
			},
DCloud_JSON's avatar
DCloud_JSON 已提交
194 195 196 197 198 199 200 201 202 203
			setUserInfo(e) {
				console.log('setUserInfo', e);
			},
			getRoute(n = 0) {
				let pages = getCurrentPages();
				if (n > pages.length) {
					return ''
				}
				return '/' + pages[pages.length - n].route
			},
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
204 205
			toPage(path,index = 0) {
				let type = ['navigateTo','redirectTo'][index]
DCloud_JSON's avatar
DCloud_JSON 已提交
206 207 208 209
				//console.log('比较', this.getRoute(1),this.getRoute(2), path)
				if (this.getRoute(1) == path.split('?')[0] && this.getRoute(1) ==
					'/uni_modules/uni-id-pages/pages/login/login-withoutpwd') {
					//如果要被打开的页面已经打开,且这个页面是 /uni_modules/uni-id-pages/pages/index/index 则把类型参数传给他
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
210 211
					let loginType = path.split('?')[1].split('=')[1]
					uni.$emit('uni-id-pages-setLoginType', loginType)
DCloud_JSON's avatar
DCloud_JSON 已提交
212 213 214
				} else if (this.getRoute(2) == path) { // 如果上一个页面就是,马上要打开的页面,直接返回。防止重复开启
					uni.navigateBack();
				} else if (this.getRoute(1) != path) {
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
215
					uni[type]({
DCloud_JSON's avatar
DCloud_JSON 已提交
216 217 218 219 220 221 222 223 224 225
						url: path,
						animationType: 'slide-in-left',
						complete(e) {
							// console.log(e);
						}
					})
				} else {
					console.log('出乎意料的情况,path:' + path);
				}
			},
C
chenruilong 已提交
226 227
			async login_before(type, navigateBack = true, options = {}) {
				console.log(type);
DCloud_JSON's avatar
DCloud_JSON 已提交
228 229 230 231 232 233 234 235
				//提示空实现
				if (["qq",
						"xiaomi",
						"sinaweibo",
						"taobao",
						"facebook",
						"google",
						"alipay",
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
236
						"douyin",
DCloud_JSON's avatar
DCloud_JSON 已提交
237 238
					].includes(type)) {
					return uni.showToast({
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
239
						title: '该登录方式暂未实现,欢迎提交pr',
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
240
						icon: 'none',
241
						duration: 3000
DCloud_JSON's avatar
DCloud_JSON 已提交
242
					});
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
243
				}
C
chenruilong 已提交
244

DCloud_JSON's avatar
DCloud_JSON 已提交
245 246
				//检查当前环境是否支持这种登录方式
				// #ifdef APP
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
247 248 249 250 251 252 253 254 255 256
				let isAppExist = true
				await new Promise((callback) => {
					plus.oauth.getServices(oauthServices => {
						let index = oauthServices.findIndex(e => e.id == type)
						if(index != -1){
							isAppExist = oauthServices[index].nativeClient
							callback()
						}else{
							return uni.showToast({
								title: '当前设备不支持此登录,请选择其他登录方式',
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
257
								icon: 'none',
258
								duration: 3000
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
259 260 261 262 263
							});
						}
					}, err => {
						throw new Error('获取服务供应商失败:' + JSON.stringify(err))
					})
DCloud_JSON's avatar
DCloud_JSON 已提交
264
				})
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
265
				// #endif
C
chenruilong 已提交
266

DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
267 268 269 270
				if (
					// #ifdef APP
					!isAppExist
					// #endif
C
chenruilong 已提交
271

DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
272 273 274 275
					//非app端使用了,app特有登录方式
					// #ifndef APP
					["univerify","apple"].includes(type)
					// #endif
C
chenruilong 已提交
276

DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
277 278 279
				) {
					return uni.showToast({
						title: '当前设备不支持此登录,请选择其他登录方式',
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
280
						icon: 'none',
281
						duration: 3000
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
282 283
					});
				}
C
chenruilong 已提交
284

DCloud_JSON's avatar
DCloud_JSON 已提交
285
				//判断是否需要弹出隐私协议授权框
C
chenruilong 已提交
286 287
				let needAgreements = (config?.agreements?.scope || []).includes('register')
				if (type != 'univerify' && needAgreements && !this.agree) {
288
					let agreementsRef = this.getParentComponent().$refs.agreements
C
chenruilong 已提交
289 290
					return agreementsRef.popup(() => {
						this.login_before(type, navigateBack, options)
DCloud_JSON's avatar
DCloud_JSON 已提交
291
					})
C
chenruilong 已提交
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319
				}

				// #ifdef H5
					if(type == 'weixin'){
						// console.log('开始微信网页登录');
						let redirectUrl = location.protocol +'//'+
										document.domain +
										(window.location.href.includes('#')?'/#':'') +
										'/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin'
						let ua = window.navigator.userAgent.toLowerCase();
						if (ua.match(/MicroMessenger/i) == 'micromessenger'){
							// console.log('在微信公众号内');
							return window.open(`https://open.weixin.qq.com/connect/oauth2/authorize?
										appid=${config.appid.weixin.h5}
										&redirect_uri=${encodeURIComponent(redirectUrl)}
										&response_type=code
										&scope=snsapi_userinfo
										&state=STATE&connect_redirect=1#wechat_redirect`);

						}else{
							// console.log('非微信公众号内');
							return location.href = `https://open.weixin.qq.com/connect/qrconnect?appid=${config.appid.weixin.web}
											&redirect_uri=${encodeURIComponent(redirectUrl)}
											&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect`
						}
					}
				// #endif

DCloud_JSON's avatar
DCloud_JSON 已提交
320 321 322
				uni.showLoading({
					mask: true
				})
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
323

DCloud_JSON's avatar
DCloud_JSON 已提交
324 325
				if (type == 'univerify') {
					let univerifyManager = uni.getUniverifyManager()
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
326
					let clickAnotherButtons = false
DCloud_JSON's avatar
DCloud_JSON 已提交
327
					let onButtonsClickFn = async res => {
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
328 329 330 331 332 333 334 335 336 337
						console.log('点击了第三方登录,provider:', res, res.provider, this.univerifyStyle.buttons.list);
						clickAnotherButtons = true
						let checkBoxState = await uni.getCheckBoxState();
						// 同步一键登录弹出层隐私协议框是否打勾
						// #ifdef VUE2
						this.agree = checkBoxState[1].state
						// #endif
						// #ifdef VUE3
						this.agree = checkBoxState.state
						// #endif
DCloud_JSON's avatar
DCloud_JSON 已提交
338 339 340
						let {
							path
						} = this.univerifyStyle.buttons.list[res.index]
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
341 342 343 344 345
						if (path) {
							if( this.getRoute(1).includes('login-withoutpwd') && path.includes('login-withoutpwd') ){
								this.getParentComponent().showCurrentWebview()
							}
							this.toPage(path,1)
DCloud_JSON's avatar
DCloud_JSON 已提交
346 347
							closeUniverify()
						} else {
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
348
							if (this.agree) {
DCloud_JSON's avatar
DCloud_JSON 已提交
349 350 351 352 353 354 355
								closeUniverify()
								setTimeout(() => {
									this.login_before(res.provider)
								}, 500)
							} else {
								uni.showToast({
									title: "你未同意隐私政策协议",
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
356
									icon: 'none',
357
									duration: 3000
DCloud_JSON's avatar
DCloud_JSON 已提交
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
								});
							}
						}
					}

					function closeUniverify() {
						uni.hideLoading()
						univerifyManager.close()
						// 取消订阅自定义按钮点击事件
						univerifyManager.offButtonsClick(onButtonsClickFn)
					}
					// 订阅自定义按钮点击事件
					univerifyManager.onButtonsClick(onButtonsClickFn)
					// 调用一键登录弹框
					return univerifyManager.login({
						"univerifyStyle": this.univerifyStyle,
						success: res => {
							this.login(res.authResult, 'univerify')
						},
						fail(err) {
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
378 379 380 381 382 383 384 385 386
							console.log(err)
							if(!clickAnotherButtons){
								uni.navigateBack()
							}
							// uni.showToast({
							// 	title: JSON.stringify(err),
							// 	icon: 'none',
							// 	duration: 3000
							// });
DCloud_JSON's avatar
DCloud_JSON 已提交
387 388 389 390
						},
						complete: async e => {
							uni.hideLoading()
							//同步一键登录弹出层隐私协议框是否打勾
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
391
							// this.agree = (await uni.getCheckBoxState())[1].state
DCloud_JSON's avatar
DCloud_JSON 已提交
392 393 394 395 396
							// 取消订阅自定义按钮点击事件
							univerifyManager.offButtonsClick(onButtonsClickFn)
						}
					})
				}
397

DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
398 399 400 401 402
				if (type === 'weixinMobile') {
					return this.login({
						phoneCode: options.phoneNumberCode
					}, type)
				}
403

DCloud_JSON's avatar
DCloud_JSON 已提交
404 405 406
				uni.login({
					"provider": type,
					"onlyAuthorize": true,
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
407 408
					// #ifdef APP
					"univerifyStyle": this.univerifyStyle,
DCloud_JSON's avatar
DCloud_JSON 已提交
409 410 411 412 413 414
					// #endif
					success: async e => {
						if (type == 'apple') {
							let res = await this.getUserInfo({
								provider: "apple"
							})
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
415
							Object.assign(e.authResult, res.userInfo)
DCloud_JSON's avatar
DCloud_JSON 已提交
416 417 418 419 420 421 422
							uni.hideLoading()
						}
						this.login(type == 'weixin' ? {
							code: e.code
						} : e.authResult, type)
					},
					fail: async (err) => {
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
423
						console.log(err);
DCloud_JSON's avatar
DCloud_JSON 已提交
424 425 426 427
						uni.hideLoading()
					}
				})
			},
C
chenruilong 已提交
428
			login(params, type) { //联网验证登录
study夏羽's avatar
1.0.37  
study夏羽 已提交
429 430
				// console.log('执行登录开始----');
				console.log({params,type});
DCloud_JSON's avatar
DCloud_JSON 已提交
431
				//toLowerCase
C
chenruilong 已提交
432
				let action = 'loginBy' + type.trim().replace(type[0], type[0].toUpperCase())
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
433 434
				const uniIdCo = uniCloud.importObject("uni-id-co",{
					customUI:true
DCloud_JSON's avatar
DCloud_JSON 已提交
435 436
				})
				uniIdCo[action](params).then(result => {
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
437 438
					uni.showToast({
						title: '登录成功',
DCloud_JSON's avatar
1.1.0  
DCloud_JSON 已提交
439
						icon: 'none',
440
						duration: 2000
DCloud_JSON's avatar
DCloud_JSON 已提交
441
					});
C
chenruilong 已提交
442 443
					// #ifdef H5
					result.loginType = type
DCloud_JSON's avatar
DCloud_JSON 已提交
444
					// #endif
DCloud_JSON's avatar
1.0.20  
DCloud_JSON 已提交
445
					mutations.loginSuccess(result)
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
446
				})
DCloud_JSON's avatar
DCloud_JSON 已提交
447
				.catch(e=>{
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
448 449 450 451
					uni.showModal({
						content: e.message,
						confirmText:"知道了",
						showCancel: false
DCloud_JSON's avatar
DCloud_JSON 已提交
452
					});
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
453
				})
DCloud_JSON's avatar
DCloud_JSON 已提交
454 455 456
				.finally(e => {
					if (type == 'univerify') {
						uni.closeAuthView()
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
457
					}
DCloud_JSON's avatar
DCloud_JSON 已提交
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
					uni.hideLoading()
				})
			},
			async getUserInfo(e) {
				return new Promise((resolve, reject) => {
					uni.getUserInfo({
						...e,
						success: (res) => {
							resolve(res);
						},
						fail: (err) => {
							uni.showModal({
								content: JSON.stringify(err),
								showCancel: false
							});
							reject(err);
						}
					})
				})
			}
		}
	}
</script>

<style lang="scss">
	/* #ifndef APP-NVUE */
	.fab-login-box,
	.item {
		display: flex;
		box-sizing: border-box;
		flex-direction: column;
	}
	/* #endif */

	.fab-login-box {
		flex-direction: row;
		flex-wrap: wrap;
		width: 750rpx;
		justify-content: space-around;
C
chenruilong 已提交
497
		position: fixed;
DCloud_JSON's avatar
DCloud_JSON 已提交
498 499
		left: 0;
	}
C
chenruilong 已提交
500

JiaRongPing's avatar
JiaRongPing 已提交
501 502 503 504 505 506 507
	.item {
		flex-direction: column;
		justify-content: center;
		align-items: center;
		height: 200rpx;
		cursor: pointer;
	}
DCloud_JSON's avatar
DCloud_JSON 已提交
508 509 510 511 512 513 514

	/* #ifndef APP-NVUE */
	@media screen and (min-width: 690px) {
		.fab-login-box {
			max-width: 500px;
			margin-left: calc(50% - 250px);
		}
JiaRongPing's avatar
JiaRongPing 已提交
515 516 517 518
		.item {
			height: 160rpx;
		}
	}
C
chenruilong 已提交
519

JiaRongPing's avatar
JiaRongPing 已提交
520 521 522 523
	@media screen and (max-width: 690px) {
		.fab-login-box {
			bottom: 10rpx;
		}
DCloud_JSON's avatar
DCloud_JSON 已提交
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543
	}

	/* #endif */

	.logo {
		width: 60rpx;
		height: 60rpx;
		max-width: 40px;
		max-height: 40px;
		border-radius: 100%;
		border: solid 1px #F6F6F6;
	}

	.login-title {
		text-align: center;
		margin-top: 6px;
		color: #999;
		font-size: 10px;
		width: 70px;
	}
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
544
</style>