216 lines
8.2 KiB
Plaintext
216 lines
8.2 KiB
Plaintext
<view class="wrapper">
|
|
<!-- STATE: LOADING_RULES -->
|
|
<view wx:if="{{ app_state == 'loading_rules' }}" class="loading-spinner">
|
|
<view class="spinner"></view>
|
|
<text>加载相机规则...</text>
|
|
</view>
|
|
|
|
<!-- STATE: LOADING_QRTOOL -->
|
|
<view wx:if="{{ app_state == 'loading_qrtool' }}" class="loading-spinner">
|
|
<view class="spinner"></view>
|
|
<text>初始化QR工具...</text>
|
|
</view>
|
|
|
|
<!-- STATE: INIT_CAMERA -->
|
|
<block wx:if="{{ app_state == 'init_camera' }}">
|
|
<!-- Show camera without overlays during initialization -->
|
|
<view class="osd">
|
|
<view class="upper" bindtap="debug_tap">
|
|
{{ hint_text }}
|
|
</view>
|
|
</view>
|
|
|
|
<!-- WeChat native camera -->
|
|
<camera class="camera"
|
|
flash="{{ camera_flash }}"
|
|
frame-size="medium"
|
|
bindinitdone="onCameraReady"
|
|
binderror="onCameraError">
|
|
</camera>
|
|
</block>
|
|
|
|
<!-- STATE: SCANNING -->
|
|
<block wx:if="{{ app_state == 'scanning' }}">
|
|
<!-- QR targeting arcs overlay -->
|
|
<view class="qrarc {{ qrarc_class }}">
|
|
<image class="topleft arc" src="./assets/arc.png"></image>
|
|
<image class="topright arc" src="./assets/arc.png"></image>
|
|
<image class="bottomleft arc" src="./assets/arc.png"></image>
|
|
<image class="bottomright arc" src="./assets/arc.png"></image>
|
|
</view>
|
|
|
|
<!-- QR markers overlay -->
|
|
<view class="qrmarkers {{ qrmarkers_class }}">
|
|
<image class="square" src="./assets/qrmarkers.png"></image>
|
|
</view>
|
|
|
|
<!-- On-screen display for hints -->
|
|
<view class="osd">
|
|
<view class="upper" bindtap="debug_tap">
|
|
{{ hint_text }}
|
|
</view>
|
|
</view>
|
|
|
|
<!-- WeChat native camera -->
|
|
<camera class="camera"
|
|
flash="{{ camera_flash }}"
|
|
frame-size="medium"
|
|
bindinitdone="onCameraReady"
|
|
binderror="onCameraError">
|
|
</camera>
|
|
</block>
|
|
|
|
<!-- STATE: WEBVIEW_SCANNING -->
|
|
<block wx:if="{{ app_state == 'webview_scanning' }}">
|
|
<!-- Web-view camera (no overlays) -->
|
|
<web-view src="{{ emblem_camera_url }}"
|
|
bindmessage="on_webview_message">
|
|
</web-view>
|
|
</block>
|
|
|
|
<!-- Debug overlay (available in all states) -->
|
|
<view class="debug" wx:if="{{ enable_debug }}">
|
|
<view class="debug-top-row">
|
|
<view class="debug-image-box">
|
|
<image src="{{ debug_image_data_url }}"></image>
|
|
<view class="debug-label">Processed Frame</view>
|
|
</view>
|
|
<view class="debug-frame-box">
|
|
<image src="{{ debug_current_frame_url }}"></image>
|
|
<view class="debug-label">Raw Frame</view>
|
|
</view>
|
|
<view class="debug-info-panel">
|
|
<view class="debug-items">
|
|
<!-- Application State -->
|
|
<view class="debug-item">
|
|
<text class="debug-label">state:</text>
|
|
<text class="debug-value">{{ app_state }}</text>
|
|
</view>
|
|
|
|
<!-- System Info -->
|
|
<view class="debug-item">
|
|
<text class="debug-label">model:</text>
|
|
<text class="debug-value">{{ phone_model }}</text>
|
|
</view>
|
|
<view class="debug-item">
|
|
<text class="debug-label">zoom:</text>
|
|
<text class="debug-value-number">{{ zoom }}/{{ max_zoom }}</text>
|
|
</view>
|
|
<view class="debug-item">
|
|
<text class="debug-label">sensitivity:</text>
|
|
<text class="debug-value">{{ camera_sensitivity }}</text>
|
|
</view>
|
|
<view class="debug-item debug-flag-box" wx:if="{{ no_web_view }}">
|
|
<text class="debug-flag">no_web_view</text>
|
|
</view>
|
|
|
|
<!-- Frame Statistics -->
|
|
<view class="debug-item">
|
|
<text class="debug-label">frames:</text>
|
|
<text class="debug-value-number">{{ frames_processed }}</text>
|
|
<text class="debug-value">/</text>
|
|
<text class="debug-value-number">{{ frames_processed + frames_skipped }}</text>
|
|
</view>
|
|
<view class="debug-item">
|
|
<text class="debug-label">ok:</text>
|
|
<text class="debug-value">{{ ok_frames }}</text>
|
|
<text class="debug-value">/3</text>
|
|
</view>
|
|
<view class="debug-item">
|
|
<text class="debug-label">avg:</text>
|
|
<text class="debug-value-number">{{ avg_processing_time_ms }}ms</text>
|
|
</view>
|
|
|
|
<!-- QR Detection Results -->
|
|
<view class="debug-item" wx:if="{{ debug_last_result }}">
|
|
<text class="debug-label">qr:</text>
|
|
<text class="debug-value">{{ debug_last_result.qrcode || 'none' }}</text>
|
|
</view>
|
|
<view class="debug-item" wx:if="{{ debug_last_result }}">
|
|
<text class="debug-label">ok:</text>
|
|
<text class="debug-value">{{ debug_last_result.ok ? 'yes' : 'no' }}</text>
|
|
</view>
|
|
<view class="debug-item" wx:if="{{ debug_last_result && debug_last_result.err }}">
|
|
<text class="debug-label">err:</text>
|
|
<text class="debug-value">{{ debug_last_result.err }}</text>
|
|
</view>
|
|
|
|
<!-- Legacy Result -->
|
|
<view class="debug-item" wx:if="{{ result }}">
|
|
<text class="debug-label">result:</text>
|
|
<text class="debug-value">{{ result }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="debug-messages">
|
|
<text wx:for="{{ debug_msgs }}" class="debug-msg">{{ item }}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- Bottom action controls (for camera init and scanning) -->
|
|
<view wx:if="{{ app_state == 'init_camera' || app_state == 'scanning' }}" class="bottomfixed">
|
|
<view class="actions">
|
|
<view class="half {{ show_tip ? 'brighter' : '' }}" bindtap="show_scanguide">
|
|
<view class="icon">
|
|
<image src="./assets/play-button.png"></image>
|
|
</view>
|
|
<view class="text">
|
|
扫描指南
|
|
</view>
|
|
</view>
|
|
<view class="half {{ camera_flash == 'torch' ? 'brighter' : '' }}" bindtap="toggle_torch">
|
|
<view class="icon">
|
|
<image src="./assets/flash-button.png"></image>
|
|
</view>
|
|
<view class="text">
|
|
开启补光
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- Tooltip -->
|
|
<view wx:if="{{ show_tip && show_modal == '' }}" class="tooltip">
|
|
<view class="tooltip-content">
|
|
<text>将QR码置于框内进行扫描</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- Service Modal -->
|
|
<view wx:if="{{ show_modal == 'service' }}" class="modal">
|
|
<view class="modal-content">
|
|
<text>服务联系信息</text>
|
|
<button bindtap="close_modal">关闭</button>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- Verification Spinner -->
|
|
<view wx:if="{{ show_modal == 'verifying' }}" class="modal">
|
|
<view class="modal-content verifying">
|
|
<view class="spinner"></view>
|
|
<text>正在验证中...</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- Verification Failed -->
|
|
<view wx:if="{{ show_modal == 'verifyfailed' }}" class="modal">
|
|
<view class="modal-content">
|
|
<text>验证失败</text>
|
|
<button bindtap="restartScanning">重新扫描</button>
|
|
<button bindtap="show_service">联系客服</button>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- Scan Guide -->
|
|
<view wx:if="{{ show_modal == 'scanguide' }}" class="modal">
|
|
<view class="modal-content">
|
|
<text>扫描指南</text>
|
|
<view>1. 将QR码置于框内</view>
|
|
<view>2. 保持稳定</view>
|
|
<view>3. 确保光线充足</view>
|
|
<button bindtap="close_modal">开始扫描</button>
|
|
<button bindtap="show_service">联系客服</button>
|
|
</view>
|
|
</view> |