feat: Add Scoreboard and Date Calc pages, update Calculator with scientific mode and new UI

This commit is contained in:
2026-02-05 16:04:09 +08:00
parent c8a67abdd2
commit 10304c4abf
15 changed files with 1390 additions and 80 deletions

View File

@@ -1,32 +1,68 @@
<!--pages/calculator/calculator.wxml-->
<view class="calculator">
<view class="screen">
<view class="history">{{history}}</view>
<view class="result">{{displayValue}}</view>
<view class="calculator-container">
<!-- 显示区域 -->
<view class="display-area">
<view class="mode-indicator" bindtap="toggleMode">
<text class="{{isScientific ? 'active' : ''}}">⚗️ 科学模式</text>
</view>
<view class="history-text">{{history}}</view>
<view class="current-value {{displayValue.length > 9 ? 'shrink' : ''}} {{displayValue.length > 15 ? 'shrink-more' : ''}}">{{displayValue}}</view>
</view>
<view class="keypad">
<view class="btn operator" bindtap="onClear">C</view>
<view class="btn operator" bindtap="onDelete">DEL</view>
<view class="btn operator" bindtap="onOperator" data-op="%">%</view>
<view class="btn operator" bindtap="onOperator" data-op="/">÷</view>
<!-- 键盘区域 -->
<view class="keypad-area {{isScientific ? 'scientific-pad' : ''}}">
<view class="btn" bindtap="onDigit" data-digit="7">7</view>
<view class="btn" bindtap="onDigit" data-digit="8">8</view>
<view class="btn" bindtap="onDigit" data-digit="9">9</view>
<view class="btn operator" bindtap="onOperator" data-op="*">×</view>
<!-- 科学功能区 (隐藏/显示) -->
<block wx:if="{{isScientific}}">
<view class="row small-row">
<view class="btn sci-btn" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onMathFunc" data-func="sin">sin</view>
<view class="btn sci-btn" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onMathFunc" data-func="cos">cos</view>
<view class="btn sci-btn" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onMathFunc" data-func="tan">tan</view>
<view class="btn sci-btn" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onMathFunc" data-func="log">log</view>
<view class="btn sci-btn" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onMathFunc" data-func="ln">ln</view>
</view>
<view class="row small-row">
<view class="btn sci-btn" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onConstant" data-const="pi">π</view>
<view class="btn sci-btn" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onConstant" data-const="e">e</view>
<view class="btn sci-btn" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onMathFunc" data-func="pow2">x²</view>
<view class="btn sci-btn" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onMathFunc" data-func="sqrt">√</view>
<view class="btn sci-btn" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onMathFunc" data-func="percent">%</view>
</view>
</block>
<!-- 基础键盘 -->
<view class="row">
<view class="btn func" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onClear">AC</view>
<view class="btn func" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onDelete">⌫</view>
<view class="btn func" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onToggleSign">+/-</view>
<view class="btn operator" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onOperator" data-op="÷">÷</view>
</view>
<view class="btn" bindtap="onDigit" data-digit="4">4</view>
<view class="btn" bindtap="onDigit" data-digit="5">5</view>
<view class="btn" bindtap="onDigit" data-digit="6">6</view>
<view class="btn operator" bindtap="onOperator" data-op="-">-</view>
<view class="row">
<view class="btn digit" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onDigit" data-digit="7">7</view>
<view class="btn digit" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onDigit" data-digit="8">8</view>
<view class="btn digit" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onDigit" data-digit="9">9</view>
<view class="btn operator" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onOperator" data-op="×">×</view>
</view>
<view class="btn" bindtap="onDigit" data-digit="1">1</view>
<view class="btn" bindtap="onDigit" data-digit="2">2</view>
<view class="btn" bindtap="onDigit" data-digit="3">3</view>
<view class="btn operator" bindtap="onOperator" data-op="+">+</view>
<view class="row">
<view class="btn digit" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onDigit" data-digit="4">4</view>
<view class="btn digit" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onDigit" data-digit="5">5</view>
<view class="btn digit" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onDigit" data-digit="6">6</view>
<view class="btn operator" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onOperator" data-op="-"></view>
</view>
<view class="btn zero" bindtap="onDigit" data-digit="0">0</view>
<view class="btn" bindtap="onDot">.</view>
<view class="btn equal" bindtap="onEqual">=</view>
<view class="row">
<view class="btn digit" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onDigit" data-digit="1">1</view>
<view class="btn digit" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onDigit" data-digit="2">2</view>
<view class="btn digit" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onDigit" data-digit="3">3</view>
<view class="btn operator" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onOperator" data-op="+">+</view>
</view>
<view class="row">
<view class="btn digit zero" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onDigit" data-digit="0">0</view>
<view class="btn digit" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onDot">.</view>
<view class="btn operator equal" hover-class="btn-hover" hover-start-time="0" hover-stay-time="100" bindtap="onEqual">=</view>
</view>
</view>
</view>