feat(招生在线): 实现教师列表接口对接及界面优化
This commit is contained in:
parent
e87cadb2f2
commit
4c882e34fb
3
App.vue
3
App.vue
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue