You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
205 lines
7.1 KiB
205 lines
7.1 KiB
<template>
|
|
<div>
|
|
<!-- <chat-main
|
|
v-if="isToken"
|
|
:tokenExist="isToken"
|
|
:isWX="isWX"
|
|
:lostChatInfoNum="lostChatInfoNum"
|
|
/> -->
|
|
<chat-new />
|
|
<!-- <human-appraise-popup /> -->
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, onMounted, computed } from 'vue'
|
|
import { useAppStore } from '@/store'
|
|
import { showLoadingToast, closeToast } from 'vant'
|
|
import { useRouter } from 'vue-router'
|
|
import { Post } from '@/utils/https'
|
|
import chatMain from '@/components/chat-main.vue'
|
|
import chatNew from '@/components/chat-new.vue'
|
|
// import HumanAppraisePopup from "@/components/human-appraise-popup.vue";
|
|
import Utils from '@/utils/utils'
|
|
|
|
// 状态管理
|
|
const store = useAppStore()
|
|
const router = useRouter()
|
|
console.log(store, 'store');
|
|
const { set_source , set_userInfo, set_notitle , set_configId,set_entrance,set_appentry,set_htmlExtParams,set_complaint, set_navigationCorpus, setSessionId }= store
|
|
// 响应式数据
|
|
const isToken = ref(false)
|
|
const isWX = ref(false)
|
|
const lostChatInfoNum = ref(0)
|
|
const urlParams = ref({})
|
|
|
|
// 计算属性
|
|
const userInfo = computed(() => store.userInfo)
|
|
const source = computed(() => store.source)
|
|
|
|
// 生命周期
|
|
onMounted(async () => {
|
|
var liccsAds = localStorage.getItem("liccsAds"); // 记录用户弹窗提示
|
|
localStorage.clear();
|
|
localStorage.liccsAds = liccsAds || "";
|
|
//清除session 清除上次的记录
|
|
sessionStorage.clear();
|
|
|
|
urlParams.value = Utils.getUrlParams();
|
|
console.log("txfModules参数", urlParams.value.txfModules);
|
|
console.log('this.urlParams--', urlParams.value)
|
|
|
|
let userInfo = {
|
|
phone: urlParams.value.phone || "",
|
|
name: urlParams.value.name || "",
|
|
sex: urlParams.value.sex || "",
|
|
openid: urlParams.value.openid || "",
|
|
idtype: urlParams.value.idtype || "",
|
|
pid: urlParams.value.pid || "",
|
|
|
|
auStatus: urlParams.value.auStatus || "", //实名认证状态 枚举:1、0、其他(1为已认证状态,其他为非认证认证状态)
|
|
bdStatus: urlParams.value.bStatus || urlParams.value.bdStatus || "", //老客户绑定状态 1为已绑定状态,其他为非绑定状态
|
|
bthdate: urlParams.value.bthdate || "", //出生日期
|
|
workNum: urlParams.value.workNum || "", //营销员工号
|
|
unit: urlParams.value.unit || "", //单位
|
|
orgname: urlParams.value.orgname || "", //机构名称
|
|
|
|
txfModules: urlParams.value.txfModules || "", //太享福渠道活动与功能显示
|
|
|
|
sceneId: urlParams.value.sceneId || "", //场景标识(微信跟随)
|
|
entrance: urlParams.value.entrance || "", // 入口标识
|
|
planCode: urlParams.value.planCode || urlParams.value.modelCode || "", //星云渠道产品代码
|
|
|
|
// 断点服务
|
|
bpErrorCode: urlParams.value.bErrorCode || urlParams.value.brErrorCode || "",
|
|
bpErrorContent: urlParams.value.bErrorContent || urlParams.value.errorMsg || "",
|
|
bpErrorModule: urlParams.value.bErrorModule || "", // 电子回访断点服务
|
|
bpErrorPicture: urlParams.value.bErrorPicture || "", // 微信给付断点服务
|
|
entryIdnum: '', // 查门店证件号加密传参
|
|
entryOpenid: '', // 查门店openid加密传参
|
|
userType: urlParams.value.usertype || "", // 95980000渠道(b2bi),说明一下是游客
|
|
};
|
|
|
|
isWX.value = Utils.isWeiXin();
|
|
// set_userInfo(userInfo);//用户信息
|
|
// set_source(urlParams.value.ht || ""); //来源
|
|
// set_notitle(urlParams.value.notitle || ""); //是否展示头部
|
|
// set_configId(urlParams.value.configId || ""); //环信参数
|
|
// set_entrance(urlParams.value.entrance || ""); //入口标识
|
|
// set_appentry(urlParams.value.appentry || ""); // 是否为老版本app
|
|
|
|
// set_htmlExtParams(urlParams.value.htmlExtParams || ""); //扩展参数
|
|
// set_complaint(urlParams.value.complaint || ""); //扩展参数
|
|
// set_navigationCorpus(urlParams.value.navigationCorpus || ""); //扩展参数
|
|
|
|
// 渠道校验
|
|
let checkToast = null;
|
|
try {
|
|
checkToast = showLoadingToast({
|
|
message: "加载中...",
|
|
duration: 0,
|
|
loadingType: "spinner",
|
|
forbidClick: true,
|
|
});
|
|
const checkRes = await Post("config/downSource", {
|
|
source: urlParams.value.ht || "95810000"
|
|
});
|
|
checkToast.clear();
|
|
if (checkRes.code === 0 && checkRes.data !== null) {
|
|
Dialog.alert({
|
|
title: "提示",
|
|
message: checkRes.data.toast,
|
|
confirmButtonText: "确定"
|
|
}).then(res => {
|
|
Utils.closeWindow();
|
|
});
|
|
return;
|
|
}
|
|
} catch (error) {
|
|
console.log("渠道校验异常:", error);
|
|
// if (checkToast) {
|
|
// checkToast.clear();
|
|
// }
|
|
}
|
|
|
|
urlParams.value = Utils.getUrlParams()
|
|
await initToken()
|
|
})
|
|
|
|
// 方法
|
|
const initToken = async () => {
|
|
try {
|
|
const res = await getToken()
|
|
isToken.value = true
|
|
// 其他逻辑...
|
|
} catch (error) {
|
|
console.error(error)
|
|
}
|
|
}
|
|
|
|
const getToken = async () => {
|
|
const params = {
|
|
name: urlParams.value.name || '',
|
|
source: urlParams.value.ht || '',
|
|
phone: urlParams.value.phone || '',
|
|
userId: urlParams.value.openid || '',
|
|
sex: urlParams.value.sex || '',
|
|
pid: urlParams.value.pid || '',
|
|
idType: urlParams.value.idtype || urlParams.value.idType || '',
|
|
sessionId: store.sessionId, //取出本地存入的上次的id
|
|
|
|
auStatus: urlParams.value.auStatus || '',
|
|
bdStatus: urlParams.value.bStatus || urlParams.value.bdStatus || '',
|
|
bthDate: urlParams.value.bthdate || '',
|
|
workNum: urlParams.value.workNum || '',
|
|
htmlExtParams: urlParams.value.htmlExtParams || '',
|
|
unit: urlParams.value.unit || '', //单位
|
|
orgname: urlParams.value.orgname || '', //机构名称
|
|
|
|
sceneId: urlParams.value.sceneId || '', //场景标识(微信跟随)
|
|
planCode: urlParams.value.planCode || urlParams.value.modelCode || '', //星云渠道产品代码
|
|
|
|
// 断点服务
|
|
bpErrorCode: urlParams.value.bErrorCode || urlParams.value.brErrorCode || '',
|
|
bpErrorContent:
|
|
urlParams.value.bErrorContent ||
|
|
`${urlParams.value.policyNo ? urlParams.value.policyNo + '#' : ''}${
|
|
urlParams.value.errorMsg ? urlParams.value.errorMsg : ''
|
|
}` ||
|
|
'',
|
|
bpErrorModule: urlParams.value.bErrorModule || '', // 电子回访断点服务
|
|
bpErrorPicture: urlParams.value.bErrorPicture || '', // 微信给付断点服务
|
|
userType: urlParams.value.usertype || '', // 95980000渠道(b2bi),说明一下是游客
|
|
// 非游客标识
|
|
sort: '1',
|
|
}
|
|
if (urlParams.value.ticket) {
|
|
params.userId = decodeURIComponent(urlParams.value.ticket).replace(/ /g, '+')
|
|
}
|
|
if (!!urlParams.value.param) {
|
|
//95985000 E家福渠道传递密文
|
|
params.param = urlParams.value.param
|
|
}
|
|
// APP处理appTicket参数
|
|
if (urlParams.value.appTicket) {
|
|
params.userId = decodeURIComponent(urlParams.value.appTicket).replace(/ /g, '+')
|
|
}
|
|
showLoadingToast({ message: '加载中...', duration: 0, loadingType: 'spinner', forbidClick: true })
|
|
console.log('Post', Post);
|
|
try {
|
|
const res = await Post('user/info', params)
|
|
console.log('res', res);
|
|
// await Post('user/info', params)
|
|
// closeToast()
|
|
return res
|
|
} catch (error) {
|
|
console.log('error', error);
|
|
// closeToast()
|
|
throw error
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
/* 样式保持不变 */
|
|
</style>
|
|
|