feat: deaw share
This commit is contained in:
@@ -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",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -56,6 +56,14 @@
|
|||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false,
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/fortune/record",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "我的运势记录",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|||||||
@@ -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
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,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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user