324 lines
6.9 KiB
Vue
324 lines
6.9 KiB
Vue
<template>
|
|
<view class="page-container">
|
|
<view class="page-header">
|
|
<PageHeader
|
|
title="我的"
|
|
:is-back="false"
|
|
:border-bottom="false"
|
|
:background="headerBackground"
|
|
/>
|
|
</view>
|
|
|
|
<scroll-view
|
|
class="page-main"
|
|
scroll-y
|
|
enable-back-to-top
|
|
>
|
|
<view class="main-content">
|
|
<div class="user-info">
|
|
<div class="avatar">
|
|
<image :src="teacherInfo.avatar" class="avatar-img"></image>
|
|
</div>
|
|
<div class="info">
|
|
<div class="name">{{ teacherInfo.name }}</div>
|
|
<div class="tag">
|
|
<image
|
|
class="tag-icon"
|
|
src="@/static/notes/collage-icon.png"
|
|
></image>
|
|
{{ teacherInfo.collegeName }}
|
|
</div>
|
|
<div class="tag">
|
|
<image class="tag-icon" src="@/static/notes/major-icon.png"></image>
|
|
{{ teacherInfo.professionalName }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="banner">
|
|
<img src="@/static/notes/banner.png" alt="banner" />
|
|
</div>
|
|
|
|
<div class="menu-list">
|
|
<div class="menu-item" @click="navigateTo('personal-info')">
|
|
<div class="menu-icon">
|
|
<image src="@/static/notes/menu1.png" class="menu-icon-img"></image>
|
|
</div>
|
|
<div class="menu-text">个人信息</div>
|
|
<view class="arrow-icon">
|
|
<u-icon name="arrow-right" color="#999" size="24"></u-icon>
|
|
</view>
|
|
</div>
|
|
<div class="menu-item" @click="navigateTo('change-password')">
|
|
<div class="menu-icon">
|
|
<image src="@/static/notes/menu2.png" class="menu-icon-img"></image>
|
|
</div>
|
|
<div class="menu-text">修改密码</div>
|
|
<view class="arrow-icon">
|
|
<u-icon name="arrow-right" color="#999" size="24"></u-icon>
|
|
</view>
|
|
</div>
|
|
<div class="menu-item" @click="navigateTo('logout-records')">
|
|
<div class="menu-icon">
|
|
<image src="@/static/notes/menu3.png" class="menu-icon-img"></image>
|
|
</div>
|
|
<div class="menu-text">退出登录</div>
|
|
<view class="arrow-icon">
|
|
<u-icon name="arrow-right" color="#999" size="24"></u-icon>
|
|
</view>
|
|
</div>
|
|
</div>
|
|
</view>
|
|
</scroll-view>
|
|
|
|
<view class="page-tabbar">
|
|
<TabBar :currentPath="'/pages/my/index'" @change="handleTabChange" />
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import TabBar from "@/components/TabBar-optimized.vue";
|
|
import PageHeader from "@/components/PageHeader.vue";
|
|
|
|
export default {
|
|
name: "MyPage",
|
|
components: {
|
|
TabBar,
|
|
PageHeader,
|
|
},
|
|
data() {
|
|
return {
|
|
headerBackground: {
|
|
background: "transparent",
|
|
},
|
|
teacherInfo: {
|
|
name:'孙老师',
|
|
collegeName:'生命科学与工程学院·生物工程专业',
|
|
professionalName:'生物工程专业',
|
|
avatar:'/static/common/images/avatar_default.jpg',
|
|
},
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.getTeacherInfo();
|
|
},
|
|
methods: {
|
|
navigateTo(route) {
|
|
// 导航到指定路由
|
|
if (route === 'personal-info') {
|
|
uni.navigateTo({
|
|
url: '/pages/my/personalInfo'
|
|
});
|
|
} else if (route === 'change-password') {
|
|
uni.showToast({
|
|
title: '功能开发中',
|
|
icon: 'none'
|
|
});
|
|
} else if (route === 'logout-records') {
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '确定要退出登录吗?',
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
// 清除用户信息
|
|
this.$u.vuex('vuex_teacherInfo', {});
|
|
this.$u.vuex('vuex_token', '');
|
|
// 跳转到登录页
|
|
uni.reLaunch({
|
|
url: '/pages/login/login/login'
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
},
|
|
handleTabChange(path, index) {
|
|
console.log("切换到标签页:", path, index);
|
|
},
|
|
getTeacherInfo() {
|
|
this.$u.api
|
|
.getTeacherInfo({ Id: "b5269ed1-5bc8-11f0-9a89-00163e2d2dd3" })
|
|
.then((res) => {
|
|
this.teacherInfo = res.data[0];
|
|
this.$u.vuex("vuex_teacherInfo", this.teacherInfo);
|
|
});
|
|
}
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
/* ===== 页面容器 - 主流三段式布局 ===== */
|
|
.page-container {
|
|
/* 固定定位,占满整个视口 */
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
|
|
/* Flex 布局 */
|
|
display: flex;
|
|
flex-direction: column;
|
|
|
|
/* 背景图片(保留特色) */
|
|
background-image: url("@/static/notes/bg.png");
|
|
background-position: center top;
|
|
background-repeat: no-repeat;
|
|
background-size: 100% auto;
|
|
|
|
/* 防止溢出 */
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* ===== 头部导航 ===== */
|
|
.page-header {
|
|
/* 不收缩,固定高度 */
|
|
flex-shrink: 0;
|
|
|
|
/* 层级 */
|
|
z-index: 100;
|
|
}
|
|
|
|
/* ===== 内容区域 ===== */
|
|
.page-main {
|
|
/* 占据剩余空间 */
|
|
flex: 1;
|
|
|
|
/* 重要:防止 flex 子元素溢出 */
|
|
height: 0;
|
|
|
|
/* 允许滚动 */
|
|
overflow-y: auto;
|
|
|
|
/* iOS 滚动优化 */
|
|
-webkit-overflow-scrolling: touch;
|
|
}
|
|
|
|
/* ===== 内容内层 ===== */
|
|
.main-content {
|
|
/* 底部留出 TabBar 空间 + 安全区域 */
|
|
padding-bottom: calc(50px + env(safe-area-inset-bottom));
|
|
|
|
/* 最小高度(确保可以滚动) */
|
|
min-height: 100%;
|
|
}
|
|
|
|
/* ===== 底部导航 ===== */
|
|
.page-tabbar {
|
|
/* 不收缩,固定高度 */
|
|
flex-shrink: 0;
|
|
|
|
/* 层级 */
|
|
z-index: 100;
|
|
}
|
|
|
|
.user-info {
|
|
display: flex;
|
|
padding: 30rpx;
|
|
}
|
|
|
|
.avatar {
|
|
width: 148rpx;
|
|
height: 148rpx;
|
|
border-radius: 16rpx;
|
|
overflow: hidden;
|
|
margin-right: 30rpx;
|
|
background-color: #ddd;
|
|
}
|
|
|
|
.avatar img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.info .name {
|
|
font-size: 16px;
|
|
font-weight: bold;
|
|
margin-bottom: 24rpx;
|
|
}
|
|
|
|
.tag-icon {
|
|
width: 20rpx;
|
|
height: 20rpx;
|
|
margin-right: 16rpx;
|
|
}
|
|
|
|
.tag {
|
|
font-size: 10px;
|
|
font-weight: 500;
|
|
color: #666;
|
|
margin-bottom: 26rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.stat-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
padding: 20rpx 0 26rpx 0;
|
|
}
|
|
|
|
.stat-num {
|
|
font-size: 20px;
|
|
font-weight: bold;
|
|
line-height: 40rpx;
|
|
color: #333;
|
|
}
|
|
|
|
.stat-label {
|
|
font-size: 10px;
|
|
color: #666;
|
|
margin-top: 16rpx;
|
|
}
|
|
|
|
.banner {
|
|
padding: 0 26rpx 0 26rpx;
|
|
}
|
|
|
|
.banner img {
|
|
width: 100%;
|
|
border-radius: 8px;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.menu-list {
|
|
background-color: #fff;
|
|
border-radius: 8px;
|
|
margin: 54rpx 30rpx 0 30rpx;
|
|
}
|
|
|
|
.menu-item {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 15px;
|
|
}
|
|
|
|
.menu-icon {
|
|
margin-right: 10px;
|
|
font-size: 20px;
|
|
}
|
|
|
|
.menu-text {
|
|
flex: 1;
|
|
font-size: 16px;
|
|
}
|
|
|
|
.arrow-icon {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 30px;
|
|
height: 30px;
|
|
}
|
|
|
|
.menu-icon-img {
|
|
width: 28rpx;
|
|
height: 28rpx;
|
|
}
|
|
</style>
|