<template>
	<view class="container"></view>
</template>

<script>
	export default {
		data() {
			return {
				faceType: "",
				fromPage: ""
			};
		},
		onLoad: function(options) {
			console.log(options);
			this.faceType = options.faceType || "";
			this.fromPage = options.fromPage || "";
			console.log("准备跳转了哦1");
			//faceAuth = 1  人脸活体检测成功
			// my.navigateTo({
			//   url: `/pages/BankModule/OpenAccount/OpenAccount?faceAuth=1`,
			// });
		},
		onShow() {
			console.log(this.faceType, "lalalallalala", this.fromPage);
			if (this.fromPage == "WECHAT") {
				if (this.faceType == "OPEN_ACCOUNT") {
					// 开户
					jWeixin.miniProgram.navigateTo({
						url: `/pages_subpack/pages/BankOpenAccount/BankOpenAccount?faceAuth=1`,
						success: function(res) {
							// 跳转成功
						},
						fail: function(err) {
							// 捕捉到错误，可以在这里处理错误
							console.error('navigateTo failed:', err);
						}
					});
				} else if (this.faceType == "CHANGE_CARD") {
					// 换绑卡
					jWeixin.miniProgram.navigateTo({
						url: `/pages/AssignAddCardInfo/main?faceAuth=1`,
						success: function(res) {
							// 跳转成功
						},
						fail: function(err) {
							// 捕捉到错误，可以在这里处理错误
							console.error('navigateTo failed:', err);
						}
					});
				} else if (this.faceType == "CANCEL_ACCOUNT") {
					// 销户
					jWeixin.miniProgram.navigateTo({
						url: `/pages/AssignCancelUserPhone/main?faceAuth=1`,
						success: function(res) {
							// 跳转成功
						},
						fail: function(err) {
							// 捕捉到错误，可以在这里处理错误
							console.error('navigateTo failed:', err);
						}
					});
				}
			} else {
				if (this.faceType == "OPEN_ACCOUNT") {
					// 开户
					my.navigateTo({
						url: `/pages/BankModule/OpenAccount/OpenAccount?faceAuth=1`,
					});
				} else if (this.faceType == "CHANGE_CARD") {
					// 换绑卡
					my.navigateTo({
						url: `/pages/BankModule/ChangeBankPay/ChangeBankPay?faceAuth=1`,
					});
				} else if (this.faceType == "CANCEL_ACCOUNT" || this.faceType == "ACTIVE_ACCOUNT") {
					// 销户、不动户激活
					my.navigateTo({
						url: `/pages/BankModule/Recharge/Recharge?faceAuth=1&faceType=${this.faceType}`,
					});
				}
			}
		}
	}
</script>

<style scoped>
</style>