diff --git a/README.md b/README.md index dcb4918..ae890df 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ - [x] 开发webpack loader-将内联样式的px转换为rem - [ ] 艾特@功能 - [ ] 抽出下拉上拉逻辑,重构pullRefresh组件 +- [ ] 目前暂时用v-html展示,考虑转义还是拆组件 # 安装运行 1. 拉取项目 diff --git a/src/assets/styles/common.scss b/src/assets/styles/common.scss index 1c6dde9..1ff5e8b 100644 --- a/src/assets/styles/common.scss +++ b/src/assets/styles/common.scss @@ -17,4 +17,13 @@ .iconfont { font-size: 20px; +} + +.emoji-icon { + display: inline-block; + width: 30px; + height: 30px; + background: url('~@/assets/images/biaoqing.png'); + background-size: 30px auto; + background-repeat: no-repeat; } \ No newline at end of file diff --git a/src/components/avatar/index.vue b/src/components/avatar/index.vue index b4469fa..7aeac44 100644 --- a/src/components/avatar/index.vue +++ b/src/components/avatar/index.vue @@ -2,11 +2,11 @@ * @Description: 头像组件 * @Author: astar * @Date: 2020-09-08 21:10:10 - * @LastEditTime: 2021-02-04 14:28:05 + * @LastEditTime: 2021-04-01 17:07:53 * @LastEditors: astar --> diff --git a/src/views/chat/index.vue b/src/views/chat/index.vue index b1bcfa8..cac09e3 100644 --- a/src/views/chat/index.vue +++ b/src/views/chat/index.vue @@ -23,17 +23,17 @@
- +
- + @@ -44,11 +44,10 @@ import { io } from 'socket.io-client'; import { mapGetters } from 'vuex'; import { getAuthorization } from '@/utils'; import inputBox from './components/inputBox'; -import expressions from './components/expression/config'; -import expressionItem from './components/expression/expressionItem'; import { removeToken } from '@/utils/token'; import { getHistoryChatByCount } from '@/request'; import { getDpr } from '@/utils/setRem'; +import { getHTMLFromJSON } from '@/utils/editor.js'; export default { name: "chat", @@ -56,7 +55,6 @@ export default { return { pageSize: 20, totalDone: false, - expressions, socket: null, // socket reConnectCount: 10, reConnectId: null, @@ -79,6 +77,24 @@ export default { }); }, methods: { + getHTMLFromJSON, + /** + * 长按艾特@ + * @author astar + * @date 2021-04-01 17:01 + * @param {Object} item - 艾特某人 + * @returns {*} + */ + atSomeone (item) { + const _this = this; + return function () { + console.log(item) + _this.$refs.inputBox.onSelectExpression({ + kind: 'AT', + value: item.name + }) + } + }, refreshNext () { return new Promise((resolve, reject) => { if (!this.totalDone) { @@ -135,7 +151,7 @@ export default { } if (this.reConnectCount) { this.reConnectId = setTimeout(() => { - console.log('重新连接'); + console.warn('[socket] - reconnect'); this.reConnectCount--; this.socket.connect(); }, 1000); @@ -152,7 +168,7 @@ export default { } this.socket.emit('message', message); } else { - console.log('socket 还未初始化'); + console.warn('[socket] - socket not initialized yet'); } } }, @@ -185,8 +201,7 @@ export default { } }, components: { - inputBox, - expressionItem + inputBox } }