|
|
|
|
@ -1,5 +1,5 @@ |
|
|
|
|
import { defineStore } from 'pinia' |
|
|
|
|
import { computed, ref } from 'vue' |
|
|
|
|
import { ref } from 'vue' |
|
|
|
|
|
|
|
|
|
import { Toast, Dialog } from 'vant' |
|
|
|
|
import { fetchPost, upLoadImgHttp } from '@/utils/https' |
|
|
|
|
@ -8,16 +8,19 @@ import FormatDate from '@/utils/filters' |
|
|
|
|
import utils from '@/utils/utils' |
|
|
|
|
import { Decryption, DecryptionECB, Encrypt } from '@/utils' |
|
|
|
|
import _ from 'lodash' |
|
|
|
|
|
|
|
|
|
// 幂等键统一采用用户消息前缀,便于和后端日志对齐排查。
|
|
|
|
|
const createIdempotentKey = () => `user_msg_${Date.now()}` |
|
|
|
|
export const UPDATE_DIRECTION = 'UPDATE_DIRECTION' |
|
|
|
|
let token = sessionStorage.token ? sessionStorage.token : '' |
|
|
|
|
let userId = localStorage.userId ? localStorage.userId : '' |
|
|
|
|
let source = localStorage.source ? localStorage.source : '' |
|
|
|
|
let planCode = localStorage.planCode ? localStorage.planCode : '' |
|
|
|
|
let entrance = localStorage.entrance ? localStorage.entrance : '' |
|
|
|
|
|
|
|
|
|
// —— 模块级初始值(加 initial 前缀,避免与 setup 内同名 ref 产生 TDZ/遮蔽问题)——
|
|
|
|
|
const initialToken = sessionStorage.token ? sessionStorage.token : '' |
|
|
|
|
const initialUserId = localStorage.userId ? localStorage.userId : '' |
|
|
|
|
const initialSource = localStorage.source ? localStorage.source : '' |
|
|
|
|
const initialPlanCode = localStorage.planCode ? localStorage.planCode : '' |
|
|
|
|
const initialEntrance = localStorage.entrance ? localStorage.entrance : '' |
|
|
|
|
// 取到身份证后解密
|
|
|
|
|
let userInfo = localStorage.userInfo ? JSON.parse(localStorage.userInfo) : {} |
|
|
|
|
const initialUserInfo = localStorage.userInfo ? JSON.parse(localStorage.userInfo) : {} |
|
|
|
|
// try {
|
|
|
|
|
// if(!!userInfo.versionNo1){
|
|
|
|
|
// const year = new Date().getFullYear()
|
|
|
|
|
@ -33,61 +36,62 @@ let userInfo = localStorage.userInfo ? JSON.parse(localStorage.userInfo) : {} |
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } catch (error) { }
|
|
|
|
|
let configId = localStorage.configId ? localStorage.configId : '' |
|
|
|
|
let sessionId = localStorage.sessionId ? localStorage.sessionId : '' |
|
|
|
|
|
|
|
|
|
let auStatus = localStorage.auStatus ? localStorage.auStatus : '' |
|
|
|
|
let bStatus = localStorage.bStatus ? localStorage.bStatus : '' |
|
|
|
|
let bthdate = localStorage.bthdate ? localStorage.bthdate : '' |
|
|
|
|
let workNum = localStorage.workNum ? localStorage.workNum : '' |
|
|
|
|
let htmlExtParams = localStorage.htmlExtParams ? localStorage.htmlExtParams : '' |
|
|
|
|
let complaint = localStorage.complaint ? localStorage.complaint : '' |
|
|
|
|
let navigationCorpus = localStorage.navigationCorpus ? localStorage.navigationCorpus : '' |
|
|
|
|
|
|
|
|
|
// let manualService = sessionStorage.manualService ? sessionStorage.manualService : ''; //1机器人 2人工
|
|
|
|
|
let headerAvatar = localStorage.headerAvatar ? JSON.parse(localStorage.headerAvatar) : {} |
|
|
|
|
let sysConfig = localStorage.sysConfig ? localStorage.sysConfig : '' |
|
|
|
|
let isLeaveMessageSuccess = sessionStorage.isLeaveMessageSuccess |
|
|
|
|
const initialConfigId = localStorage.configId ? localStorage.configId : '' |
|
|
|
|
const initialSessionId = localStorage.sessionId ? localStorage.sessionId : '' |
|
|
|
|
|
|
|
|
|
const initialHtmlExtParams = localStorage.htmlExtParams ? localStorage.htmlExtParams : '' |
|
|
|
|
const initialComplaint = localStorage.complaint ? localStorage.complaint : '' |
|
|
|
|
const initialNavigationCorpus = localStorage.navigationCorpus ? localStorage.navigationCorpus : '' |
|
|
|
|
|
|
|
|
|
const initialHeaderAvatar = localStorage.headerAvatar ? JSON.parse(localStorage.headerAvatar) : {} |
|
|
|
|
const initialSysConfig = localStorage.sysConfig ? localStorage.sysConfig : '' |
|
|
|
|
const initialIsLeaveMessageSuccess = sessionStorage.isLeaveMessageSuccess |
|
|
|
|
? sessionStorage.isLeaveMessageSuccess |
|
|
|
|
: false //留言是否成功
|
|
|
|
|
|
|
|
|
|
// 聊天消息 数据
|
|
|
|
|
let chatList = localStorage.chatList ? JSON.parse(localStorage.chatList) : [] |
|
|
|
|
const initialChatList = localStorage.chatList ? JSON.parse(localStorage.chatList) : [] |
|
|
|
|
|
|
|
|
|
const initialSendMessageList = localStorage.sendMessageList |
|
|
|
|
? JSON.parse(localStorage.sendMessageList) |
|
|
|
|
: [] |
|
|
|
|
|
|
|
|
|
let sendMessageList = localStorage.sendMessageList ? JSON.parse(localStorage.sendMessageList) : [] |
|
|
|
|
let receiveMessageList = localStorage.receiveMessageList |
|
|
|
|
const initialReceiveMessageList = localStorage.receiveMessageList |
|
|
|
|
? JSON.parse(localStorage.receiveMessageList) |
|
|
|
|
: [] |
|
|
|
|
|
|
|
|
|
export const useAppStore = defineStore('app', () => { |
|
|
|
|
// Session 相关状态(原 apiState)
|
|
|
|
|
const token = ref(token) |
|
|
|
|
const userId = ref(userId) |
|
|
|
|
const configId = ref(configId) |
|
|
|
|
const sessionId = ref(sessionId) |
|
|
|
|
const source = ref(source) |
|
|
|
|
const planCode = ref(planCode) |
|
|
|
|
const entrance = ref(entrance) |
|
|
|
|
const token = ref(initialToken) |
|
|
|
|
const userId = ref(initialUserId) |
|
|
|
|
const configId = ref(initialConfigId) |
|
|
|
|
const sessionId = ref(initialSessionId) |
|
|
|
|
const source = ref(initialSource) |
|
|
|
|
const planCode = ref(initialPlanCode) |
|
|
|
|
const entrance = ref(initialEntrance) |
|
|
|
|
const elder = ref(true) |
|
|
|
|
const headerAvatar = ref(headerAvatar) |
|
|
|
|
const htmlExtParams = ref(htmlExtParams) |
|
|
|
|
const complaint = ref(complaint) |
|
|
|
|
const navigationCorpus = ref(navigationCorpus) |
|
|
|
|
const notitle = ref('') |
|
|
|
|
const userInfo = ref(initialUserInfo) |
|
|
|
|
const sysConfig = ref(initialSysConfig) |
|
|
|
|
const headerAvatar = ref(initialHeaderAvatar) |
|
|
|
|
const htmlExtParams = ref(initialHtmlExtParams) |
|
|
|
|
const complaint = ref(initialComplaint) |
|
|
|
|
const navigationCorpus = ref(initialNavigationCorpus) |
|
|
|
|
const routeAction = ref('push') |
|
|
|
|
const direction = ref('forward') |
|
|
|
|
const mescrollContent = ref('') |
|
|
|
|
const isLeaveMessage = ref(false) |
|
|
|
|
const isLeaveMessageSuccess = ref(isLeaveMessageSuccess) |
|
|
|
|
const isLeaveMessageSuccess = ref(initialIsLeaveMessageSuccess) |
|
|
|
|
const manualService = ref(1) |
|
|
|
|
const queuedTimeout = ref(false) |
|
|
|
|
const sendLoading = ref(false) |
|
|
|
|
const isSendSuccess = ref(false) |
|
|
|
|
const timestamp = ref(0) |
|
|
|
|
const sendParmas = ref({}) |
|
|
|
|
const chatList = ref(chatList) |
|
|
|
|
const sendMessageList = ref(sendMessageList) |
|
|
|
|
const receiveMessageList = ref(receiveMessageList) |
|
|
|
|
const chatId = ref(chatId) |
|
|
|
|
const chatList = ref(initialChatList) |
|
|
|
|
const sendMessageList = ref(initialSendMessageList) |
|
|
|
|
const receiveMessageList = ref(initialReceiveMessageList) |
|
|
|
|
const chatId = ref('') |
|
|
|
|
const currentItemId = ref('') |
|
|
|
|
const issubmit = ref(true) |
|
|
|
|
const otherTips = ref('') |
|
|
|
|
@ -120,397 +124,435 @@ export const useAppStore = defineStore('app', () => { |
|
|
|
|
const isBqCalcClaim = ref(false) |
|
|
|
|
const msgReply = ref(true) |
|
|
|
|
const hotUserData = ref(null) |
|
|
|
|
const branchCompany = ref('') |
|
|
|
|
|
|
|
|
|
function setIsBqCalcClaim(isBqCalcClaim) { |
|
|
|
|
isBqCalcClaim.value = isBqCalcClaim |
|
|
|
|
// —— Session ——
|
|
|
|
|
function setIsBqCalcClaim(payload) { |
|
|
|
|
isBqCalcClaim.value = payload |
|
|
|
|
} |
|
|
|
|
function set_token(token) { |
|
|
|
|
token.value = token |
|
|
|
|
|
|
|
|
|
function setToken(payload) { |
|
|
|
|
token.value = payload |
|
|
|
|
try { |
|
|
|
|
sessionStorage.token = token |
|
|
|
|
sessionStorage.token = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_sessionId(sessionId) { |
|
|
|
|
sessionId.value = sessionId |
|
|
|
|
|
|
|
|
|
function setSessionId(payload) { |
|
|
|
|
sessionId.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.sessionId = sessionId |
|
|
|
|
localStorage.sessionId = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_configId(configId) { |
|
|
|
|
configId.value = configId |
|
|
|
|
|
|
|
|
|
function setConfigId(payload) { |
|
|
|
|
configId.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.configId = configId |
|
|
|
|
localStorage.configId = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_appentry(appentry) { |
|
|
|
|
appentry.value = appentry |
|
|
|
|
|
|
|
|
|
function setAppentry(payload) { |
|
|
|
|
appentry.value = payload |
|
|
|
|
} |
|
|
|
|
function set_bpErrorInfo(bpErrorInfo) { |
|
|
|
|
bpErrorInfo.value = bpErrorInfo |
|
|
|
|
|
|
|
|
|
function setBpErrorInfo(payload) { |
|
|
|
|
bpErrorInfo.value = payload |
|
|
|
|
} |
|
|
|
|
function del_token() { |
|
|
|
|
|
|
|
|
|
function delToken() { |
|
|
|
|
token.value = '' |
|
|
|
|
} |
|
|
|
|
function set_userid(userId) { |
|
|
|
|
userId.value = userId |
|
|
|
|
try { |
|
|
|
|
localStorage.userId = userId |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_sessionId(sessionId) { |
|
|
|
|
sessionId.value = sessionId |
|
|
|
|
try { |
|
|
|
|
localStorage.sessionId = sessionId |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_configId(configId) { |
|
|
|
|
configId.value = configId |
|
|
|
|
|
|
|
|
|
function setUserId(payload) { |
|
|
|
|
userId.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.configId = configId |
|
|
|
|
localStorage.userId = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_source(source) { |
|
|
|
|
source.value = source |
|
|
|
|
|
|
|
|
|
function setSource(payload) { |
|
|
|
|
source.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.source = source |
|
|
|
|
localStorage.source = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_notitle(notitle) { |
|
|
|
|
notitle.value = notitle |
|
|
|
|
|
|
|
|
|
function setNotitle(payload) { |
|
|
|
|
notitle.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.notitle = notitle |
|
|
|
|
localStorage.notitle = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_elder(elder) { |
|
|
|
|
elder.value = elder |
|
|
|
|
|
|
|
|
|
function setElder(payload) { |
|
|
|
|
elder.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.elder = elder |
|
|
|
|
localStorage.elder = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_plan_code(planCode) { |
|
|
|
|
planCode.value = planCode |
|
|
|
|
|
|
|
|
|
function setPlanCode(payload) { |
|
|
|
|
planCode.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.planCode = planCode |
|
|
|
|
localStorage.planCode = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_entrance(entrance) { |
|
|
|
|
entrance.value = entrance |
|
|
|
|
|
|
|
|
|
function setEntrance(payload) { |
|
|
|
|
entrance.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.entrance = entrance |
|
|
|
|
localStorage.entrance = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_userInfo(userInfo) { |
|
|
|
|
userInfo.value = userInfo |
|
|
|
|
|
|
|
|
|
function setUserInfo(payload) { |
|
|
|
|
userInfo.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.userInfo = JSON.stringify(userInfo) |
|
|
|
|
localStorage.userInfo = JSON.stringify(payload) |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_htmlExtParams(htmlExtParams) { |
|
|
|
|
htmlExtParams.value = htmlExtParams |
|
|
|
|
|
|
|
|
|
function setHtmlExtParams(payload) { |
|
|
|
|
htmlExtParams.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.htmlExtParams = htmlExtParams |
|
|
|
|
localStorage.htmlExtParams = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_complaint(complaint) { |
|
|
|
|
complaint.value = complaint |
|
|
|
|
|
|
|
|
|
function setComplaint(payload) { |
|
|
|
|
complaint.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.complaint = complaint |
|
|
|
|
localStorage.complaint = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_navigationCorpus(navigationCorpus) { |
|
|
|
|
navigationCorpus.value = navigationCorpus |
|
|
|
|
|
|
|
|
|
function setNavigationCorpus(payload) { |
|
|
|
|
navigationCorpus.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.navigationCorpus = navigationCorpus |
|
|
|
|
localStorage.navigationCorpus = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_manualService(manualService) { |
|
|
|
|
manualService.value = manualService |
|
|
|
|
|
|
|
|
|
function setManualService(payload) { |
|
|
|
|
manualService.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.manualService = JSON.stringify(manualService) |
|
|
|
|
localStorage.manualService = JSON.stringify(payload) |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_sysConfig(sysConfig) { |
|
|
|
|
sysConfig.value = sysConfig |
|
|
|
|
|
|
|
|
|
function setSysConfig(payload) { |
|
|
|
|
sysConfig.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.sysConfig = JSON.stringify(sysConfig) |
|
|
|
|
localStorage.sysConfig = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_headerAvatar(headerAvatar) { |
|
|
|
|
headerAvatar.value = headerAvatar |
|
|
|
|
|
|
|
|
|
function setHeaderAvatar(payload) { |
|
|
|
|
headerAvatar.value = payload |
|
|
|
|
try { |
|
|
|
|
localStorage.headerAvatar = JSON.stringify(headerAvatar) |
|
|
|
|
localStorage.headerAvatar = JSON.stringify(payload) |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_sendLoading(sendLoading) { |
|
|
|
|
sendLoading.value = sendLoading |
|
|
|
|
|
|
|
|
|
// —— 消息发送状态 ——
|
|
|
|
|
function setSendLoading(payload) { |
|
|
|
|
sendLoading.value = payload |
|
|
|
|
} |
|
|
|
|
function set_isSendSuccess(isSendSuccess) { |
|
|
|
|
isSendSuccess.value = isSendSuccess |
|
|
|
|
|
|
|
|
|
function setIsSendSuccess(payload) { |
|
|
|
|
isSendSuccess.value = payload |
|
|
|
|
} |
|
|
|
|
function set_qaId(qaId) { |
|
|
|
|
qaId.value = qaId |
|
|
|
|
|
|
|
|
|
function setQaId(payload) { |
|
|
|
|
qaId.value = payload |
|
|
|
|
} |
|
|
|
|
function set_problemFeedback(problemFeedback) { |
|
|
|
|
problemFeedback.value = problemFeedback |
|
|
|
|
|
|
|
|
|
function setProblemFeedback(payload) { |
|
|
|
|
problemFeedback.value = payload |
|
|
|
|
} |
|
|
|
|
function set_otherTips(otherTips) { |
|
|
|
|
otherTips.value = otherTips |
|
|
|
|
|
|
|
|
|
function setOtherTips(payload) { |
|
|
|
|
otherTips.value = payload |
|
|
|
|
} |
|
|
|
|
function set_lastMessage(lastMessage) { |
|
|
|
|
lastMessage.value = lastMessage |
|
|
|
|
|
|
|
|
|
function setLastMessage(payload) { |
|
|
|
|
lastMessage.value = payload |
|
|
|
|
} |
|
|
|
|
function set_sendFailList(sendFailList) { |
|
|
|
|
sendFailList.value.push(sendFailList) |
|
|
|
|
|
|
|
|
|
function setSendFailList(payload) { |
|
|
|
|
sendFailList.value.push(payload) |
|
|
|
|
} |
|
|
|
|
function set_isLostMessage(isLostMessage) { |
|
|
|
|
isLostMessage.value = isLostMessage |
|
|
|
|
|
|
|
|
|
function setIsLostMessage(payload) { |
|
|
|
|
isLostMessage.value = payload |
|
|
|
|
} |
|
|
|
|
function del_sendFailList(delSendFailList) { |
|
|
|
|
sendFailList.value = delSendFailList |
|
|
|
|
|
|
|
|
|
function delSendFailList(payload) { |
|
|
|
|
sendFailList.value = payload |
|
|
|
|
} |
|
|
|
|
function set_leaveMessage(leaveMessage) { |
|
|
|
|
leaveMessage.value = leaveMessage |
|
|
|
|
|
|
|
|
|
function setLeaveMessage(payload) { |
|
|
|
|
isLeaveMessage.value = payload |
|
|
|
|
} |
|
|
|
|
function set_isLeaveMessageSuccess(leaveMessage) { |
|
|
|
|
isLeaveMessageSuccess.value = isLeaveMessageSuccess |
|
|
|
|
|
|
|
|
|
function setIsLeaveMessageSuccess(payload) { |
|
|
|
|
isLeaveMessageSuccess.value = payload |
|
|
|
|
try { |
|
|
|
|
sessionStorage.isLeaveMessageSuccess = isLeaveMessageSuccess |
|
|
|
|
sessionStorage.isLeaveMessageSuccess = payload |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function set_mescrollContent(mescrollContent) { |
|
|
|
|
mescrollContent.value = mescrollContent |
|
|
|
|
function setMescrollContent(payload) { |
|
|
|
|
mescrollContent.value = payload |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function setSendMessageList(payload) { |
|
|
|
|
sendMessageList.value = payload |
|
|
|
|
} |
|
|
|
|
function set_sendMessageList(sendMessageList) { |
|
|
|
|
sendMessageList.value = sendMessageList |
|
|
|
|
|
|
|
|
|
function setReceiveMessageList(payload) { |
|
|
|
|
receiveMessageList.value = payload |
|
|
|
|
} |
|
|
|
|
function set_receiveMessageList(receiveMessageList) { |
|
|
|
|
receiveMessageList.value = receiveMessageList |
|
|
|
|
|
|
|
|
|
function setTts(payload) { |
|
|
|
|
tts.value = payload |
|
|
|
|
} |
|
|
|
|
function set_tts(tts) { |
|
|
|
|
tts.value = tts |
|
|
|
|
|
|
|
|
|
function setHxOpenSuccesed(payload) { |
|
|
|
|
hxOpenSucceseds.value = payload |
|
|
|
|
} |
|
|
|
|
function set_hxOpenSuccesed(sendMessageList) { |
|
|
|
|
sendMessageList.value = sendMessageList |
|
|
|
|
|
|
|
|
|
function setTimestamp(payload) { |
|
|
|
|
timestamp.value = payload |
|
|
|
|
} |
|
|
|
|
function addSendMessageList(sendMessageList) { |
|
|
|
|
sendMessageList.value = sendMessageList |
|
|
|
|
|
|
|
|
|
function setSendParmas(payload) { |
|
|
|
|
sendParmas.value = payload |
|
|
|
|
} |
|
|
|
|
function set_sendMessageList(sendMessageList) { |
|
|
|
|
sendMessageList.value = sendMessageList |
|
|
|
|
|
|
|
|
|
function setQueuedTimeout(payload) { |
|
|
|
|
queuedTimeout.value = payload |
|
|
|
|
} |
|
|
|
|
function addSendMessageList(sendMessageList) { |
|
|
|
|
sendMessage = sendMessage || {} |
|
|
|
|
console.log("接收发送的消息===", sendMessage); |
|
|
|
|
|
|
|
|
|
// 存储发送的消息到 chatList
|
|
|
|
|
function addSendMessageList(payload = {}) { |
|
|
|
|
console.log('接收发送的消息===', payload) |
|
|
|
|
|
|
|
|
|
sendParmas.value = { |
|
|
|
|
token: token.value, |
|
|
|
|
fromFlag: sendMessage.fromFlag || 1, // 1为自己 2为其他 other提示消息
|
|
|
|
|
fromFlag: payload.fromFlag || 1, // 1为自己 2为其他 other提示消息
|
|
|
|
|
userId: userId.value, |
|
|
|
|
sessionId: sessionId.value, |
|
|
|
|
reqAndResType: sendMessage.reqAndResType, // 1文本 2图片 3问提评价
|
|
|
|
|
msgType: sendMessage.msgType || '', //
|
|
|
|
|
msgText: sendMessage.msgText, |
|
|
|
|
file: sendMessage.file || '', |
|
|
|
|
filename: sendMessage.filename || '', |
|
|
|
|
formData: sendMessage.formData || '', |
|
|
|
|
reqAndResType: payload.reqAndResType, // 1文本 2图片 3问提评价
|
|
|
|
|
msgType: payload.msgType || '', |
|
|
|
|
msgText: payload.msgText, |
|
|
|
|
file: payload.file || '', |
|
|
|
|
filename: payload.filename || '', |
|
|
|
|
formData: payload.formData || '', |
|
|
|
|
source: source.value, |
|
|
|
|
timestamp: sendMessage.timestamp || (new Date()).valueOf(), |
|
|
|
|
timestamp: payload.timestamp || new Date().valueOf(), |
|
|
|
|
msgSource: manualService.value, // 1机器人 2人工
|
|
|
|
|
cmd: sendMessage.cmd || '', |
|
|
|
|
sendLoading: sendMessage.sendLoading, |
|
|
|
|
isSendSuccess: sendMessage.isSendSuccess, |
|
|
|
|
voiceNo: sendMessage.voiceNo, |
|
|
|
|
quoteData: sendMessage.quoteData || null |
|
|
|
|
cmd: payload.cmd || '', |
|
|
|
|
sendLoading: payload.sendLoading, |
|
|
|
|
isSendSuccess: payload.isSendSuccess, |
|
|
|
|
voiceNo: payload.voiceNo, |
|
|
|
|
quoteData: payload.quoteData || null, |
|
|
|
|
bpErrorContent: payload.bpErrorContent || '', // 电子回访断点服务
|
|
|
|
|
} |
|
|
|
|
console.log("发送消息==", sendParmas.value); |
|
|
|
|
console.log('发送消息==', sendParmas.value) |
|
|
|
|
|
|
|
|
|
timestamp.value = sendParmas.value.timestamp; |
|
|
|
|
timestamp.value = sendParmas.value.timestamp |
|
|
|
|
|
|
|
|
|
// 存储正在发送的那条数据
|
|
|
|
|
set_currentItemId(endParmas.timestamp) |
|
|
|
|
sendParmas.value.bpErrorContent = sendMessage.bpErrorContent || '', // 电子回访断点服务
|
|
|
|
|
|
|
|
|
|
chatList.value.push(sendParmas.value); |
|
|
|
|
// console.log("消息列表数据1==", chatList);
|
|
|
|
|
try { |
|
|
|
|
// localStorage.chatList = JSON.stringify(chatList)
|
|
|
|
|
setCurrentItemId(sendParmas.value.timestamp) |
|
|
|
|
|
|
|
|
|
// console.log("addSendMessageList==", chatList);
|
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
chatList.value.push(sendParmas.value) |
|
|
|
|
} |
|
|
|
|
function set_chatList(chatList) {// 消息列表
|
|
|
|
|
let normalizedItem = utils.normalizeMessage(chatList); |
|
|
|
|
chatList.value.push(normalizedItem); |
|
|
|
|
try { |
|
|
|
|
// localStorage.chatList = JSON.stringify(chatList)
|
|
|
|
|
// console.log("set_chatList==", chatList);
|
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 消息列表
|
|
|
|
|
function setChatList(payload) { |
|
|
|
|
const normalizedItem = utils.normalizeMessage(payload) |
|
|
|
|
chatList.value.push(normalizedItem) |
|
|
|
|
} |
|
|
|
|
function del_chatList(index) { |
|
|
|
|
|
|
|
|
|
function delChatList(index) { |
|
|
|
|
chatList.value.splice(index, 1) |
|
|
|
|
} |
|
|
|
|
function delall_chatList() { |
|
|
|
|
chatList.value.splice(0, chatList.value.length); |
|
|
|
|
|
|
|
|
|
function delAllChatList() { |
|
|
|
|
chatList.value.splice(0, chatList.value.length) |
|
|
|
|
} |
|
|
|
|
function del_set_sendFailList(del_Id) { |
|
|
|
|
|
|
|
|
|
function delSendFailListById(delId) { |
|
|
|
|
if (sendFailList.value && sendFailList.value.length > 0) { |
|
|
|
|
console.log('未删除前sendFailList===', sendFailList.value.length); |
|
|
|
|
sendFailList.value.forEach((item, index) => { |
|
|
|
|
|
|
|
|
|
if (del_Id === item.timestamp) { |
|
|
|
|
if (delId === item.timestamp) { |
|
|
|
|
sendFailList.value.splice(index, 1) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
console.log('删除后的数据sendFailList==', sendFailList.value.length); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 存储到消息队列中
|
|
|
|
|
function set_chatId(chatId) { |
|
|
|
|
chatId.value.push(chatId); |
|
|
|
|
// console.log("存储的消息chatId:", chatId)
|
|
|
|
|
function setChatId(payload) { |
|
|
|
|
chatId.value.push(payload) |
|
|
|
|
} |
|
|
|
|
function set_currentItemId(currentItemId) { |
|
|
|
|
currentItemId.value = currentItemId; |
|
|
|
|
// console.log("存储的消息chatId:", chatId)
|
|
|
|
|
|
|
|
|
|
function setCurrentItemId(payload) { |
|
|
|
|
currentItemId.value = payload |
|
|
|
|
} |
|
|
|
|
function set_findActiveItem(findActiveItem) { |
|
|
|
|
|
|
|
|
|
function setFindActiveItem(findActiveItem) { |
|
|
|
|
if (chatList.value && chatList.value.length > 0) { |
|
|
|
|
chatList.value.forEach(item => { |
|
|
|
|
chatList.value.forEach((item) => { |
|
|
|
|
if (currentItemId.value == item.timestamp) { |
|
|
|
|
item.isSendSuccess = findActiveItem; |
|
|
|
|
item.sendLoading = false; |
|
|
|
|
item.isSendSuccess = findActiveItem |
|
|
|
|
item.sendLoading = false |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_activeItemExtra(state, data) { |
|
|
|
|
|
|
|
|
|
function setActiveItemExtra(data) { |
|
|
|
|
if (chatList.value && chatList.value.length > 0) { |
|
|
|
|
chatList.value.forEach(item => { |
|
|
|
|
chatList.value.forEach((item) => { |
|
|
|
|
if (currentItemId.value == item.timestamp) { |
|
|
|
|
if (data && data.imgKey) { |
|
|
|
|
Vue.set(item, 'imgKey', data.imgKey); |
|
|
|
|
item.imgKey = data.imgKey |
|
|
|
|
} |
|
|
|
|
if (data && data.imgUrl) { |
|
|
|
|
Vue.set(item, 'imgUrl', data.imgUrl); |
|
|
|
|
item.imgUrl = data.imgUrl |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function set_reSendMessage(state, reSendMessageId) { |
|
|
|
|
if (chatList.value && chatList.value.length > 0) { |
|
|
|
|
|
|
|
|
|
function setReSendMessage(reSendMessageId) { |
|
|
|
|
if (chatList.value && chatList.value.length > 0) { |
|
|
|
|
chatList.value.forEach((item, index) => { |
|
|
|
|
if (reSendMessageId === item.timestamp) { |
|
|
|
|
chatList.value.splice(index, 1) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
del_set_sendFailList(reSendMessageId) |
|
|
|
|
delSendFailListById(reSendMessageId) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function scrollBottom() { |
|
|
|
|
setTimeout(() => { |
|
|
|
|
try { |
|
|
|
|
mescrollContent.value.scrollTop = mescrollContent.value.scrollHeight || 0; |
|
|
|
|
mescrollContent.value.scrollTop = mescrollContent.value.scrollHeight || 0 |
|
|
|
|
} catch (error) { |
|
|
|
|
console.log(error.message) |
|
|
|
|
} |
|
|
|
|
}, 500); |
|
|
|
|
}, 500) |
|
|
|
|
} |
|
|
|
|
// 页面是否后台了
|
|
|
|
|
function set_isBackstage(isBackstage) { |
|
|
|
|
isBackstage.value = isBackstage; |
|
|
|
|
|
|
|
|
|
// —— 其他状态 ——
|
|
|
|
|
function setIsBackstage(payload) { |
|
|
|
|
isBackstage.value = payload |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 存储语音
|
|
|
|
|
function set_VoiceData(payload) { |
|
|
|
|
voiceDataList.value.push(payload); |
|
|
|
|
function setVoiceData(payload) { |
|
|
|
|
voiceDataList.value.push(payload) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// sdk是否已加载好
|
|
|
|
|
function set_sdkLoaded(sdkLoaded) { |
|
|
|
|
sdkLoaded.value = sdkLoaded; |
|
|
|
|
function setSdkLoaded(payload) { |
|
|
|
|
sdkLoaded.value = payload |
|
|
|
|
} |
|
|
|
|
function set_isBackstage(isBackstage) { |
|
|
|
|
isBackstage.value = isBackstage; |
|
|
|
|
|
|
|
|
|
function setPcaData(payload) { |
|
|
|
|
pcaData.value = payload |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function set_pcaData(payload) { |
|
|
|
|
pcaData.value = payload; |
|
|
|
|
function setChannelReform(payload) { |
|
|
|
|
channelReform.value = payload |
|
|
|
|
} |
|
|
|
|
function set_channelReform(payload) { |
|
|
|
|
channelReform.value = payload; |
|
|
|
|
|
|
|
|
|
function setMsgStatus(payload) { |
|
|
|
|
msgStatus.value = payload |
|
|
|
|
} |
|
|
|
|
function set_msgStatus(payload) { |
|
|
|
|
msgStatus.value = payload; |
|
|
|
|
|
|
|
|
|
function setMsgReply(payload) { |
|
|
|
|
msgReply.value = payload |
|
|
|
|
} |
|
|
|
|
function set_msgReply(payload) { |
|
|
|
|
msgReply.value = payload; |
|
|
|
|
|
|
|
|
|
function setIsHumanChat(payload) { |
|
|
|
|
isHumanChat.value = payload |
|
|
|
|
} |
|
|
|
|
function set_isHumanChat(payload) { |
|
|
|
|
isHumanChat.value = payload; |
|
|
|
|
|
|
|
|
|
function setGaokeUser(payload) { |
|
|
|
|
gaokeUser.value = payload |
|
|
|
|
} |
|
|
|
|
function set_gaokeUser(payload) { |
|
|
|
|
gaokeUser.value = payload; |
|
|
|
|
|
|
|
|
|
function setBranchCompany(payload) { |
|
|
|
|
branchCompany.value = payload |
|
|
|
|
} |
|
|
|
|
function set_branchCompany(payload) { |
|
|
|
|
branchCompany.value = payload; |
|
|
|
|
|
|
|
|
|
function setHotUser(payload) { |
|
|
|
|
hotUser.value = payload |
|
|
|
|
} |
|
|
|
|
function set_hotUser(payload) { |
|
|
|
|
hotUser.value = payload; |
|
|
|
|
|
|
|
|
|
function setHotUserData(payload) { |
|
|
|
|
hotUserData.value = payload |
|
|
|
|
} |
|
|
|
|
function set_hotUserData(payload) { |
|
|
|
|
hotUserData.value = payload; |
|
|
|
|
|
|
|
|
|
function setReviewRestricted(payload) { |
|
|
|
|
reviewRestricted.value = payload |
|
|
|
|
} |
|
|
|
|
function set_reviewRestricted(payload) { |
|
|
|
|
hotUserData.value = payload; |
|
|
|
|
|
|
|
|
|
function setIntegratedUser(payload) { |
|
|
|
|
integratedUser.value = payload |
|
|
|
|
} |
|
|
|
|
function set_integratedUser(payload) { |
|
|
|
|
integratedUser.value = payload; |
|
|
|
|
|
|
|
|
|
function setHxSessionId(payload) { |
|
|
|
|
hxSessionId.value = payload |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function setShowHumanAppraise(payload) { |
|
|
|
|
showHumanAppraise.value = payload |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
// State
|
|
|
|
|
token, |
|
|
|
|
userId, |
|
|
|
|
configId, |
|
|
|
|
@ -519,11 +561,13 @@ export const useAppStore = defineStore('app', () => { |
|
|
|
|
planCode, |
|
|
|
|
entrance, |
|
|
|
|
elder, |
|
|
|
|
notitle, |
|
|
|
|
userInfo, |
|
|
|
|
sysConfig, |
|
|
|
|
headerAvatar, |
|
|
|
|
htmlExtParams, |
|
|
|
|
complaint, |
|
|
|
|
navigationCorpus, |
|
|
|
|
headerAvatar, |
|
|
|
|
routeAction, |
|
|
|
|
direction, |
|
|
|
|
mescrollContent, |
|
|
|
|
@ -551,7 +595,7 @@ export const useAppStore = defineStore('app', () => { |
|
|
|
|
problemFeedback, |
|
|
|
|
isBackstage, |
|
|
|
|
sdkLoaded, |
|
|
|
|
chatAr, |
|
|
|
|
chatArr, |
|
|
|
|
bpErrorInfo, |
|
|
|
|
voiceDataList, |
|
|
|
|
hxOpenSucceseds, |
|
|
|
|
@ -568,33 +612,78 @@ export const useAppStore = defineStore('app', () => { |
|
|
|
|
integratedUser, |
|
|
|
|
showHumanAppraise, |
|
|
|
|
mydFlag, |
|
|
|
|
isBqCalcClaim, |
|
|
|
|
msgReply, |
|
|
|
|
hotUserData, |
|
|
|
|
branchCompany, |
|
|
|
|
|
|
|
|
|
// Actions
|
|
|
|
|
setIsBqCalcClaim, |
|
|
|
|
set_token, |
|
|
|
|
setToken, |
|
|
|
|
setSessionId, |
|
|
|
|
set_configId, |
|
|
|
|
set_appentry, |
|
|
|
|
set_bpErrorInfo, |
|
|
|
|
del_token, |
|
|
|
|
set_userid, |
|
|
|
|
set_source, |
|
|
|
|
set_notitle, |
|
|
|
|
set_planCode, |
|
|
|
|
set_entrance, |
|
|
|
|
set_elder, |
|
|
|
|
set_headerAvatar, |
|
|
|
|
set_htmlExtParams, |
|
|
|
|
set_compl, |
|
|
|
|
set_navigationCorpus, |
|
|
|
|
set_manualService, |
|
|
|
|
set_queuedTimeout, |
|
|
|
|
set_sendLoading, |
|
|
|
|
set_isSendSuccess, |
|
|
|
|
set_timestamp, |
|
|
|
|
set_sendParmas, |
|
|
|
|
set_chatList, |
|
|
|
|
set_chatId, |
|
|
|
|
setConfigId, |
|
|
|
|
setAppentry, |
|
|
|
|
setBpErrorInfo, |
|
|
|
|
delToken, |
|
|
|
|
setUserId, |
|
|
|
|
setSource, |
|
|
|
|
setNotitle, |
|
|
|
|
setElder, |
|
|
|
|
setPlanCode, |
|
|
|
|
setEntrance, |
|
|
|
|
setUserInfo, |
|
|
|
|
setHtmlExtParams, |
|
|
|
|
setComplaint, |
|
|
|
|
setNavigationCorpus, |
|
|
|
|
setManualService, |
|
|
|
|
setSysConfig, |
|
|
|
|
setHeaderAvatar, |
|
|
|
|
setSendLoading, |
|
|
|
|
setIsSendSuccess, |
|
|
|
|
setQaId, |
|
|
|
|
setProblemFeedback, |
|
|
|
|
setOtherTips, |
|
|
|
|
setLastMessage, |
|
|
|
|
setSendFailList, |
|
|
|
|
setIsLostMessage, |
|
|
|
|
delSendFailList, |
|
|
|
|
delSendFailListById, |
|
|
|
|
setLeaveMessage, |
|
|
|
|
setIsLeaveMessageSuccess, |
|
|
|
|
setMescrollContent, |
|
|
|
|
setSendMessageList, |
|
|
|
|
setReceiveMessageList, |
|
|
|
|
setTts, |
|
|
|
|
setHxOpenSuccesed, |
|
|
|
|
setTimestamp, |
|
|
|
|
setSendParmas, |
|
|
|
|
setQueuedTimeout, |
|
|
|
|
addSendMessageList, |
|
|
|
|
setChatList, |
|
|
|
|
delChatList, |
|
|
|
|
delAllChatList, |
|
|
|
|
setChatId, |
|
|
|
|
setCurrentItemId, |
|
|
|
|
setFindActiveItem, |
|
|
|
|
setActiveItemExtra, |
|
|
|
|
setReSendMessage, |
|
|
|
|
scrollBottom, |
|
|
|
|
setIsBackstage, |
|
|
|
|
setVoiceData, |
|
|
|
|
setSdkLoaded, |
|
|
|
|
setPcaData, |
|
|
|
|
setChannelReform, |
|
|
|
|
setMsgStatus, |
|
|
|
|
setMsgReply, |
|
|
|
|
setIsHumanChat, |
|
|
|
|
setGaokeUser, |
|
|
|
|
setBranchCompany, |
|
|
|
|
setHotUser, |
|
|
|
|
setHotUserData, |
|
|
|
|
setReviewRestricted, |
|
|
|
|
setIntegratedUser, |
|
|
|
|
setHxSessionId, |
|
|
|
|
setShowHumanAppraise, |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
export default useAppStore |
|
|
|
|
export default useAppStore |
|
|
|
|
|