feat: 增加分享功能

This commit is contained in:
2026-09-02 09:23:52 +08:00
parent cd2e7d47c4
commit 389db4f279
7 changed files with 74 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
<template>
<wd-popup
v-model="profileStore.showAboutPopup"
position="bottom"
:safe-area-inset-bottom="true"
custom-style="border-radius: 32rpx 32rpx 0 0; padding: 40rpx 32rpx"
>
<text class="leading-8 text-[#5A5A5A] text-center">
本小程序处于持续建设阶段各项功能按计划分批次推进<br/>
当前可体验的内容为阶段性成果后续模块将陆续补齐<br/>
期间已有功能可正常访问感谢理解与等候
</text>
</wd-popup>
</template>
<script lang="ts" setup>
import { useProfileStore } from '@/store/profile'
const profileStore = useProfileStore()
</script>

View File

@@ -76,7 +76,14 @@
</view>
</wd-card>
<wd-card title="🔥 今日资讯">
<wd-card>
<template #title>
<view class="wd-card__title-text flex items-center justify-between">
<text>🔥 健康资讯</text>
<text class="text-11px text-[#999]">🔄 每日更新</text>
</view>
</template>
<wd-empty v-if="tipList.length === 0" icon="no-content"
:tip="errorMessage || '获取资讯失败,请检查网络连接或联系管理员'" />
@@ -100,7 +107,14 @@
</view>
</wd-card>
<wd-card title="🔥 今日食谱">
<wd-card>
<template #title>
<view class="wd-card__title-text flex items-center justify-between">
<text>🌿 养生食谱</text>
<text class="text-11px text-[#999]">🔄 每日更新</text>
</view>
</template>
<wd-empty v-if="recipeList.length === 0" icon="no-content"
:tip="errorMessage || '获取资讯失败,请检查网络连接或联系管理员'" />
@@ -161,6 +175,10 @@ import type { IRecipe, ITip } from "@/type";
import TipPopup from "@/components/Home/TipPopup.vue";
import { getTheme, getThemePrimaryColor, getThemeStyle } from "@/utils/themes";
import RecipePopup from "@/components/Home/RecipePopup.vue";
import { share } from '@/utils/share'
const { onShareAppMessage } = share()
onShareAppMessage()
defineOptions({
name: 'Home',
@@ -209,6 +227,8 @@ const today = computed(() => {
onShow(() => {
todayRecords.value = getDayRecords(getDateStr(Date.now()))
hasSignedToday.value = checkSignedToday()
errorMessage.value = '加载中'
getTipList()
getRecipeList()
})

View File

@@ -100,6 +100,10 @@ import { onShow } from "@dcloudio/uni-app";
import type { ICalendarSelect, IGroupHealthRecord, IHealthRecord } from "@/type/record";
import { useAppStore } from "@/store/app";
import { getTheme, getThemePrimaryColor, getThemeStyle } from "@/utils/themes";
import { share } from '@/utils/share'
const { onShareAppMessage } = share()
onShareAppMessage()
const currentDate = ref(Date.now())
const currentRecordTypeSegment = ref('')

View File

@@ -128,6 +128,10 @@ import { useAppStore } from '@/store/app'
import { getStats } from "@/utils/profile";
import { getTheme, getThemeStyle } from "@/utils/themes";
import SummaryCard from "@/components/Stats/SummaryCard.vue";
import { share } from '@/utils/share'
const { onShareAppMessage } = share()
onShareAppMessage()
const profileStore = useProfileStore()
const appStore = useAppStore()

View File

@@ -47,6 +47,7 @@
<wd-cell size="large" title="数据统计" is-link @click="openStatsPopup"/>
<wd-cell size="large" title="主题色" is-link @click="openThemePopup"/>
<wd-cell size="large" title="存储详情" is-link @click="openStoragePopup"/>
<wd-cell size="large" title="关于我们" is-link @click="openAboutPopup"/>
</wd-cell-group>
<wd-text :text="`版本号:${appStore.version}`" custom-style="margin-top: 5px;display:block; text-align:center;"></wd-text>
@@ -66,6 +67,7 @@
<point-popup />
<theme-popup />
<about-popup />
</view>
</wd-config-provider>
</template>
@@ -87,6 +89,11 @@ import PointPopup from "@/components/Profile/PointPopup.vue";
import StatsPopup from "@/components/Profile/StatsPopup.vue";
import { getTheme, getThemePrimaryColor } from "@/utils/themes";
import ThemePopup from "@/components/Profile/ThemePopup.vue";
import AboutPopup from "@/components/Profile/AboutPopup.vue";
import { share } from '@/utils/share'
const { onShareAppMessage } = share()
onShareAppMessage()
const profileStore = useProfileStore()
const appStore = useAppStore()
@@ -147,6 +154,10 @@ function openStoragePopup() {
profileStore.showStoragePopup = true
}
function openAboutPopup() {
profileStore.showAboutPopup = true
}
function openPointPopup() {
profileStore.showPointPopup = true
}

View File

@@ -13,6 +13,7 @@ export const useProfileStore = defineStore('profile', {
showDefaultRecordValuePopup: false,
showPointPopup: false,
showThemePopup: false,
showAboutPopup: false,
profileForm: {
gender: '',
height: 0,

12
src/utils/share.ts Normal file
View File

@@ -0,0 +1,12 @@
export function share(title = '今日健康打卡 🌿 一起来记录') {
return {
onShareAppMessage() {
const pages = getCurrentPages()
return {
title,
path: `/${pages[pages.length - 1].route}`,
imageUrl: '/static/logo.png'
}
}
}
}