window._tcloud_trackLog = (a) => {
try {
// eslint-disable-next-line no-undef
if (_zyat && _zyat.push) _zyat.push(a)
} catch { }
}
router.afterEach((to, from) => {
addInput()
})
function addInput () {
if (store.state.userInfo.loginName) {
log = false
var uid = document.querySelector('#uid')
if (!uid) {
uid = document.createElement('input')
}
uid.id = 'uid'
uid.setAttribute('value', store.state.userInfo.loginName)
uid.setAttribute('type', 'hidden')
document.body.append(uid)
var slist = document.getElementsByTagName('script')
for (var i = 0; i < slist.length; i++) {
if (slist[i].src.indexOf('https://productjs.71360.com') > -1) {
slist[i].remove()
}
}
loadScript('https://productjs.71360.com/statistics.js')
} else {
setTimeout(() => {
addInput()
}, 100)
}
}
function loadScript (url, callback) {
var s = document.createElement('script')
s.type = 'text/javascript'
if (s.readyState) {
s.onreadystatechange = function () { // 兼容IE
if (s.readyState === 'complete' || s.readyState === 'loaded') {
if (callback) { callback() }
}
}
} else {
s.onload = function () { // safari chrome opera firefox
if (callback) { callback() }
}
}
s.src = url
document.head.appendChild(s)
}
// eslint-disable-next-line no-unused-vars
let log = false
router.beforeEach((to, from, next) => {
localStorage.setItem('ttotalFrom', window.location.origin + from.fullPath)
localStorage.setItem('ttotalTo', window.location.origin + to.fullPath)
log = true
})
_tcloud_trackLog(['trackEvent', 'scrm_rootqrcode', 'click', 'rootqrcode_index'])
router.beforeEach((to, from, next) => {
// IOS 鉴权
// 1,ios的微信在vue使用history模式时,当前的“地址栏”的url不是真实的当前页面的URL
// 2,当用户在操作页面的时候,无论进了几个页面,跳转到哪里,当前页面是什么,当前地址栏的url始终是第一次进入的url。
if (window.__wxjs_is_wkwebview) { // IOS
if (window.entryUrl == '' || window.entryUrl == undefined) {
var url = process.env.VUE_APP_OPEN_H5 +
to.fullPath
window.entryUrl = url
}
} else { // 安卓
window.entryUrl = process.env.VUE_APP_OPEN_H5 +
to.fullPath
}
localStorage.setItem('ttotalFrom', window.location.origin + from.fullPath)
localStorage.setItem('ttotalTo', window.location.origin + to.fullPath)
log = true
if (dd.env.platform !== 'notInDingTalk' && !getToken()) {
getDDCookie(to, from, next)
} else {
routerJump(to, from, next)
}
// 2.进入路由钩子拦截时候, 路由跳转之前,清空(终止)上一个页面正在请求的内容
if (window._axiosPromiseArr.length > 0) {
window._axiosPromiseArr.forEach((item) => {
item()
})
window._axiosPromiseArr = []
}
})
```
|