feat: deaw share
This commit is contained in:
@@ -6,3 +6,10 @@ export const drawFortune = async () => {
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
export const getList = async (page = 1) => {
|
||||
return request({
|
||||
url: `/api/blessing/fortune/list?page=${page}`,
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
@@ -56,6 +56,14 @@
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/fortune/record",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的运势记录",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<button class="sec-btn" @tap="saveCard">
|
||||
<text class="icon">📥</text> 保存运势卡片
|
||||
</button>
|
||||
<button class="sec-btn" @tap="reset">
|
||||
<button class="sec-btn" @tap="goToRecord">
|
||||
<text class="icon">↺</text> 我的记录
|
||||
</button>
|
||||
</view>
|
||||
@@ -208,6 +208,12 @@ const goBack = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const goToRecord = () => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/fortune/record",
|
||||
});
|
||||
};
|
||||
|
||||
const startShake = async () => {
|
||||
if (!isLoggedIn.value) {
|
||||
loginPopupRef.value.open();
|
||||
|
||||
413
pages/fortune/record.vue
Normal file
413
pages/fortune/record.vue
Normal 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>
|
||||
@@ -1,11 +1,18 @@
|
||||
<template>
|
||||
<view class="mine-page">
|
||||
<!-- 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> -->
|
||||
</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">
|
||||
<!-- User Card -->
|
||||
<view class="user-card" @tap="handleUserClick">
|
||||
@@ -22,7 +29,9 @@
|
||||
</view>
|
||||
<view class="row-2" v-if="isLoggedIn">
|
||||
<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 class="row-2" v-else>
|
||||
<text class="stats-text">点击登录解锁更多功能</text>
|
||||
@@ -39,9 +48,9 @@
|
||||
<text class="menu-text">我的新春祝福</text>
|
||||
<text class="arrow">›</text>
|
||||
</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>
|
||||
<text class="menu-text">我的拜年视频</text>
|
||||
<text class="menu-text">我的新年运势</text>
|
||||
<text class="arrow">›</text>
|
||||
</view>
|
||||
<view class="menu-item" @tap="navTo('decorations')">
|
||||
@@ -90,7 +99,7 @@
|
||||
<view class="version-info">2026 丙午马年 · 新春助手 v1.0.2</view>
|
||||
|
||||
<!-- Bottom Spacer for TabBar -->
|
||||
<view style="height: 120rpx;"></view>
|
||||
<view style="height: 120rpx"></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
@@ -100,53 +109,60 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { wxLogin } from '@/utils/login.js'
|
||||
import { getPlatformProvider, getBavBarHeight } from '@/utils/system'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { apiLogin } from '@/api/auth.js'
|
||||
import { ref, computed, onMounted } from "vue";
|
||||
import { wxLogin } from "@/utils/login.js";
|
||||
import { getPlatformProvider, getBavBarHeight } from "@/utils/system";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { apiLogin } from "@/api/auth.js";
|
||||
|
||||
import LoginPopup from '@/components/LoginPopup/LoginPopup.vue'
|
||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||
|
||||
const userStore = useUserStore()
|
||||
const loginPopupRef = ref(null)
|
||||
const userStore = useUserStore();
|
||||
const loginPopupRef = ref(null);
|
||||
|
||||
// Navigation Bar
|
||||
const navBarTop = ref(20)
|
||||
const navBarHeight = ref(44)
|
||||
const navBarTop = ref(20);
|
||||
const navBarHeight = ref(44);
|
||||
|
||||
// User Info
|
||||
const defaultAvatarUrl = 'https://file.lihailezzc.com/resource/d9b329082b32f8305101f708593a4882.png'
|
||||
const defaultAvatarUrl =
|
||||
"https://file.lihailezzc.com/resource/d9b329082b32f8305101f708593a4882.png";
|
||||
|
||||
const userInfo = computed(() => ({
|
||||
nickName: userStore.userInfo.nickName || '点击登录',
|
||||
avatarUrl: userStore.userInfo.avatarUrl || defaultAvatarUrl
|
||||
}))
|
||||
nickName: userStore.userInfo.nickName || "点击登录",
|
||||
avatarUrl: userStore.userInfo.avatarUrl || defaultAvatarUrl,
|
||||
}));
|
||||
|
||||
const isLoggedIn = computed(() => !!userStore.userInfo.nickName)
|
||||
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
||||
|
||||
onMounted(() => {
|
||||
const sysInfo = uni.getSystemInfoSync()
|
||||
navBarTop.value = sysInfo.statusBarHeight
|
||||
const sysInfo = uni.getSystemInfoSync();
|
||||
navBarTop.value = sysInfo.statusBarHeight;
|
||||
// Assuming standard nav bar height
|
||||
navBarHeight.value = 44
|
||||
})
|
||||
navBarHeight.value = 44;
|
||||
});
|
||||
|
||||
const handleUserClick = () => {
|
||||
if (!isLoggedIn.value) {
|
||||
loginPopupRef.value.open()
|
||||
loginPopupRef.value.open();
|
||||
} else {
|
||||
// Navigate to profile details or do nothing
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleLogind = async () => {
|
||||
// Logic after successful login if needed
|
||||
}
|
||||
};
|
||||
|
||||
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>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -319,11 +335,26 @@ const navTo = (page) => {
|
||||
margin-right: 24rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
.red-bg { background: #fff0f0; color: #ff3b30; }
|
||||
.orange-bg { background: #fff8e6; color: #ff9500; }
|
||||
.pink-bg { background: #fff0f5; color: #ff2d55; }
|
||||
.yellow-bg { background: #fffae0; color: #ffcc00; }
|
||||
.gray-bg { background: #f5f5f5; color: #666; }
|
||||
.red-bg {
|
||||
background: #fff0f0;
|
||||
color: #ff3b30;
|
||||
}
|
||||
.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 {
|
||||
width: 40rpx;
|
||||
@@ -332,7 +363,8 @@ const navTo = (page) => {
|
||||
margin-right: 24rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
.share-icon, .help-icon {
|
||||
.share-icon,
|
||||
.help-icon {
|
||||
font-size: 36rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user