911 lines
28 KiB
JavaScript
911 lines
28 KiB
JavaScript
/* ................... 防抖函数 ................... */
|
|
function debounce(func, delay) {
|
|
let timeout
|
|
return function () {
|
|
clearTimeout(timeout) // 如果持续触发,那么就清除定时器,定时器的回调就不会执行。
|
|
timeout = setTimeout(() => {
|
|
func.apply(this, arguments)
|
|
}, delay)
|
|
}
|
|
}
|
|
var vm = new Vue({
|
|
el: "#app",
|
|
data: {
|
|
filterText: '',
|
|
dockLeftExpandFlag: true,
|
|
dockLeftHideClass: false,
|
|
data: [
|
|
{
|
|
"id": "63789",
|
|
"pid": "63788",
|
|
"label": "新手指引",
|
|
"href": "/help/guide",
|
|
"type": "menu",
|
|
"children": [
|
|
{
|
|
"id": "3851",
|
|
"pid": "63789",
|
|
"label": "快速了解合力云客服",
|
|
"href": "/help/guide/3851.html"
|
|
},
|
|
{
|
|
"id": "63824",
|
|
"pid": "63789",
|
|
"label": "热门问题",
|
|
"href": "/help/guide/hot"
|
|
},
|
|
{
|
|
"id": "63795",
|
|
"pid": "63789",
|
|
"label": "云客服登录指南",
|
|
"href": "/help/guide/login",
|
|
"type": "cate",
|
|
"children": [
|
|
{
|
|
"id": "3852",
|
|
"pid": "63795",
|
|
"label": "登录前准备",
|
|
"href": "/help/guide/login/3852.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3877",
|
|
"pid": "63795",
|
|
"label": "新账号初次登录",
|
|
"href": "/help/guide/login/3877.html",
|
|
"type": "docLast"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "63803",
|
|
"pid": "63789",
|
|
"label": "进阶使用",
|
|
"href": "/help/guide/use",
|
|
"type": "cate",
|
|
"children": [
|
|
{
|
|
"id": "3965",
|
|
"pid": "63803",
|
|
"label": "部分进阶使用指南",
|
|
"href": "/help/guide/use/3965.html",
|
|
"type": "docLast"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "63804",
|
|
"pid": "63789",
|
|
"label": "常见问题",
|
|
"href": "/help/guide/problem",
|
|
"type": "cate",
|
|
"children": [
|
|
{
|
|
"id": "3966",
|
|
"pid": "63804",
|
|
"label": "登录常见问题",
|
|
"href": "/help/guide/problem/3966.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3971",
|
|
"pid": "63804",
|
|
"label": "通话相关问题",
|
|
"href": "/help/guide/problem/3971.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3972",
|
|
"pid": "63804",
|
|
"label": "在线相关问题",
|
|
"href": "/help/guide/problem/3972.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3973",
|
|
"pid": "63804",
|
|
"label": "客户公海相关问题",
|
|
"href": "/help/guide/problem/3973.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3974",
|
|
"pid": "63804",
|
|
"label": "工单相关问题",
|
|
"href": "/help/guide/problem/3974.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3975",
|
|
"pid": "63804",
|
|
"label": "管理相关问题",
|
|
"href": "/help/guide/problem/3975.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3976",
|
|
"pid": "63804",
|
|
"label": "配置相关问题",
|
|
"href": "/help/guide/problem/3976.html",
|
|
"type": "docLast"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "63790",
|
|
"pid": "63788",
|
|
"label": "呼叫中心",
|
|
"href": "/help/callcenter",
|
|
"type": "menu",
|
|
"children": [
|
|
{
|
|
"id": "63794",
|
|
"pid": "63790",
|
|
"label": "坐席端",
|
|
"href": "/help/callcenter/seat",
|
|
"type": "cate",
|
|
"children": [
|
|
{
|
|
"id": "3855",
|
|
"pid": "63794",
|
|
"label": "常见的接听方式使用介绍",
|
|
"href": "/help/callcenter/seat/3855.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3878",
|
|
"pid": "63794",
|
|
"label": "断电/断网时如何切换离线接听",
|
|
"href": "/help/callcenter/seat/3878.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3879",
|
|
"pid": "63794",
|
|
"label": "设置座席迁入/迁出",
|
|
"href": "/help/callcenter/seat/3879.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3880",
|
|
"pid": "63794",
|
|
"label": "接听客户来电",
|
|
"href": "/help/callcenter/seat/3880.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3881",
|
|
"pid": "63794",
|
|
"label": "外呼客户电话",
|
|
"href": "/help/callcenter/seat/3881.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3899",
|
|
"pid": "63794",
|
|
"label": "客户来电弹屏",
|
|
"href": "/help/callcenter/seat/3899.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3900",
|
|
"pid": "63794",
|
|
"label": "转接、咨询/三⽅通话、保持",
|
|
"href": "/help/callcenter/seat/3900.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3901",
|
|
"pid": "63794",
|
|
"label": "添加通话标签与备注",
|
|
"href": "/help/callcenter/seat/3901.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3902",
|
|
"pid": "63794",
|
|
"label": "个人通话管理",
|
|
"href": "/help/callcenter/seat/3902.html",
|
|
"type": "docLast"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "63796",
|
|
"pid": "63790",
|
|
"label": "管理端",
|
|
"href": "/help/callcenter/manager",
|
|
"type": "cate",
|
|
"children": [
|
|
{
|
|
"id": "3868",
|
|
"pid": "63796",
|
|
"label": "通话基础配置",
|
|
"href": "/help/callcenter/manager/3868.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3905",
|
|
"pid": "63796",
|
|
"label": "管理和查看通话数据",
|
|
"href": "/help/callcenter/manager/3905.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3906",
|
|
"pid": "63796",
|
|
"label": "查看和分配未接来电",
|
|
"href": "/help/callcenter/manager/3906.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3907",
|
|
"pid": "63796",
|
|
"label": "通话数据导出",
|
|
"href": "/help/callcenter/manager/3907.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3908",
|
|
"pid": "63796",
|
|
"label": "监控话务整体情况",
|
|
"href": "/help/callcenter/manager/3908.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3914",
|
|
"pid": "63796",
|
|
"label": "通话报表管理",
|
|
"href": "/help/callcenter/manager/3914.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3915",
|
|
"pid": "63796",
|
|
"label": "通话人工质检",
|
|
"href": "/help/callcenter/manager/3915.html",
|
|
"type": "docLast"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "63823",
|
|
"pid": "63790",
|
|
"label": "呼叫中心功能",
|
|
"href": "/help/callcenter/function"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "63791",
|
|
"pid": "63788",
|
|
"label": "在线客服",
|
|
"href": "/help/webchat",
|
|
"type": "menu",
|
|
"children": [
|
|
{
|
|
"id": "63797",
|
|
"pid": "63791",
|
|
"label": "坐席端",
|
|
"href": "/help/webchat/seat",
|
|
"type": "cate",
|
|
"children": [
|
|
{
|
|
"id": "3856",
|
|
"pid": "63797",
|
|
"label": "在线基础设置",
|
|
"href": "/help/webchat/seat/3856.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3882",
|
|
"pid": "63797",
|
|
"label": "⾸次接入在线聊天会话",
|
|
"href": "/help/webchat/seat/3882.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3916",
|
|
"pid": "63797",
|
|
"label": "个人会话管理",
|
|
"href": "/help/webchat/seat/3916.html",
|
|
"type": "docLast"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "63798",
|
|
"pid": "63791",
|
|
"label": "管理端",
|
|
"href": "/help/webchat/manager",
|
|
"type": "cate",
|
|
"children": [
|
|
{
|
|
"id": "3869",
|
|
"pid": "63798",
|
|
"label": "设置在线技能组",
|
|
"href": "/help/webchat/manager/3869.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3917",
|
|
"pid": "63798",
|
|
"label": "聊天入口配置",
|
|
"href": "/help/webchat/manager/3917.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3918",
|
|
"pid": "63798",
|
|
"label": "坐席端基础设置",
|
|
"href": "/help/webchat/manager/3918.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3919",
|
|
"pid": "63798",
|
|
"label": "访客端基础配置",
|
|
"href": "/help/webchat/manager/3919.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3935",
|
|
"pid": "63798",
|
|
"label": "坐席端聊天话术配置",
|
|
"href": "/help/webchat/manager/3935.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3961",
|
|
"pid": "63798",
|
|
"label": "会话管理与查询",
|
|
"href": "/help/webchat/manager/3961.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3962",
|
|
"pid": "63798",
|
|
"label": "监控话务整体情况",
|
|
"href": "/help/webchat/manager/3962.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3980",
|
|
"pid": "63798",
|
|
"label": "在线聊天报表管理",
|
|
"href": "/help/webchat/manager/3980.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3981",
|
|
"pid": "63798",
|
|
"label": "会话质检",
|
|
"href": "/help/webchat/manager/3981.html",
|
|
"type": "docLast"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "63805",
|
|
"pid": "63791",
|
|
"label": "对接渠道设置",
|
|
"href": "/help/webchat/channel",
|
|
"type": "cate",
|
|
"children": [
|
|
{
|
|
"id": "3991",
|
|
"pid": "63805",
|
|
"label": "渠道对接概述",
|
|
"href": "/help/webchat/channel/3991.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "4282",
|
|
"pid": "63805",
|
|
"label": "邮件渠道接入",
|
|
"href": "/help/webchat/channel/4282.html",
|
|
"type": "docLast"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "63806",
|
|
"pid": "63791",
|
|
"label": "在线客服机器人",
|
|
"href": "/help/webchat/robot",
|
|
"type": "cate",
|
|
"children": [
|
|
{
|
|
"id": "3993",
|
|
"pid": "63806",
|
|
"label": "在线机器人概述",
|
|
"href": "/help/webchat/robot/3993.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3994",
|
|
"pid": "63806",
|
|
"label": "机器人配置",
|
|
"href": "/help/webchat/robot/3994.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3995",
|
|
"pid": "63806",
|
|
"label": "FAQ知识",
|
|
"href": "/help/webchat/robot/3995.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3996",
|
|
"pid": "63806",
|
|
"label": "机器人报表",
|
|
"href": "/help/webchat/robot/3996.html",
|
|
"type": "docLast"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "63792",
|
|
"pid": "63788",
|
|
"label": "CRM客户管理",
|
|
"href": "/help/crm",
|
|
"type": "menu",
|
|
"children": [
|
|
{
|
|
"id": "63799",
|
|
"pid": "63792",
|
|
"label": "坐席端",
|
|
"href": "/help/crm/seat",
|
|
"type": "cate",
|
|
"children": [
|
|
{
|
|
"id": "3859",
|
|
"pid": "63799",
|
|
"label": "查看跟进的客户数据",
|
|
"href": "/help/crm/seat/3859.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3920",
|
|
"pid": "63799",
|
|
"label": "处理新分配的客户数据",
|
|
"href": "/help/crm/seat/3920.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3921",
|
|
"pid": "63799",
|
|
"label": "公海客户领取和退回",
|
|
"href": "/help/crm/seat/3921.html",
|
|
"type": "docLast"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "63800",
|
|
"pid": "63792",
|
|
"label": "管理端",
|
|
"href": "/help/crm/manager",
|
|
"type": "cate",
|
|
"children": [
|
|
{
|
|
"id": "3867",
|
|
"pid": "63800",
|
|
"label": "公海规则配置",
|
|
"href": "/help/crm/manager/3867.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3936",
|
|
"pid": "63800",
|
|
"label": "客户导入与筛重",
|
|
"href": "/help/crm/manager/3936.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3937",
|
|
"pid": "63800",
|
|
"label": "客户管理",
|
|
"href": "/help/crm/manager/3937.html",
|
|
"type": "docLast"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "63793",
|
|
"pid": "63788",
|
|
"label": "工单",
|
|
"href": "/help/order",
|
|
"type": "menu",
|
|
"children": [
|
|
{
|
|
"id": "3860",
|
|
"pid": "63793",
|
|
"label": "工单概述",
|
|
"href": "/help/order/3860.html"
|
|
},
|
|
{
|
|
"id": "63801",
|
|
"pid": "63793",
|
|
"label": "坐席端",
|
|
"href": "/help/order/seat",
|
|
"type": "cate",
|
|
"children": [
|
|
{
|
|
"id": "3861",
|
|
"pid": "63801",
|
|
"label": "工单创建与处理",
|
|
"href": "/help/order/seat/3861.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3922",
|
|
"pid": "63801",
|
|
"label": "工单的领取与改派",
|
|
"href": "/help/order/seat/3922.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3923",
|
|
"pid": "63801",
|
|
"label": "工单委托",
|
|
"href": "/help/order/seat/3923.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3938",
|
|
"pid": "63801",
|
|
"label": "工单查询",
|
|
"href": "/help/order/seat/3938.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3983",
|
|
"pid": "63801",
|
|
"label": "工单作废",
|
|
"href": "/help/order/seat/3983.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3984",
|
|
"pid": "63801",
|
|
"label": "工单退回",
|
|
"href": "/help/order/seat/3984.html",
|
|
"type": "docLast"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "63802",
|
|
"pid": "63793",
|
|
"label": "管理端",
|
|
"href": "/help/order/manager",
|
|
"type": "cate",
|
|
"children": [
|
|
{
|
|
"id": "3864",
|
|
"pid": "63802",
|
|
"label": "工单分配",
|
|
"href": "/help/order/manager/3864.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3924",
|
|
"pid": "63802",
|
|
"label": "工单管理与查询",
|
|
"href": "/help/order/manager/3924.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3960",
|
|
"pid": "63802",
|
|
"label": "工单报表统计",
|
|
"href": "/help/order/manager/3960.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3985",
|
|
"pid": "63802",
|
|
"label": "工单消息提醒设置",
|
|
"href": "/help/order/manager/3985.html",
|
|
"type": "docLast"
|
|
},
|
|
{
|
|
"id": "3986",
|
|
"pid": "63802",
|
|
"label": "工单流程配置",
|
|
"href": "/help/order/manager/3986.html",
|
|
"type": "docLast"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
],
|
|
defaultProps: {
|
|
children: 'children',
|
|
label: 'label'
|
|
},
|
|
defaultMenuProps: {
|
|
title: 'title',
|
|
children: 'children'
|
|
},
|
|
currentDoc: {
|
|
id: 0,
|
|
expandedKeys: JSON.parse(sessionStorage.getItem('expandedKeys')),
|
|
catalog: []
|
|
},
|
|
imgZoomFlag: false,
|
|
dockRightMenuActive: false,
|
|
currentChidI: 0,
|
|
},
|
|
beforeCreate() {
|
|
NProgress.start()
|
|
},
|
|
created() {
|
|
this.queryDock()
|
|
},
|
|
mounted() {
|
|
this.autoMenu()
|
|
this.imgZoom()
|
|
},
|
|
watch: {
|
|
filterText(val) {
|
|
this.$refs.tree.filter(val);
|
|
}
|
|
},
|
|
mixins: [mixins],
|
|
methods: {
|
|
goAnchor(e) { // 点击锚点
|
|
let id = "#" + e;
|
|
document.querySelector(id).scrollIntoView({
|
|
behavior: "smooth",
|
|
block: "start",
|
|
inline: "nearest"
|
|
});
|
|
},
|
|
imgZoom() { // 图片放大
|
|
const self = this;
|
|
$(".dock-content img").each(function () {
|
|
$(this).click(function () {
|
|
if (!self.imgZoomFlag) {
|
|
self.imgZoomFlag = true
|
|
$(this).addClass("img-active")
|
|
} else {
|
|
self.imgZoomFlag = false
|
|
$(this).removeClass("img-active")
|
|
}
|
|
})
|
|
})
|
|
document.addEventListener('keydown', function (event) {
|
|
if (event.key === 'Escape' || event.keyCode === 27) {
|
|
$(".dock-content img").each(function () {
|
|
self.imgZoomFlag = false
|
|
$(this).removeClass("img-active")
|
|
})
|
|
}
|
|
});
|
|
},
|
|
imgZoomHide(e) { // 图片放大隐藏
|
|
e.stopPropagation() // 阻止事件冒泡
|
|
this.imgZoomFlag = false
|
|
$(".img-active").removeClass("img-active")
|
|
},
|
|
filterNode(value, data) {
|
|
if (!value) return true;
|
|
return data.label.indexOf(value) !== -1;
|
|
},
|
|
hideLeftBar() { // 左边目录树隐藏
|
|
this.dockLeftHideClass = !this.dockLeftHideClass
|
|
},
|
|
clickExpand() { // 展开收起
|
|
const self = this;
|
|
self.dockLeftExpandFlag = !self.dockLeftExpandFlag;
|
|
let node = self.$refs.tree.store.root;
|
|
this.expandAllNodes(node, self.dockLeftExpandFlag);
|
|
},
|
|
expandAllNodes(node, flag) {
|
|
node.expanded = flag;
|
|
if (node.childNodes) {
|
|
for (let i = 0; i < node.childNodes.length; i++) {
|
|
this.expandAllNodes(node.childNodes[i], flag);
|
|
}
|
|
}
|
|
},
|
|
autoMenu: function () { // 组合出右侧的小目录
|
|
var h2Tags = document.querySelectorAll('.dock-content h4');
|
|
var tocContainer = document.querySelector('.dock-right-menu');
|
|
// 生成目录
|
|
var tocList = document.createElement('ul');
|
|
for (var i = 0; i < h2Tags.length; i++) {
|
|
var h2Tag = h2Tags[i];
|
|
var id = 'doc' + (i + 1);
|
|
h2Tag.id = id;
|
|
var tocItem = document.createElement('li');
|
|
var tocLink = document.createElement('a');
|
|
tocLink.href = '#' + id;
|
|
tocLink.textContent = h2Tag.textContent;
|
|
tocLink.classList.add('menu');
|
|
tocItem.appendChild(tocLink);
|
|
tocList.appendChild(tocItem);
|
|
}
|
|
tocContainer.appendChild(tocList);
|
|
// 监听目录节点点击事件
|
|
var tocLinks = tocContainer.querySelectorAll('a');
|
|
for (var i = 0; i < tocLinks.length; i++) {
|
|
tocLinks[i].addEventListener('click', function (event) {
|
|
event.preventDefault();
|
|
var targetId = this.getAttribute('href').substring(1);
|
|
var targetElement = document.getElementById(targetId);
|
|
var targetOffset = targetElement.offsetTop - 80; // 距离顶部 80px 的位置
|
|
targetElement.scrollIntoView({ behavior: 'smooth' })// 执行滚动
|
|
// scrollTo({ top: targetOffset, behavior: 'smooth' });
|
|
});
|
|
}
|
|
function handleScroll() {
|
|
var currentPosition = window.pageYOffset || document.documentElement.scrollTop;
|
|
var highlightedIndex = -1;
|
|
for (var i = 0; i < h2Tags.length; i++) {
|
|
var h2Tag = h2Tags[i];
|
|
var rect = h2Tag.getBoundingClientRect();
|
|
if (rect.top <= 160) {
|
|
highlightedIndex = i;
|
|
}
|
|
}
|
|
// 移除所有目录节点的高亮样式
|
|
for (var i = 0; i < tocLinks.length; i++) {
|
|
tocLinks[i].classList.remove('menu-active');
|
|
}
|
|
// 高亮显示当前区域对应的目录节点
|
|
if (highlightedIndex >= 0) {
|
|
tocLinks[highlightedIndex].classList.add('menu-active');
|
|
}
|
|
}
|
|
const debounceHandleScroll = debounce(handleScroll, 100);
|
|
// 监听滚动事件,实现目录节点的高亮
|
|
const dockContent = document.querySelector('.dock-right');
|
|
document.querySelector('.dock-right').addEventListener('scroll', debounceHandleScroll);
|
|
},
|
|
async queryMenu() {
|
|
const self = this;
|
|
self.data = []
|
|
/* ----------- 查询大目录 ---------- */
|
|
try {
|
|
const menuParam = new URLSearchParams({ query: "query" });
|
|
const res = await axios.post("/api/help/query_catalog.php", menuParam);
|
|
let data = res.data;
|
|
let objChildren = data.filter(item => item.parent_id != 63788).map(item => ({
|
|
id: item.id,
|
|
pid: item.parent_id,
|
|
label: item.typename,
|
|
href: item.diy_dirpath,
|
|
type: "cate",
|
|
children: []
|
|
}));
|
|
self.data = data.filter(item => item.parent_id == 63788).map(item => ({
|
|
id: item.id,
|
|
pid: item.parent_id,
|
|
label: item.typename,
|
|
href: item.diy_dirpath,
|
|
type: "menu",
|
|
children: objChildren.filter(child => child.pid === item.id)
|
|
}));
|
|
} catch (err) {
|
|
console.error(err);
|
|
return {};
|
|
}
|
|
/* ----------- 查询小目录 ---------- */
|
|
try {
|
|
const dockParam = new URLSearchParams({ dockQuery: "dockQuery" });
|
|
const res = await axios({
|
|
method: "post",
|
|
url: "/api/help/query_catalog.php",
|
|
data: dockParam
|
|
});
|
|
let data = res.data;
|
|
let arr = data.map(item => ({
|
|
id: item.aid,
|
|
pid: item.typeid,
|
|
label: item.title,
|
|
href: ''
|
|
}));
|
|
arr.forEach(item => {
|
|
let parent = self.data.find(d => d.id === item.pid);
|
|
if (parent) {
|
|
item.href = `${parent.href}/${item.id}.html`;
|
|
parent.children.push(item);
|
|
parent.children.sort((a, b) => a.id - b.id);
|
|
} else {
|
|
let grandParent = self.data.find(d => d.children.some(child => child.id === item.pid));
|
|
if (grandParent) {
|
|
let parent = grandParent.children.find(child => child.id === item.pid);
|
|
item.type = "docLast";
|
|
item.href = `${parent.href}/${item.id}.html`;
|
|
parent.children.push(item);
|
|
}
|
|
}
|
|
});
|
|
} catch (err) {
|
|
console.log("🚀 file: help.js:123 queryDock err:", err);
|
|
return {};
|
|
}
|
|
},
|
|
async queryDock() { // 查询目录树
|
|
const self = this;
|
|
// await self.queryMenu();
|
|
/* ------------- 当前文档信息 ------------- */
|
|
var lastUrlNameIndex = location.href.lastIndexOf("/");
|
|
var lastUrlNameText = location.href.substring(lastUrlNameIndex + 1);
|
|
lastUrlNameIndex = lastUrlNameText.indexOf(".html");
|
|
lastUrlName = lastUrlNameText.substring(0, lastUrlNameIndex) || 3851;
|
|
let currentDocId = lastUrlName || sessionStorage.getItem("currentDocId") || tool.getCookie("currentDocId") || 3851
|
|
if (location.href.includes("/help/callcenter/function/")) {
|
|
currentDocId = 4375
|
|
}
|
|
/* ----------- 查询右侧目录 ---------- */
|
|
let docParam = new URLSearchParams();
|
|
docParam.append("doc", "doc");
|
|
docParam.append("docId", currentDocId);
|
|
let currentDocPid = currentDocId;
|
|
let response = await axios({
|
|
method: "post",
|
|
url: "/api/help/query_catalog.php",
|
|
data: docParam
|
|
});
|
|
let data = response.data;
|
|
// 组合出右侧的小目录
|
|
let lastItem = data[data.length - 1];
|
|
self.currentDoc.id = lastItem.aid;
|
|
self.currentDoc.pid = lastItem.typeid;
|
|
currentDocPid = lastItem.typeid;
|
|
self.currentDoc.label = lastItem.title;
|
|
if (!sessionStorage.getItem("expandedKeys") || JSON.parse(sessionStorage.getItem("expandedKeys")).length == 0 || sessionStorage.getItem("currentDocId") != currentDocId) {
|
|
self.currentDoc.expandedKeys = [];
|
|
self.data.find(({ id, children }) => {
|
|
if (currentDocPid == id) {
|
|
self.currentDoc.expandedKeys.push(currentDocPid);
|
|
return true;
|
|
}
|
|
return children.find(({ id }) => {
|
|
if (currentDocPid == id) {
|
|
self.currentDoc.expandedKeys.push(id);
|
|
return true;
|
|
}
|
|
});
|
|
});
|
|
}
|
|
NProgress.done();
|
|
},
|
|
currentDocClick(e, clickId, pid, href) {
|
|
e.preventDefault();
|
|
sessionStorage.setItem("currentDocId", clickId)
|
|
tool.setCookie("currentDocId", clickId, 1)
|
|
const tempArr = [];
|
|
this.data.find(({ id, children }) => {
|
|
if (pid == id) {
|
|
tempArr.push(pid);
|
|
return true;
|
|
}
|
|
return children.find(({ id }) => {
|
|
if (pid == id) {
|
|
tempArr.push(pid);
|
|
return true;
|
|
}
|
|
});
|
|
});
|
|
const sessionExpandedKeys = JSON.parse(sessionStorage.getItem("expandedKeys")) || [];
|
|
if (sessionExpandedKeys.length == 0 || !sessionExpandedKeys.includes(pid)) {
|
|
sessionStorage.setItem("expandedKeys", JSON.stringify(tempArr))
|
|
}
|
|
location.href = href;
|
|
}
|
|
}
|
|
});
|