pc发布商品不显示IM
parent
0dc3124bba
commit
aaa2deef85
|
@ -68,7 +68,7 @@
|
||||||
<pre v-html="item.text" />
|
<pre v-html="item.text" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="item.messageType == 'GOODS' && item.text != null" class="text-message" :class="{
|
<div v-if="item.messageType == 'GOODS' && item.text != null" class="text-message" :class="{
|
||||||
left: item.float == 'left',
|
left: item.float == 'left',
|
||||||
right: item.float == 'right',
|
right: item.float == 'right',
|
||||||
}">
|
}">
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="item.messageType == 'ORDER' && item.text != null" class="text-message" :class="{
|
<div v-if="item.messageType == 'ORDER' && item.text != null" class="text-message" :class="{
|
||||||
left: item.float == 'left',
|
left: item.float == 'left',
|
||||||
right: item.float == 'right',
|
right: item.float == 'right',
|
||||||
}">
|
}">
|
||||||
|
@ -483,10 +483,10 @@ export default {
|
||||||
if (item.toUser > 0) {
|
if (item.toUser > 0) {
|
||||||
item.float = item.fromUser == user_id ? "right" : "left";
|
item.float = item.fromUser == user_id ? "right" : "left";
|
||||||
}
|
}
|
||||||
if (item.messageType === 'GOODS') {
|
if (item.messageType == 'GOODS') {
|
||||||
item.text = JSON.parse(item.text)
|
item.text = JSON.parse(item.text)
|
||||||
}
|
}
|
||||||
if (item.messageType === 'ORDER') {
|
if (item.messageType == 'ORDER') {
|
||||||
item.text = JSON.parse(item.text)
|
item.text = JSON.parse(item.text)
|
||||||
}
|
}
|
||||||
return { ...item, [key]: key };
|
return { ...item, [key]: key };
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<dd v-for="(item, index) in orderList" v-infinite-scroll="loadMore" :key="index">
|
<dd v-for="(item, index) in orderList" v-infinite-scroll="loadMore" :key="index">
|
||||||
<div style="margin-bottom: 20px;">
|
<div style="margin-bottom: 20px;">
|
||||||
<span class="orderSn">订单号:{{ item.sn }}</span>
|
<span class="orderSn">订单号:{{ item.sn }}</span>
|
||||||
<img :src="item.groupImages" alt="暂无图片"
|
<img :src="item.groupImages" alt=""
|
||||||
style="height: 100px; width: 100px;margin-top: 10px; vertical-align: middle; ">
|
style="height: 100px; width: 100px;margin-top: 10px; vertical-align: middle; ">
|
||||||
<span class="orderGoodsName" @click="linkToOrders(item.sn)"> {{ item.groupName }}</span>
|
<span class="orderGoodsName" @click="linkToOrders(item.sn)"> {{ item.groupName }}</span>
|
||||||
<span style="margin-left: 10px; color: red;">{{ item.paymentTime }}</span>
|
<span style="margin-left: 10px; color: red;">{{ item.paymentTime }}</span>
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Base {
|
||||||
* 获取当前登录用户的ID
|
* 获取当前登录用户的ID
|
||||||
*/
|
*/
|
||||||
getAccountId() {
|
getAccountId() {
|
||||||
console.log("store.state", store.state.user);
|
// console.log("store.state", store.state.user);
|
||||||
return store.state.user.id;
|
return store.state.user.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@ class Talk extends Base {
|
||||||
*/
|
*/
|
||||||
constructor(resource) {
|
constructor(resource) {
|
||||||
super();
|
super();
|
||||||
console.log("接口构造 resource", resource);
|
|
||||||
this.sender_id = resource.fromUser; //发送
|
this.sender_id = resource.fromUser; //发送
|
||||||
this.receiver_id = resource.toUser; //接收
|
this.receiver_id = resource.toUser; //接收
|
||||||
this.talk_type = resource.messageType; //类型
|
this.talk_type = resource.messageType; //类型
|
||||||
|
@ -60,7 +59,7 @@ class Talk extends Base {
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
isCurrSender() {
|
isCurrSender() {
|
||||||
console.log("sender_id", this.sender_id);
|
// console.log("sender_id", this.sender_id);
|
||||||
return this.sender_id == this.getAccountId();
|
return this.sender_id == this.getAccountId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +107,7 @@ class Talk extends Base {
|
||||||
|
|
||||||
handle() {
|
handle() {
|
||||||
let store = this.getStoreInstance();
|
let store = this.getStoreInstance();
|
||||||
console.log("触发handle");
|
// console.log("触发handle");
|
||||||
// 判断当前是否在聊天页面
|
// 判断当前是否在聊天页面
|
||||||
if (!this.isTalkPage()) {
|
if (!this.isTalkPage()) {
|
||||||
store.commit("INCR_UNREAD_NUM");
|
store.commit("INCR_UNREAD_NUM");
|
||||||
|
@ -116,10 +115,10 @@ class Talk extends Base {
|
||||||
// 判断消息是否来自于我自己,否则会提示消息通知
|
// 判断消息是否来自于我自己,否则会提示消息通知
|
||||||
return !this.isCurrSender() && this.showMessageNocice();
|
return !this.isCurrSender() && this.showMessageNocice();
|
||||||
}
|
}
|
||||||
console.log("this.receiver_id", this.receiver_id);
|
// console.log("this.receiver_id", this.receiver_id);
|
||||||
console.log("this.sender_id", this.sender_id);
|
// console.log("this.sender_id", this.sender_id);
|
||||||
let isTrue = this.isTalk(1, this.receiver_id, this.sender_id);
|
let isTrue = this.isTalk(1, this.receiver_id, this.sender_id);
|
||||||
console.log("判断当前是否正在和好友对话", isTrue);
|
// console.log("判断当前是否正在和好友对话", isTrue);
|
||||||
// 判断当前是否正在和好友对话
|
// 判断当前是否正在和好友对话
|
||||||
if (isTrue) {
|
if (isTrue) {
|
||||||
this.insertTalkRecord();
|
this.insertTalkRecord();
|
||||||
|
@ -177,7 +176,7 @@ class Talk extends Base {
|
||||||
} else if (talk_type == 2) {
|
} else if (talk_type == 2) {
|
||||||
receiver_id = this.receiver_id;
|
receiver_id = this.receiver_id;
|
||||||
}
|
}
|
||||||
console.log("加载对接节点", this.resource);
|
// console.log("加载对接节点", this.resource);
|
||||||
|
|
||||||
ServeCreateTalkList(receiver_id).then(({ code, data }) => {
|
ServeCreateTalkList(receiver_id).then(({ code, data }) => {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
|
@ -192,7 +191,7 @@ class Talk extends Base {
|
||||||
insertTalkRecord() {
|
insertTalkRecord() {
|
||||||
let store = this.getStoreInstance();
|
let store = this.getStoreInstance();
|
||||||
let record = this.resource;
|
let record = this.resource;
|
||||||
console.log("插入谈话记录", record);
|
// console.log("插入谈话记录", record);
|
||||||
|
|
||||||
record.float = this.getFloatType();
|
record.float = this.getFloatType();
|
||||||
|
|
||||||
|
@ -213,13 +212,13 @@ class Talk extends Base {
|
||||||
el.scrollTop = el.scrollHeight;
|
el.scrollTop = el.scrollHeight;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log("%c SET_TLAK_UNREAD_MESSAGE %c", "color:red");
|
// console.log("%c SET_TLAK_UNREAD_MESSAGE %c", "color:red");
|
||||||
store.commit("SET_TLAK_UNREAD_MESSAGE", {
|
store.commit("SET_TLAK_UNREAD_MESSAGE", {
|
||||||
content: this.getTalkText(),
|
content: this.getTalkText(),
|
||||||
nickname: record.name,
|
nickname: record.name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
console.log("%c 准备更新...UPDATE_TALK_ITEM ", "color:red");
|
// console.log("%c 准备更新...UPDATE_TALK_ITEM ", "color:red");
|
||||||
|
|
||||||
store.commit("UPDATE_TALK_ITEM", {
|
store.commit("UPDATE_TALK_ITEM", {
|
||||||
index_name: this.getIndexName(),
|
index_name: this.getIndexName(),
|
||||||
|
@ -228,7 +227,7 @@ class Talk extends Base {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.talk_type == 1 && this.getAccountId() !== this.sender_id) {
|
if (this.talk_type == 1 && this.getAccountId() !== this.sender_id) {
|
||||||
console.log("%c 清除 未读数...ServeClearTalkUnreadNum ", "color:blue");
|
// console.log("%c 清除 未读数...ServeClearTalkUnreadNum ", "color:blue");
|
||||||
ServeClearTalkUnreadNum({
|
ServeClearTalkUnreadNum({
|
||||||
talk_type: 1,
|
talk_type: 1,
|
||||||
receiver_id: this.sender_id,
|
receiver_id: this.sender_id,
|
||||||
|
@ -240,7 +239,6 @@ class Talk extends Base {
|
||||||
* 更新对话列表记录
|
* 更新对话列表记录
|
||||||
*/
|
*/
|
||||||
updateTalkItem() {
|
updateTalkItem() {
|
||||||
console.log("%c 更新对话列表记录", "color:#32ccbc");
|
|
||||||
let store = this.getStoreInstance();
|
let store = this.getStoreInstance();
|
||||||
|
|
||||||
store.commit("INCR_UNREAD_NUM");
|
store.commit("INCR_UNREAD_NUM");
|
||||||
|
|
|
@ -33,7 +33,7 @@ Vue.prototype.linkToStore = function (storeId) { // 跳转买家端商品
|
||||||
window.open(`${config.PC_URL}/Merchant?id=${storeId}`, '_blank')
|
window.open(`${config.PC_URL}/Merchant?id=${storeId}`, '_blank')
|
||||||
};
|
};
|
||||||
// 订单跳转商家订单页面
|
// 订单跳转商家订单页面
|
||||||
Vue.prototype.linkToOrders = function (sn) { // 跳转买家端商品
|
Vue.prototype.linkToOrders = function (sn) { // 跳转买家端订单
|
||||||
window.open(`${config.STORE_URL}/order-detail?sn=${sn}`, '_blank')
|
window.open(`${config.STORE_URL}/order-detail?sn=${sn}`, '_blank')
|
||||||
};
|
};
|
||||||
const Instance = new Vue({
|
const Instance = new Vue({
|
||||||
|
|
|
@ -226,9 +226,12 @@ class WsSocket {
|
||||||
console.log("接收消息", result, "color:red");
|
console.log("接收消息", result, "color:red");
|
||||||
// 判断消息事件是否被绑定
|
// 判断消息事件是否被绑定
|
||||||
// event_talk;
|
// event_talk;
|
||||||
|
let params = {
|
||||||
|
...this.onParse(evt),
|
||||||
|
text: JSON.parse(this.onParse(evt).text)
|
||||||
|
}
|
||||||
// 指定推送消息
|
// 指定推送消息
|
||||||
this.onCallBacks["event_talk"](result);
|
this.onCallBacks["event_talk"](params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -51,7 +51,7 @@ export default {
|
||||||
state.records.push(...records);
|
state.records.push(...records);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("最后的数据",state.records)
|
// console.log("最后的数据",state.records)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 推送对话记录
|
// 推送对话记录
|
||||||
|
|
|
@ -21,6 +21,7 @@ const Talk = {
|
||||||
getters: {
|
getters: {
|
||||||
// 过滤所有置顶对话列表
|
// 过滤所有置顶对话列表
|
||||||
topItems: (state) => {
|
topItems: (state) => {
|
||||||
|
console.log(state.items, 'state.items');
|
||||||
return state.items.filter((item) => item.is_top == 1);
|
return state.items.filter((item) => item.is_top == 1);
|
||||||
},
|
},
|
||||||
talkItems: (state) => {
|
talkItems: (state) => {
|
||||||
|
@ -45,11 +46,11 @@ const Talk = {
|
||||||
|
|
||||||
// 更新对话节点
|
// 更新对话节点
|
||||||
UPDATE_TALK_ITEM (state, resource) {
|
UPDATE_TALK_ITEM (state, resource) {
|
||||||
console.log("%c 更新对话节点", "color:#32c");
|
// console.log("%c 更新对话节点", "color:#32c");
|
||||||
console.log("state", state);
|
// console.log("state", state);
|
||||||
console.log("resource", resource);
|
// console.log("resource", resource);
|
||||||
|
|
||||||
console.log("%c 更新对话节点结束", "color:#32c",state.items);
|
// console.log("%c 更新对话节点结束", "color:#32c",state.items);
|
||||||
let index = state.items.findIndex(
|
let index = state.items.findIndex(
|
||||||
(item) => item.userId === resource.index_name.split("_")[1]
|
(item) => item.userId === resource.index_name.split("_")[1]
|
||||||
);
|
);
|
||||||
|
@ -60,7 +61,7 @@ const Talk = {
|
||||||
|
|
||||||
// 新增对话节点
|
// 新增对话节点
|
||||||
PUSH_TALK_ITEM (state, resource) {
|
PUSH_TALK_ITEM (state, resource) {
|
||||||
console.log(state)
|
// console.log(state)
|
||||||
state.items.push(resource);
|
state.items.push(resource);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -85,12 +86,10 @@ const Talk = {
|
||||||
|
|
||||||
// 更新对话消息
|
// 更新对话消息
|
||||||
UPDATE_TALK_MESSAGE (state, resource) {
|
UPDATE_TALK_MESSAGE (state, resource) {
|
||||||
console.log("%c 更新对话消息", "color:green");
|
// console.log("%c 更新对话消息", "color:green");
|
||||||
|
// console.log("state", state);
|
||||||
|
// console.log("resource", resource);
|
||||||
console.log("state", state);
|
// console.log("%c 更新对话结束", "color:green",state.items);
|
||||||
console.log("resource", resource);
|
|
||||||
console.log("%c 更新对话结束", "color:green",state.items);
|
|
||||||
|
|
||||||
let enableGetTalkList = true
|
let enableGetTalkList = true
|
||||||
state.items.forEach(item => {
|
state.items.forEach(item => {
|
||||||
|
|
|
@ -108,6 +108,7 @@
|
||||||
<div class="talk-message">
|
<div class="talk-message">
|
||||||
<span v-if="item.lastMessageType === 'MESSAGE'">{{ item.lastTalkMessage }}</span>
|
<span v-if="item.lastMessageType === 'MESSAGE'">{{ item.lastTalkMessage }}</span>
|
||||||
<span v-if="item.lastMessageType === 'GOODS'">[商品链接]</span>
|
<span v-if="item.lastMessageType === 'GOODS'">[商品链接]</span>
|
||||||
|
<span v-if="item.lastMessageType === 'ORDER'">[订单链接]</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<template v-if="
|
<template v-if="
|
||||||
|
|
|
@ -49,6 +49,7 @@ body {
|
||||||
.ivu-tag {
|
.ivu-tag {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tox-notifications-container {
|
.tox-notifications-container {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,11 +253,12 @@ export default {
|
||||||
// 获取访问Token
|
// 获取访问Token
|
||||||
let accessToken = this.getStore("accessToken");
|
let accessToken = this.getStore("accessToken");
|
||||||
await this.getIMDetailMethods();
|
await this.getIMDetailMethods();
|
||||||
|
let res = await getIMDetail();
|
||||||
if (!accessToken) {
|
if (!accessToken) {
|
||||||
this.$Message.error("请登录后再联系客服");
|
this.$Message.error("请登录后再联系客服");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.open(" http://192.168.0.139:8000?token=" + accessToken);
|
window.open(`${res.result}?token=` + accessToken);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取im信息
|
// 获取im信息
|
||||||
|
|
Loading…
Reference in New Issue