微信小程序實戰(zhàn)之打卡時鐘的繪制
更新時間:2022年04月26日 08:43:22 作者:失散多年的哥哥
這篇文章主要介紹了如何利用微信小程序制作一個打卡時鐘,分為工作和休息兩種狀態(tài),用戶可以設置相應的時間,所有的時鐘記錄都會被保存下來,感興趣的可以了解一下
一、項目展示
這是一款簡單實用的小時鐘工具
分為工作和休息兩種狀態(tài)
用戶可以設置相應的時間
所有的時鐘記錄都會被保存下來
二、首頁
首頁由計時器、任務輸入框和兩個計時按鈕組成
<view class="container timer {{isRuning ? 'timer--runing': ''}}"> <view class="timer_main"> <view class="timer_time-wrap"> <view class="timer_progress_mask"></view> <view class="timer_progress timer_left"> <view class="timer_circle timer_circle--left" style="transform: rotate({{leftDeg}}deg);"></view> </view> <view class="timer_progress timer_right"> <view class="timer_circle timer_circle--right" style="transform: rotate({{rightDeg}}deg);"></view> </view> <text wx:if="{{!completed}}" class="timer_time">{{remainTimeText}}</text> <text wx:if="{{isRuning}}" animation="{{nameAnimation}}" class="timer_taskName">{{taskName}}{{completed ? '已完成!' : '中'}}</text> <image wx:if="{{completed}}" class="timer_done" src="../../image/complete.png"></image> </view> <input type="text" placeholder-style="text-align:center" class="timer_inputname" bindinput="changeLogName" placeholder="給您的任務取個名字吧"/> </view> <view class="timer_footer"> <view bindtap="startTimer" data-type="work" class="timer_ctrl {{isRuning && timerType == 'rest' ? 'hide' : ''}}" >{{isRuning ? '完成': '工作'}}</view> <view bindtap="startTimer" data-type="rest" class="timer_ctrl {{isRuning && timerType == 'work' ? 'hide' : ''}}" >{{isRuning ? '完成': '休息'}}</view> </view> </view>
效果圖如下:
三、設置
用戶在設置界面可以更改工作時長和休息時長
<view class="container"> <view class="section panel"> <text class="section_title">工作時長(分鐘)</text> <view class="section_body"> <slider bindchange="changeWorkTime" show-value="true" min="1" max="60" value="{{workTime}}" left-icon="cancel" right-icon="success_no_circle"/> </view> </view> <view class="section panel"> <text class="section_title">休息時長(分鐘)</text> <view class="section_body"> <slider bindchange="changeRestTime" show-value="true" min="5" max="60" value="{{restTime}}" left-icon="cancel" right-icon="success_no_circle"/> </view> </view> <view class="section panel"> <view class="section_title"> <text>主頁背景</text> </view> <view class="section_body"> <text bindtab="" class="section_tip">選擇背景 > </text> </view> </view> <view class="section panel"> <view class="section_title"> <switch class="section_check" type="checkbox" size="mini" checked bindchange="switch1Change"/> <text>啟用鈴聲</text> </view> <view class="section_body"> <text bindtab="" class="section_tip">選擇鈴聲 > </text> </view> </view> </view>
效果圖如下:
到此這篇關于微信小程序實戰(zhàn)之打卡時鐘的繪制的文章就介紹到這了,更多相關小程序打卡時鐘內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
html+css+js實現(xiàn)canvas跟隨鼠標的小圓特效源碼
這篇文章主要介紹了html+css+js實現(xiàn)canvas跟隨鼠標的小圓特效源碼,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-03-03基于javascript實現(xiàn)動態(tài)時鐘效果
這篇文章主要為大家詳細介紹了基于javascript實現(xiàn)動態(tài)時鐘效果的相關資料,動態(tài)顯示系統(tǒng)當前時間,具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-02-02