商家增加im按钮

master
Chopper 2022-02-22 01:32:36 +08:00
parent 31f438edfa
commit 7e8ff778f9
2 changed files with 30 additions and 1 deletions

View File

@ -9,3 +9,10 @@ export const getChildRegion = (id) => {
export const getRegion = (params) => {
return getRequest(`${commonUrl}/common/common/region/region`, params);
};
// 获取IM接口前缀
export function getIMDetail () {
return getRequest(`${commonUrl}/common/common/IM`);
}

View File

@ -16,11 +16,13 @@
<div class="shop-box">
<div class="box-item">
<div>店铺名称{{userData.storeName || '暂无'}}</div>
</div>
<div class="box-item">
<div>店铺状态{{userData.storeDisable=='OPEN' ? '开启中' : '关闭'}}</div>
</div>
<div class="box-item" @click="im()">
<Button type="info">点击登录客服</Button>
</div>
</div>
<div class="rate-box">
@ -199,6 +201,7 @@
<script>
import { getSellerHomeData, getHomeNotice } from "@/api/index";
import { getIMDetail } from "@/api/common"
import { seeArticle } from "@/api/pages";
import Cookies from "js-cookie";
@ -214,6 +217,7 @@ export default {
noticesDetail: { //
title: "",
},
IMLink:"",
};
},
methods: {
@ -242,6 +246,24 @@ export default {
this.noticeFlage = true;
}
},
async im() {
// 访Token
let accessToken = this.getStore("accessToken");
await this.getIMDetailMethods();
if (!accessToken) {
this.$Message.error("请登录后再联系客服");
return;
}
window.open(this.IMLink + "?token=" + accessToken);
},
// im
async getIMDetailMethods() {
let res = await getIMDetail();
if (res.success) {
this.IMLink = res.result;
}
},
//
async getHomeData() {
let res = await getSellerHomeData();