feat(招生在线): 实现教师列表接口对接及界面优化

This commit is contained in:
yangzhe 2025-12-05 16:53:52 +08:00
parent e87cadb2f2
commit 4c882e34fb
3 changed files with 57 additions and 63 deletions

View File

@ -303,6 +303,7 @@ export default {
},
//
handleWsClose(e) {
console.log(`[WebSocket] 连接关闭: code=${e.code}, reason=${e.reason}`);
this.lockReconnect = false;
this.reconnect();
},
@ -330,7 +331,7 @@ export default {
},
mounted() {
// 使 oa-web-phone WebSocket
this.startLink();
// this.startLink();
},
};
</script>

View File

@ -214,6 +214,11 @@ const install = (Vue, vm) => {
let UpdateUserApi = (params = {}) =>
vm.$u.post("api/BasicDataMaintenance/UpdateUser", params);
/** 会话 */
// 获取教师列表(学生端-招办在线)
let GetTeacherListApi = (params = {}) =>
vm.$u.get("api/Dialogue/GetTeacherList", params);
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
vm.$u.api = {
UploadSingleImage,
@ -272,6 +277,7 @@ const install = (Vue, vm) => {
TeacherLoginByCode,
GetUserApi,
UpdateUserApi,
GetTeacherListApi,
};
};

View File

@ -20,20 +20,23 @@
<!-- 教师列表 -->
<view
class="teacher-item"
v-for="(teacher, index) in currentList"
v-for="(teacher, index) in teacherList"
:key="index"
>
<image class="teacher-avatar" :src="teacher.avatar"></image>
<image
class="teacher-avatar"
src="/static/common/images/avatar.png"
></image>
<view class="teacher-info">
<view class="teacher-detail">
<view class="teacher-name">
<text>{{ teacher.name }}</text>
<view v-if="teacher.online" class="online-status">
<view v-if="teacher.presence" class="online-status">
<view class="online-dot"></view>
<text>在线</text>
</view>
</view>
<view class="teacher-department">{{ teacher.department }}</view>
<view class="teacher-department">{{ teacher.collegeName }}</view>
</view>
<view class="ask-button" @click="handleAskQuestion(teacher)">
立即提问
@ -44,31 +47,32 @@
</view>
<!-- 留言弹出层 -->
<leave-message
<!-- <leave-message
:show.sync="showLeaveMessage"
:teacher="currentTeacher"
@submit="handleMessageSubmit"
/>
/> -->
</view>
</template>
<script>
import HeaderBar from "@/components/HeaderBar.vue"; //
import LeaveMessage from "@/components/LeaveMessage.vue";
// import LeaveMessage from "@/components/LeaveMessage.vue";
export default {
components: {
HeaderBar, //
LeaveMessage,
// LeaveMessage,
},
data() {
return {
activeTab: "1", // tab
// showLeaveMessage: false,
// currentTeacher: null,
activeTab: 0, // tab
tabList: [
{ id: "1", name: "招生在线", key: "admissions" },
{ id: "2", name: "迎新在线", key: "welcome" },
{ id: 0, name: "招生在线" },
{ id: 1, name: "迎新在线" },
],
showLeaveMessage: false,
teacherList: [
{
id: 1,
@ -84,71 +88,37 @@ export default {
avatar: "/static/common/images/student.png",
online: false,
},
{
id: 3,
name: "招办赵老师",
department: "财政学院/会计专业",
avatar: "/static/common/images/student.png",
online: true,
},
{
id: 4,
name: "招办王老师",
department: "电子信息学院",
avatar: "/static/common/images/student.png",
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,
};
},
computed: {
currentList() {
return this.activeTab === "1" ? this.teacherList : this.welcomeList;
},
computed: {},
created() {
this.getTeacherList();
},
methods: {
switchTab(tab) {
this.activeTab = tab;
switchTab(id) {
this.activeTab = id;
this.getTeacherList();
},
handleLeftClick() {
uni.navigateBack();
},
handleAskQuestion(teacher) {
//
uni.navigateTo({
url: `/pages/home/teacherInfo/index?teacherId=${teacher.id}`,
});
return;
//
if (!teacher.online) {
//
this.currentTeacher = teacher;
this.showLeaveMessage = true;
} else {
//
uni.navigateTo({
url: `/pages/home/teacherInfo/index?teacherId=${teacher.id}`,
});
}
},
// ()
handleMessageSubmit(data) {
console.log("提交留言:", data.content, "教师:", data.teacher?.name);
@ -164,6 +134,22 @@ export default {
//
}
},
// ()
getTeacherList() {
this.$u.api
.GetTeacherListApi({
"Item1.ConsultationType": this.activeTab,
PageIndex: 1,
PageSize: 10,
})
.then((res) => {
if (res.succeed) {
this.teacherList = res.data.item1 || [];
}
})
.finally(() => {});
},
},
};
</script>
@ -257,7 +243,8 @@ export default {
}
.teacher-info {
padding: 30rpx 0;
// padding: 30rpx 0;
height: 150rpx;
flex: 1;
flex-shrink: 0;
display: flex;
@ -289,7 +276,7 @@ export default {
text {
font-size: 24rpx;
color: #4cd964;
color: #999999;
font-weight: normal;
}
}