| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
- <title>连接华为运动健康</title>
- <style>
- * { margin: 0; padding: 0; box-sizing: border-box; }
- body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; background: #F8F8F8; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
- .card { background: #fff; border-radius: 16px; padding: 32px 24px; width: 88%; max-width: 380px; text-align: center; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
- .icon { font-size: 44px; margin-bottom: 12px; }
- h1 { font-size: 18px; font-weight: 700; color: #333; margin-bottom: 8px; }
- .desc { font-size: 14px; color: #999; margin-bottom: 20px; line-height: 1.6; }
- .btn { display: inline-block; background: #F97316; color: #fff; border: none; border-radius: 24px; padding: 10px 32px; font-size: 14px; cursor: pointer; text-decoration: none; }
- .btn:hover { opacity: 0.9; }
- .error { color: #E53E3E; font-size: 13px; margin-top: 12px; display: none; }
- </style>
- </head>
- <body>
- <div class="card">
- <div class="icon">⌚</div>
- <h1>连接华为运动健康</h1>
- <p class="desc" id="desc">正在跳转华为账号授权…</p>
- <a class="btn" id="fallback" style="display:none" href="javascript:void(0)">若未自动跳转请点此</a>
- <p class="error" id="error">授权页加载失败,请返回重试</p>
- </div>
- <script>
- // §5.1:入口 /huawei-auth.html?memberId=<id>&authUrl=<encodeURIComponent(authUrl)>
- // 读 query 后 location.replace(authUrl) 跳华为授权(authUrl 由前端调接口1获取后拼在本页 query)。
- // 本页不出现任何华为账号/密码输入框(防钓鱼观感与合规风险)。
- (function() {
- function getParam(name) {
- var m = location.search.match(new RegExp('[?&]' + name + '=([^&]*)'))
- return m ? decodeURIComponent(m[1].replace(/\+/g, '%20')) : ''
- }
- var authUrl = getParam('authUrl')
- var fallback = document.getElementById('fallback')
- var error = document.getElementById('error')
- var desc = document.getElementById('desc')
- function jump(url) {
- // 小屏 web-view 内 location.replace 跳转 OAuth
- location.replace(url)
- }
- fallback.addEventListener('click', function() {
- if (authUrl) { desc.textContent = '正在跳转华为账号授权…'; jump(authUrl) }
- })
- if (authUrl) {
- desc.textContent = '正在跳转华为账号授权…'
- jump(authUrl)
- } else {
- desc.textContent = '缺少授权参数'
- error.style.display = 'block'
- fallback.style.display = 'none'
- }
- })();
- </script>
- </body>
- </html>
|