feat: 初始化工程
This commit is contained in:
99
src/pages/index/index.vue
Normal file
99
src/pages/index/index.vue
Normal file
@@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<view class="min-h-screen flex flex-col" style="background-image: linear-gradient(180deg, #4CAF50 0%, #8BC34A 42%, #E8F5E9 100%)">
|
||||
<!-- 顶部 -->
|
||||
<view class="self-center py-3 flex items-center gap-2 text-gray-800">
|
||||
<wd-img :width="40" :height="40" :src="imgURL" />
|
||||
<view class="flex min-w-0 flex-col">
|
||||
<text class="truncate text-lg text-white font-semibold">
|
||||
{{ greeting }}
|
||||
</text>
|
||||
<text class="mt-0.5 text-xs text-white/70">
|
||||
{{ today }} · 记录每一次耕耘
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<wd-card title="1号菜地">
|
||||
<image src="https://wot-ui.cn/assets/panda.jpg" mode="aspectFill" />
|
||||
|
||||
<template #footer>
|
||||
<view class="flex-1 flex justify-between items-center">
|
||||
<view class="flex flex-col gap-1">
|
||||
<view class="text-base font-medium">
|
||||
西红柿
|
||||
<text class="text-sm text-gray-400 font-normal ml-1">粉果番茄</text>
|
||||
</view>
|
||||
<view class="flex gap-1 align-center">
|
||||
<wd-text text="🌱 生长期"/>
|
||||
<wd-text text="📅 2025-04-10"/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex gap-1">
|
||||
<wd-button icon="edit" round></wd-button>
|
||||
<wd-button icon="list" round></wd-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</wd-card>
|
||||
|
||||
<wd-card title="2号菜地">
|
||||
<image src="https://wot-ui.cn/assets/redpanda.jpg" mode="aspectFill" />
|
||||
|
||||
<template #footer>
|
||||
<view class="flex-1 flex justify-between items-center">
|
||||
<view class="flex flex-col gap-1">
|
||||
<view class="text-base font-medium">
|
||||
黄瓜
|
||||
<text class="text-sm text-gray-400 font-normal ml-1">旱黄瓜</text>
|
||||
</view>
|
||||
<view class="flex gap-1 align-center">
|
||||
<wd-text text="🌱 开花期"/>
|
||||
<wd-text text="📅 2025-04-10"/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex gap-1">
|
||||
<wd-button icon="edit" round></wd-button>
|
||||
<wd-button icon="list" round></wd-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</wd-card>
|
||||
|
||||
<view class="h-[10px]"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import appLogo from '@/static/logo.png'
|
||||
|
||||
defineOptions({ name: 'Home' })
|
||||
|
||||
const imgURL = appLogo
|
||||
|
||||
// ===== 时间 =====
|
||||
const now = new Date()
|
||||
const hour = now.getHours()
|
||||
|
||||
const greeting = computed(() => {
|
||||
if (hour < 6) return '夜深了 🌙'
|
||||
if (hour < 12) return '早上好 ☀️'
|
||||
if (hour < 18) return '下午好 👋'
|
||||
return '晚上好 ✨'
|
||||
})
|
||||
|
||||
const today = computed(() => {
|
||||
const m = now.getMonth() + 1
|
||||
const d = now.getDate()
|
||||
const w = ['日', '一', '二', '三', '四', '五', '六'][now.getDay()]
|
||||
return `${m}月${d}日 周${w}`
|
||||
})
|
||||
|
||||
|
||||
onShow(() => loadData())
|
||||
|
||||
function loadData() {
|
||||
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user