| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>连接华为运动健康</title>
- <style>
- * { margin: 0; padding: 0; box-sizing: border-box; }
- body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f7f8fa; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
- .wrap { background: #fff; border-radius: 16px; padding: 40px 32px; width: 88%; max-width: 420px; text-align: center; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
- h1 { font-size: 20px; color: #1f2329; margin-bottom: 12px; }
- .sub { font-size: 14px; color: #8a919f; margin-bottom: 28px; line-height: 1.6; }
- .loading { color: #5f6b7a; font-size: 15px; margin-bottom: 16px; }
- .btn { display: inline-block; background: #4259ff; color: #fff; border: none; border-radius: 8px; padding: 12px 28px; font-size: 15px; cursor: pointer; }
- .btn:hover { opacity: .9; }
- .err { color: #e5484d; font-size: 14px; margin-top: 12px; line-height: 1.6; }
- .hide { display: none; }
- </style>
- </head>
- <body>
- <div class="wrap">
- <h1>连接华为运动健康</h1>
- <p class="sub">正在跳转华为账号授权页,请在弹出的页面中完成授权。</p>
- <p id="loading" class="loading">加载中…</p>
- <button id="fallback" class="btn hide" onclick="jump()">若未自动跳转请点此</button>
- <p id="err" class="err hide"></p>
- </div>
- <script>
- // H5 中转授权页(huawei-auth.html):读 query 后 location.replace(authUrl) 跳华为授权。
- // authUrl 由小程序调 POST /api/huawei-health/auth-url 获取后拼在本页 query(real 分支)。
- // 页面内不含任何密码输入框(合规/防钓鱼观感)。
- function parseQuery() {
- var qs = window.location.search.replace(/^\?/, '')
- var out = {}
- if (!qs) return out
- var parts = qs.split('&')
- for (var i = 0; i < parts.length; i++) {
- var kv = parts[i].split('=')
- if (kv[0]) out[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1] || '')
- }
- return out
- }
- var q = parseQuery()
- var authUrl = q.authUrl || ''
- function jump() {
- if (!authUrl) {
- document.getElementById('loading').classList.add('hide')
- document.getElementById('err').classList.remove('hide')
- document.getElementById('err').textContent = '缺少授权链接(authUrl),请返回小程序重新发起绑定'
- return
- }
- window.location.replace(authUrl)
- }
- document.getElementById('fallback').classList.remove('hide')
- jump()
- </script>
- </body>
- </html>
|