当前位置: 首页 > news >正文

高效备忘清单工具类小程序

Index.html

<view class="container">

<!-- 头部进度概览 -->

<view class="tracker-card">

<view class="tracker-header">

<view>

<text class="hero-title">高效备忘清单</text>

<text class="hero-subtitle">整理一天的心情和任务</text>

</view>

<text class="score-card">{{completedCount}}/{{tasksList.length}}</text>

</view>

<view class="progress-bar">

<progress percent="{{taskProgress}}" stroke-width="6" activeColor="#FFF" backgroundColor="rgba(255,255,255,0.25)" />

</view>

</view>

<!-- 选项卡分类 -->

<view class="tabs-bar">

<view class="tab {{activeTab === 'all' ? 'active' : ''}}" bindtap="switchTab" data-tab="all">

全部 ({{tasksList.length}})

</view>

<view class="tab {{activeTab === 'active' ? 'active' : ''}}" bindtap="switchTab" data-tab="active">

进行中

</view>

<view class="tab {{activeTab === 'completed' ? 'active' : ''}}" bindtap="switchTab" data-tab="completed">

已完成

</view>

</view>

<!-- 输入条 -->

<view class="card add-card">

<view class="add-row">

<input class="add-input" value="{{newTaskText}}" bindinput="onNewTaskInput" placeholder="在此输入需要执行的事情..." />

<button class="btn-add" bindtap="createTask">添加</button>

</view>

<view class="priority-row">

<text class="label">优先级:</text>

<picker bindchange="onPriorityChange" value="{{priorityIndex}}" range="{{priorityRange}}" mode="selector">

<view class="picker-val">标记为: {{priorityRange[priorityIndex]}} ▾</view>

</picker>

</view>

</view>

<!-- 任务列表 -->

<view class="card tasks-list-card">

<view class="empty-state" wx:if="{{filteredTasks.length === 0}}">

<text class="empty-icon">📝</text>

<text class="empty-text">今天也是轻松的一天,快添加一项任务吧!</text>

</view>

<!-- 任务展示 -->

<view class="tasks-list" wx:if="{{filteredTasks.length > 0}}">

<view class="task-row {{item.completed ? 'task-done' : ''}}" wx:for="{{filteredTasks}}" wx:key="id">

<!-- 仿Checkbox打勾状态 -->

<view class="checkbox {{item.completed ? 'checked' : ''}}" bindtap="toggleTask" data-id="{{item.id}}">

<text class="check-tick" wx:if="{{item.completed}}">✓</text>

</view>

<!-- 任务详情 -->

<view class="task-content">

<text class="task-title">{{item.text}}</text>

<text class="task-badge badge-{{item.priority}}">{{item.priority === 'urgent' ? '极其重要' : '普通日常'}}</text>

</view>

<!-- 删除 -->

<text class="btn-delete" bindtap="removeTask" data-id="{{item.id}}">删除</text>

</view>

</view>

</view>

</view>

index.wxss

page {

background-color: #f4f5f7;

}

.container {

padding: 20rpx;

}

.tracker-card {

background: linear-gradient(135deg, #007aff, #0050b3);

color: white;

border-radius: 20rpx;

padding: 30rpx;

margin-bottom: 20rpx;

}

.tracker-header {

display: flex;

justify-content: space-between;

align-items: center;

margin-bottom: 20rpx;

}

.hero-title {

font-size: 32rpx;

font-weight: bold;

}

.hero-subtitle {

font-size: 22rpx;

opacity: 0.8;

margin-top: 5rpx;

}

.score-card {

background-color: rgba(255, 255, 255, 0.2);

padding: 8rpx 20rpx;

border-radius: 40rpx;

font-size: 26rpx;

font-weight: bold;

}

.progress-bar {

margin-top: 10rpx;

}

.tabs-bar {

display: flex;

background: #fff;

border-radius: 12rpx;

margin-bottom: 20rpx;

width: 100%;

}

.tab {

flex: 1;

text-align: center;

font-size: 24rpx;

color: #666;

line-height: 70rpx;

}

.tab.active {

background-color: #007aff;

color: #fff;

}

.card {

background: #fff;

border-radius: 16rpx;

padding: 20rpx;

margin-bottom: 16rpx;

}

.add-card {

display: flex;

flex-direction: column;

}

.add-row {

display: flex;

gap: 12rpx;

margin-bottom: 16rpx;

}

.add-input {

flex: 1;

border: 1rpx solid #e1e4eb;

border-radius: 8rpx;

padding: 14rpx 16rpx;

font-size: 26rpx;

background: #f8fafc;

}

.btn-add {

background: #007aff;

color: #fff;

font-size: 26rpx;

padding: 0 28rpx;

border-radius: 8rpx;

height: 72rpx;

display: flex;

align-items: center;

}

.priority-row {

display: flex;

align-items: center;

}

.label {

font-size: 24rpx;

color: #666;

width: 100rpx;

}

.picker-val {

font-size: 24rpx;

color: #007aff;

}

.empty-state {

text-align: center;

padding: 60rpx 20rpx;

}

.empty-icon {

font-size: 60rpx;

margin-bottom: 20rpx;

}

.empty-text {

font-size: 24rpx;

color: #999;

}

.task-row {

display: flex;

align-items: center;

padding-bottom: 20rpx;

border-bottom: 1rpx solid #f0f0f0;

margin-bottom: 20rpx;

}

.task-row:last-child {

border-bottom: none;

margin-bottom: 0;

}

.checkbox {

width: 40rpx;

height: 40rpx;

border: 3rpx solid #ddd;

border-radius: 50%;

display: flex;

justify-content: center;

align-items: center;

margin-right: 20rpx;

}

.checkbox.checked {

background: #007aff;

border-color: #007aff;

}

.check-tick {

color: #fff;

font-size: 22rpx;

font-weight: bold;

}

.task-content {

flex: 1;

}

.task-title {

font-size: 28rpx;

color: #333;

font-weight: 500;

}

.task-done .task-title {

text-decoration: line-through;

color: #999;

}

.task-badge {

font-size: 18rpx;

font-weight: bold;

padding: 4rpx 12rpx;

border-radius: 6rpx;

margin-top: 8rpx;

}

.badge-urgent {

background: #ffeef0;

color: #ff3b30;

}

.badge-normal {

background: #f0f4ff;

color: #007aff;

}

.btn-delete {

font-size: 24rpx;

color: #ff4d4f;

background: #fff1f0;

padding: 6rpx 16rpx;

border-radius: 8rpx;

}

index.js

Page({

data: {

tasksList: [],

newTaskText: "",

priorityRange: ["常规备忘", "突发重要"],

priorityValues: ["normal", "urgent"],

priorityIndex: 0,

activeTab: "all",

completedCount: 0,

taskProgress: 0,

filteredTasks: []

},

onLoad: function() {

console.log("微信高效清算工具初始化");

// Mock sample items

const defaultTasks = [

{ id: "1001", text: "制定本周的微信小程序开发计划 📝", priority: "urgent", completed: false },

{ id: "1002", text: "买蔬菜水果,多补充水分糖分 🍎", priority: "normal", completed: true },

{ id: "1003", text: "参加下午2点的设计评审会 ☕", priority: "normal", completed: false }

];

this.setData({

tasksList: defaultTasks

});

this.refreshComputed();

},

onNewTaskInput: function(e) {

this.setData({

newTaskText: e.detail.value

});

},

onPriorityChange: function(e) {

this.setData({

priorityIndex: parseInt(e.detail.value)

});

},

switchTab: function(e) {

const tabSelected = e.currentTarget.dataset.tab;

this.setData({

activeTab: tabSelected

});

this.refreshComputed();

},

createTask: function() {

const text = this.data.newTaskText.trim();

if (!text) {

wx.showToast({

title: "请填写任务内容",

icon: "warn"

});

return;

}

const priorityKey = this.data.priorityValues[this.data.priorityIndex];

const newId = String(Date.now());

const newTask = {

id: newId,

text: text,

priority: priorityKey,

completed: false

};

const currentList = this.data.tasksList;

currentList.push(newTask);

this.setData({

tasksList: currentList,

newTaskText: "",

priorityIndex: 0

});

this.refreshComputed();

wx.showToast({

title: "任务已新增!",

icon: "success"

});

},

toggleTask: function(e) {

const id = e.currentTarget.dataset.id;

const currentList = this.data.tasksList;

for (let i = 0; i < currentList.length; i++) {

if (currentList[i].id === id) {

currentList[i].completed = !currentList[i].completed;

const msg = currentList[i].completed ? "打卡标志成功 ✓" : "标记为待办";

wx.showToast({

title: msg,

icon: "success"

});

break;

}

}

this.setData({

tasksList: currentList

});

this.refreshComputed();

},

removeTask: function(e) {

const id = e.currentTarget.dataset.id;

const that = this;

wx.showModal({

title: "确认删除?",

content: "该提醒将从您的日程库中永久移除",

showCancel: true,

success: function(res) {

if (!res.cancel) {

const currentList = that.data.tasksList.filter(t => t.id !== id);

that.setData({

tasksList: currentList

});

that.refreshComputed();

wx.showToast({

title: "已安全删除",

icon: "success"

});

}

}

});

},

refreshComputed: function() {

const list = this.data.tasksList;

const doneCount = list.filter(t => t.completed).length;

const progress = list.length > 0 ? Math.round((doneCount / list.length) * 100) : 0;

let filtered = [];

if (this.data.activeTab === "all") {

filtered = list;

} else if (this.data.activeTab === "active") {

filtered = list.filter(t => !t.completed);

} else {

filtered = list.filter(t => t.completed);

}

this.setData({

completedCount: doneCount,

taskProgress: progress,

filteredTasks: filtered

});

}

})

http://www.gsyq.cn/news/1515044.html

相关文章:

  • 伦茨品牌设备维修服务评测:四家服务商实战对比 - 优质品牌商家
  • SAP S/4HANA开发实战:用CONCAT、RIGHT、LPAD、SUBSTRING搞定ACDOCA与MSEG表字段长度不匹配的JOIN问题
  • 终极指南:如何用KeymouseGo实现鼠标键盘自动化,彻底告别重复工作
  • 计算机毕业设计之基于协同过滤推荐算法的影单管理系统
  • AI Codebase Expert Agent:面向工程落地的多智能体代码协作系统
  • 【渔夫搬砖AI早报】· 第 2 期 | 2026年6月11日
  • 2026年孝感市工程技术中级职称申报时间已出,附上详细的申报材料清单
  • 告别Vina脚本:用Uni-Dock Python API重构你的分子对接流程(效率提升实测)
  • 2026年智能电表行业深度分析:谁在构建可靠的能源计量体系? - 优质品牌商家
  • 基于PLC控制的简易停车场空位显示系统设计31(设计源文件+万字报告+讲解)(支持资料、图片参考_相关定制)_可以扫码或者私信
  • 别再死记硬背了!用‘继承’和‘多态’写个游戏角色系统,轻松理解C++面向对象
  • 2026年雷达测速仪与平安哨兵厂家怎么选?基于技术、工程与供应链的深度分析 - 优质品牌商家
  • 2026年口碑好的惠州独立站开发/惠州外贸网站建设/惠州谷歌独立站/惠州外贸网站推广正规公司推荐 - 行业平台推荐
  • 基于PLC的电镀生产线控制系统设计31(设计源文件+万字报告+讲解)(支持资料、图片参考_相关定制)_可以扫码或者私信
  • 2026年金丝楠木厂家实力盘点:从原木贸易到集成房屋,谁在主导供应链? - 优质品牌商家
  • [STM32]Day14独立看门狗+窗口看门狗
  • 2026年比较好的车灯透镜升级/无锡LED 透镜大灯/无锡双光透镜改装稳定供货厂家推荐 - 品牌宣传支持者
  • 2026年比较好的东莞记账报税代办/东莞个体户核定征收代办/东莞跨境电商税务代办优选企业推荐 - 行业平台推荐
  • MonkeyCode 开源治理:如何管理一个50+贡献者的社区
  • 假设检验实战指南:从p值误解到业务决策落地
  • Blender 3MF插件:从3D设计到3D打印的终极桥梁
  • 2026年碳素管/碳素螺旋管供应厂家市场测评报告 - 品牌发掘
  • 2026年广州走廊地毯采购指南:品牌对比与行业趋势分析 - 优质品牌商家
  • 外贸跟单/跨境电商卖家必看:如何用AQL 2.5标准跟工厂谈验货,避免货不对板?
  • 2026年比较好的钢结构厂房/钢结构桥梁实力公司推荐 - 品牌宣传支持者
  • 从性能故障到安全风险,现代企业数字化转型下的网络丢包运维管控指南
  • KaKs_Calculator2.0:命令行版分子进化速率分析工具,支持滑动窗口与伽马校正
  • 多维聚合实战:超越GROUP BY的数据操作框架
  • Towards AI:O‘Reilly的工程化AI知识实时出版范式
  • 告别杂乱布线:用AD20的这几个隐藏功能,让你的PCB布局效率翻倍