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

View File

@ -214,6 +214,11 @@ const install = (Vue, vm) => {
let UpdateUserApi = (params = {}) => let UpdateUserApi = (params = {}) =>
vm.$u.post("api/BasicDataMaintenance/UpdateUser", 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(因为vm就是this也即this.$u.api)下
vm.$u.api = { vm.$u.api = {
UploadSingleImage, UploadSingleImage,
@ -272,6 +277,7 @@ const install = (Vue, vm) => {
TeacherLoginByCode, TeacherLoginByCode,
GetUserApi, GetUserApi,
UpdateUserApi, UpdateUserApi,
GetTeacherListApi,
}; };
}; };

View File

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