diff --git a/common/http.api.js b/common/http.api.js index 0e468d4..73f5f29 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -41,11 +41,11 @@ const install = (Vue, vm) => { let updateTeacherInfo = (params = {}) => vm.$u.post("api/BasicDataMaintenance/UpdateTeacher", params); - let getData = (params = {}) => - vm.$u.get("api/BasicDataMaintenance/GetData", params); - // 获取排班数据 - let getShiftSchedulingData = (params = {}) => - vm.$u.get("api/BasicDataMaintenance/GetShiftSchedulingData", params); + let getData = (params = {}) => + vm.$u.get("api/BasicDataMaintenance/GetData", params); + // 获取排班数据 + let getShiftSchedulingData = (params = {}) => + vm.$u.get("api/BasicDataMaintenance/GetShiftSchedulingData", params); // 登录 let LoginApp = (params = {}) => vm.$u.post("api/Token/LoginApp", params); @@ -251,14 +251,17 @@ const install = (Vue, vm) => { // 转人工服务 let TransferToALiveAgentApi = (params = {}) => vm.$u.post("api/Dialogue/TransferToALiveAgent", params); + // 结束人工服务 + let EndLiveAgentApi = (params = {}) => + vm.$u.post("api/Dialogue/EndLiveAgent", params); // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 - vm.$u.api = { - UploadSingleImage, - getTeacherInfo, - getData, - getShiftSchedulingData, - updateTeacherInfo, + vm.$u.api = { + UploadSingleImage, + getTeacherInfo, + getData, + getShiftSchedulingData, + updateTeacherInfo, LoginApp, RegisterUser, saveUserInfo, @@ -322,6 +325,7 @@ const install = (Vue, vm) => { ReadMessageApi, DeleteDialogueApi, TransferToALiveAgentApi, + EndLiveAgentApi, }; }; diff --git a/components/AdvicePhone.vue b/components/AdvicePhone.vue index bf6091b..c82b17f 100644 --- a/components/AdvicePhone.vue +++ b/components/AdvicePhone.vue @@ -10,11 +10,31 @@ > 招生电话 - 0790-6764666/6765666 + + + + + + + + 0790-6764666 + 拨打招生电话1 + + + + + + + + + 0790-6765666 + 拨打招生电话2 + + + + - 取消 + 取消 @@ -48,6 +68,11 @@ export default { }, }, methods: { + makeCall(phoneNumber) { + uni.makePhoneCall({ + phoneNumber, + }); + }, closePopup() { this.showPopup = false; this.$emit("update:show", false); @@ -66,7 +91,6 @@ export default { background-size: 630rpx 100rpx; background-position: -20rpx 0; - .phone-title { text-align: center; font-family: DouyinSans; @@ -76,19 +100,72 @@ export default { margin-bottom: 40rpx; } - .phone-content { - margin-bottom: 120rpx; - text-align: center; - font-family: PingFang SC; - font-size: 32rpx; - color: #333333; + .phone-card-list { + padding: 0 48rpx; + margin-bottom: 60rpx; + + .phone-card { + display: flex; + align-items: center; + padding: 30rpx 40rpx; + margin-bottom: 24rpx; + background: #ffffff; + border: 1px solid #f0f0f0; + box-shadow: 0px 4rpx 12rpx rgba(0, 0, 0, 0.05); + border-radius: 16rpx; + + &:last-child { + margin-bottom: 0; + } + + .icon-wrapper { + width: 80rpx; + height: 80rpx; + background: #5ac799; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + margin-right: 30rpx; + flex-shrink: 0; + } + + .info-wrapper { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + flex: 1; + + .phone-number { + font-size: 36rpx; + font-weight: bold; + color: #333333; + letter-spacing: 2rpx; + margin-bottom: 10rpx; + } + + .phone-desc { + font-size: 24rpx; + color: #999999; + } + } + } } .phone-button { - padding: 0 40rpx; + padding: 0 48rpx; - .cancel-button { + .cancel-btn { + width: 100%; + height: 88rpx; + line-height: 88rpx; + text-align: center; + background: #ffffff; + border: 1px solid #e5e5e5; border-radius: 16rpx; + font-size: 32rpx; + color: #333333; } } } diff --git a/pages/home/index/index.vue b/pages/home/index/index.vue index b3acb39..fc71d7c 100644 --- a/pages/home/index/index.vue +++ b/pages/home/index/index.vue @@ -2,9 +2,24 @@ + > + + + + @@ -61,10 +76,16 @@ :style="{ background: item.background, }" - @click="handleFeatureClick(item)" > - {{ item.title }} + + {{ item.title }} + {{ item.tip }} + + + 去咨询 + + @@ -318,7 +339,7 @@ @@ -424,16 +445,17 @@ export default { "我什么时候能推知道自己是否被录取?", ], features: [ - { - title: "在线咨询", - icon: "/static/common/images/icon_admissions.png", - path: "/pages/home/admissions/index", - background: "linear-gradient(0deg, #F4FBFE 0%, #F4FBFE 100%)", - }, + // { + // title: "在线咨询", + // icon: "/static/common/images/icon_admissions.png", + // path: "/pages/home/admissions/index", + // background: "linear-gradient(0deg, #F4FBFE 0%, #F4FBFE 100%)", + // }, { title: "电话咨询", - icon: "/static/common/images/icon_phone.png", - background: "linear-gradient(0deg, #F4FBF9 0%, #F4FBF9 100%)", + tip: "欢迎致电本校招生咨询热线", + icon: "/static/common/images/icon-phone1.png", + background: "#fff", }, ], floatingTabs: [ @@ -441,11 +463,11 @@ export default { title: "首页", icon: "/static/common/images/icon_home.png", }, - { - title: "招生在线", - icon: "/static/common/images/icon_admissions2.png", - path: "/pages/home/admissions/index", - }, + // { + // title: "招生在线", + // icon: "/static/common/images/icon_admissions2.png", + // path: "/pages/home/admissions/index", + // }, { title: "转人工", icon: "/static/common/images/icon_conversation.png", @@ -518,6 +540,10 @@ export default { }, displayFeatures() { const list = Array.isArray(this.features) ? this.features : []; + return list; + }, + displayFloatingTabs() { + const list = Array.isArray(this.floatingTabs) ? this.floatingTabs : []; return list.map((item) => { if (item && item.title === "转人工") { return { @@ -578,6 +604,18 @@ export default { this.handlePopupShow(); }, + // 处理设置点击 + handleSettingClick() { + uni.navigateTo({ + url: "/pages/home/userSetting/index", + }); + }, + + // 处理记录点击 + // handleRecordClick() { + // console.log("点击了记录"); + // }, + // 重置对话状态 resetChatState({ conversationId = "", @@ -660,38 +698,44 @@ export default { extraOffset: 200, }); }, + + // 处理功能点击 handleFeatureClick(item) { - if (item.title === "首页") { - this.resetChatState({ isChat: false }); - return; - } - if (item.title === "转人工") { - this.handleTransferEntryClick(); - return; - } - if (item.title === "结束会话") { - this.$store.commit("set_IsTransferChat", false); - return; - } + const actions = { + "首页": () => this.resetChatState({ isChat: false }), + "转人工": () => this.handleTransferEntryClick(), + "结束会话": () => this.handleEndConversation(), + "电话咨询": () => { this.advicePhoneShow = true; } + }; - if (item.title === "电话咨询") { - this.advicePhoneShow = true; - return; + const action = actions[item.title]; + if (action) { + action(); } else if (item.path) { - uni.navigateTo({ - url: item.path, - }); - return; + uni.navigateTo({ url: item.path }); } else { - this.$refs.uToast.show({ - title: "暂未开放", - type: "warning", - }); - - return; + this.$refs.uToast.show({ title: "暂未开放", type: "warning" }); } }, + // 独立出结束会话逻辑 + handleEndConversation() { + this.$u.api + .EndLiveAgentApi({ + dialogueManagementId: this.vuex_msgUser?.dialogueManagementId, + teacherManagementId: this.vuex_msgUser?.receiverId, + }) + .then((res) => { + if (res.succeed) { + this.$store.commit("set_IsTransferChat", false); + this.$u.toast("会话已结束"); + } else { + this.$u.toast(res.error || "会话结束失败"); + } + }); + }, + + // 创建本地用户文本消息 createLocalUserTextMessage(messageText) { return { id: Math.random().toString(36).substring(2, 15), @@ -706,6 +750,7 @@ export default { }; }, + // 创建转人工卡片消息 createTransferCardMessage() { return { id: "transfer_" + Math.random().toString(36).substring(2, 15), @@ -724,6 +769,7 @@ export default { }; }, + // 处理转人工点击 handleTransferEntryClick() { if (!this.isChat) { this.resetChatState(); @@ -809,22 +855,14 @@ export default { return; } + // dialogueManagementId 结束转人工用 const dialogueManagementId = - this.currentDMid || - (res && - res.data && - (res.data.dialogueManagementId || - res.data.DialogueManagementId)) || - ""; - const receiverId = - (res && - res.data && - (res.data.receiverId || - res.data.ReceiverId || - res.data.liveAgentId || - res.data.agentId || - res.data.userId)) || - ""; + (res && res.data && res.data.dialogueManagementId) || ""; + // receiverId 接线老师 + const receiverId = (res && res.data && res.data.receiverId) || ""; + + console.log(dialogueManagementId, "dialogueManagementId"); + console.log(receiverId, "receiverId"); if (!this.currentDMid && dialogueManagementId) { this.currentDMid = dialogueManagementId; @@ -837,12 +875,17 @@ export default { if (dialogueManagementId && receiverId) { this.$store.commit("set_IsTransferChat", true); + this.$store.commit("update_MsgUser", { + dialogueManagementId, + receiverId, + }); this.$store.dispatch("selectTeacherChatItem", { id: dialogueManagementId, receiverId, navigate: false, }); } + console.log(this.vuex_msgUser, "vuex_msgUser"); }) .catch(() => { updateTransferCard({ @@ -967,10 +1010,11 @@ export default { }, // 点击热门问题 - handleQAClick(item) { + async handleQAClick(item) { // 如果不在对话模式,切换到对话模式并初始化 if (!this.isChat) { - this.resetChatState(); + // this.resetChatState(); + await this.handleStartChat(); // 切换到对话模式并初始化,加载历史数据 } const sendMessage = item.content; @@ -1122,11 +1166,11 @@ export default { // 刷新当前对话的消息详情 handleGetConversationDetail() { - if (!this.currentDMid) return; + // if (!this.currentDMid) return; - this.$u.api + return this.$u.api .GetConversationDetail({ - "Item1.Id": this.currentDMid, + // "Item1.Id": "08de2e31-4cdf-4b0c-8b83-d3185f604a5a", PageIndex: this.pageQuery.PageIndex, PageSize: this.pageQuery.PageSize, }) @@ -1147,14 +1191,14 @@ export default { // 刷新当前页数据;若当前页为空且页码>1,则自动回退上一页 refreshPageWithFallback() { - if (!this.currentDMid) return; + // if (!this.currentDMid) return; const currentIndex = this.pageQuery.PageIndex || 1; const pageSize = this.pageQuery.PageSize; return this.$u.api .GetConversationDetail({ - "Item1.Id": this.currentDMid, + // "Item1.Id": this.currentDMid, PageIndex: currentIndex, PageSize: pageSize, }) @@ -1164,7 +1208,7 @@ export default { const prevIndex = currentIndex - 1; return this.$u.api .GetConversationDetail({ - "Item1.Id": this.currentDMid, + // "Item1.Id": this.currentDMid, PageIndex: prevIndex, PageSize: pageSize, }) @@ -1195,6 +1239,9 @@ export default { // 开始新对话 handleStartChat() { this.resetChatState(); + + // 获取历史对话 + return this.handleGetConversationDetail(); }, // 滚动到底部事件处理 @@ -1221,7 +1268,7 @@ export default { this.pageQuery.PageIndex++; this.$u.api .GetConversationDetail({ - "Item1.Id": this.currentDMid, + // "Item1.Id": this.currentDMid, PageIndex: this.pageQuery.PageIndex, PageSize: this.pageQuery.PageSize, }) @@ -1328,6 +1375,11 @@ export default { /* Header样式移至HeaderBar组件 */ + .header-icon { + width: 40rpx; + height: 40rpx; + } + .main-content { padding: 30rpx; padding-top: 60rpx; @@ -1466,29 +1518,59 @@ export default { border-radius: 16rpx; padding: 30rpx; display: flex; + flex-direction: column; justify-content: space-between; margin-top: 32rpx; gap: 30rpx; .feature-item { - height: 150rpx; + height: 140rpx; border-radius: 16rpx; display: flex; justify-content: flex-start; align-items: center; - padding-left: 30rpx; - gap: 20rpx; + // padding-left: 30rpx; + gap: 30rpx; flex: 1; .feature-icon { width: 80rpx; height: 80rpx; - margin-top: 16rpx; } - .feature-text { - font-size: 26rpx; - color: #333333; + .feature-text-wrapper { + display: flex; + flex-direction: column; + justify-content: space-between; + gap: 12rpx; + flex: 1; + .feature-title { + font-size: 28rpx; + color: #333333; + font-weight: bold; + } + .feature-tip { + font-size: 24rpx; + color: #999; + } + } + + .feature-action-btn { + display: flex; + align-items: center; + justify-content: center; + padding: 14rpx 20rpx 14rpx 24rpx; + gap: 10rpx; + // height: 56rpx; + background: linear-gradient(-33deg, #6079ff 0%, #418ded 100%); + box-shadow: 0px 4rpx 16rpx 0rpx rgba(62, 106, 255, 0.6); + border-radius: 28rpx; + + text { + font-size: 24rpx; + color: #ffffff; + margin-right: 4rpx; + } } } } diff --git a/pages/home/messageBoard/index.vue b/pages/home/messageBoard/index.vue index 8820a9b..2afb120 100644 --- a/pages/home/messageBoard/index.vue +++ b/pages/home/messageBoard/index.vue @@ -1,4 +1,5 @@