From 38244ab2ff5a3e38b731b5e93d273a74908bca05 Mon Sep 17 00:00:00 2001 From: Rekord <1324596506@qq.com> Date: Thu, 23 Mar 2023 19:25:10 +0800 Subject: [PATCH 1/6] feat: implement real delete contact --- .../NavigationZone/RelationList.vue | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/components/NavigationZone/RelationList.vue b/src/components/NavigationZone/RelationList.vue index f532e52..fbcade0 100644 --- a/src/components/NavigationZone/RelationList.vue +++ b/src/components/NavigationZone/RelationList.vue @@ -17,13 +17,14 @@

{{ item.name }}

-
+
diff --git a/src/components/MessageArea/MessageBottomInputArea.vue b/src/components/MessageArea/MessageBottomInputArea.vue index 9a452b6..cd4673f 100644 --- a/src/components/MessageArea/MessageBottomInputArea.vue +++ b/src/components/MessageArea/MessageBottomInputArea.vue @@ -1,207 +1,229 @@ \ No newline at end of file +} +.emotionList { + display: flex; + flex-wrap: wrap; + padding: 5px; +} +.emotionItem { + width: 10%; + font-size: 20px; + text-align: center; + text-decoration: none; +} +/*正常的未被访问过的链接*/ +.emotionItem:link { + text-decoration: none; +} +/*已经访问过的链接*/ +.emotionItem:visited { + text-decoration: none; +} +/*鼠标划过(停留)的链接*/ +.emotionItem:hover { + text-decoration: none; +} +/* 正在点击的链接*/ +.emotionItem:active { + text-decoration: none; +} + diff --git a/src/components/MessageArea/MessageTopTitle.vue b/src/components/MessageArea/MessageTopTitle.vue index c078be5..b247ef2 100644 --- a/src/components/MessageArea/MessageTopTitle.vue +++ b/src/components/MessageArea/MessageTopTitle.vue @@ -1,40 +1,42 @@ \ No newline at end of file +} + diff --git a/src/components/NavigationZone/ApplicationList.vue b/src/components/NavigationZone/ApplicationList.vue index 2c8e926..fe8c433 100644 --- a/src/components/NavigationZone/ApplicationList.vue +++ b/src/components/NavigationZone/ApplicationList.vue @@ -17,12 +17,28 @@

{{ item.name }}

- 同意 - 拒绝 + 同意 + 拒绝 -
{{item.status == 0 ? '等待回应' : (item.status == 1 ?'已同意' : '已拒绝')}}
+
+ {{ + item.status == 0 + ? "等待回应" + : item.status == 1 + ? "已同意" + : "已拒绝" + }} +

2023 22:58:43 @@ -33,15 +49,15 @@ diff --git a/src/components/NavigationZone/NavigationApplication.vue b/src/components/NavigationZone/NavigationApplication.vue index 6a2f417..b8eb843 100644 --- a/src/components/NavigationZone/NavigationApplication.vue +++ b/src/components/NavigationZone/NavigationApplication.vue @@ -6,13 +6,13 @@ - + - + @@ -31,30 +31,36 @@ export default { ApplicationList, }, props: { - 'isGroup': Boolean, + isGroup: Boolean, }, methods: { clearProcessed() { - this.$confirm('此操作将清理所有已处理的好友或群组申请记录, 是否继续?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { - // 移除已处理的申请记录 - this.users = this.users.filter(item => item.status == 0) - this.$message({ - type: 'success', - message: '清理成功!' + this.$confirm( + "此操作将清理所有已处理的好友或群组申请记录, 是否继续?", + "提示", + { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + } + ) + .then(() => { + // 移除已处理的申请记录 + this.users = this.users.filter((item) => item.status == 0); + this.$message({ + type: "success", + message: "清理成功!", + }); + }) + .catch(() => { + this.$message({ + type: "info", + message: "已取消清理", + }); }); - }).catch(() => { - this.$message({ - type: 'info', - message: '已取消清理' - }); - }); }, }, -} +}; \ No newline at end of file + diff --git a/src/components/NavigationZone/NavigationContact.vue b/src/components/NavigationZone/NavigationContact.vue index 12cc5b3..7fd1226 100644 --- a/src/components/NavigationZone/NavigationContact.vue +++ b/src/components/NavigationZone/NavigationContact.vue @@ -2,21 +2,20 @@

- +
- - + - +

加载中...

@@ -26,24 +25,24 @@ diff --git a/src/components/NavigationZone/NavigationTopSearchBar.vue b/src/components/NavigationZone/NavigationTopSearchBar.vue index e3dc9b1..7f78daf 100644 --- a/src/components/NavigationZone/NavigationTopSearchBar.vue +++ b/src/components/NavigationZone/NavigationTopSearchBar.vue @@ -1,42 +1,51 @@ \ No newline at end of file +} + diff --git a/src/components/NavigationZone/NavigationZone.vue b/src/components/NavigationZone/NavigationZone.vue index d6f1dbc..07994d4 100644 --- a/src/components/NavigationZone/NavigationZone.vue +++ b/src/components/NavigationZone/NavigationZone.vue @@ -1,108 +1,119 @@ diff --git a/src/components/NavigationZone/RelationList.vue b/src/components/NavigationZone/RelationList.vue index 44bdd8a..7477001 100644 --- a/src/components/NavigationZone/RelationList.vue +++ b/src/components/NavigationZone/RelationList.vue @@ -1,10 +1,15 @@ \ No newline at end of file +} + diff --git a/src/components/SearchArea/SearchArea.vue b/src/components/SearchArea/SearchArea.vue index fc5f8e9..f611f00 100644 --- a/src/components/SearchArea/SearchArea.vue +++ b/src/components/SearchArea/SearchArea.vue @@ -2,21 +2,21 @@ 找人 - + 找群 - + \ No newline at end of file +}; + diff --git a/src/components/SearchArea/SearchAreaBody.vue b/src/components/SearchArea/SearchAreaBody.vue index 9831d53..fa23639 100644 --- a/src/components/SearchArea/SearchAreaBody.vue +++ b/src/components/SearchArea/SearchAreaBody.vue @@ -1,28 +1,57 @@ \ No newline at end of file + diff --git a/src/config/env.js b/src/config/env.js index f297bb7..f11629d 100644 --- a/src/config/env.js +++ b/src/config/env.js @@ -1,9 +1,7 @@ /** - * + * * baseUrl: */ -let baseUrl = '/chatting'; +let baseUrl = "/chatting"; -export { - baseUrl, -} \ No newline at end of file +export { baseUrl }; diff --git a/src/main.js b/src/main.js index 73c31f1..166b005 100644 --- a/src/main.js +++ b/src/main.js @@ -1,21 +1,21 @@ -import Vue from 'vue' -import App from './App.vue' +import Vue from "vue"; +import App from "./App.vue"; -import router from './router' +import router from "./router"; -import ElementUI from 'element-ui'; -import 'element-ui/lib/theme-chalk/index.css'; +import ElementUI from "element-ui"; +import "element-ui/lib/theme-chalk/index.css"; Vue.use(ElementUI); -import store from './store' +import store from "./store"; -Vue.config.productionTip = false +Vue.config.productionTip = false; new Vue({ - router, - store, - render: h => h(App), - beforeCreate() { - Vue.prototype.$bus = this - }, -}).$mount('#app') + router, + store, + render: (h) => h(App), + beforeCreate() { + Vue.prototype.$bus = this; + }, +}).$mount("#app"); diff --git a/src/pages/ChattingPage.vue b/src/pages/ChattingPage.vue index 3c7b18e..f277cc0 100644 --- a/src/pages/ChattingPage.vue +++ b/src/pages/ChattingPage.vue @@ -1,108 +1,112 @@ \ No newline at end of file + diff --git a/src/router/index.js b/src/router/index.js index 2d2bf80..d6aedd4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,33 +1,33 @@ -import Vue from 'vue' -import VueRouter from 'vue-router' +import Vue from "vue"; +import VueRouter from "vue-router"; -import Login from '../pages/LoginPage' -import Chatting from '../pages/ChattingPage' +import Login from "../pages/LoginPage"; +import Chatting from "../pages/ChattingPage"; -Vue.use(VueRouter) +Vue.use(VueRouter); const routes = [ { - path: '/', - name: 'login', + path: "/", + name: "login", component: Login, }, { - path: '/chatting', - name: 'chatting', + path: "/chatting", + name: "chatting", component: Chatting, beforeEnter: (to, from, next) => { if (window.sessionStorage.getItem("user") == null) { next({ - path: '/', - }) + path: "/", + }); } else { - next() + next(); } }, }, -] +]; export default new VueRouter({ - routes -}) \ No newline at end of file + routes, +}); diff --git a/src/service/request.js b/src/service/request.js index 3db56c9..fa5766f 100644 --- a/src/service/request.js +++ b/src/service/request.js @@ -1,12 +1,12 @@ -import axios from 'axios' -import { baseUrl } from '@/config/env' +import axios from "axios"; +import { baseUrl } from "@/config/env"; function get(url, params, data) { - return request('get', url, params, data) + return request("get", url, params, data); } function post(url, params, data) { - return request('post', url, params, data) + return request("post", url, params, data); } function request(method, url, params, data) { @@ -15,11 +15,8 @@ function request(method, url, params, data) { url: baseUrl + url, params, data, - responseType: 'json', - }) + responseType: "json", + }); } -export { - get, - post, -} \ No newline at end of file +export { get, post }; diff --git a/src/store/index.js b/src/store/index.js index 1196364..2427d19 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,16 +1,12 @@ -import { socket } from '@/utils/socket' -import Vue from 'vue' -import Vuex from 'vuex' +import { socket } from "@/utils/socket"; +import Vue from "vue"; +import Vuex from "vuex"; -Vue.use(Vuex) +Vue.use(Vuex); -const actions = { +const actions = {}; -} - -const mutations = { - -} +const mutations = {}; const state = { messages: {}, @@ -24,7 +20,7 @@ const state = { socket: socket, toId: -1, isGroup: false, -} +}; const getters = { getApplications: (state) => (isGroup, isRequest) => { @@ -52,11 +48,11 @@ const getters = { return state.joinGroups; } } - } -} + }, +}; export default new Vuex.Store({ actions, mutations, state, getters, -}) \ No newline at end of file +}); diff --git a/src/utils/date.js b/src/utils/date.js index 11670c5..8237c04 100644 --- a/src/utils/date.js +++ b/src/utils/date.js @@ -1,12 +1,12 @@ -import dayjs from 'dayjs'; +import dayjs from "dayjs"; export default { getCurrentTime: () => { - return dayjs().add(8, 'h').format('YYYY-MM-DD HH:mm:ss'); + return dayjs().add(8, "h").format("YYYY-MM-DD HH:mm:ss"); }, convertTime: (time) => { - return dayjs(time).add(-8, 'h').format('YYYY-MM-DD HH:mm:ss'); + return dayjs(time).add(-8, "h").format("YYYY-MM-DD HH:mm:ss"); }, wrapSendTime: (time) => { - return dayjs(time).format('YYYY-MM-DD HH:mm:ss') - } -} \ No newline at end of file + return dayjs(time).format("YYYY-MM-DD HH:mm:ss"); + }, +}; diff --git a/src/utils/socket.js b/src/utils/socket.js index 11d17ad..52374fb 100644 --- a/src/utils/socket.js +++ b/src/utils/socket.js @@ -4,85 +4,81 @@ let socket = { ws_url: null, ws_port: 3333, - + init: (hostname) => { - socket.ws_url = `ws://${hostname}:${socket.ws_port}/ws` + socket.ws_url = `ws://${hostname}:${socket.ws_port}/ws`; if (!window.WebSocket) { window.WebSocket = window.MozWebSocket; } - - socket.ws = new WebSocket(socket.ws_url) + + socket.ws = new WebSocket(socket.ws_url); socket.ws.onmessage = (e) => { - socket.receive(e) - } - + socket.receive(e); + }; + // 连接关闭 socket.ws.onclose = () => { - console.log('ws连接已断开') - } - + console.log("ws连接已断开"); + }; + // 连接成功 socket.ws.onopen = () => { - console.log('ws连接成功') - } + console.log("ws连接成功"); + }; // 连接错误 socket.ws.onerror = () => { - console.log('ws连接发生错误') - } + console.log("ws连接发生错误"); + }; }, - /** * 发送消息 */ send: (data, callback = null) => { // 开启状态直接发送 if (socket.ws.readyState === socket.ws.OPEN) { - socket.ws.send(JSON.stringify(data)) + socket.ws.send(JSON.stringify(data)); if (callback) { - callback() + callback(); } - // 正在开启状态,则等待1s后重新调用 + // 正在开启状态,则等待1s后重新调用 } else if (socket.ws.readyState === socket.ws.CONNECTING) { setTimeout(function () { - socket.send(data, callback) - }, 1000) - - // 未开启,则等待1s后重新调用 + socket.send(data, callback); + }, 1000); + + // 未开启,则等待1s后重新调用 } else { - socket.init() + socket.init(); setTimeout(function () { - socket.send(data, callback) - }, 1000) + socket.send(data, callback); + }, 1000); } }, - + receive: (message) => { - JSON.parse(message.data) + JSON.parse(message.data); }, - /** * 主动关闭连接 */ close: () => { - console.log('主动断开连接') - socket.ws.close() + console.log("主动断开连接"); + socket.ws.close(); }, - + /** * 重新连接 */ reconnect: () => { - console.log('重新发起ws连接') + console.log("重新发起ws连接"); if (socket.ws) { - socket.close() + socket.close(); } - socket.init() + socket.init(); }, -} +}; -export { - socket -} \ No newline at end of file +export { socket };