From 604a8293ee71394aa139fb5f0b9b45a287e96b1f Mon Sep 17 00:00:00 2001
From: astar <2320390964@qq.com>
Date: Mon, 19 Apr 2021 18:04:12 +0800
Subject: [PATCH] style: improve
---
src/components/inputCell/index.scss | 1 +
src/request/index.js | 14 +++++++++++-
src/views/chat/index.vue | 35 ++++++++++++++++++++++++-----
src/views/sign/comps/index.scss | 7 ++++--
src/views/sign/comps/index.vue | 4 ++--
5 files changed, 51 insertions(+), 10 deletions(-)
diff --git a/src/components/inputCell/index.scss b/src/components/inputCell/index.scss
index 790c532..1a456f0 100644
--- a/src/components/inputCell/index.scss
+++ b/src/components/inputCell/index.scss
@@ -1,6 +1,7 @@
.input-cell {
position: relative;
display: flex;
+ align-items: flex-end;
border-bottom: 1px solid #999;
width: 100%;
&__label {
diff --git a/src/request/index.js b/src/request/index.js
index 9452899..9804e2f 100644
--- a/src/request/index.js
+++ b/src/request/index.js
@@ -2,7 +2,7 @@
* @Author: astar
* @Date: 2020-09-09 17:47:49
* @LastEditors: astar
- * @LastEditTime: 2021-04-14 17:49:04
+ * @LastEditTime: 2021-04-19 17:09:39
* @Description: 定义接口请求
* @FilePath: \vue-chat\src\request\index.js
*/
@@ -37,3 +37,15 @@ export const getHistoryChatByCount = (data = {}) => {
export const getGifs = (data = {}) => {
return getRequest('/chat/searchGifs', data)
}
+
+export const getGroups = (data = {}) => {
+ return getRequest('/group/getGroups', data)
+}
+
+export const addGroup = (data = {}) => {
+ return postRequest('/group/addGroup', data)
+}
+
+export const getHistoryChatSortByGroup = (data = {}) => {
+ return getRequest('/chat/getHistoryChatSortByGroup', data)
+}
diff --git a/src/views/chat/index.vue b/src/views/chat/index.vue
index 08ab300..06be7bc 100644
--- a/src/views/chat/index.vue
+++ b/src/views/chat/index.vue
@@ -12,6 +12,7 @@
+
+
+
+
@@ -42,7 +46,7 @@ import { mapGetters } from 'vuex';
import { getAuthorization } from '@/utils';
import inputBox from './components/inputBox';
import { removeToken } from '@/utils/token';
-import { getHistoryChatByCount } from '@/request';
+import { getGroups, getHistoryChatByCount, addGroup } from '@/request';
import { getDpr } from '@/utils/setRem';
import { KINDS, getSimpleMessageFromJSON } from '@/utils/editor.js';
import message from './components/message';
@@ -55,16 +59,21 @@ export default {
pageSize: 20,
totalDone: false,
socket: null, // socket
- reConnectCount: 10,
+ reConnectCount: 5,
reConnectId: null,
searchPerson: '', // 搜索联系人
onlineList: [], // 当前在线人
- chatRecord: [] // 当前聊天记录
+ chatRecord: [], // 当前聊天记录
+ showAddGroup: false,
+ formData: {
+ groupName: ''
+ }
}
},
- created () {
- this.reConnectCount = 10;
+ async created () {
this.initSocket();
+ // 获取用户群组
+ this.getGroups();
this.refreshNext().then(() => {
this.$nextTick(() => {
if (this.$refs.box) {
@@ -76,6 +85,22 @@ export default {
});
},
methods: {
+ /**
+ * 创建群组
+ * @author astar
+ * @date 2021-04-19 16:50
+ */
+ addGroup () {
+ addGroup({ groupName: this.formData.groupName.trim() }).then(res => {
+ this.getGroups();
+ this.$toast.text(res.msg);
+ }).catch(_ => {
+ console.log(_)
+ })
+ },
+ getGroups () {
+ getGroups()
+ },
/**
* 长按艾特@
* @author astar
diff --git a/src/views/sign/comps/index.scss b/src/views/sign/comps/index.scss
index 3277be7..4ed4855 100644
--- a/src/views/sign/comps/index.scss
+++ b/src/views/sign/comps/index.scss
@@ -11,9 +11,9 @@
display: flex;
align-items: center;
justify-content: center;
- height: 50%;
+ // height: 50%;
// padding: 0 12px;
- width: 300px;
+ min-width: 300px;
background-color: #eee;
border-radius: 4px;
.panel-container {
@@ -28,6 +28,9 @@
.icon-login {
font-size: 50px;
}
+ img {
+ width: 100px;
+ }
}
}
&__btn {
diff --git a/src/views/sign/comps/index.vue b/src/views/sign/comps/index.vue
index 825ad24..b49ad08 100644
--- a/src/views/sign/comps/index.vue
+++ b/src/views/sign/comps/index.vue
@@ -2,7 +2,7 @@
* @Author: astar
* @Date: 2021-01-25 17:06:52
* @LastEditors: astar
- * @LastEditTime: 2021-04-01 11:10:52
+ * @LastEditTime: 2021-04-19 16:38:37
* @Description: 登录注册页面
* @FilePath: \vue-chat\src\views\sign\comps\index.vue
-->
@@ -17,7 +17,7 @@
-
+