目录结构调整

This commit is contained in:
2026-02-04 23:47:45 +08:00
parent 6938c911c3
commit 6b22238c6e
8780 changed files with 15333 additions and 574 deletions

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {
}
}

View File

@@ -0,0 +1,73 @@
// index.ts
import { config } from '../../config';
const app = getApp<IAppOption>()
Component({
data: {
userInfo: {
avatarUrl: config.defaultAvatarUrl,
nickName: '未登录'
},
hasUserInfo: false,
greeting: ''
},
pageLifetimes: {
show() {
this.updateGreeting();
// 每次显示页面时,重新获取最新的用户信息
const session = wx.getStorageSync('USER_SESSION');
if (session && session.userInfo) {
this.setData({
userInfo: session.userInfo,
hasUserInfo: true
});
} else {
this.setData({
userInfo: {
avatarUrl: config.defaultAvatarUrl,
nickName: '点击登录'
},
hasUserInfo: false
});
}
}
},
methods: {
updateGreeting() {
const hour = new Date().getHours();
let greeting = '';
if (hour < 5) greeting = '夜深了,注意休息';
else if (hour < 9) greeting = '早上好,新的一天';
else if (hour < 12) greeting = '上午好';
else if (hour < 14) greeting = '中午好';
else if (hour < 19) greeting = '下午好';
else greeting = '晚上好';
this.setData({ greeting });
},
goToProfile() {
wx.navigateTo({
url: '/pages/profile/profile'
});
},
goToCalculator() {
wx.navigateTo({
url: '/pages/calculator/calculator'
});
},
goToUnitConverter() {
wx.navigateTo({
url: '/pages/unit-converter/unit-converter'
});
},
goToRandomDraw() {
wx.navigateTo({
url: '/pages/random-draw/random-draw'
});
}
}
})

View File

@@ -0,0 +1,69 @@
<!--index.wxml-->
<scroll-view class="scrollarea" scroll-y type="list">
<view class="container">
<!-- 顶部背景区 -->
<view class="header-bg">
<view class="header-content" bindtap="goToProfile">
<view class="text-area">
<text class="greeting">{{greeting}}</text>
<text class="nickname">{{userInfo.nickName}}</text>
</view>
<view class="avatar-wrapper">
<image class="avatar" src="{{userInfo.avatarUrl}}"></image>
</view>
</view>
</view>
<!-- 主要内容区(向上浮动覆盖背景) -->
<view class="main-content">
<view class="section-title">工具箱</view>
<!-- 功能网格 -->
<view class="grid-container">
<!-- 计算器 -->
<view class="grid-item" bindtap="goToCalculator" hover-class="grid-item-hover">
<view class="icon-box bg-gradient-blue">
<text class="icon">🧮</text>
</view>
<view class="text-box">
<text class="label">计算器</text>
<text class="sub-label">日常计算</text>
</view>
</view>
<!-- 单位换算 -->
<view class="grid-item" bindtap="goToUnitConverter" hover-class="grid-item-hover">
<view class="icon-box bg-gradient-green">
<text class="icon">⚖️</text>
</view>
<view class="text-box">
<text class="label">单位换算</text>
<text class="sub-label">长度/重量...</text>
</view>
</view>
<!-- 谁去拿外卖 -->
<view class="grid-item" bindtap="goToRandomDraw" hover-class="grid-item-hover">
<view class="icon-box bg-gradient-purple">
<text class="icon">🎲</text>
</view>
<view class="text-box">
<text class="label">谁去拿外卖</text>
<text class="sub-label">随机抽取幸运儿</text>
</view>
</view>
</view>
<!-- 推广/banner区域 -->
<view class="banner" bindtap="goToProfile" wx:if="{{!hasUserInfo}}">
<view class="banner-text">
<text class="banner-title">点击登录 / 完善信息</text>
<text class="banner-desc">绑定手机号,体验更多云端功能</text>
</view>
<view class="banner-icon">📝</view>
</view>
</view>
</view>
</scroll-view>

View File

@@ -0,0 +1,192 @@
/**index.wxss**/
page {
height: 100vh;
display: flex;
flex-direction: column;
background-color: #f6f7f9;
}
.scrollarea {
flex: 1;
}
.container {
padding: 0;
display: flex;
flex-direction: column;
}
/* 顶部背景区 */
.header-bg {
width: 100%;
height: 380rpx;
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
border-bottom-left-radius: 40rpx;
border-bottom-right-radius: 40rpx;
padding: 40rpx;
box-sizing: border-box;
display: flex;
justify-content: center;
/* 加上一点阴影 */
box-shadow: 0 10rpx 20rpx rgba(79, 172, 254, 0.2);
}
.header-content {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center; /* 垂直居中 */
margin-top: 20rpx;
height: 140rpx; /* 固定高度确保对齐 */
}
.text-area {
display: flex;
flex-direction: column;
justify-content: center;
}
.greeting {
color: rgba(255, 255, 255, 0.9);
font-size: 28rpx;
margin-bottom: 10rpx;
}
.nickname {
color: #ffffff;
font-size: 48rpx;
font-weight: bold;
letter-spacing: 2rpx;
}
.avatar-wrapper {
padding: 6rpx;
background: rgba(255, 255, 255, 0.3);
border-radius: 50%;
}
.avatar {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
background-color: #fff;
border: 4rpx solid #ffffff;
}
/* 主要内容区 */
.main-content {
flex: 1;
width: 100%;
padding: 0 30rpx;
box-sizing: border-box;
margin-top: -80rpx; /* 向上浮动覆盖 Header */
z-index: 10;
padding-bottom: 40rpx;
}
.section-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-left: 10rpx;
margin-bottom: 20rpx;
display: none; /* 卡片式设计不需要标题也行,或保留 */
}
/* 一行两列或三列的卡片 */
.grid-container {
display: flex;
flex-direction: column; /* 垂直排列的卡片列表看起来更像菜单 */
gap: 24rpx;
}
/* 单个卡片样式 */
.grid-item {
background-color: #ffffff;
border-radius: 24rpx;
padding: 30rpx;
display: flex;
align-items: center;
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
transition: all 0.2s ease;
}
.grid-item-hover {
transform: scale(0.98);
background-color: #fafafa;
}
.icon-box {
width: 100rpx;
height: 100rpx;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 30rpx;
}
.icon {
font-size: 50rpx;
}
.bg-gradient-blue {
background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
}
.bg-gradient-green {
background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%);
}
/* 替换为柔和的莫兰迪色或渐变 */
.bg-gradient-blue { background: #e3f2fd; color: #2196f3; }
.bg-gradient-green { background: #e8f5e9; color: #4caf50; }
.bg-gradient-orange { background: #fff3e0; color: #ff9800; }
.bg-gradient-purple { background: #f3e5f5; color: #9c27b0; }
.text-box {
display: flex;
flex-direction: column;
}
.label {
font-size: 32rpx;
color: #333;
font-weight: 600;
margin-bottom: 6rpx;
}
.sub-label {
font-size: 24rpx;
color: #999;
}
/* Banner */
.banner {
margin-top: 40rpx;
background: linear-gradient(to right, #4facfe, #00f2fe);
border-radius: 24rpx;
padding: 30rpx 40rpx;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 8rpx 20rpx rgba(79, 172, 254, 0.3);
}
.banner-text {
display: flex;
flex-direction: column;
}
.banner-title {
color: #fff;
font-weight: bold;
font-size: 30rpx;
margin-bottom: 8rpx;
}
.banner-desc {
color: rgba(255,255,255,0.8);
font-size: 24rpx;
}
.banner-icon {
font-size: 40rpx;
}