feat(咨询页面): 添加咨询页面tab切换功能并优化首页布局

This commit is contained in:
yangzhe 2025-10-28 11:49:44 +08:00
parent 32005433fc
commit 9327eb673a
7 changed files with 134 additions and 53 deletions

View File

@ -8,16 +8,29 @@
@click="handleLeftClick" @click="handleLeftClick"
></u-icon> ></u-icon>
</div> </div>
<text class="header-title">招办在线</text> <text class="header-title">在线咨询</text>
<div></div> <div></div>
</view> </view>
<view class="admissions-content"> <view class="admissions-content">
<!-- 自定义tab -->
<view class="custom-tab">
<view
v-for="tab in tabList"
:key="tab.id"
:class="['tab-item', { active: activeTab === tab.id }]"
@click="switchTab(tab.id)"
>
<text class="tab-text">{{ tab.name }}</text>
<view class="tab-underline" v-if="activeTab === tab.id"></view>
</view>
</view>
<view class="teacher-list"> <view class="teacher-list">
<!-- 教师列表 --> <!-- 教师列表 -->
<view <view
class="teacher-item" class="teacher-item"
v-for="(teacher, index) in teacherList" v-for="(teacher, index) in currentList"
:key="index" :key="index"
> >
<image class="teacher-avatar" :src="teacher.avatar"></image> <image class="teacher-avatar" :src="teacher.avatar"></image>
@ -32,9 +45,9 @@
</view> </view>
<view class="teacher-department">{{ teacher.department }}</view> <view class="teacher-department">{{ teacher.department }}</view>
</view> </view>
<view class="ask-button" @click="handleAskQuestion(teacher)">{{ <view class="ask-button" @click="handleAskQuestion(teacher)">
teacher.online ? "立即提问" : "留言" 立即提问
}}</view> </view>
</view> </view>
</view> </view>
</view> </view>
@ -58,6 +71,11 @@ export default {
}, },
data() { data() {
return { return {
activeTab: "1", // tab
tabList: [
{ id: "1", name: "招生在线", key: "admissions" },
{ id: "2", name: "迎新在线", key: "welcome" },
],
showLeaveMessage: false, showLeaveMessage: false,
teacherList: [ teacherList: [
{ {
@ -89,10 +107,41 @@ export default {
online: false, online: false,
}, },
], ],
welcomeList: [
{
id: 5,
name: "李老师",
department: "学生处",
avatar: "/static/common/images/avatar.png",
online: true,
},
{
id: 6,
name: "张老师",
department: "宿管中心",
avatar: "/static/common/images/student.png",
online: true,
},
{
id: 7,
name: "迎新办陈老师",
department: "后勤服务中心",
avatar: "/static/common/images/student.png",
online: false,
},
],
currentTeacher: null, currentTeacher: null,
}; };
}, },
computed: {
currentList() {
return this.activeTab === "1" ? this.teacherList : this.welcomeList;
},
},
methods: { methods: {
switchTab(tab) {
this.activeTab = tab;
},
handleLeftClick() { handleLeftClick() {
uni.navigateBack(); uni.navigateBack();
}, },
@ -159,6 +208,44 @@ export default {
} }
.admissions-content { .admissions-content {
.custom-tab {
padding: 0 30rpx;
margin: 24rpx 0;
display: flex;
align-items: center;
.tab-item {
position: relative;
padding: 12rpx 0;
margin-right: 60rpx;
cursor: pointer;
.tab-text {
font-size: 32rpx;
font-weight: 500;
color: #505866;
letter-spacing: 0.04rpx;
}
&.active .tab-text {
color: #4f6aff;
font-weight: 600;
}
.tab-underline {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
right: 0;
width: 80rpx;
height: 4rpx;
background-color: #4f6aff;
border-radius: 2rpx;
}
}
}
.teacher-list { .teacher-list {
.teacher-item { .teacher-item {
display: flex; display: flex;

View File

@ -19,7 +19,7 @@
> >
</view> </view>
<!-- <view class="qa-section"> <view class="qa-section">
<view class="qa-header"> <view class="qa-header">
<text class="qa-title">大家都在问</text> <text class="qa-title">大家都在问</text>
<view class="more-link"> <view class="more-link">
@ -37,16 +37,6 @@
</view> </view>
</view> </view>
<button class="chat-button" @click="isChat = true">
<image
class="chat-icon"
src="/static/common/images/icon_chat.png"
></image>
<text class="chat-text">开启对话</text>
</button>
</view> -->
<view class="start-chat">
<button class="chat-button" @click="handleStartChat"> <button class="chat-button" @click="handleStartChat">
<image <image
class="chat-icon" class="chat-icon"
@ -61,6 +51,9 @@
class="feature-item" class="feature-item"
v-for="(item, index) in features" v-for="(item, index) in features"
:key="index" :key="index"
:style="{
background: item.background,
}"
@click="handleFeatureClick(item)" @click="handleFeatureClick(item)"
> >
<image :src="item.icon" class="feature-icon"></image> <image :src="item.icon" class="feature-icon"></image>
@ -294,18 +287,20 @@ export default {
], ],
features: [ features: [
{ {
title: "招办在线", title: "在线咨询",
icon: "/static/common/images/icon_admissions.png", icon: "/static/common/images/icon_admissions.png",
path: "/pages/home/admissions/index", path: "/pages/home/admissions/index",
background: "linear-gradient(0deg, #F4FBFE 0%, #F4FBFE 100%)",
}, },
{ // {
title: "留言板", // title: "",
icon: "/static/common/images/icon_messageBoard.png", // icon: "/static/common/images/icon_messageBoard.png",
path: "/pages/home/messageBoard/index", // path: "/pages/home/messageBoard/index",
}, // },
{ {
title: "电话咨询", title: "电话咨询",
icon: "/static/common/images/icon_phone.png", icon: "/static/common/images/icon_phone.png",
background: "linear-gradient(0deg, #F4FBF9 0%, #F4FBF9 100%)",
}, },
], ],
popupShow: false, popupShow: false,
@ -771,7 +766,7 @@ export default {
.main-content { .main-content {
padding: 30rpx; padding: 30rpx;
padding-top: 100rpx; padding-top: 60rpx;
.welcome-message { .welcome-message {
// display: inline-block; // display: inline-block;
@ -784,8 +779,8 @@ export default {
.avatar { .avatar {
display: inline-block; display: inline-block;
width: 42rpx; width: 50rpx;
height: 34rpx; height: 44rpx;
margin-right: 12rpx; margin-right: 12rpx;
} }
@ -894,20 +889,19 @@ export default {
gap: 30rpx; gap: 30rpx;
.feature-item { .feature-item {
height: 210rpx; height: 150rpx;
border-radius: 16rpx; border-radius: 16rpx;
background-color: #fafafc;
display: flex; display: flex;
flex-direction: column; justify-content: flex-start;
align-items: center; align-items: center;
justify-content: center; padding-left: 30rpx;
// gap: 20rpx; gap: 20rpx;
flex: 1; flex: 1;
.feature-icon { .feature-icon {
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;
margin-bottom: 12rpx; margin-top: 16rpx;
} }
.feature-text { .feature-text {

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 22 KiB