Ver código fonte

Merge branch 'feature-app-login-page' into feature-ip-9.6

jihuaqiang 2 anos atrás
pai
commit
696767a8a7
2 arquivos alterados com 68 adições e 0 exclusões
  1. 5 0
      nuxt.config.js
  2. 63 0
      pages/auth/authLoginInApp.vue

+ 5 - 0
nuxt.config.js

@@ -60,6 +60,11 @@ export default {
 					path: '/authlogin',
 					component: resolve(__dirname, 'pages/auth/authLogin.vue'),
 				},
+				{
+					name: 'AuthloginApp',
+					path: '/authloginApp',
+					component: resolve(__dirname, 'pages/auth/authLoginInApp.vue'),
+				},
 				{
 					name: 'Unlogin',
 					path: '/unlogin',

+ 63 - 0
pages/auth/authLoginInApp.vue

@@ -0,0 +1,63 @@
+<!-- 移动端 twitter授权登录中间页 -->
+<template>
+	<div class="welcome">
+		<span class="text"></span>
+	</div>
+</template>
+
+<script>
+export default {
+	name: 'authLogin',
+	data() {
+		return {
+			code: '',
+		};
+	},
+	mounted() {
+		let url = new URL(window.location.href);
+		let search = url.search;
+		let urlParams = new URLSearchParams(search);
+		let verifier = urlParams.get('oauth_verifier');
+		if (verifier) {
+			alert(verifier);
+			window.ReactNativeWebView.postMessage(
+				JSON.stringify({
+					verifier,
+				})
+			);
+			// setStorage(storageKey.verifier, verifier);
+			// let time = process.env.NODE_ENV === 'production' ? 200 : 500;
+			// setTimeout(() => {
+			// 	this.close();
+			// }, time);
+		} else {
+			// 用户取消 或者 异常进入
+			window.ReactNativeWebView.postMessage(
+				JSON.stringify({
+					verifier,
+				})
+			);
+			// setStorage(storageKey.backFromTwitterLogin, 1);
+			// this.close();
+		}
+	},
+};
+</script>
+
+<style lang="scss" scoped>
+body {
+	background-color: #f5f5f5;
+}
+
+.welcome {
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	width: 100%;
+	height: 100%;
+	.text {
+		font-size: 22px;
+		color: #1d9bf0;
+	}
+}
+</style>