1
This commit is contained in:
86
pages/tools/tools.js
Normal file
86
pages/tools/tools.js
Normal file
@@ -0,0 +1,86 @@
|
||||
// pages/tools/tools.js
|
||||
const learningTracker = require('../../utils/learningTracker.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
tools: [
|
||||
{
|
||||
id: 1,
|
||||
name: '启思AI',
|
||||
icon: '🤖',
|
||||
desc: '启迪思维,智慧学习',
|
||||
path: '/pages/ai-assistant/ai-assistant',
|
||||
color: '#6C5CE7',
|
||||
badge: 'AI',
|
||||
badgeColor: '#A29BFE'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '学习数据',
|
||||
icon: '📊',
|
||||
desc: '可视化数据分析',
|
||||
path: '/pages/dashboard/dashboard',
|
||||
color: '#667eea',
|
||||
badge: 'NEW',
|
||||
badgeColor: '#4CAF50'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'GPA计算器',
|
||||
icon: '🎯',
|
||||
desc: '快速计算学期绩点',
|
||||
path: '/pages/gpa/gpa',
|
||||
color: '#FF6B6B'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '课程表',
|
||||
icon: '📅',
|
||||
desc: '查看个人课程安排',
|
||||
path: '/pages/schedule/schedule',
|
||||
color: '#9B59B6'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: '考试倒计时',
|
||||
icon: '⏰',
|
||||
desc: '重要考试提醒',
|
||||
path: '/pages/countdown/countdown',
|
||||
color: '#F39C12'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 开始跟踪学习时间
|
||||
learningTracker.onPageShow('tools')
|
||||
|
||||
// 更新自定义TabBar选中状态
|
||||
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
|
||||
this.getTabBar().setData({
|
||||
selected: 3
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
onHide() {
|
||||
// 停止跟踪学习时间
|
||||
learningTracker.onPageHide()
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
// 记录学习时长
|
||||
learningTracker.onPageUnload()
|
||||
},
|
||||
|
||||
onToolClick(e) {
|
||||
const { path } = e.currentTarget.dataset
|
||||
wx.navigateTo({
|
||||
url: path
|
||||
})
|
||||
}
|
||||
})
|
||||
3
pages/tools/tools.json
Normal file
3
pages/tools/tools.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "实用工具"
|
||||
}
|
||||
27
pages/tools/tools.wxml
Normal file
27
pages/tools/tools.wxml
Normal file
@@ -0,0 +1,27 @@
|
||||
<!--pages/tools/tools.wxml-->
|
||||
<view class="container">
|
||||
<view class="header">
|
||||
<view class="header-title">实用工具</view>
|
||||
<view class="header-desc">提升学习效率的小帮手</view>
|
||||
</view>
|
||||
|
||||
<view class="tools-list">
|
||||
<view
|
||||
class="tool-card"
|
||||
wx:for="{{tools}}"
|
||||
wx:key="id"
|
||||
data-path="{{item.path}}"
|
||||
bindtap="onToolClick"
|
||||
>
|
||||
<view class="tool-icon" style="background-color: {{item.color}}20;">
|
||||
<text class="icon-text">{{item.icon}}</text>
|
||||
<view class="badge" wx:if="{{item.badge}}" style="background-color: {{item.badgeColor || '#FF5252'}};">{{item.badge}}</view>
|
||||
</view>
|
||||
<view class="tool-info">
|
||||
<view class="tool-name">{{item.name}}</view>
|
||||
<view class="tool-desc">{{item.desc}}</view>
|
||||
</view>
|
||||
<view class="arrow">›</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
96
pages/tools/tools.wxss
Normal file
96
pages/tools/tools.wxss
Normal file
@@ -0,0 +1,96 @@
|
||||
/* pages/tools/tools.wxss */
|
||||
.container {
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
padding: 60rpx 30rpx;
|
||||
/* 底部留出TabBar的空间 */
|
||||
padding-bottom: calc(env(safe-area-inset-bottom) + 150rpx);
|
||||
}
|
||||
|
||||
.header {
|
||||
color: #ffffff;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
font-size: 48rpx;
|
||||
font-weight: bold;
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.header-desc {
|
||||
font-size: 28rpx;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.tools-list {
|
||||
background-color: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tool-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #F5F5F5;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.tool-card:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.tool-card:active {
|
||||
background-color: #F8F9FA;
|
||||
}
|
||||
|
||||
.tool-icon {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 25rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.icon-text {
|
||||
font-size: 56rpx;
|
||||
}
|
||||
|
||||
.badge {
|
||||
position: absolute;
|
||||
top: -8rpx;
|
||||
right: -8rpx;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 20rpx;
|
||||
font-size: 20rpx;
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.tool-info {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.tool-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.tool-desc {
|
||||
font-size: 26rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
font-size: 60rpx;
|
||||
color: #CCCCCC;
|
||||
font-weight: 300;
|
||||
}
|
||||
Reference in New Issue
Block a user