转换表情

master
2023-01-13 10:53:39 +08:00
parent bad9f9109c
commit 5d16a7a80e
5 changed files with 53 additions and 56 deletions

View File

@ -3,8 +3,8 @@ var BASE = {
* @description api请求基础路径
*/
API_DEV: {
common: "https://common-api.pickmall.cn",
buyer: "https://buyer-api.pickmall.cn",
common: "http://192.168.0.113:8890",
buyer: "http://192.168.0.113:8898",
seller: "https://store-api.pickmall.cn",
manager: "https://admin-api.pickmall.cn"
},

View File

@ -65,8 +65,8 @@
right: item.float == 'right',
}">
<div class="arrow"></div>
<pre v-html="item.text" />
<pre v-if="!emojistwo.includes(item.text)" v-html="item.text" />
<pre v-if="emojistwo.includes(item.text)" v-html="textReplaceEmoji(item.text)" />
</div>
<div v-if="item.messageType == 'GOODS' && item.text != null" class="goodsStyle " :class="{
@ -176,7 +176,7 @@
</template>
<script>
import { textReplaceLink } from "@/utils/functions";
import { textReplaceEmoji } from "@/utils/emojis";
import { textReplaceEmoji, emojistwo } from "@/utils/emojis";
import OtherLink from "@/components/chat/panel/OtherLink.vue";
import { mapState, mapGetters } from "vuex";
import TalkSearchRecord from "@/components/chat/TalkSearchRecord";
@ -233,6 +233,7 @@ export default {
return {
//
textReplaceEmoji,
emojistwo,
textReplaceLink,
loadRecord: {
status: 0,
@ -387,7 +388,6 @@ export default {
//
submitSendMessage (content) {
console.log("发送", content);
const record = {
operation_type: "MESSAGE",
to: this.params.receiver_id,
@ -396,6 +396,9 @@ export default {
context: content,
talk_id: this.params.talkId,
};
// if (record.messageType == 'MESSAGE"') {
// record.text = this.textReplaceEmoji(record.content)
// }
SocketInstance.emit("event_talk", record);
this.$store.commit("UPDATE_TALK_ITEM", {
@ -415,8 +418,6 @@ export default {
text: content,
float: "right",
};
console.log("insterChat", insterChat);
// console.log("",'')
//
this.$store.commit("PUSH_DIALOGUE", insterChat);
@ -500,9 +501,9 @@ export default {
if (item.messageType == 'GOODS') {
item.text = JSON.parse(item.text)
}
if (item.messageType == '"MESSAGE"') {
item.text = textReplaceEmoji(item.text)
}
// if (item.messageType == 'MESSAGE"') {
// item.text = this.textReplaceEmoji(item.text)
// }
if (item.messageType == 'ORDER') {
item.text = JSON.parse(item.text)
}

View File

@ -308,7 +308,6 @@ export default {
//
selecteEmoticon (data) {
console.log(data);
if (data.type == 1) {
let value = this.editorText;
let el = this.$refs.textarea;
@ -330,8 +329,6 @@ export default {
}
} else {
const { talk_type, receiver_id } = this.$store.state.dialogue;
console.log(talk_type);
console.log(receiver_id);
ServeSendEmoticon({
talk_type,
receiver_id,

View File

@ -121,14 +121,12 @@ const symbol = [
];
const emojisKeys = Object.keys(emojis);
export const emojiList = {
symbol,
emojis
}
const regEmoji = emojisKeys.map((value) => '|\\' + value).join('').replace('|', '')
/**
* 替换表情文字
*
@ -142,3 +140,4 @@ export function textReplaceEmoji (content) {
return emojis[$1];
});
}
export const emojistwo = Object.keys(emojis)