feat: 优化im 接口403判定,新增从买家端以及卖家端进行跳转im权限判定,新增im掉线重连以及重连成功提醒,新增发送的消息断线将会进行重新发送消息提示,优化最近浏览 订单列表空展示。注释部分im打印的日志信息

This commit is contained in:
学习很差啦
2023-03-01 14:59:54 +08:00
parent 32b29f45e7
commit 4700bc995a
16 changed files with 288 additions and 153 deletions

View File

@@ -0,0 +1,43 @@
<template>
<div></div>
</template>
<script>
import { getIMDetail } from "@/api/common";
import Storage from "@/plugins/storage";
import { getMemberMsg } from "@/api/login";
export default {
data() {
return {
Storage,
IMLink: "",
};
},
methods: {
// 跳转im客服
async IMService() {
// 获取访问Token
let accessToken = Storage.getItem("accessToken");
await this.getIMDetailMethods();
const userInfo = await getMemberMsg();
if (userInfo.success) {
window.open(
this.IMLink + "?token=" + accessToken + "&id=" + this.storeMsg.storeId
);
} else {
this.$Message.error("请登录后再联系客服");
return;
}
},
// 获取im信息
async getIMDetailMethods() {
let res = await getIMDetail();
if (res.success) {
this.IMLink = res.result;
}
},
},
};
</script>
<style lang="scss" scoped></style>

View File

@@ -50,8 +50,7 @@ import {
getGoodsDistribution,
} from "@/api/member";
import { getDetailById } from "@/api/shopentry";
import { getIMDetail } from "@/api/common";
import Storage from "../plugins/storage";
import imTalk from '@/components/mixes/talkIm'
export default {
name: "GoodsDetail",
beforeRouteEnter (to, from, next) {
@@ -61,6 +60,7 @@ export default {
created () {
this.getGoodsDetail();
},
mixins: [imTalk],
data () {
return {
goodsMsg: {}, // 商品信息
@@ -68,49 +68,11 @@ export default {
categoryBar: [], // 分类
storeCollected: false, // 商品收藏
storeMsg: {}, // 店铺信息
IMLink: "",
};
},
methods: {
// 跳转im客服
async IMService () {
// 获取访问Token
let accessToken = Storage.getItem("accessToken");
await this.getIMDetailMethods();
if (!accessToken) {
this.$Message.error("请登录后再联系客服");
return;
}
window.open(
this.IMLink +
"?token=" +
accessToken +
"&id=" +
this.goodsMsg.data.storeId +
"&goodsId=" +
this.goodsMsg.data.goodsId +
"&skuId=" +
this.goodsMsg.data.id
);
// window.open(
// 'http://192.168.0.139:8000/' +
// "?token=" +
// accessToken +
// "&id=" +
// this.goodsMsg.data.storeId +
// "&goodsId=" +
// this.goodsMsg.data.goodsId +
// "&skuId=" +
// this.goodsMsg.data.id
// );
},
// 获取im信息
async getIMDetailMethods () {
let res = await getIMDetail();
if (res.success) {
this.IMLink = res.result;
}
},
// 点击规格
targetClickSku (val) {
this.getGoodsDetail(val);

View File

@@ -106,8 +106,7 @@
</template>
<script>
import {getIMDetail} from "@/api/common";
import Storage from "../plugins/storage";
import {getDetailById, getCateById} from "@/api/shopentry";
import {cancelCollect, collectGoods, isCollection} from "@/api/member";
import {goodsList} from "@/api/goods";
@@ -117,6 +116,7 @@ import HoverSearch from "@/components/header/hoverSearch";
import storage from "@/plugins/storage";
import {getFloorStoreData} from "@/api/index.js";
import {seckillByDay} from "@/api/promotion";
import imTalk from '@/components/mixes/talkIm'
export default {
name: "Merchant",
@@ -125,6 +125,7 @@ export default {
ModelForm,
HoverSearch,
},
mixins: [imTalk],
data() {
return {
// 店铺装修的内容
@@ -140,7 +141,6 @@ export default {
cateList: [], // 店铺分裂
goodsList: [], // 商品列表
total: 0, // 商品数量
IMLink: "",
params: {
// 请求参数
pageNumber: 1,
@@ -187,30 +187,8 @@ export default {
}
);
},
// 跳转im客服
async IMService() {
// 获取访问Token
let accessToken = Storage.getItem("accessToken");
await this.getIMDetailMethods();
if (!accessToken) {
this.$Message.error("请登录后再联系客服");
return;
}
window.open(
this.IMLink +
"?token=" +
accessToken +
"&id=" +
this.storeMsg.storeId
);
},
// 获取im信息
async getIMDetailMethods() {
let res = await getIMDetail();
if (res.success) {
this.IMLink = res.result;
}
},
// getStoreMsg () { // 店铺信息
// getDetailById(this.$route.query.id).then(res => {
// if (res.success) {