Compare commits

...

3 Commits

Author SHA1 Message Date
zzc
083d52a5d7 feat: make gpage tpl 2026-01-22 00:01:30 +08:00
zzc
6742776e64 feat: make gpage 2026-01-21 23:58:21 +08:00
zzc
25de38a1f5 feat: deaw share 2026-01-21 22:33:37 +08:00
7 changed files with 646 additions and 116 deletions

View File

@@ -6,3 +6,10 @@ export const drawFortune = async () => {
method: "GET", method: "GET",
}); });
}; };
export const getList = async (page = 1) => {
return request({
url: `/api/blessing/fortune/list?page=${page}`,
method: "GET",
});
};

View File

@@ -15,3 +15,10 @@ export const updateCard = async (data) => {
data, data,
}); });
}; };
export const getCardTemplateList = async (page = 1) => {
return request({
url: "/api/blessing/card/template/list?page=" + page,
method: "GET",
});
};

View File

@@ -56,6 +56,14 @@
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},
{
"path": "pages/fortune/record",
"style": {
"navigationBarTitleText": "我的运势记录",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
} }
], ],
"globalStyle": { "globalStyle": {

View File

@@ -95,7 +95,7 @@
<button class="sec-btn" @tap="saveCard"> <button class="sec-btn" @tap="saveCard">
<text class="icon">📥</text> 保存运势卡片 <text class="icon">📥</text> 保存运势卡片
</button> </button>
<button class="sec-btn" @tap="reset"> <button class="sec-btn" @tap="goToRecord">
<text class="icon"></text> 我的记录 <text class="icon"></text> 我的记录
</button> </button>
</view> </view>
@@ -208,6 +208,12 @@ const goBack = () => {
} }
}; };
const goToRecord = () => {
uni.navigateTo({
url: "/pages/fortune/record",
});
};
const startShake = async () => { const startShake = async () => {
if (!isLoggedIn.value) { if (!isLoggedIn.value) {
loginPopupRef.value.open(); loginPopupRef.value.open();

413
pages/fortune/record.vue Normal file
View File

@@ -0,0 +1,413 @@
<template>
<view class="record-page" :style="{ paddingTop: navBarHeight + 'px' }">
<!-- 导航栏 -->
<view class="nav-bar" :style="{ height: navBarHeight + 'px' }">
<view class="nav-content" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="back-btn" @tap="goBack">
<text class="uni-icons"></text>
</view>
<text class="nav-title">我的运势记录</text>
</view>
</view>
<scroll-view
scroll-y
:lower-threshold="80"
class="content-scroll"
@scrolltolower="loadMore"
>
<view class="container">
<!-- 统计卡片 -->
<view class="stats-card">
<view class="stats-header">
<text class="stats-icon"></text>
<text class="stats-sub">2026 灵驹贺岁</text>
</view>
<view class="stats-body">
<view class="stats-row">
<text class="stats-label">已收集</text>
<text class="stats-num">{{ records.length }}</text>
<text class="stats-label">张好运卡</text>
</view>
<view class="progress-bar">
<view
class="progress-inner"
:style="{ width: progressWidth }"
></view>
</view>
</view>
</view>
<!-- 列表标题 -->
<view class="list-header">
<text class="list-title">我的宝藏锦囊</text>
<text class="list-subtitle">ARCHIVES</text>
</view>
<!-- 卡片列表 -->
<view class="card-grid">
<view
class="grid-item"
v-for="(item, index) in records"
:key="index"
@tap="goDetail(item)"
>
<view class="item-image-box">
<image
:src="item.imageUrl"
mode="aspectFill"
class="item-image"
/>
<view class="item-tag" :class="getTagClass(item.tag)">
{{ item.tag || "大吉" }}
</view>
</view>
<view class="item-info">
<text class="item-title">{{ item.title }}</text>
<view class="item-footer">
<text class="item-date">{{ item.date }}</text>
<view class="item-link">
<text>详情</text>
<text class="arrow"></text>
</view>
</view>
</view>
</view>
</view>
<!-- 加载状态 -->
<view class="loading-status" v-if="records.length > 0">
<text v-if="loading">加载中...</text>
<text v-else-if="!hasMore">没有更多了</text>
</view>
<!-- 空状态 -->
<view v-if="!loading && records.length === 0" class="empty-state">
<text class="empty-text">暂无运势记录快去抽取吧</text>
<button class="go-draw-btn" @tap="goDraw">去抽签</button>
</view>
<view style="height: 40px"></view>
</view>
</scroll-view>
</view>
</template>
<script setup>
import { ref, computed } from "vue";
import { getBavBarHeight, getStatusBarHeight } from "@/utils/system";
import { onLoad } from "@dcloudio/uni-app";
import { getList } from "@/api/fortune.js";
const navBarHeight = getBavBarHeight();
const statusBarHeight = getStatusBarHeight();
// 状态管理
const records = ref([]);
const page = ref(1);
const curCount = ref(0);
const loading = ref(false);
const hasMore = ref(true);
const progressWidth = computed(() => {
const total = 75; // 假设总共有20种卡片
const current = records.value.length;
const percentage = Math.min((current / total) * 100, 100);
return `${percentage}%`;
});
const getTagClass = (tag) => {
const map = {
大吉: "tag-gold",
安康: "tag-green",
顺遂: "tag-red",
上吉: "tag-orange",
};
return map[tag] || "tag-gold";
};
const loadData = async () => {
if (loading.value || !hasMore.value) return;
loading.value = true;
try {
const res = await getList(page.value);
// 兼容返回格式可能是数组或包含list的对象
const list = Array.isArray(res) ? res : res.list || res.data || [];
if (list.length > 0) {
records.value = [...records.value, ...list];
page.value++;
// 简单判断是否还有更多数据
hasMore.value = res.hasNext;
curCount.value = res.totalCount || 0;
} else {
hasMore.value = false;
}
} catch (error) {
console.error("加载记录失败:", error);
uni.showToast({
title: "加载失败",
icon: "none",
});
} finally {
loading.value = false;
}
};
const loadMore = () => {
console.log(666666666);
loadData();
};
const goBack = () => {
uni.navigateBack();
};
const goDetail = (item) => {
// 传递数据到详情页
const data = encodeURIComponent(JSON.stringify(item));
uni.navigateTo({
url: `/pages/fortune/detail?data=${data}`,
});
};
const goDraw = () => {
uni.navigateBack();
};
onLoad(() => {
loadData();
});
</script>
<style scoped>
.loading-status {
text-align: center;
padding: 20px 0;
color: #999;
font-size: 12px;
}
.record-page {
height: 100vh;
background-color: #1a1a1a;
color: #fff;
display: flex;
flex-direction: column;
overflow: hidden;
}
.nav-bar {
position: fixed;
top: 0;
left: 0;
width: 100%;
background-color: #1a1a1a;
z-index: 100;
}
.nav-content {
height: 100%;
display: flex;
align-items: center;
padding: 0 16px;
position: relative;
}
.back-btn {
font-size: 32px;
color: #fff;
margin-right: 12px;
line-height: 1;
padding: 0 10px;
}
.nav-title {
font-size: 18px;
font-weight: 600;
color: #fff;
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.content-scroll {
flex: 1;
height: 0; /* Important for scroll-view in flex container */
}
.container {
padding: 20px 16px;
}
/* 统计卡片 */
.stats-card {
background: linear-gradient(135deg, #2a2a2a 0%, #222 100%);
border-radius: 20px;
padding: 24px;
margin-bottom: 30px;
border: 1px solid rgba(255, 215, 0, 0.2);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
.stats-header {
display: flex;
align-items: center;
margin-bottom: 16px;
}
.stats-icon {
margin-right: 6px;
font-size: 16px;
}
.stats-sub {
color: #999;
font-size: 14px;
}
.stats-body {
display: flex;
flex-direction: column;
}
.stats-row {
display: flex;
align-items: baseline;
margin-bottom: 12px;
}
.stats-label {
font-size: 16px;
color: #fff;
font-weight: bold;
}
.stats-num {
font-size: 32px;
color: #ffd700;
font-weight: bold;
margin: 0 8px;
font-family: serif;
}
.progress-bar {
width: 100%;
height: 6px;
background: rgba(255, 255, 255, 0.1);
border-radius: 3px;
overflow: hidden;
}
.progress-inner {
height: 100%;
background: linear-gradient(90deg, #ffd700 0%, #ffa500 100%);
border-radius: 3px;
}
/* 列表标题 */
.list-header {
display: flex;
justify-content: space-between;
align-items: flex-end;
margin-bottom: 20px;
}
.list-title {
font-size: 18px;
font-weight: bold;
color: #fff;
}
.list-subtitle {
font-size: 12px;
color: #666;
letter-spacing: 2px;
font-weight: bold;
}
/* Grid List */
.card-grid {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.grid-item {
width: 48%;
margin-bottom: 24px;
display: flex;
flex-direction: column;
}
.item-image-box {
width: 100%;
height: 220px; /* Adjust based on aspect ratio */
border-radius: 12px;
overflow: hidden;
position: relative;
margin-bottom: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.item-image {
width: 100%;
height: 100%;
display: block;
}
.item-tag {
position: absolute;
left: 10px;
bottom: 10px;
padding: 4px 12px;
border-radius: 12px;
font-size: 12px;
font-weight: bold;
color: #fff;
backdrop-filter: blur(4px);
}
.tag-gold {
background: rgba(212, 175, 55, 0.9);
}
.tag-green {
background: rgba(46, 139, 87, 0.9);
}
.tag-red {
background: rgba(178, 34, 34, 0.9);
}
.tag-orange {
background: rgba(255, 140, 0, 0.9);
}
.item-info {
display: flex;
flex-direction: column;
}
.item-title {
font-size: 16px;
font-weight: bold;
color: #fff;
margin-bottom: 6px;
}
.item-footer {
display: flex;
justify-content: space-between;
align-items: center;
}
.item-date {
font-size: 12px;
color: #666;
}
.item-link {
display: flex;
align-items: center;
font-size: 12px;
color: #ffd700;
}
.arrow {
margin-left: 4px;
}
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
padding: 40px 0;
}
.empty-text {
color: #666;
font-size: 14px;
margin-bottom: 20px;
}
.go-draw-btn {
background: #ffd700;
color: #333;
font-size: 14px;
padding: 8px 24px;
border-radius: 20px;
font-weight: bold;
}
</style>

View File

@@ -2,7 +2,11 @@
<view class="make-page" :style="{ paddingTop: getBavBarHeight() + 'px' }"> <view class="make-page" :style="{ paddingTop: getBavBarHeight() + 'px' }">
<!-- 预览卡片 --> <!-- 预览卡片 -->
<view class="card-preview"> <view class="card-preview">
<image class="card-bg" :src="currentTemplate.cover" mode="aspectFill" /> <image
class="card-bg"
:src="currentTemplate?.imageUrl"
mode="aspectFill"
/>
<view class="card-overlay"> <view class="card-overlay">
<view class="title"> <view class="title">
<text class="main">新春快乐</text> <text class="main">新春快乐</text>
@@ -31,6 +35,22 @@
<view class="editor-panel"> <view class="editor-panel">
<view class="drag-handle"></view> <view class="drag-handle"></view>
<!-- 底部操作 -->
<view class="bottom-actions">
<button class="btn secondary" @tap="preview">
<uni-icons type="cloud-download" size="20" color="#888"></uni-icons>
<view>保存</view>
</button>
<button open-type="share" class="btn primary" @tap="shareOrSave">
<uni-icons
type="paperplane-filled"
size="20"
color="#fff"
></uni-icons>
<view>分享给好友</view>
</button>
</view>
<!-- 功能入口 --> <!-- 功能入口 -->
<view class="tools"> <view class="tools">
<view <view
@@ -49,25 +69,30 @@
<view v-if="activeTool === 'template'" class="section"> <view v-if="activeTool === 'template'" class="section">
<view class="section-title"> <view class="section-title">
<text>热门模板</text> <text>热门模板</text>
<text class="more" @tap="showMore">查看更多 ></text>
</view> </view>
<scroll-view scroll-x class="tpl-scroll" show-scrollbar="false"> <view class="tpl-scroll">
<view class="tpl-wrap"> <view class="tpl-grid">
<view <view
v-for="(tpl, i) in templates" v-for="(tpl, i) in templates"
:key="i" :key="i"
class="tpl-card" class="tpl-card"
:class="{ selected: tpl.id === currentTemplate.id }" :class="{ selected: tpl?.id === currentTemplate?.id }"
@tap="applyTemplate(tpl)" @tap="applyTemplate(tpl)"
> >
<image :src="tpl.cover" class="tpl-cover" mode="aspectFill" /> <image :src="tpl.imageUrl" class="tpl-cover" mode="aspectFill" />
<view class="tpl-name">{{ tpl.name }}</view> <view class="tpl-name">{{ tpl.name }}</view>
<view v-if="tpl.id === currentTemplate.id" class="tpl-check" <view v-if="tpl?.id === currentTemplate?.id" class="tpl-check"
></view ></view
> >
</view> </view>
</view> </view>
</scroll-view> <view v-if="loadingTemplates" class="loading-more">加载中...</view>
<view
v-else-if="!hasMoreTemplates && templates.length > 0"
class="no-more"
>没有更多了</view
>
</view>
</view> </view>
<!-- 文字编辑 --> <!-- 文字编辑 -->
@@ -154,22 +179,6 @@
<button class="btn" @tap="toggleAvatarDecor">切换挂饰</button> <button class="btn" @tap="toggleAvatarDecor">切换挂饰</button>
</view> </view>
</view> </view>
<!-- 底部操作 -->
<view class="bottom-actions">
<button class="btn secondary" @tap="preview">
<uni-icons type="cloud-download" size="20" color="#888"></uni-icons>
<view>保存</view>
</button>
<button open-type="share" class="btn primary" @tap="shareOrSave">
<uni-icons
type="paperplane-filled"
size="20"
color="#fff"
></uni-icons>
<view>分享给好友</view>
</button>
</view>
</view> </view>
<canvas <canvas
@@ -183,11 +192,14 @@
<script setup> <script setup>
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import { getBavBarHeight, getDeviceInfo } from "@/utils/system"; import { getBavBarHeight, getDeviceInfo } from "@/utils/system";
import { createCardTmp, updateCard } from "@/api/make"; import { createCardTmp, getCardTemplateList } from "@/api/make";
import { createCardShareToken } from "@/api/card"; import { createCardShareToken } from "@/api/card";
import { onShareAppMessage, onLoad } from "@dcloudio/uni-app"; import { onShareAppMessage, onLoad, onReachBottom } from "@dcloudio/uni-app";
import { useUserStore } from "@/stores/user"; import { useUserStore } from "@/stores/user";
const templatePage = ref(1);
const loadingTemplates = ref(false);
const hasMoreTemplates = ref(true);
const userStore = useUserStore(); const userStore = useUserStore();
const cardId = ref(""); const cardId = ref("");
@@ -195,11 +207,11 @@ const targetName = ref("祝您");
const signatureName = ref(userStore?.userInfo?.nickName || "xxx"); const signatureName = ref(userStore?.userInfo?.nickName || "xxx");
const userAvatar = ref( const userAvatar = ref(
userStore?.userInfo?.avatarUrl || userStore?.userInfo?.avatarUrl ||
"https://file.lihailezzc.com/resource/b48c41054c2633c478463ac1b1f1ca23.png" "https://file.lihailezzc.com/resource/b48c41054c2633c478463ac1b1f1ca23.png",
); );
const blessingText = ref( const blessingText = ref(
"岁末将至敬颂冬绥。平安喜乐万事胜意。祝您2026年大吉大利一马当先前程似锦龙马精神阖家安康" "岁末将至敬颂冬绥。平安喜乐万事胜意。祝您2026年大吉大利一马当先前程似锦龙马精神阖家安康",
); );
const textColors = ["#ffffff", "#ff3b30", "#F5A623", "#8B572A", "#000000"]; const textColors = ["#ffffff", "#ff3b30", "#F5A623", "#8B572A", "#000000"];
@@ -217,6 +229,13 @@ const greetingLib = [
onLoad((options) => { onLoad((options) => {
cardId.value = "69674f307307beac4519025f"; cardId.value = "69674f307307beac4519025f";
// createCard(); // createCard();
getTemplateList();
});
onReachBottom(() => {
if (activeTool.value === "template") {
loadMoreTemplates();
}
}); });
const createCard = async () => { const createCard = async () => {
@@ -230,6 +249,53 @@ const createCard = async () => {
} }
}; };
const getTemplateList = async (isLoadMore = false) => {
if (loadingTemplates.value || (!hasMoreTemplates.value && isLoadMore)) return;
loadingTemplates.value = true;
try {
const res = await getCardTemplateList(templatePage.value);
// 兼容数组或对象列表格式
const list = Array.isArray(res) ? res : res.list || [];
if (list.length > 0) {
if (isLoadMore) {
templates.value = [...templates.value, ...list];
} else {
templates.value = list;
// 初始加载时设置第一个为当前选中
if (list.length > 0 && !currentTemplate.value) {
currentTemplate.value = list[0];
}
}
// 判断是否还有更多
if (typeof res.hasNext !== "undefined") {
hasMoreTemplates.value = res.hasNext;
} else {
// 如果没有 hasNext 字段,根据返回数量简单判断
hasMoreTemplates.value = list.length >= 8; // 假设每页 10 条
}
if (hasMoreTemplates.value) {
templatePage.value++;
}
} else {
if (!isLoadMore) templates.value = [];
hasMoreTemplates.value = false;
}
} catch (error) {
console.error("加载模板失败:", error);
} finally {
loadingTemplates.value = false;
}
};
const loadMoreTemplates = () => {
getTemplateList(true);
};
onShareAppMessage(async () => { onShareAppMessage(async () => {
const deviceInfo = getDeviceInfo(); const deviceInfo = getDeviceInfo();
const shareTokenRes = await createCardShareToken({ const shareTokenRes = await createCardShareToken({
@@ -262,33 +328,12 @@ const selectGreeting = (text) => {
const tools = [ const tools = [
{ type: "template", text: "模板", icon: "▦" }, { type: "template", text: "模板", icon: "▦" },
{ type: "text", text: "文字", icon: "文" }, { type: "text", text: "文字", icon: "文" },
{ type: "image", text: "图片/背景", icon: "图" }, // { type: "image", text: "图片/背景", icon: "图" },
{ type: "avatar", text: "头像挂饰", icon: "饰" }, // { type: "avatar", text: "头像挂饰", icon: "饰" },
]; ];
const activeTool = ref("template"); const activeTool = ref("template");
const templates = ref([ const templates = ref([]);
{
id: 1,
name: "金典红金",
cover: "https://file.lihailezzc.com/20260109082842_666_1.jpg",
},
{
id: 2,
name: "富贵花开",
cover: "https://file.lihailezzc.com/20260108222141_644_1.jpg",
},
{
id: 3,
name: "大气字法",
cover: "https://file.lihailezzc.com/20260108222141_644_1.jpg",
},
{
id: 4,
name: "萌趣马年",
cover: "https://file.lihailezzc.com/20260109082842_666_1.jpg",
},
]);
const currentTemplate = ref(templates.value[0]); const currentTemplate = ref(templates.value[0]);
@@ -359,7 +404,7 @@ const saveByCanvas = async (save = true) => {
// 1⃣ 画背景 // 1⃣ 画背景
// ⭐ 先加载背景图 // ⭐ 先加载背景图
const [bgPath, avatarPath] = await Promise.all([ const [bgPath, avatarPath] = await Promise.all([
loadImage(currentTemplate.value.cover), loadImage(currentTemplate?.value?.imageUrl),
loadImage(userAvatar.value), loadImage(userAvatar.value),
]); ]);
@@ -552,7 +597,7 @@ function drawUserBubble(ctx, options) {
bubbleWidth, bubbleWidth,
bubbleHeight, bubbleHeight,
bubbleHeight / 2, bubbleHeight / 2,
bubbleColor bubbleColor,
); );
// 2⃣ 绘制头像 // 2⃣ 绘制头像
@@ -566,7 +611,7 @@ function drawUserBubble(ctx, options) {
avatarY + avatarSize / 2, avatarY + avatarSize / 2,
avatarSize / 2, avatarSize / 2,
0, 0,
Math.PI * 2 Math.PI * 2,
); );
ctx.clip(); ctx.clip();
ctx.drawImage(avatarPath, avatarX, avatarY, avatarSize, avatarSize); ctx.drawImage(avatarPath, avatarX, avatarY, avatarSize, avatarSize);
@@ -768,45 +813,57 @@ function drawRoundRect(ctx, x, y, w, h, r, color) {
.tpl-scroll { .tpl-scroll {
margin-top: 12rpx; margin-top: 12rpx;
} }
.tpl-wrap { .tpl-grid {
display: flex; display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16rpx;
padding-bottom: 20rpx;
} }
.tpl-card { .tpl-card {
width: 180rpx; width: 100%; /* 自适应 grid 宽度 */
height: 240rpx; border-radius: 12rpx;
border-radius: 18rpx;
overflow: hidden; overflow: hidden;
background: #fff; background: #fff;
margin-right: 16rpx;
position: relative; position: relative;
box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.06); box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.06);
} }
.tpl-card.selected { .tpl-card.selected {
outline: 4rpx solid #ff3b30; outline: 4rpx solid #ff3b30;
} }
.tpl-cover { .tpl-cover {
width: 100%; width: 100%;
height: 160rpx; height: 368rpx;
} }
.tpl-name { .tpl-name {
font-size: 22rpx; font-size: 20rpx;
color: #333; color: #333;
padding: 8rpx 12rpx; padding: 6rpx 8rpx;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} }
.tpl-check { .tpl-check {
position: absolute; position: absolute;
right: 10rpx; right: 6rpx;
top: 10rpx; top: 6rpx;
width: 36rpx; width: 32rpx;
height: 36rpx; height: 32rpx;
border-radius: 50%; border-radius: 50%;
background: #ff3b30; background: #ff3b30;
color: #fff; color: #fff;
font-size: 22rpx; font-size: 20rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.loading-more,
.no-more {
text-align: center;
font-size: 22rpx;
color: #999;
padding: 10rpx 0;
}
/* 文字编辑区 */ /* 文字编辑区 */
.text-edit-section { .text-edit-section {

View File

@@ -1,17 +1,24 @@
<template> <template>
<view class="mine-page"> <view class="mine-page">
<!-- Custom Navbar --> <!-- Custom Navbar -->
<view class="nav-bar" :style="{ paddingTop: navBarTop + 'px', height: navBarHeight + 'px' }"> <view
class="nav-bar"
:style="{ paddingTop: navBarTop + 'px', height: navBarHeight + 'px' }"
>
<!-- <text class="nav-title">我的</text> --> <!-- <text class="nav-title">我的</text> -->
</view> </view>
<scroll-view scroll-y class="content-scroll" :style="{ paddingTop: (navBarTop + navBarHeight) + 'px' }"> <scroll-view
scroll-y
class="content-scroll"
:style="{ paddingTop: navBarTop + navBarHeight + 'px' }"
>
<view class="content-wrap"> <view class="content-wrap">
<!-- User Card --> <!-- User Card -->
<view class="user-card" @tap="handleUserClick"> <view class="user-card" @tap="handleUserClick">
<view class="avatar-box"> <view class="avatar-box">
<image :src="userInfo.avatarUrl" class="avatar" mode="aspectFill" /> <image :src="userInfo.avatarUrl" class="avatar" mode="aspectFill" />
<view class="red-badge"><text class="fire">🔥</text></view> <view class="red-badge"><text class="fire">🔥</text></view>
</view> </view>
<view class="user-info"> <view class="user-info">
<view class="row-1"> <view class="row-1">
@@ -22,7 +29,9 @@
</view> </view>
<view class="row-2" v-if="isLoggedIn"> <view class="row-2" v-if="isLoggedIn">
<text class="arrow-icon"></text> <text class="arrow-icon"></text>
<text class="stats-text">已发送 <text class="num">3</text> 条新春祝福</text> <text class="stats-text"
>已发送 <text class="num">3</text> 条新春祝福</text
>
</view> </view>
<view class="row-2" v-else> <view class="row-2" v-else>
<text class="stats-text">点击登录解锁更多功能</text> <text class="stats-text">点击登录解锁更多功能</text>
@@ -39,9 +48,9 @@
<text class="menu-text">我的新春祝福</text> <text class="menu-text">我的新春祝福</text>
<text class="arrow"></text> <text class="arrow"></text>
</view> </view>
<view class="menu-item" @tap="navTo('videos')"> <view class="menu-item" @tap="navTo('fortune-record')">
<view class="icon-box orange-bg"><text>📹</text></view> <view class="icon-box orange-bg"><text>📹</text></view>
<text class="menu-text">我的拜年视频</text> <text class="menu-text">我的新年运势</text>
<text class="arrow"></text> <text class="arrow"></text>
</view> </view>
<view class="menu-item" @tap="navTo('decorations')"> <view class="menu-item" @tap="navTo('decorations')">
@@ -72,7 +81,7 @@
</view> </view>
</view> </view>
<!-- Other Actions --> <!-- Other Actions -->
<view class="menu-group mt-30"> <view class="menu-group mt-30">
<button class="menu-item share-btn" open-type="share"> <button class="menu-item share-btn" open-type="share">
<view class="icon-left"><text class="share-icon">🔗</text></view> <view class="icon-left"><text class="share-icon">🔗</text></view>
@@ -90,63 +99,70 @@
<view class="version-info">2026 丙午马年 · 新春助手 v1.0.2</view> <view class="version-info">2026 丙午马年 · 新春助手 v1.0.2</view>
<!-- Bottom Spacer for TabBar --> <!-- Bottom Spacer for TabBar -->
<view style="height: 120rpx;"></view> <view style="height: 120rpx"></view>
</view> </view>
</scroll-view> </scroll-view>
<!-- Login Popup --> <!-- Login Popup -->
<LoginPopup ref="loginPopupRef" @logind="handleLogind"/> <LoginPopup ref="loginPopupRef" @logind="handleLogind" />
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, computed, onMounted } from 'vue' import { ref, computed, onMounted } from "vue";
import { wxLogin } from '@/utils/login.js' import { wxLogin } from "@/utils/login.js";
import { getPlatformProvider, getBavBarHeight } from '@/utils/system' import { getPlatformProvider, getBavBarHeight } from "@/utils/system";
import { useUserStore } from '@/stores/user' import { useUserStore } from "@/stores/user";
import { apiLogin } from '@/api/auth.js' import { apiLogin } from "@/api/auth.js";
import LoginPopup from '@/components/LoginPopup/LoginPopup.vue' import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
const userStore = useUserStore() const userStore = useUserStore();
const loginPopupRef = ref(null) const loginPopupRef = ref(null);
// Navigation Bar // Navigation Bar
const navBarTop = ref(20) const navBarTop = ref(20);
const navBarHeight = ref(44) const navBarHeight = ref(44);
// User Info // User Info
const defaultAvatarUrl = 'https://file.lihailezzc.com/resource/d9b329082b32f8305101f708593a4882.png' const defaultAvatarUrl =
"https://file.lihailezzc.com/resource/d9b329082b32f8305101f708593a4882.png";
const userInfo = computed(() => ({ const userInfo = computed(() => ({
nickName: userStore.userInfo.nickName || '点击登录', nickName: userStore.userInfo.nickName || "点击登录",
avatarUrl: userStore.userInfo.avatarUrl || defaultAvatarUrl avatarUrl: userStore.userInfo.avatarUrl || defaultAvatarUrl,
})) }));
const isLoggedIn = computed(() => !!userStore.userInfo.nickName) const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
onMounted(() => { onMounted(() => {
const sysInfo = uni.getSystemInfoSync() const sysInfo = uni.getSystemInfoSync();
navBarTop.value = sysInfo.statusBarHeight navBarTop.value = sysInfo.statusBarHeight;
// Assuming standard nav bar height // Assuming standard nav bar height
navBarHeight.value = 44 navBarHeight.value = 44;
}) });
const handleUserClick = () => { const handleUserClick = () => {
if (!isLoggedIn.value) { if (!isLoggedIn.value) {
loginPopupRef.value.open() loginPopupRef.value.open();
} else { } else {
// Navigate to profile details or do nothing // Navigate to profile details or do nothing
} }
} };
const handleLogind = async () => { const handleLogind = async () => {
// Logic after successful login if needed // Logic after successful login if needed
} };
const navTo = (page) => { const navTo = (page) => {
uni.showToast({ title: '功能开发中', icon: 'none' }) if (page === "fortune-record") {
} uni.navigateTo({
url: "/pages/fortune/record",
});
return;
}
uni.showToast({ title: "功能开发中", icon: "none" });
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -189,7 +205,7 @@ const navTo = (page) => {
align-items: center; align-items: center;
margin-bottom: 40rpx; margin-bottom: 40rpx;
position: relative; position: relative;
box-shadow: 0 10rpx 30rpx rgba(0,0,0,0.03); box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.03);
} }
.avatar-box { .avatar-box {
position: relative; position: relative;
@@ -200,7 +216,7 @@ const navTo = (page) => {
height: 120rpx; height: 120rpx;
border-radius: 50%; border-radius: 50%;
border: 4rpx solid #fff; border: 4rpx solid #fff;
box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.1); box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
} }
.red-badge { .red-badge {
position: absolute; position: absolute;
@@ -283,7 +299,7 @@ const navTo = (page) => {
border-radius: 24rpx; border-radius: 24rpx;
overflow: hidden; overflow: hidden;
margin-bottom: 40rpx; margin-bottom: 40rpx;
box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.02); box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.02);
} }
.menu-group.mt-30 { .menu-group.mt-30 {
margin-top: 30rpx; margin-top: 30rpx;
@@ -319,11 +335,26 @@ const navTo = (page) => {
margin-right: 24rpx; margin-right: 24rpx;
font-size: 36rpx; font-size: 36rpx;
} }
.red-bg { background: #fff0f0; color: #ff3b30; } .red-bg {
.orange-bg { background: #fff8e6; color: #ff9500; } background: #fff0f0;
.pink-bg { background: #fff0f5; color: #ff2d55; } color: #ff3b30;
.yellow-bg { background: #fffae0; color: #ffcc00; } }
.gray-bg { background: #f5f5f5; color: #666; } .orange-bg {
background: #fff8e6;
color: #ff9500;
}
.pink-bg {
background: #fff0f5;
color: #ff2d55;
}
.yellow-bg {
background: #fffae0;
color: #ffcc00;
}
.gray-bg {
background: #f5f5f5;
color: #666;
}
.icon-left { .icon-left {
width: 40rpx; width: 40rpx;
@@ -332,7 +363,8 @@ const navTo = (page) => {
margin-right: 24rpx; margin-right: 24rpx;
margin-left: 16rpx; margin-left: 16rpx;
} }
.share-icon, .help-icon { .share-icon,
.help-icon {
font-size: 36rpx; font-size: 36rpx;
color: #666; color: #666;
} }