box_app: add wx-h5-demo standalone project (two mini-program auth scenarios); mount /wx-h5-demo; update auth doc; drop old examples/wx-h5-auth

This commit is contained in:
2026-09-07 16:22:51 +08:00
commit eaaf2b6773
6 changed files with 280 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<!-- 场景2(也是场景1授权后的落地页):web-view 承载 H5 + postMessage 授权 + 回传
用法:本页 <web-view src="{{url}}"> 加载 wx-h5-demo/index.html。
- 场景2:H5 请求授权 → bindmessage 收到 → 弹原生面板 → 授权 → 更新 web-view src(带结果)。
- 场景1:auth-bridge 授权后 redirectTo 本页,本页 onLoad 从 globalData 读结果拼进 H5 url。 -->
<!-- wxml -->
<web-view wx:if="{{url}}" src="{{url}}" bindmessage="onMessage"></web-view>
<view wx:if="{{showAuth}}" class="auth-mask" bindtap="closeAuth">
<view class="auth-panel" catchtap="noop">
<view class="auth-title">授权获取资料</view>
<view class="auth-sub">用于在 wx-h5-demo 中展示昵称/头像/手机号</view>
<button class="auth-btn" open-type="getPhoneNumber" bindgetphonenumber="onPhone">获取手机号</button>
<input class="auth-input" type="nickname" bindblur="onNick" bindchange="onNick" placeholder="输入昵称" />
<button class="auth-btn avatar" open-type="chooseAvatar" bindchooseavatar="onAvatar">
<image wx:if="{{avatar}}" class="auth-avatar" src="{{avatar}}" mode="aspectFill" /><text wx:else>选择头像</text>
</button>
<view class="auth-cancel" bindtap="closeAuth">取消</view>
</view>
</view>