|
@@ -68,66 +68,103 @@ function scrollSideIconHide(el) {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-$(function () {
|
|
|
- scrollSideIconHide()
|
|
|
-})
|
|
|
-/* 客服咨询 */
|
|
|
-;(function (w, d, e, x) {
|
|
|
- w[e] = function () { w.cbk = w.cbk || []; w.cbk.push(arguments); }
|
|
|
- x = d.createElement('script');
|
|
|
- x.async = true;
|
|
|
- x.id = 'zhichiScript';
|
|
|
- x.className="open-customer";
|
|
|
- // wxh5、app、pc
|
|
|
- x.src = 'https://pc-jianyu.sobot.com/chat/frame/v2/entrance.js?sysnum=9d1e3980f91e4b75b8f04e2d206a4c76&t=' + new Date().getTime();
|
|
|
- d.body.appendChild(x);
|
|
|
-})(window, document, 'zc');
|
|
|
-var ajaxUserInfo = {
|
|
|
- headImage: '',
|
|
|
- nickName: '默认昵称',
|
|
|
- userId: '',
|
|
|
+function getKfDate(res) {
|
|
|
+ var current = new Date(new Date()).toLocaleDateString()
|
|
|
+ console.info(current)
|
|
|
+
|
|
|
}
|
|
|
-function setConfig () {
|
|
|
- typeof window.getUserInfoCallback === 'function' ? getUserInfoCallback() : null
|
|
|
- zc("config", {
|
|
|
- custom:true,
|
|
|
- auto_expand: false,
|
|
|
- show_face: 1,
|
|
|
- partnerid: ajaxUserInfo.userId,
|
|
|
- face: ajaxUserInfo.headImage,
|
|
|
- height: '640',
|
|
|
- async: 0,
|
|
|
- manual: false
|
|
|
- })
|
|
|
- zc("offline_message_count",function(res){
|
|
|
- // console.log(res, 'offline_message_count')
|
|
|
- if (res && res.size && res.size > 0) {
|
|
|
- var omc = res.size > 99 ? '99+' : res.size
|
|
|
- $(".icon-badge-number").attr('data-badge-number', omc)
|
|
|
- } else {
|
|
|
- $(".icon-badge-number").removeAttr('data-badge-number')
|
|
|
+var kfType = {}
|
|
|
+function kfContact() {
|
|
|
+ /* 客服咨询 */
|
|
|
+ $.post({
|
|
|
+ url: '/jyapi/message/obtainShunt',// 分流
|
|
|
+ type: 'POST',
|
|
|
+ data: JSON.stringify({type: 'PC'}),
|
|
|
+ contentType: 'application/json',
|
|
|
+ success: function (res) {
|
|
|
+ var kfDatas = JSON.stringify({
|
|
|
+ isShunt: res.data.isShunt,
|
|
|
+ url: res.data.url,
|
|
|
+ currentDate: new Date(new Date()).toLocaleDateString()
|
|
|
+ })
|
|
|
+ var getDates = localStorage.getItem('kf-shunt-data')
|
|
|
+ var currents = new Date(new Date()).toLocaleDateString()
|
|
|
+ console.info(getDates, currents)
|
|
|
+ if (getDates) {
|
|
|
+ if (currents !== JSON.parse(getDates).currentDate) {
|
|
|
+ localStorage.setItem('kf-shunt-data', kfDatas)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ localStorage.setItem('kf-shunt-data', kfDatas)
|
|
|
+ }
|
|
|
+ kfType = localStorage.getItem('kf-shunt-data')
|
|
|
+ console.info(JSON.parse(kfType).isShunt,JSON.parse(kfType).url)
|
|
|
+ if (JSON.parse(kfType).isShunt && JSON.parse(kfType).url == 'zcpc') {
|
|
|
+ ;(function (w, d, e, x) {
|
|
|
+ w[e] = function () { w.cbk = w.cbk || []; w.cbk.push(arguments); }
|
|
|
+ x = d.createElement('script');
|
|
|
+ x.async = true;
|
|
|
+ x.id = 'zhichiScript';
|
|
|
+ x.className="open-customer";
|
|
|
+ // wxh5、app、pc
|
|
|
+ x.src = 'https://pc-jianyu.sobot.com/chat/frame/v2/entrance.js?sysnum=9d1e3980f91e4b75b8f04e2d206a4c76&t=' + new Date().getTime();
|
|
|
+ d.body.appendChild(x);
|
|
|
+ })(window, document, 'zc');
|
|
|
+
|
|
|
+ var ajaxUserInfo = {
|
|
|
+ headImage: '',
|
|
|
+ nickName: '默认昵称',
|
|
|
+ userId: '',
|
|
|
+ }
|
|
|
+ function setConfig () {
|
|
|
+ typeof window.getUserInfoCallback === 'function' ? getUserInfoCallback() : null
|
|
|
+ zc("config", {
|
|
|
+ custom:true,
|
|
|
+ auto_expand: false,
|
|
|
+ show_face: 1,
|
|
|
+ partnerid: ajaxUserInfo.userId,
|
|
|
+ face: ajaxUserInfo.headImage,
|
|
|
+ height: '640',
|
|
|
+ async: 0,
|
|
|
+ manual: false
|
|
|
+ })
|
|
|
+ zc("offline_message_count",function(res){
|
|
|
+ // console.log(res, 'offline_message_count')
|
|
|
+ if (res && res.size && res.size > 0) {
|
|
|
+ var omc = res.size > 99 ? '99+' : res.size
|
|
|
+ $(".icon-badge-number").attr('data-badge-number', omc)
|
|
|
+ } else {
|
|
|
+ $(".icon-badge-number").removeAttr('data-badge-number')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ zc("dynamic_ready")
|
|
|
+ }
|
|
|
+ $.post("/jypay/user/getSimpleData?t="+new Date().getTime(),{},function(r) {
|
|
|
+ if (r) {
|
|
|
+ Object.keys(ajaxUserInfo).forEach(function (v) {
|
|
|
+ if (r[v] && r[v] !== '') {
|
|
|
+ ajaxUserInfo[v] = r[v]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 存储userId 大会员中标预测历史记录要用到
|
|
|
+ localStorage.setItem('BIGMEMBER_PC', r.userId)
|
|
|
+ }
|
|
|
+ setConfig()
|
|
|
+ }).fail(function () {
|
|
|
+ ajaxUserInfo = {
|
|
|
+ headImage: '',
|
|
|
+ nickName: '默认昵称',
|
|
|
+ userId: '',
|
|
|
+ }
|
|
|
+ setConfig()
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
- zc("dynamic_ready")
|
|
|
}
|
|
|
-$.post("/jypay/user/getSimpleData?t="+new Date().getTime(),{},function(r) {
|
|
|
- if (r) {
|
|
|
- Object.keys(ajaxUserInfo).forEach(function (v) {
|
|
|
- if (r[v] && r[v] !== '') {
|
|
|
- ajaxUserInfo[v] = r[v]
|
|
|
- }
|
|
|
- })
|
|
|
- // 存储userId 大会员中标预测历史记录要用到
|
|
|
- localStorage.setItem('BIGMEMBER_PC', r.userId)
|
|
|
- }
|
|
|
- setConfig()
|
|
|
-}).fail(function () {
|
|
|
- ajaxUserInfo = {
|
|
|
- headImage: '',
|
|
|
- nickName: '默认昵称',
|
|
|
- userId: '',
|
|
|
- }
|
|
|
- setConfig()
|
|
|
+$(function () {
|
|
|
+ scrollSideIconHide()
|
|
|
+ kfContact()
|
|
|
})
|
|
|
var openCustomDig = false
|
|
|
window.onmessage = function(e){
|
|
@@ -150,6 +187,16 @@ $(window).on('click', function (e) {
|
|
|
var openDom = $(e.target).hasClass('open-customer') || $(e.target).parents().hasClass('open-customer')
|
|
|
if (openDom) {
|
|
|
openCustomDig = true
|
|
|
+ var shunt = JSON.parse(localStorage.getItem('kf-shunt-data'))
|
|
|
+ console.info(shunt)
|
|
|
+ if (!shunt.url && shunt.url !== 'zcpc') {
|
|
|
+ // 登录判断
|
|
|
+ if (!loginflag) {
|
|
|
+ openLoginDig()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ location.href = shunt.url + '&mini=0'
|
|
|
+ }
|
|
|
$(".icon-badge-number").removeAttr('data-badge-number');
|
|
|
var href = window.location.href;
|
|
|
var sourceStr =""
|