parent
b9ff01e056
commit
16391a2eef
@ -0,0 +1,235 @@ |
||||
*** Begin Patch |
||||
*** Update File: D:\code\taibao\customAgent\src\views\chat.vue |
||||
@@ -421,10 +421,14 @@ |
||||
} |
||||
} |
||||
-// 北极星SDK鉴权 |
||||
-function initBxSDK() { |
||||
+ |
||||
+// 北极星SDK鉴权 |
||||
+const initBxSDK = () => { |
||||
setConfig({ |
||||
url: isProd() ? "life-open.cpic.com.cn/fop/ui/poc/shumeng/h5" : "life-open-sit.cpic.com.cn/fop/ui/poc/shumeng/h5", |
||||
deb: "false", |
||||
}) |
||||
} |
||||
- // 异步微信鉴权方法 |
||||
- function async initWxAuth(versionNo1) { |
||||
+ |
||||
+// 异步微信鉴权方法 |
||||
+const initWxAuth = async (versionNo1) => { |
||||
try { |
||||
- // 异步获取微信配置参数 |
||||
- const res = await this.getWxAuthConfig(versionNo1); |
||||
+ // 异步获取微信配置参数 |
||||
+ const res = await getWxAuthConfig(versionNo1); |
||||
if (!res.success) { |
||||
@@ -459,8 +463,9 @@ |
||||
} |
||||
} |
||||
|
||||
- // 获取微信鉴权配置参数 |
||||
- function async getWxAuthConfig(versionNo1) { |
||||
+// 获取微信鉴权配置参数 |
||||
+const getWxAuthConfig = async (versionNo1) => { |
||||
const v1 = versionNo1 |
||||
try { |
||||
@@ -471,3 +476,3 @@ |
||||
const encryptUrl = Encrypt(key, iv, url) |
||||
- const response = await this.("thirdPartyAuth/getGwResultByUrl", { |
||||
+ const response = await Post("thirdPartyAuth/getGwResultByUrl", { |
||||
url: encryptUrl |
||||
@@ -486,48 +491,35 @@ |
||||
|
||||
// 微信鉴权成功后的回调 |
||||
-function onWxAuthSuccess() { |
||||
+const onWxAuthSuccess = () => { |
||||
console.log('微信鉴权成功'); |
||||
- Toast('wx.ready回调') |
||||
+ showToast('wx.ready回调') |
||||
} |
||||
-function disableShare() { |
||||
- var that = this; |
||||
+ |
||||
+const disableShare = () => { |
||||
try { |
||||
//禁止分享 |
||||
if (typeof WeixinJSBridge == "undefined") { |
||||
if (document.addEventListener) { |
||||
document.addEventListener( |
||||
"WeixinJSBridgeReady", |
||||
- that.onBridgeReady(), |
||||
+ onBridgeReady, |
||||
false |
||||
); |
||||
} else if (document.attachEvent) { |
||||
- document.attachEvent("WeixinJSBridgeReady", that.onBridgeReady()); |
||||
- document.attachEvent("onWeixinJSBridgeReady", that.onBridgeReady()); |
||||
+ document.attachEvent("WeixinJSBridgeReady", onBridgeReady); |
||||
+ document.attachEvent("onWeixinJSBridgeReady", onBridgeReady); |
||||
} |
||||
} else { |
||||
- that.onBridgeReady(); |
||||
+ onBridgeReady(); |
||||
} |
||||
} catch (error) { |
||||
console.log("禁止分享hideOptionMenu", error.message); |
||||
} |
||||
} |
||||
-function onBridgeReady() { |
||||
+ |
||||
+const onBridgeReady = () => { |
||||
WeixinJSBridge.call("hideOptionMenu"); |
||||
} |
||||
-//链接人工客服 |
||||
-function transferLabor() { |
||||
- var that = this; |
||||
- let sendParmas = { |
||||
- reqAndResType: "1", //1文本 2图片 3问提评价 |
||||
- msgType: "01", //01文本 02图片 |
||||
- msgText: "转接寿险人工客服", |
||||
- msgSource: this.manualService, //1机器人 2人工 |
||||
- cmd: "ZJSXRGFW", |
||||
- // qaId: item.qaId, // 2022.03需求记录 |
||||
- }; |
||||
- |
||||
- // let current = event.currentTarget; |
||||
- |
||||
- //统计转人工 8月28日 |
||||
- // this.statisticsTransferLabor(item); |
||||
- |
||||
- // 如果当前websocket链接已存在 |
||||
- if ( |
||||
- this.. && |
||||
- this...readyState != this...CLOSED |
||||
- ) { |
||||
- // console.log(res) |
||||
- Toast("当前已经在人工会话中"); |
||||
- // current.disabled = true; |
||||
- return; |
||||
- } |
||||
- |
||||
- //http接口 |
||||
- var transferToast = Toast.loading({ |
||||
- message: "转接中...", |
||||
- duration: 0, |
||||
- loadingType: "spinner", |
||||
- forbidClick: true, |
||||
- }); |
||||
- |
||||
- this. |
||||
- .dispatch("transferCustomer", sendParmas) |
||||
- .then((res) => { |
||||
- transferToast.clear(); |
||||
- // console.log(res) |
||||
- // current.disabled = true; |
||||
- // //用户行为统计 start |
||||
- // this.getUserBehavior(item.qaId, '5', 'ZJSXRGFW'); // 延期 |
||||
- // //用户行为统计 end |
||||
- |
||||
- //我要转人工 |
||||
- if (res.cmd === "ZJSXRGFWCONNECTION") { |
||||
- //初始化websocket 如果当前还是机器人 |
||||
- that.setWebsocket(); //转人工 |
||||
- return; |
||||
- } |
||||
- |
||||
- //其他消息 直接展示消息列表中 |
||||
- this.set_chatList(res); |
||||
- //滚动到底部 |
||||
- this.scrollTopBody(); |
||||
- }) |
||||
- .catch((err) => { |
||||
- transferToast.clear(); |
||||
- console.log(err); |
||||
- }); |
||||
-} |
||||
-//建立websocket |
||||
-function setWebsocket() { |
||||
- var that = this; |
||||
- try { |
||||
- //http接口 |
||||
- var socketToast = Toast.loading({ |
||||
- message: "连接中...", |
||||
- duration: 0, |
||||
- loadingType: "spinner", |
||||
- forbidClick: true, |
||||
- }); |
||||
- |
||||
- //建立websocket |
||||
- this..initWebSocket(() => { |
||||
- that. |
||||
- .dispatch("setConnectToEasemob") |
||||
- .then((res) => { |
||||
- socketToast.clear(); |
||||
- // if(res.connection){//机器人转人工 |
||||
- // that.set_manualService(res.msgSource); |
||||
- // } |
||||
- |
||||
- // //用户行为统计 start |
||||
- // that.getUserBehavior(item.qaId, "5", "ZJSXRGFW"); |
||||
- // //用户行为统计 end |
||||
- }) |
||||
- .catch((err) => { |
||||
- socketToast.clear(); |
||||
- console.log(err); |
||||
- }); |
||||
- }); |
||||
- } catch (err) { |
||||
- console.log(err.message); |
||||
- } |
||||
-} |
||||
-function scrollTopBody() { |
||||
- setTimeout(() => { |
||||
- //滚动到底部 |
||||
- try { |
||||
- this.mescrollContent.scrollTop = |
||||
- this.mescrollContent.scrollHeight || 0; |
||||
- } catch (error) { |
||||
- console.log(error.message); |
||||
- } |
||||
- }, 300); |
||||
-} |
||||
-function loadSdk(){ |
||||
+ |
||||
+// 加载SDK |
||||
+const loadSdk = () => { |
||||
const script = document.createElement('script'); |
||||
- this.("config/mydConfig", {}) |
||||
+ Post("config/mydConfig", {}) |
||||
.then((res) => { |
||||
@@ -538,3 +530,3 @@ |
||||
script.onload = () => { |
||||
- this.set_sdkLoaded(true) |
||||
+ store.set_sdkLoaded?.(true) |
||||
console.log('SDK successed'); |
||||
@@ -549,5 +541,6 @@ |
||||
}) |
||||
} |
||||
-//获取高温用户弹窗数据 |
||||
-function getHotUserData(){ |
||||
- this.("product/tip/select") |
||||
+ |
||||
+// 获取高温用户弹窗数据 |
||||
+const getHotUserData = () => { |
||||
+ Get("product/tip/select") |
||||
.then((res) => { |
||||
@@ -559,3 +552,3 @@ |
||||
if (res.data.rhetoricString && res.data.productTipEntityList.length > 0) { |
||||
- this.set_hotUserData(hotUserData); |
||||
+ store.set_hotUserData?.(hotUserData); |
||||
} |
||||
@@ -563,7 +556,7 @@ |
||||
const now = new Date(); |
||||
const clickTime = \-\-\ \:\:\; |
||||
- const userId = this.userId; |
||||
- const source = this.source; |
||||
- const sessionId = this.sessionId; |
||||
+ const userId = store.userId; |
||||
+ const source = store.source; |
||||
+ const sessionId = store.sessionId; |
||||
// 调用埋点接口 |
||||
- this.("product/record/save", { |
||||
+ Post("product/record/save", { |
||||
userId: userId, |
||||
*** End Patch |
||||
@ -0,0 +1,125 @@ |
||||
<script setup> |
||||
import { ref, computed, inject, watch, nextTick, onMounted } from 'vue' |
||||
import { showToast } from 'vant'; |
||||
import { Post } from '@/utils/https' |
||||
const store = inject('appStore', null) |
||||
const questionList = ref([]) |
||||
const initHotQuestion = async () => { |
||||
let param = { |
||||
userInfoId: store.userId || '', |
||||
category: 3, |
||||
source: store.source || '', |
||||
planCode: store.planCode || '', |
||||
sceneId: store.userInfo.sceneId || "", |
||||
}; |
||||
|
||||
Post("config/activity", param) |
||||
.then((res) => { |
||||
if (res.code && res.code != 0) { |
||||
showToast(res.msg); |
||||
return; |
||||
} |
||||
questionList.value = (res?.data || []).slice(0,3); |
||||
// this.renderR(); |
||||
// this.initViewState(); |
||||
// 获取一体化领取后更新hotList重新更新 |
||||
// this.initHotQuestionYTH((ythRes) => { |
||||
// if (Array.isArray(ythRes) && Array.isArray(questionList.value)) { |
||||
// // 合并数组并根据name去重 |
||||
// // const mergedList = [...ythRes,...this.hotList] |
||||
// // const uniqueMap = new Map() |
||||
// // mergedList.forEach(item => { |
||||
// // // 使用name作为唯一标识符,如果已存在则不覆盖(保留第一次出现的) |
||||
// // if(!uniqueMap.has(item.name)){ |
||||
// // uniqueMap.set(item.name, item) |
||||
// // } |
||||
// // }) |
||||
// // this.hotList = Array.from(uniqueMap.values()) |
||||
// questionList.value = [...ythRes, ...questionList.value] |
||||
// } |
||||
// this.renderR(); |
||||
// this.initViewState(); |
||||
// }) |
||||
}) |
||||
.catch((error) => { |
||||
console.log(error); |
||||
}); |
||||
} |
||||
const handleAskClick=(record)=>{ |
||||
// store.setAskRecord(record) |
||||
} |
||||
onMounted(async () => { |
||||
await initHotQuestion() |
||||
}) |
||||
</script> |
||||
<template> |
||||
<div class="ask-con"> |
||||
<div class="item" v-for="(item, index) in questionList" :key="index" @click="handleAskClick(item)"> |
||||
<div class="icon"><span>#</span></div> |
||||
<span>{{ item.name }}</span> |
||||
<img src="@/assets/images/chat/line.svg" alt="" /> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<style scoped lang="scss"> |
||||
.ask-con { |
||||
display: flex; |
||||
flex-direction: column; |
||||
gap: 10rem; |
||||
margin-top: 16rem; |
||||
|
||||
.item { |
||||
border-radius: 24rem; |
||||
display: flex; |
||||
// flex-direction: column; |
||||
// justify-content: center; |
||||
padding: 6rem 16rem 6rem 6rem; |
||||
gap: 12rem; |
||||
|
||||
background: #f9fbff; |
||||
|
||||
box-sizing: border-box; |
||||
border: 1rem solid rgba(255, 255, 255, 0.9); |
||||
width: fit-content; |
||||
cursor: pointer; |
||||
|
||||
.icon { |
||||
width: 30rem; |
||||
height: 30rem; |
||||
min-width: 30rem; |
||||
border-radius: 186rem; |
||||
opacity: 1; |
||||
|
||||
background: #fcfdfd; |
||||
|
||||
box-shadow: 0rem 4rem 10rem 0rem #e7effd; |
||||
text-align: center; |
||||
|
||||
span { |
||||
line-height: 30rem; |
||||
font-size: 14rem; |
||||
font-variation-settings: 'opsz' auto; |
||||
background: linear-gradient(100deg, #38afff 27%, #025cea 101%); |
||||
font-weight: 600; |
||||
-webkit-background-clip: text; |
||||
-webkit-text-fill-color: transparent; |
||||
background-clip: text; |
||||
text-fill-color: transparent; |
||||
display: inline-block; |
||||
} |
||||
} |
||||
|
||||
>span { |
||||
font-family: PingFang SC; |
||||
font-size: 14rem; |
||||
font-weight: normal; |
||||
line-height: 31rem; |
||||
letter-spacing: 0rem; |
||||
|
||||
/* 科个中性/正文-标题 17204D */ |
||||
/* 样式描述:用于正文标题 */ |
||||
color: #17204d; |
||||
} |
||||
} |
||||
} |
||||
</style> |
||||
@ -0,0 +1,28 @@ |
||||
import sensors from 'sa-sdk-javascript' |
||||
|
||||
// 神策埋点 初始化全局
|
||||
let server_url = 'https://sc.cpic.com.cn/sa?project=SXTOC';// 生产环境环境神策接入地址
|
||||
let host = window.location.host; |
||||
const ISLOG = ['production', 'prod'].includes(process.env.NODE_ENV); |
||||
|
||||
if (host.indexOf('uat') > -1 || host.indexOf('sit') > -1 || host.indexOf('localhost') > -1) { |
||||
server_url = 'https://sc-sit.cpic.com.cn:443/sa?project=SXXT' // 测试环境神策接入地址
|
||||
} |
||||
|
||||
console.log("神策接入地址环境", server_url); |
||||
sensors.init({ |
||||
server_url: server_url, |
||||
is_track_single_page: true, // 单页应用页面浏览事件采集(url改变就触发)
|
||||
show_log: false, // 控制台显示数据开
|
||||
heatmap: { |
||||
//是否开启点击图,default 表示开启,自动采集 $WebClick 事件,可以设置 'not_collect' 表示关闭。
|
||||
clickmap: 'default', |
||||
//是否开启触达注意力图,not_collect 表示关闭,不会自动采集 $WebStay 事件,可以设置 'default' 表示开启。
|
||||
scroll_notice_map: 'default' |
||||
} |
||||
}); |
||||
|
||||
sensors.quick('autoTrack') // 首次触发页面加载事件 $pageview
|
||||
|
||||
|
||||
export default sensors |
||||
Loading…
Reference in new issue