otp/pages/form/form.wxml
“xHuPo” 2b8870a40e init
2025-06-09 13:35:15 +08:00

82 lines
No EOL
3 KiB
Text

<!--pages/form/form.wxml-->
<view class="container {{pageReady ? 'page-loaded' : ''}}">
<form bindsubmit="keySubmit">
<!-- 基本信息 -->
<view class="section">
<view class="section-title">基本信息</view>
<view class="input-box">
<text>Service</text>
<input name="issuer" placeholder="服务名称" value="{{formData.issuer}}" placeholder-style="color: #666; font-size: 1rem;" />
</view>
<view class="input-box">
<text>Account</text>
<input name="remark" placeholder="帐号备注" value="{{formData.remark}}" placeholder-style="color: #666; font-size: 1rem;" />
</view>
<view class="input-box">
<text>KEY</text>
<input name="secret" placeholder="Secret" value="{{formData.secret}}" placeholder-style="color: #666; font-size: 1rem;" />
</view>
</view>
<!-- 令牌类型 -->
<view class="section">
<view class="section-title">令牌类型</view>
<view class="input-box">
<text>类型</text>
<radio-group name="type" bindchange="onTypeChange">
<radio value="totp" checked="{{type === 'totp'}}">TOTP (基于时间)</radio>
<radio value="hotp" checked="{{type === 'hotp'}}">HOTP (基于计数器)</radio>
</radio-group>
</view>
</view>
<!-- 高级设置 -->
<view class="section">
<view class="section-title">高级设置</view>
<view class="input-box">
<text>算法</text>
<radio-group name="algo">
<radio value="SHA1" checked="{{!formData.algo || formData.algo === 'SHA1'}}">SHA1</radio>
<radio value="SHA256" checked="{{formData.algo === 'SHA256'}}">SHA256</radio>
<radio value="SHA512" checked="{{formData.algo === 'SHA512'}}">SHA512</radio>
</radio-group>
</view>
<view class="input-box">
<text>验证码位数</text>
<radio-group name="digits">
<radio value="6" checked="{{!formData.digits || formData.digits === '6'}}">6位</radio>
<radio value="7" checked="{{formData.digits === '7'}}">7位</radio>
<radio value="8" checked="{{formData.digits === '8'}}">8位</radio>
</radio-group>
</view>
<!-- TOTP特定设置 -->
<block wx:if="{{type === 'totp'}}">
<view class="input-box">
<text>更新周期(秒)</text>
<input type="number" name="period" value="{{formData.period || '30'}}" />
</view>
</block>
<!-- HOTP特定设置 -->
<block wx:if="{{type === 'hotp'}}">
<view class="input-box">
<text>初始计数器值</text>
<input type="number" name="counter" value="{{formData.counter || '0'}}" />
</view>
</block>
</view>
<!-- 操作按钮 -->
<view class="button-group">
<button
form-type="submit"
type="primary"
disabled="{{isSubmitting}}"
class="submit-button">
{{isSubmitting ? '添加中...' : '确认添加'}}
</button>
</view>
</form>
</view>