<template>
|
<view class="page">
|
<view class="profile-section" :style="backgroundStyle">
|
<up-sticky bgColor="#000">
|
<view class="top-bar">
|
<up-icon name="list" size="60rpx" color="#D0E1E9" @click="onSettingClick" />
|
<view class="top-bar-right">
|
<up-icon name="share" size="60rpx" color="#D0E1E9" />
|
</view>
|
</view>
|
</up-sticky>
|
<view class="profile-content">
|
<view class="profile-header">
|
<view class="avatar-container">
|
<image v-if="userStore?.userInfo?.customerDTO?.cover" class="avatar"
|
:src="userStore?.userInfo?.customerDTO?.cover" mode="aspectFill" />
|
<image v-else class="avatar"
|
src="https://ai-public.mastergo.com/ai/img_res/e8ae645c666c247b895b488e60b048f5.jpg" mode="aspectFill" />
|
<view class="add-icon">
|
<up-icon name="plus" size="20rpx" color="#333" />
|
</view>
|
</view>
|
<view class="user-info">
|
<view class="username">影途 {{ userStore?.userInfo?.customerDTO?.name }}</view>
|
<view class="user-id">影途号:{{ userStore?.userInfo?.customerDTO?.id }}</view>
|
<view class="location">IP 属地:{{ userStore.address?.ad_info?.province }}</view>
|
</view>
|
</view>
|
|
<view class="edit-profile" >点击这里,填写简介</view>
|
|
<view class="stats">
|
<view class="stat-row">
|
<view class="stat-item">
|
<text class="number">0</text>
|
<text class="label">关注</text>
|
</view>
|
<view class="stat-item">
|
<text class="number">0</text>
|
<text class="label">粉丝</text>
|
</view>
|
<view class="stat-item">
|
<text class="number">1</text>
|
<text class="label">获赞与收藏</text>
|
</view>
|
</view>
|
<view class="action-buttons">
|
<up-button text="编辑资料" size="mini" type="info" plain hairline @click="navigateTo('/sub-pages/mine/profile-edit')"
|
:custom-style="{ backgroundColor: 'transparent', borderColor: '#B1ABA9' }" />
|
<up-icon name="setting" size="40rpx" @click="navigateTo('/sub-pages/mine/settings')" />
|
</view>
|
</view>
|
</view>
|
|
<scroll-view class="function-cards" scroll-x show-scrollbar="false">
|
<view class="card" v-for="item in cardList" :key="item.title">
|
<view class="card-content">
|
<text class="card-title">{{ item.title }}</text>
|
<text class="card-subtitle">{{ item.subtitle }}</text>
|
</view>
|
</view>
|
</scroll-view>
|
</view>
|
|
<view class="tab-section">
|
<up-sticky bgColor="#fff">
|
<up-tabs :list="tabList" :current="current" @change="onTabChange" lineColor="#2979ff"
|
activeStyle="color: #2979ff" />
|
</up-sticky>
|
|
<swiper class="swiper-box" :current="current" @change="onSwiperChange" duration="300">
|
<swiper-item v-for="(item, index) in tabList" :key="index">
|
<view class="empty-state">
|
<image class="empty-icon"
|
src="https://ai-public.mastergo.com/ai/img_res/fc3cb775274ef0f5e58ac01687a9c121.jpg" mode="aspectFit" />
|
<text class="empty-text">快去发布你的笔记吧</text>
|
<up-button class="publish-btn" size="mini" type="warning" shape="circle">去发布</up-button>
|
</view>
|
</swiper-item>
|
</swiper>
|
</view>
|
|
<common-footer flg="0" />
|
<setting-popup v-model="settingShow" />
|
</view>
|
</template>
|
|
<script setup lang="ts">
|
import { ref, computed, watch } from 'vue';
|
import { onShow } from '@dcloudio/uni-app'
|
import SettingPopup from '@/components/setting/setting-popup.vue';
|
import { usePlatformLoginType } from '@/composables/usePlatformLoginType'
|
import { useUserStore } from '@/store/user'
|
import { useLocation } from '@/composables/useLocation'
|
import { useNavigator } from '@/composables/useNavigator'
|
|
const { apitype } = usePlatformLoginType()
|
const userStore = useUserStore()
|
const { navigateTo } = useNavigator()
|
const {getLocation,province } = useLocation()
|
|
|
watch(
|
() => userStore.userInfo, // 监听 userInfo 这个响应式属性
|
(newVal, oldVal) => {
|
console.log('userInfo 发生变化:', newVal)
|
},
|
{ deep: true } // 如果 userInfo 是对象,需要深度监听其属性变化
|
)
|
|
onShow(() => {
|
getLocation()
|
});
|
|
|
// 当前 tab 索引
|
const current = ref(0);
|
|
// 背景图
|
const backgroundUrl = ref('');
|
|
// 控制设置弹窗显示
|
const settingShow = ref(false);
|
|
// tab 列表
|
const tabList = ref([
|
{ name: '笔记' },
|
{ name: '收藏' },
|
{ name: '赞过' },
|
]);
|
|
// 横向滑动卡片
|
const cardList = ref([
|
{ title: '购物车', subtitle: '查看推荐好物' },
|
{ title: '创作灵感', subtitle: '学创作找灵感' },
|
{ title: '浏览记录', subtitle: '看过的笔记' },
|
{ title: '浏览记录', subtitle: '看过的笔记' },
|
]);
|
|
// 背景样式
|
const backgroundStyle = computed(() => {
|
return backgroundUrl.value
|
? `background: url(${backgroundUrl.value}) center center / cover no-repeat;`
|
: 'background-color: #1e1e1e;';
|
});
|
|
// 方法定义
|
const onSettingClick= ()=> {
|
settingShow.value = true;
|
}
|
|
const onTabChange=(item: { index: number })=> {
|
current.value = item.index;
|
}
|
|
const onSwiperChange=(e: any) => {
|
current.value = e.detail.current;
|
}
|
|
|
const goToProfile= ()=> {
|
navigateTo('/sub-pages/mine/edit-profile');
|
}
|
</script>
|
|
|
<style>
|
.page {
|
height: 100vh;
|
overflow-y: auto;
|
}
|
|
.top-bar {
|
position: relative;
|
z-index: 3;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
padding: 24rpx 32rpx;
|
}
|
|
.top-bar-right {
|
display: flex;
|
align-items: center;
|
}
|
|
.icon-margin {
|
margin-right: 32rpx;
|
}
|
|
.profile-section {
|
position: relative;
|
/* height: 680rpx; */
|
}
|
|
.bg-image {
|
position: absolute;
|
width: 100%;
|
height: 100%;
|
z-index: 1;
|
}
|
|
.profile-content {
|
position: relative;
|
z-index: 2;
|
padding: 30rpx;
|
}
|
|
.profile-header {
|
display: flex;
|
align-items: flex-start;
|
margin-bottom: 24rpx;
|
}
|
|
.avatar-container {
|
position: relative;
|
margin-right: 24rpx;
|
}
|
|
.avatar {
|
width: 120rpx;
|
height: 120rpx;
|
border-radius: 60rpx;
|
border: 2px solid #ffffff;
|
}
|
|
.add-icon {
|
position: absolute;
|
right: -8rpx;
|
bottom: -8rpx;
|
width: 40rpx;
|
height: 40rpx;
|
background-color: #FFE411;
|
border-radius: 20rpx;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
|
.user-info {
|
flex: 1;
|
}
|
|
.username {
|
font-size: 30rpx;
|
color: #FCFFFE;
|
font-weight: bold;
|
margin-bottom: 8rpx;
|
}
|
|
.user-id,
|
.location {
|
font-size: 26rpx;
|
color: #666666;
|
margin-bottom: 4rpx;
|
}
|
|
.edit-profile {
|
color: #999999;
|
font-size: 26rpx;
|
margin-bottom: 20rpx;
|
}
|
|
.stats {
|
display: flex;
|
/* margin-bottom: 20rpx; */
|
align-items: center;
|
justify-content: space-between;
|
}
|
|
.stat-row {
|
display: flex;
|
}
|
|
.stat-item {
|
margin-right: 48rpx;
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
}
|
|
.stat-item:last-child {
|
margin-right: auto;
|
}
|
|
.number {
|
font-size: 30rpx;
|
color: #A19B99;
|
font-weight: bold;
|
margin-bottom: 4rpx;
|
}
|
|
.label {
|
font-size: 24rpx;
|
color: #B1ABA9;
|
}
|
|
.action-buttons {
|
display: flex;
|
gap: 16rpx;
|
}
|
|
.edit-btn {
|
padding: 0 24rpx !important;
|
background-color: #f5f5f5 !important;
|
color: #333333 !important;
|
border: none !important;
|
}
|
|
.settings-btn {
|
width: 80rpx !important;
|
background-color: #f5f5f5 !important;
|
color: #333333 !important;
|
border: none !important;
|
padding: 0 !important;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
|
.function-cards {
|
/* padding: 32rpx 0; */
|
white-space: nowrap;
|
overflow: auto;
|
padding-bottom: 20rpx;
|
}
|
|
.card {
|
display: inline-block;
|
width: 180rpx;
|
height: 80rpx;
|
margin-left: 20rpx;
|
background-color: rgba(60, 60, 60, 0.4);
|
/* 灰色 + 20% 透明度 */
|
border-radius: 16rpx;
|
padding: 10rpx;
|
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
|
}
|
|
.card:last-child {
|
margin-right: 24rpx;
|
}
|
|
.card-content {
|
height: 100%;
|
display: flex;
|
flex-direction: column;
|
justify-content: space-between;
|
}
|
|
.card-title {
|
font-size: 30rpx;
|
color: #E7E1DF;
|
font-weight: bold;
|
}
|
|
.card-subtitle {
|
font-size: 20rpx;
|
color: #BEBBB8;
|
}
|
|
.tab-section {
|
padding: 0 32rpx;
|
}
|
|
.tab-header {
|
display: flex;
|
justify-content: space-between;
|
margin-bottom: 48rpx;
|
}
|
|
.tab {
|
position: relative;
|
padding: 16rpx 0;
|
display: flex;
|
align-items: center;
|
}
|
|
.tab.active::after {
|
content: '';
|
position: absolute;
|
bottom: 0;
|
left: 50%;
|
transform: translateX(-50%);
|
width: 48rpx;
|
height: 4rpx;
|
background-color: #333;
|
border-radius: 2rpx;
|
}
|
|
.tab-text {
|
font-size: 16px;
|
color: #333;
|
margin-right: 8rpx;
|
}
|
|
.tab-count {
|
font-size: 16px;
|
color: #999;
|
}
|
|
.empty-state {
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
padding: 48rpx 0;
|
min-height: 600rpx;
|
}
|
|
.empty-icon {
|
width: 200rpx;
|
height: 200rpx;
|
margin-bottom: 24rpx;
|
}
|
|
.empty-text {
|
font-size: 14px;
|
color: #999;
|
/* margin-bottom: 24rpx; */
|
}
|
|
.publish-btn {
|
background-color: #ffe411 !important;
|
color: #333 !important;
|
border: none !important;
|
border-radius: 32rpx !important;
|
padding: 0 48rpx !important;
|
}
|
</style>
|
<style lang="scss" scoped>
|
.swiper-box {
|
// min-height: 600rpx;
|
/* 或 100vh,或具体 px */
|
min-height: 800px;
|
}
|
</style>
|