| <template> | |
| 	<view class="se-pos se-h-vh-100"> | |
| 		<view class="se-flex se-pt-200 se-flex-h-c se-flex-ff-cw"> | |
| 			<image class="se-w-150 se-h-150" src="@/static/image/logo.png" mode=""></image> | |
| 			<view class="se-flex se-flex-h-c se-fs-34 se-fw-6 se-c-black se-mt-40"> | |
| 				智选猎头 | |
| 			</view> | |
| 			 | |
| 		</view> | |
| 		 | |
| 		<view class="se-pb-200 se-pos-cb se-w-p-100"> | |
| 			<button  @getuserinfo="onLogin" open-type="getUserInfo" class="se-mx-80  se-br-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-32 se-c-white se-bgc-orange"> | |
| 				<image class="se-w-45 se-h-35" src="@/static/image/wechat.png" mode=""></image> | |
| 				<text class="se-ml-10">微信登录</text> | |
| 			</button> | |
| 			<view @click="onNavigator" class="se-mx-80 se-br-40 se-mt-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-32 se-c-66 se-bgc-f5"> | |
| 				<text>取消登录</text> | |
| 			</view> | |
| 			<view class="se-mx-80 se-br-40 se-mt-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-24 se-c-33"> | |
| 				<u-checkbox-group @change="checkboxChange" v-model="checked"> | |
| 					<u-checkbox name="1" activeColor="#ff7a31" label-size="12" shape="circle" label="阅读并同意"></u-checkbox> | |
| 				</u-checkbox-group> | |
| 				<text class="se-c-orange" @click="show=true">《隐私政策》</text> | |
| 				<text class="se-c-orange" @click="show=true">《服务条款》</text> | |
| 			</view> | |
| 		</view> | |
| 		 | |
| 		<u-popup :show="show" :custom-style="{alignItems:'center'}" mode="center" bg-color="transparent"> | |
| 			<view class="se-w-600  se-bgc-white se-br-40 se-p-40"> | |
| 				<view class="se-flex se-flex-h-c"> | |
| 					<image class="se-a-80" src="@/static/image/6588.png" mode=""></image> | |
| 				</view> | |
| 				<view class="se-flex se-flex-h-c se-fs-34 se-fw-6 se-c-black se-mt-40"> | |
| 					服务协议和隐私权政策 | |
| 				</view> | |
| 				<view class="se-lh-40 se-mt-40 se-fs-24 se-c-99"> | |
| 					<u-parse :content="getValueByName('config_privacy')"></u-parse> | |
| 					<text>请您务必审慎阅读、充分理解用户协议和隐私政策各条款,包括但不限于用户注意事项、用户行为规范以及为了向你提供服务而收集、使用、存储你个人信息的情况等。你可阅读</text> | |
| 					<text class="se-c-black se-fw-6" @click="handleOpenPrivacyContract()">《用工平台小程序用户服务协议》</text> | |
| 					<text>和</text> | |
| 					<text class="se-c-black se-fw-6" @click="handleOpenPrivacyContract()">《用工平台小程序平台隐私权政策》</text> | |
| 					<text>了解详细信息。如你同意,请点击下方按钮开始接受我们的服务。</text> | |
| 				</view> | |
| 				<view class="se-flex se-flex-h-sb se-mt-40"> | |
| 					<view @click="onCancel" class="se-br-20 se-flex-1 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-32 se-c-66 se-bgc-f5"> | |
| 						<text>不同意</text> | |
| 					</view> | |
| 					<view @click="onAgree" class="se-br-20 se-ml-20 se-flex-1 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-32 se-c-white se-bgc-orange"> | |
| 						<text class="se-ml-10">同意</text> | |
| 					</view> | |
| 				</view> | |
| 			</view> | |
| 		</u-popup> | |
| 	</view> | |
| </template> | |
| 
 | |
| <script> | |
| 	import { appletLogin,userInfo,getSysText,getSessionKey } from "@/common/api.js" | |
| 	export default { | |
| 		name : 'Auth', | |
| 		data() { | |
| 			return { | |
| 				checked:[], | |
| 				show:false, | |
| 				sysList:[], | |
| 				code:"" | |
| 			} | |
| 		}, | |
| 		mounted() { | |
| 			this.onSysText() | |
| 			this.onSessionKey() | |
| 		}, | |
| 		filter:{ | |
| 			 | |
| 		}, | |
| 		methods: { | |
| 			onSessionKey(){ | |
| 				// let that = this | |
| 				// uni.login({ | |
| 				// 	success(res) { | |
| 				// 		that.code = res.code | |
| 				// 		getSessionKey({code:that.code}).then(response=>{ | |
| 				// 			uni.setStorageSync('sessionKey',response.result) | |
| 				// 		}).catch(error=>{ | |
| 							 | |
| 				// 		}) | |
| 				// 	} | |
| 				// }) | |
| 			}, | |
| 			getValueByName(name) { | |
| 				const item = this.sysList.find((item) => item.paramCode == name); | |
| 				return item ? item.value : ""; | |
| 			}, | |
| 			onSysText(){ | |
| 				let that = this | |
| 				let params={} | |
| 				// getSysText(params).then(response=>{ | |
| 				// 	that.sysList=response.result | |
| 				// 	uni.setStorageSync('sysList', response.result) | |
| 				// }).catch(error=>{ | |
| 					 | |
| 				// }) | |
| 			}, | |
| 			checkboxChange(n) { | |
| 				console.log('change', n); | |
| 			}, | |
| 			onCancel(){ | |
| 				this.show=false; | |
| 				this.checked=[]; | |
| 			}, | |
| 			onAgree(){ | |
| 				this.show=false; | |
| 				this.checked=['1']; | |
| 			}, | |
| 			onLogin(event){ | |
| 				console.info(event) | |
| 				let that = this | |
| 				if(that.checked.length==0){ | |
| 					return uni.showToast({ | |
| 						icon: "none", | |
| 						title: "请勾选隐私协议" | |
| 					}) | |
| 				} | |
| 				uni.showLoading({ | |
| 					title: '登录中...' | |
| 				}) | |
| 				uni.login({ | |
| 					success(res) { | |
| 						console.info(res.code) | |
| 						if(res.errMsg != "login:ok"){ | |
| 							return | |
| 						} | |
| 						let params={ | |
| 							code : res.code, | |
| 							encryptedData: event.detail.encryptedData, | |
| 							headimgurl:event.detail.userInfo.avatarUrl, | |
| 							iv:event.detail.iv, | |
| 							nickName:event.detail.userInfo.nickName, | |
| 							session_key:uni.getStorageSync('sessionKey'), | |
| 							shareId:uni.getStorageSync('userId'), | |
| 							vid:"" | |
| 						} | |
| 						appletLogin(params).then((response) => { | |
| 							let result = response.result | |
| 							console.info(`appletLogin`,result) | |
| 							uni.hideLoading() | |
| 							uni.setStorageSync('token', result.token) | |
| 							uni.setStorageSync('userInfo', result.userInfo) | |
| 							if(!result.userInfo.headImage && !result.userInfo.nickName && !result.userInfo.phone){ | |
| 								uni.navigateTo({ | |
| 									url:"/pages/login/index" | |
| 								}) | |
| 							}else{ | |
| 								// 检查个人和企业认证状态 | |
| 								that.checkAuthStatus() | |
| 							} | |
| 						}).catch((error) =>{ | |
| 							uni.hideLoading() | |
| 							uni.showToast({ | |
| 								title: '登录失败,请重试', | |
| 								icon: 'none', | |
| 								duration: 2000 | |
| 							}) | |
| 						}) | |
| 					} | |
| 				}) | |
| 			}, | |
| 			onNavigator(){ | |
| 				uni.switchTab({ | |
| 					url:"/pages/home/index" | |
| 				}) | |
| 			}, | |
| 			checkAuthStatus() { | |
| 				let that = this | |
| 				// 显示认证状态检查加载提示 | |
| 				uni.showLoading({ | |
| 					title: '检查认证状态...', | |
| 					mask: true | |
| 				}) | |
| 				 | |
| 				// 检查个人认证状态 | |
| 				this.$store.dispatch('onPersonalAuth', { | |
| 					success: (person) => { | |
| 						// 个人认证通过,直接跳转到首页 | |
| 						uni.hideLoading() | |
| 						uni.switchTab({ | |
| 							url: "/pages/home/index" | |
| 						}) | |
| 					}, | |
| 					fail: (person) => { | |
| 						// 个人认证未通过,检查企业认证 | |
| 						that.$store.dispatch('onEnterpriseAuth', { | |
| 							success: (company) => { | |
| 								// 企业认证通过,直接跳转到首页 | |
| 								uni.hideLoading() | |
|                                 uni.switchTab({ | |
|                                     url: "/pages/home/index" | |
|                                 }) | |
| 							}, | |
| 							fail: (company) => { | |
| 								// 个人和企业都未认证,跳转到身份选择页面 | |
| 								uni.hideLoading() | |
|                                 uni.navigateTo({ | |
|                                     url: "/pages/identity/index" | |
|                                 }) | |
| 							} | |
| 						}) | |
| 					} | |
| 				}) | |
| 			}, | |
| 			handleOpenPrivacyContract() { | |
| 				// 打开隐私协议页面 | |
| 				wx.openPrivacyContract({ | |
| 					success: () => {}, // 打开成功 | |
| 					fail: () => {}, // 打开失败 | |
| 					complete: () => {} | |
| 				}) | |
| 			} | |
| 			 | |
| 		} | |
| 	} | |
| </script> | |
| 
 | |
| <style scoped lang="scss"> | |
| </style>
 |