diff --git a/src/assets/css/community/community.css b/src/assets/css/community/community.css index 96cd3f10..9cb0a82d 100644 --- a/src/assets/css/community/community.css +++ b/src/assets/css/community/community.css @@ -1,17 +1,35 @@ +/* 设置进入和离开的过渡效果 */ -/* 离开动画 */ .post-list .fade-leave-active { transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out; } -.post-list .fade-leave-to /* 离开完成后状态 */ -{ +.post-list .fade-enter-active { + transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out; +} + +/* 元素进入时,缩放并渐变 */ +.post-list .fade-leave-to /* .fade-leave-active in Vue 2.x */ { opacity: 0; - transform: translateX(100%) scale(0.5); /* 离开时从右边滑出并缩小 */ + transform: scale(0.5); /* 初始状态为缩小 */ +} +.post-list .fade-enter{ + opacity: 0; + transform: scale(0.5); /* 初始状态为缩小 */ } +/* 元素进入时恢复到原尺寸 */ +.post-list .fade-enter-to { + opacity: 1; + transform: scale(1); /* 变大恢复正常尺寸 */ +} +/* 元素离开时,继续保持缩小状态 */ +.post-list .fade-leave-to { + opacity: 0; + transform: scale(0.5); /* 离开时缩小 */ +} diff --git a/src/utils/axiosConfig.js b/src/utils/axiosConfig.js index 2c6c12e0..df07b0c2 100644 --- a/src/utils/axiosConfig.js +++ b/src/utils/axiosConfig.js @@ -4,9 +4,8 @@ import {getToken} from '@/token/auth' // 注意这里使用了解构赋值来导 // 创建axios实例 const service = axios.create({ - // baseURL: 'http://47.122.59.26:8080/api', - // baseURL: 'http://10.205.10.22:8081/loveforest/api/', - // baseURL: 'http://10.133.13.52:8082/loveforest', + // 去vue.config.js文件改baseurl!! + baseURL: '/api', // 注意!! 这里全局统一加上了 '/api' 前缀,但是vue.config.js文件在发送请求时去掉了/api,所以页面的请求接口若有/api还是要携带/api timeout: 5000, // 请求超时时间 }); diff --git a/src/views/chat/chat.vue b/src/views/chat/chat.vue index 8e8e8fae..028a73a9 100644 --- a/src/views/chat/chat.vue +++ b/src/views/chat/chat.vue @@ -176,6 +176,7 @@ export default { this.showSearchList = this.friendsInfoList this.get_friendsInfoList() + this.long_poll_serve() }, components:{ HonneyBtn, @@ -184,6 +185,42 @@ export default { ChatList }, methods:{ + async long_poll_serve(){ + try{ + const UserId = getUserId() + const token = 'Bearer '+getToken() + const response = await axios.get(`messages/poll/${UserId}`,{ + headers:{Authorization : token} + }) + if(response.data == '') + { + this.long_poll_serve() + }else{ + const senderId = response.data[response.data.length-1].senderId + console.log(senderId) + for(let i = 0;i -
avatar @@ -16,31 +15,11 @@
- - - {{ timestamp }}
-
- - -
- - -
-
-
- - - -
家族故事 @@ -72,8 +51,7 @@
-

{{ comment.userid}}: {{ comment.content }}

+

{{ comment.userid}}: {{ comment.content }}

@@ -85,7 +63,7 @@