|
|
|
@ -1,8 +1,9 @@ |
|
|
|
// import Vue from 'vue'
|
|
|
|
// import Vue from 'vue'
|
|
|
|
import router from '@/router' |
|
|
|
import router from '@/router' |
|
|
|
import store from '@/store' |
|
|
|
|
|
|
|
import CryptoJS from "crypto-js"; |
|
|
|
import CryptoJS from "crypto-js"; |
|
|
|
|
|
|
|
import utils from '@/utils/utils'; |
|
|
|
|
|
|
|
import wx from 'weixin-js-sdk'; |
|
|
|
|
|
|
|
import { useAppStore } from '@/store/app.js' |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取uuid |
|
|
|
* 获取uuid |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -244,7 +245,6 @@ export function toListDF(tree, list, parentId) { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
export function clearLoginInfo() { |
|
|
|
export function clearLoginInfo() { |
|
|
|
// Vue.cookie.delete('token')
|
|
|
|
// Vue.cookie.delete('token')
|
|
|
|
store.commit('resetStore') |
|
|
|
|
|
|
|
router.options.isAddDynamicMenuRoutes = false |
|
|
|
router.options.isAddDynamicMenuRoutes = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -403,3 +403,186 @@ export function isDev() { |
|
|
|
export function isProd() { |
|
|
|
export function isProd() { |
|
|
|
return window.location.host.includes('sxznjh.trace.com.cn') || window.location.host.includes('ssp.trace.com.cn') || window.location.host.includes('dev.trace.com.cn') |
|
|
|
return window.location.host.includes('sxznjh.trace.com.cn') || window.location.host.includes('ssp.trace.com.cn') || window.location.host.includes('dev.trace.com.cn') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export function jumpOpenLink(url) { |
|
|
|
|
|
|
|
utils.AppToHttpHtml(url); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
export function jumpOpenWeb(type, url, urlType) { |
|
|
|
|
|
|
|
console.log('chat-content', type, url); |
|
|
|
|
|
|
|
var params = {}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type === "YY_0000") { |
|
|
|
|
|
|
|
//保单管家
|
|
|
|
|
|
|
|
params = { |
|
|
|
|
|
|
|
idnum: "1", |
|
|
|
|
|
|
|
ownerId: useAppStore().userInfo.encryptPid, |
|
|
|
|
|
|
|
openid: useAppStore().userInfo.sourceUserId, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
//置换密匙
|
|
|
|
|
|
|
|
const completeURL = handleURL(url, params) |
|
|
|
|
|
|
|
Post("semantic/getYdbqTicket", { url: completeURL, userId: useAppStore().userId }).then(res => { |
|
|
|
|
|
|
|
console.log(res) |
|
|
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
|
|
//data空表示开关关闭
|
|
|
|
|
|
|
|
if (res.data === "" || res.data === null || res.data === undefined) { |
|
|
|
|
|
|
|
utils.openWxPage(url, params); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
const ticketParam = { |
|
|
|
|
|
|
|
accessTicket: res.data |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
utils.openWxPage(url, ticketParam); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Toast("网络异常,请重试") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else if (type === "YY_ydbq") { |
|
|
|
|
|
|
|
//移动保全页面
|
|
|
|
|
|
|
|
params = { |
|
|
|
|
|
|
|
mobile: useAppStore().userInfo.phone, |
|
|
|
|
|
|
|
pid: useAppStore().userInfo.encryptPid, |
|
|
|
|
|
|
|
openid: useAppStore().userInfo.sourceUserId, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
//置换密匙
|
|
|
|
|
|
|
|
const completeURL = handleURL(url, params) |
|
|
|
|
|
|
|
Post("semantic/getYdbqTicket", { url: completeURL, userId: useAppStore().userId }).then(res => { |
|
|
|
|
|
|
|
console.log(res) |
|
|
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
|
|
//data空表示开关关闭
|
|
|
|
|
|
|
|
if (res.data === "" || res.data === null || res.data === undefined) { |
|
|
|
|
|
|
|
utils.openWxPage(url, params); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
const ticketParam = { |
|
|
|
|
|
|
|
accessTicket: res.data |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
utils.openWxPage(url, ticketParam); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Toast("网络异常,请重试") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else if (type === "YY_APP_H5") { |
|
|
|
|
|
|
|
//在app内部页面打开h5(带参形式)
|
|
|
|
|
|
|
|
params = { |
|
|
|
|
|
|
|
mobile: useAppStore().userInfo.phone, |
|
|
|
|
|
|
|
pid: useAppStore().userInfo.encryptPid, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
utils.AppOpenH5(url, params); |
|
|
|
|
|
|
|
} else if (type === "ydbq_2") { |
|
|
|
|
|
|
|
// 给付系统
|
|
|
|
|
|
|
|
params = { |
|
|
|
|
|
|
|
url: url, |
|
|
|
|
|
|
|
generateType: type, |
|
|
|
|
|
|
|
userId: useAppStore().userId, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
return utils.openSpecPage(params); |
|
|
|
|
|
|
|
} else if (type === "YY_CMD") { |
|
|
|
|
|
|
|
// 查门店
|
|
|
|
|
|
|
|
const newUrl = url + `&idnum=1&openId=${useAppStore().userInfo.sourceUserId}&entryOpenid=${useAppStore().userInfo.entryOpenid}` |
|
|
|
|
|
|
|
//置换密匙
|
|
|
|
|
|
|
|
Post("semantic/getYdbqTicket", { url: newUrl, userId: useAppStore().userId, isCmd: "1" }).then(res => { |
|
|
|
|
|
|
|
console.log(res) |
|
|
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
|
|
//data空表示开关关闭
|
|
|
|
|
|
|
|
if (res.data === "" || res.data === null || res.data === undefined) { |
|
|
|
|
|
|
|
return jumpOpenLink(newUrl); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
const ticketUrl = url + `&accessTicket=${res.data}` |
|
|
|
|
|
|
|
return jumpOpenLink(ticketUrl); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Toast("网络异常,请重试") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else if (type === "YY_lsjl") { |
|
|
|
|
|
|
|
// 跳转历史记录
|
|
|
|
|
|
|
|
const openid = utils.getUrlParams().openid |
|
|
|
|
|
|
|
router.push({ |
|
|
|
|
|
|
|
name: "history", |
|
|
|
|
|
|
|
query: { |
|
|
|
|
|
|
|
ht: useAppStore().source, |
|
|
|
|
|
|
|
openid: openid, |
|
|
|
|
|
|
|
tokenExist: useAppStore().tokenExist, |
|
|
|
|
|
|
|
isWX: useAppStore().isWX, |
|
|
|
|
|
|
|
lostChatInfoNum: useAppStore().lostChatInfoNum, |
|
|
|
|
|
|
|
param: utils.getUrlParams().param |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} else if (type === "YY_kjmyd") { |
|
|
|
|
|
|
|
utils.useTechSdk() |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} else if (type === "YY_hfhz") { |
|
|
|
|
|
|
|
// 回访回执
|
|
|
|
|
|
|
|
const param = { certNum: "1", systemSource: "yykf", userId: useAppStore().userId } |
|
|
|
|
|
|
|
Post("semantic/xdhfCreateToken", param).then(res => { |
|
|
|
|
|
|
|
const entryptedId = useAppStore().userInfo.versionHFHZ |
|
|
|
|
|
|
|
params = { |
|
|
|
|
|
|
|
sessionToken: res.data, |
|
|
|
|
|
|
|
holderId: encodeURI(entryptedId), |
|
|
|
|
|
|
|
holderType: 'a', |
|
|
|
|
|
|
|
hzhfSystemSource: '0803', |
|
|
|
|
|
|
|
ishwFlag: '1', |
|
|
|
|
|
|
|
isqshzFlag: '1', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
utils.openWxPage(url, params); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else if (type === "YY_1v1") { |
|
|
|
|
|
|
|
// 1v1专属服务
|
|
|
|
|
|
|
|
post("thirdPartyAuth/getExclusiveServicesToken").then(res => { |
|
|
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
|
|
if (res.data) { |
|
|
|
|
|
|
|
params = { |
|
|
|
|
|
|
|
sour: 'yykf', |
|
|
|
|
|
|
|
omoSource: useAppStore().userInfo.source, |
|
|
|
|
|
|
|
omoSourceName: encodeURIComponent(useAppStore().userInfo.sourceName), |
|
|
|
|
|
|
|
token: res.data |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
utils.openWxPage(url, params); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Toast("网络异常,请重试") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else if (type === "YY_yzsfx") { |
|
|
|
|
|
|
|
// 一站式复效
|
|
|
|
|
|
|
|
Post("semantic/getYzsUrl", { userId: useAppStore().userId, bqType: url, urlType }).then(res => { |
|
|
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
|
|
if (res.data) { |
|
|
|
|
|
|
|
let yUrl = res.data |
|
|
|
|
|
|
|
utils.openWxPage(yUrl, ''); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Toast("网络异常,请重试") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else if (type === "YY_GWXCX") { |
|
|
|
|
|
|
|
//官微小程序
|
|
|
|
|
|
|
|
const path = url; |
|
|
|
|
|
|
|
wx.miniProgram.navigateTo({ |
|
|
|
|
|
|
|
url: path |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else if (type === "YY_GWXCX_HOME") { |
|
|
|
|
|
|
|
//官微小程序首页
|
|
|
|
|
|
|
|
const path = url; |
|
|
|
|
|
|
|
console.log('path', path, wx.miniProgram.reLaunch) |
|
|
|
|
|
|
|
wx.miniProgram.reLaunch({ |
|
|
|
|
|
|
|
url: path |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
export function handleURL(url, params) { |
|
|
|
|
|
|
|
let flag = url.indexOf("?") != -1 ? true : false |
|
|
|
|
|
|
|
let urlPar = ''; |
|
|
|
|
|
|
|
if (params) { |
|
|
|
|
|
|
|
Object.getOwnPropertyNames(params).forEach((item, index) => { |
|
|
|
|
|
|
|
if (index === 0 && !flag) { |
|
|
|
|
|
|
|
urlPar += `?${item}=${params[item]}`; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
urlPar += `&${item}=${params[item]}` |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return url + urlPar |
|
|
|
|
|
|
|
} |