Files
soul-yongping/miniprogram/pages/scan/scan.wxml

82 lines
3.1 KiB
Plaintext

<!--pages/scan/scan.wxml-->
<!--扫码解析页 - 扫描二维码/条形码展示解析内容-->
<view class="page">
<!-- 自定义导航栏 -->
<view class="nav-bar" style="padding-top: {{statusBarHeight}}px;">
<view class="nav-content">
<view class="back-btn" bindtap="goBack">
<text class="back-icon">←</text>
</view>
<text class="nav-title">扫码解析</text>
</view>
</view>
<!-- 主内容 -->
<view class="main-content" style="padding-top: {{statusBarHeight + 56}}px;">
<!-- 扫码按钮 -->
<view class="scan-action">
<view class="scan-btn" bindtap="doScan">
<text class="scan-icon">📷</text>
<text class="scan-text">扫描小程序码 / 二维码</text>
</view>
</view>
<!-- 解析结果 -->
<view class="result-card" wx:if="{{lastResult}}">
<view class="result-header">
<text class="result-label">解析内容</text>
<view class="result-actions">
<view class="action-btn" bindtap="copyResult">复制</view>
<view class="action-btn" wx:if="{{canNavigate}}" bindtap="openParsedPage">打开</view>
<view class="action-btn secondary" bindtap="clearResult">清空</view>
</view>
</view>
<!-- 小程序码解析:路径 + 参数(仅当为 pages/ 路径时展示) -->
<view class="parsed-section" wx:if="{{parsedPath && (parsedPath.indexOf('pages/') === 0 || parsedQuery.length > 0)}}">
<view class="parsed-row">
<text class="parsed-label">路径</text>
<text class="parsed-value">{{parsedPath}}</text>
</view>
<view class="parsed-row" wx:for="{{parsedQuery}}" wx:key="key" wx:for-item="q">
<text class="parsed-label">{{q.key}}</text>
<text class="parsed-value">{{q.value}}</text>
</view>
</view>
<view class="result-meta" wx:if="{{scanType}}">
<text class="meta-item">类型: {{scanType}}</text>
<text class="meta-item" wx:if="{{charSet}}">字符集: {{charSet}}</text>
</view>
<scroll-view class="result-content" scroll-y="{{true}}">
<text class="result-text" selectable="{{true}}">{{lastResult}}</text>
</scroll-view>
</view>
<!-- 无结果提示 -->
<view class="empty-tip" wx:else>
<text class="empty-icon">📷</text>
<text class="empty-text">点击上方按钮扫码</text>
<text class="empty-desc">支持小程序码、二维码、条形码</text>
</view>
<!-- 扫码历史 -->
<view class="history-section" wx:if="{{history.length > 0}}">
<view class="history-header">
<text class="history-title">扫码历史</text>
<view class="clear-history" bindtap="clearHistory">清空</view>
</view>
<view class="history-list">
<view
class="history-item"
wx:for="{{history}}"
wx:key="index"
bindtap="onHistoryItemTap"
data-result="{{item.result}}"
>
<text class="history-content">{{item.result}}</text>
<text class="history-time">{{item.time}}</text>
</view>
</view>
</view>
</view>
</view>