dsh-total-quality 2.0.55 → 2.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +51 -47
- package/LICENSE.md +37 -37
- package/README.en.md +32 -30
- package/README.md +90 -88
- package/agent-host.cjs +277 -277
- package/client.js +199 -92
- package/cordis.patch.yml +5 -5
- package/docs/enterprise-onboarding.md +10 -10
- package/docs/technical-reference.md +223 -223
- package/host.cjs +91 -124
- package/llm-bridge.cjs +234 -234
- package/locale/en.json +5 -5
- package/locale/zh.json +5 -5
- package/package.json +3 -2
- package/public/app.css +3 -0
- package/public/app.js +6 -2
- package/public/index.html +8 -9
- package/public/js/api.js +152 -152
- package/public/js/assistant-history.js +62 -62
- package/public/js/material-library.js +100 -100
- package/public/js/mobile-preview.js +119 -0
- package/public/js/pages-company-knowledge.js +9 -32
- package/public/js/pages-core.js +232 -232
- package/public/js/pages-growth.js +148 -148
- package/public/js/pages-qms.js +1 -1
- package/public/js/pages-qtools.js +410 -410
- package/public/js/pages-thanks.js +71 -71
- package/public/js/plugin-updates.js +53 -0
- package/public/js/quality-workflow.js +205 -205
- package/public/js/survey-dates.js +41 -41
- package/public/js/survey-knowledge.js +301 -301
- package/public/js/tool-wizards.js +621 -621
- package/public/js/ui.js +467 -467
- package/public/js/voice-capture-worklet.js +30 -30
- package/public/js/xiaozhi-voice.js +264 -264
- package/public/js/xiaozhi.js +468 -468
- package/public/platform-help.html +426 -426
- package/public/platform-site/assets/0468a68574112812.css +10703 -10703
- package/public/platform-site/assets/159e086d35adfa1c.css +2094 -2094
- package/public/platform-site/assets/169e3159cade0d9f.css +98 -98
- package/public/platform-site/assets/22b917c4a3d4ae3d.svg +14 -14
- package/public/platform-site/assets/476f9254ccf723e7.css +8265 -8265
- package/public/platform-site/assets/85a0a4fb4416ded9.css +120 -120
- package/public/platform-site/assets/a3b272383226f6d9.svg +135 -135
- package/public/platform-site/assets/fd16dc5f3cc9d97e.svg +104 -104
- package/public/platform-site/assets/qip-favicon.svg +5 -5
- package/public/platform-site/index.html +279 -279
- package/public/platform-site/offline.js +261 -261
- package/public/platform-site/qip-brand.css +566 -566
- package/public/platform-site/qip-module-guides.js +237 -237
- package/public/responsive.css +103 -101
- package/public/vendor/markdown-it-15.0.3.LICENSE +22 -22
- package/public/vendor/markdown-it-15.0.3.umd.min.js +13 -13
- package/public/workbench.css +7 -7
- package/public/xiaozhi.css +292 -292
- package/resources/qms-templates/019ffb58f24ed48d.docx +0 -0
- package/resources/qms-templates/04a69165fc15143a.docx +0 -0
- package/resources/qms-templates/09af69358c989a63.docx +0 -0
- package/resources/qms-templates/0e7ac77844e45311.docx +0 -0
- package/resources/qms-templates/12446a1b5e173c71.docx +0 -0
- package/resources/qms-templates/15ae40f67f9a3efc.docx +0 -0
- package/resources/qms-templates/18a69bbebf2ece7f.docx +0 -0
- package/resources/qms-templates/1978faa989134f02.docx +0 -0
- package/resources/qms-templates/1a30e121de752f7b.docx +0 -0
- package/resources/qms-templates/1b88907969ea7d4c.docx +0 -0
- package/resources/qms-templates/1e92b808722bf90a.docx +0 -0
- package/resources/qms-templates/2091cad340dc0e7f.docx +0 -0
- package/resources/qms-templates/271ae1002c896ed7.docx +0 -0
- package/resources/qms-templates/280ce53e5d3b5fcf.docx +0 -0
- package/resources/qms-templates/28ca8e4ede0adf6d.docx +0 -0
- package/resources/qms-templates/2ac6675f3cb1f993.docx +0 -0
- package/resources/qms-templates/2c3b799389909d8b.docx +0 -0
- package/resources/qms-templates/2c51038ba2cc3264.docx +0 -0
- package/resources/qms-templates/30c888851d16d764.docx +0 -0
- package/resources/qms-templates/3459fc4daaa2743d.docx +0 -0
- package/resources/qms-templates/3751dafc335e0e80.docx +0 -0
- package/resources/qms-templates/38798cd4298cd2db.docx +0 -0
- package/resources/qms-templates/38f551f9d738ab0a.docx +0 -0
- package/resources/qms-templates/3c85a23ea17018b4.docx +0 -0
- package/resources/qms-templates/3cdb7d14caf1b852.docx +0 -0
- package/resources/qms-templates/3f23239bb6b3e1db.docx +0 -0
- package/resources/qms-templates/42a5b9efeeaa8007.docx +0 -0
- package/resources/qms-templates/47352aafe9b8dac1.docx +0 -0
- package/resources/qms-templates/495359b1e3cbb8fe.docx +0 -0
- package/resources/qms-templates/4ca6920464785166.docx +0 -0
- package/resources/qms-templates/4ce862582a7791be.docx +0 -0
- package/resources/qms-templates/54c9a02a10991b9e.docx +0 -0
- package/resources/qms-templates/5aeb8fddf5f3693f.docx +0 -0
- package/resources/qms-templates/5d7e5576b0e73be7.docx +0 -0
- package/resources/qms-templates/5db3a40edac37791.docx +0 -0
- package/resources/qms-templates/5ffa21eb78eb6f77.docx +0 -0
- package/resources/qms-templates/60d0fbcb709b7161.docx +0 -0
- package/resources/qms-templates/63e1d3a166756095.docx +0 -0
- package/resources/qms-templates/65c724c080d32f10.docx +0 -0
- package/resources/qms-templates/674bd7826c6cbac2.docx +0 -0
- package/resources/qms-templates/677e851acca1b879.docx +0 -0
- package/resources/qms-templates/6bf15feb1a0d2a8d.docx +0 -0
- package/resources/qms-templates/6c3889c7d0918db9.docx +0 -0
- package/resources/qms-templates/6c4c349eeb0a96a8.docx +0 -0
- package/resources/qms-templates/6c5befbd33f759c1.docx +0 -0
- package/resources/qms-templates/6df8367901347508.docx +0 -0
- package/resources/qms-templates/71db51997037692b.docx +0 -0
- package/resources/qms-templates/78a8ef8c76510c99.docx +0 -0
- package/resources/qms-templates/8397bfd1c0a1b013.docx +0 -0
- package/resources/qms-templates/84d750cf858b60a1.docx +0 -0
- package/resources/qms-templates/880de58a4b334533.docx +0 -0
- package/resources/qms-templates/88c37d1b87d9b78c.docx +0 -0
- package/resources/qms-templates/88e9cd42f1849462.docx +0 -0
- package/resources/qms-templates/8956597403be35b6.docx +0 -0
- package/resources/qms-templates/94675c810a233e1f.docx +0 -0
- package/resources/qms-templates/94dff59dd7ebec6e.docx +0 -0
- package/resources/qms-templates/9670b9cd02141594.docx +0 -0
- package/resources/qms-templates/98c373ebd7b5163d.docx +0 -0
- package/resources/qms-templates/a4078cf2378a9388.docx +0 -0
- package/resources/qms-templates/a5b110c7ef917139.docx +0 -0
- package/resources/qms-templates/aec75820e45774be.docx +0 -0
- package/resources/qms-templates/b31c085e281d230c.docx +0 -0
- package/resources/qms-templates/b7c1c3c72f8ffeef.docx +0 -0
- package/resources/qms-templates/b81b82eaa5c8f422.docx +0 -0
- package/resources/qms-templates/b92a2fa31f75f137.docx +0 -0
- package/resources/qms-templates/b96c54ae9cfffc54.docx +0 -0
- package/resources/qms-templates/bc47cfd626c010e7.docx +0 -0
- package/resources/qms-templates/be60792734afca69.docx +0 -0
- package/resources/qms-templates/c0018d8ae9ad19e1.docx +0 -0
- package/resources/qms-templates/c171027c964c8be3.docx +0 -0
- package/resources/qms-templates/c4b93d71f5d98b4b.docx +0 -0
- package/resources/qms-templates/c531da29fcb3090f.docx +0 -0
- package/resources/qms-templates/c88eddd43358d015.docx +0 -0
- package/resources/qms-templates/cb978da542f0d892.docx +0 -0
- package/resources/qms-templates/ccde4a94532a8d36.docx +0 -0
- package/resources/qms-templates/cf3fb1e20ae6f24d.docx +0 -0
- package/resources/qms-templates/d231b4982fc8113e.docx +0 -0
- package/resources/qms-templates/d3c55aa5ed14055c.docx +0 -0
- package/resources/qms-templates/db45c44a00a13349.docx +0 -0
- package/resources/qms-templates/db849a41210f54e0.docx +0 -0
- package/resources/qms-templates/dba9ce363d83ddc8.docx +0 -0
- package/resources/qms-templates/dca3ea4c95eb2225.docx +0 -0
- package/resources/qms-templates/dfa4220d2b6b8131.docx +0 -0
- package/resources/qms-templates/dfa51222c777734f.docx +0 -0
- package/resources/qms-templates/e07ea511507e14f5.docx +0 -0
- package/resources/qms-templates/e0a2e00c03458dfa.docx +0 -0
- package/resources/qms-templates/e0e802f46b6764d1.docx +0 -0
- package/resources/qms-templates/e53fc85717f2852b.docx +0 -0
- package/resources/qms-templates/e9dd82d5e54520e5.docx +0 -0
- package/resources/qms-templates/ea7bfc22c06d82a9.docx +0 -0
- package/resources/qms-templates/ecf0db9f37294536.docx +0 -0
- package/resources/qms-templates/f05fcfc87e82ff39.docx +0 -0
- package/resources/qms-templates/fb9e56a17c4a4f97.docx +0 -0
- package/resources/qms-templates/manifest.json +932 -0
- package/src/data/seed-sme.js +317 -317
- package/src/data/seed.js +879 -879
- package/src/lib/backup-identity.js +57 -57
- package/src/lib/chat-answer.js +225 -225
- package/src/lib/chat-context.js +99 -99
- package/src/lib/company-library.js +28 -19
- package/src/lib/data-import.js +217 -217
- package/src/lib/data-sources.js +118 -118
- package/src/lib/demo-data.js +27 -1
- package/src/lib/employee-intake.js +84 -84
- package/src/lib/growth.js +53 -53
- package/src/lib/intake-packets.js +119 -119
- package/src/lib/issue-intake.js +88 -88
- package/src/lib/kb-revision.js +214 -214
- package/src/lib/llm.js +279 -279
- package/src/lib/model-error.js +14 -14
- package/src/lib/privacy.js +26 -26
- package/src/lib/qms-drafting.js +194 -194
- package/src/lib/qms-jobs.js +11 -7
- package/src/lib/qms-manual-review.js +185 -185
- package/src/lib/qms-procedure-review.js +109 -109
- package/src/lib/qms-templates.js +358 -326
- package/src/lib/qms.js +369 -369
- package/src/lib/quality-priority.js +100 -100
- package/src/lib/quality-state.js +92 -92
- package/src/lib/quality-workflow.js +65 -65
- package/src/lib/retrieval.js +159 -159
- package/src/lib/spc.js +127 -127
- package/src/lib/voice-hotwords.txt +22 -22
- package/src/lib/voice-text.js +13 -13
- package/src/lib/voice-worker.js +72 -72
- package/src/lib/voice.js +330 -330
- package/src/lib/workbench-notices.js +49 -49
- package/src/lib/workbench.js +103 -106
- package/src/package.json +3 -3
- package/src/tools/analysis.js +306 -306
- package/src/tools/data.js +596 -596
- package/src/tools/docs.js +430 -430
- package/src/tools/registry.js +57 -57
- package/tools-dsh.cjs +153 -153
- package//345/256/211/350/243/205/350/257/264/346/230/216.md +33 -25
- package//346/234/254/346/234/272/347/213/254/347/253/213/345/256/211/350/243/205/350/257/264/346/230/216.md +17 -17
- package//350/207/252/346/243/200.cjs +88 -88
- package/public/js/remote-knowledge.js +0 -165
- package/public/js/workbench-notices.js +0 -67
- package/public/remote-knowledge-help.html +0 -35
- package/public/remote-knowledge.css +0 -40
- package/src/lib/remote-knowledge.js +0 -284
|
@@ -1,261 +1,261 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
// The captured styles position slides individually. Preserve the spacing and
|
|
4
|
-
// reuse the original arrow controls without loading the site's online runtime.
|
|
5
|
-
document.querySelectorAll('.ud__carousel').forEach(carousel => {
|
|
6
|
-
const track = carousel.querySelector('.ud__carousel__track')
|
|
7
|
-
if (!track) return
|
|
8
|
-
const slides = [...track.children].filter(slide => slide.classList.contains('ud__carousel__slide'))
|
|
9
|
-
const offsets = slides.map(slide => Number(slide.style.transform.match(/translate3d\((-?[\d.]+)px/)?.[1]))
|
|
10
|
-
if (slides.length < 2 || !offsets.every(Number.isFinite)) return
|
|
11
|
-
|
|
12
|
-
const step = offsets[1] - offsets[0]
|
|
13
|
-
if (!step) return
|
|
14
|
-
const controls = carousel.parentElement.matches('.solutions__carousel-wrapper, .logowalls__carousel-wrapper') ? carousel.parentElement : carousel
|
|
15
|
-
let current = 0
|
|
16
|
-
const indicators = [...carousel.querySelectorAll('.ud__carousel__indicator-item')]
|
|
17
|
-
const initial = Math.max(0, indicators.findIndex(item => item.classList.contains('ud__carousel__indicator-item-active')))
|
|
18
|
-
const indicatorClasses = indicators.map(item => item.className)
|
|
19
|
-
|
|
20
|
-
function move(delta) {
|
|
21
|
-
current += delta
|
|
22
|
-
const period = slides.length * Math.abs(step)
|
|
23
|
-
const first = Math.min(...offsets)
|
|
24
|
-
slides.forEach((slide, index) => {
|
|
25
|
-
const offset = ((offsets[index] - first - current * step) % period + period) % period + first
|
|
26
|
-
slide.style.transform = `translate3d(${offset}px, 0px, 0px)`
|
|
27
|
-
})
|
|
28
|
-
const active = ((initial + current) % indicators.length + indicators.length) % indicators.length
|
|
29
|
-
indicators.forEach((item, index) => {
|
|
30
|
-
item.className = index === active ? indicatorClasses[initial] : indicatorClasses.find((_, j) => j !== initial) ?? indicatorClasses[initial]
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
controls.querySelectorAll('.ud__carousel__prev-switcher, .solutions__nav-left button, .logowalls__nav-left button').forEach(button => {
|
|
35
|
-
button.setAttribute('aria-label', '上一张')
|
|
36
|
-
button.addEventListener('click', () => move(-1))
|
|
37
|
-
})
|
|
38
|
-
controls.querySelectorAll('.ud__carousel__next-switcher, .solutions__nav-right button, .logowalls__nav-right button').forEach(button => {
|
|
39
|
-
button.setAttribute('aria-label', '下一张')
|
|
40
|
-
button.addEventListener('click', () => move(1))
|
|
41
|
-
})
|
|
42
|
-
indicators.forEach((item, index) => item.addEventListener('click', () => {
|
|
43
|
-
const position = ((initial + current) % indicators.length + indicators.length) % indicators.length
|
|
44
|
-
move(index - position)
|
|
45
|
-
}))
|
|
46
|
-
let startX
|
|
47
|
-
track.addEventListener('touchstart', event => { startX = event.changedTouches[0]?.clientX }, { passive: true })
|
|
48
|
-
track.addEventListener('touchend', event => {
|
|
49
|
-
const shift = event.changedTouches[0]?.clientX - startX
|
|
50
|
-
if (Math.abs(shift) > 45) move(shift < 0 ? 1 : -1)
|
|
51
|
-
}, { passive: true })
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
document.querySelector('.top-banner-container__close')?.addEventListener('click', event => {
|
|
55
|
-
event.currentTarget.closest('[class*="top-banner-container"]').parentElement.hidden = true
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const sectionTargets = ['.solutions', '.skus', '.section-3', '.supports']
|
|
60
|
-
const sectionTabs = [...document.querySelectorAll('.nav-bar__item')]
|
|
61
|
-
sectionTabs.forEach((tab, index) => {
|
|
62
|
-
const target = document.querySelector(sectionTargets[index] || ':not(*)')
|
|
63
|
-
if (!target) return
|
|
64
|
-
const activate = () => {
|
|
65
|
-
sectionTabs.forEach(item => item.classList.toggle('active', item === tab))
|
|
66
|
-
target.scrollIntoView({ behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'instant' : 'smooth' })
|
|
67
|
-
}
|
|
68
|
-
tab.tabIndex = 0
|
|
69
|
-
tab.setAttribute('role', 'button')
|
|
70
|
-
tab.addEventListener('click', activate)
|
|
71
|
-
tab.addEventListener('keydown', event => {
|
|
72
|
-
if (event.key !== 'Enter' && event.key !== ' ') return
|
|
73
|
-
event.preventDefault()
|
|
74
|
-
activate()
|
|
75
|
-
})
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
document.querySelectorAll('.industries').forEach(section => {
|
|
79
|
-
const track = section.querySelector('.industries__pc-list')
|
|
80
|
-
const cards = track ? [...track.querySelectorAll('.industries__pc-item')] : []
|
|
81
|
-
if (cards.length < 2) return
|
|
82
|
-
let selected = Math.max(0, cards.findIndex(card => card.classList.contains('active')))
|
|
83
|
-
const initial = selected
|
|
84
|
-
const base = Number(cards[0].style.transform.match(/translate3d\((-?[\d.]+)px/)?.[1]) || 0
|
|
85
|
-
function select(index) {
|
|
86
|
-
selected = (index + cards.length) % cards.length
|
|
87
|
-
const step = cards[1].offsetLeft - cards[0].offsetLeft || 240
|
|
88
|
-
cards.forEach((card, i) => {
|
|
89
|
-
card.classList.toggle('active', selected === i)
|
|
90
|
-
card.style.transform = `translate3d(${base - (selected - initial) * step}px, 0px, 0px)`
|
|
91
|
-
})
|
|
92
|
-
}
|
|
93
|
-
section.querySelectorAll('button.industries__nav').forEach((button, index) => {
|
|
94
|
-
button.setAttribute('aria-label', index ? '下一位' : '上一位')
|
|
95
|
-
button.addEventListener('click', () => select(selected + (index ? 1 : -1)))
|
|
96
|
-
})
|
|
97
|
-
cards.forEach((card, index) => card.addEventListener('click', event => {
|
|
98
|
-
if (!event.target.closest('a, button')) select(index)
|
|
99
|
-
}))
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
const qipRail = document.getElementById('qip-scene-rail')
|
|
103
|
-
if (qipRail) {
|
|
104
|
-
const prev = document.querySelector('.qip-scene-prev')
|
|
105
|
-
const next = document.querySelector('.qip-scene-next')
|
|
106
|
-
const update = () => {
|
|
107
|
-
prev.disabled = qipRail.scrollLeft <= 2
|
|
108
|
-
next.disabled = qipRail.scrollWidth - qipRail.clientWidth - qipRail.scrollLeft <= 2
|
|
109
|
-
}
|
|
110
|
-
const move = direction => {
|
|
111
|
-
const step = qipRail.children[1].offsetLeft - qipRail.children[0].offsetLeft
|
|
112
|
-
qipRail.scrollBy({ left: direction * step, behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'instant' : 'smooth' })
|
|
113
|
-
}
|
|
114
|
-
prev.addEventListener('click', () => move(-1))
|
|
115
|
-
next.addEventListener('click', () => move(1))
|
|
116
|
-
qipRail.addEventListener('scroll', update, { passive: true })
|
|
117
|
-
qipRail.addEventListener('keydown', event => {
|
|
118
|
-
if (event.target !== qipRail || !['ArrowLeft','ArrowRight'].includes(event.key)) return
|
|
119
|
-
event.preventDefault()
|
|
120
|
-
move(event.key === 'ArrowRight' ? 1 : -1)
|
|
121
|
-
})
|
|
122
|
-
new ResizeObserver(update).observe(qipRail)
|
|
123
|
-
update()
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
document.querySelectorAll('.qip-contact-open').forEach(button => {
|
|
127
|
-
const dialog = document.getElementById(button.getAttribute('aria-controls'))
|
|
128
|
-
if (!dialog) return
|
|
129
|
-
button.addEventListener('click', () => {
|
|
130
|
-
if (!dialog.open) dialog.showModal()
|
|
131
|
-
})
|
|
132
|
-
})
|
|
133
|
-
document.querySelectorAll('.qip-contact-dialog, .qip-install-dialog').forEach(dialog => {
|
|
134
|
-
dialog.addEventListener('click', event => {
|
|
135
|
-
if (event.target !== dialog) return
|
|
136
|
-
const rect = dialog.getBoundingClientRect()
|
|
137
|
-
if (event.clientX < rect.left || event.clientX > rect.right ||
|
|
138
|
-
event.clientY < rect.top || event.clientY > rect.bottom) dialog.close()
|
|
139
|
-
})
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
const qipAdvisorForm = document.getElementById('qip-advisor-form')
|
|
143
|
-
if (qipAdvisorForm) {
|
|
144
|
-
const result = document.getElementById('qip-advisor-result')
|
|
145
|
-
const download = result.querySelector('.qip-advisor-download')
|
|
146
|
-
const fields = [
|
|
147
|
-
['fullName', '姓名'],
|
|
148
|
-
['phone', '手机号'],
|
|
149
|
-
['company', '企业名称'],
|
|
150
|
-
['companySize', '公司规模'],
|
|
151
|
-
['role', '职位']
|
|
152
|
-
]
|
|
153
|
-
let draft = ''
|
|
154
|
-
const clearDraft = () => {
|
|
155
|
-
draft = ''
|
|
156
|
-
result.hidden = true
|
|
157
|
-
}
|
|
158
|
-
qipAdvisorForm.addEventListener('input', event => {
|
|
159
|
-
event.target.setCustomValidity?.('')
|
|
160
|
-
clearDraft()
|
|
161
|
-
})
|
|
162
|
-
qipAdvisorForm.addEventListener('submit', event => {
|
|
163
|
-
event.preventDefault()
|
|
164
|
-
for (const name of ['fullName', 'company']) {
|
|
165
|
-
const input = qipAdvisorForm.elements.namedItem(name)
|
|
166
|
-
input.setCustomValidity(input.value.trim() ? '' : '请填写此项')
|
|
167
|
-
}
|
|
168
|
-
if (!qipAdvisorForm.reportValidity()) return
|
|
169
|
-
const data = new FormData(qipAdvisorForm)
|
|
170
|
-
const rows = fields.map(([name, label]) => {
|
|
171
|
-
const value = data.get(name).trim()
|
|
172
|
-
return label + ':' + (name === 'phone' ? '+86 ' : '') + value
|
|
173
|
-
})
|
|
174
|
-
draft = ['全质开源质量平台顾问预约单', '', ...rows].join('\n')
|
|
175
|
-
result.hidden = false
|
|
176
|
-
download.focus()
|
|
177
|
-
})
|
|
178
|
-
download.addEventListener('click', () => {
|
|
179
|
-
if (!draft) return
|
|
180
|
-
const url = URL.createObjectURL(new Blob([draft], { type: 'text/plain;charset=utf-8' }))
|
|
181
|
-
const link = document.createElement('a')
|
|
182
|
-
link.href = url
|
|
183
|
-
link.download = '全质顾问预约单.txt'
|
|
184
|
-
link.click()
|
|
185
|
-
setTimeout(() => URL.revokeObjectURL(url), 1000)
|
|
186
|
-
})
|
|
187
|
-
qipAdvisorForm.closest('dialog').addEventListener('close', () => {
|
|
188
|
-
qipAdvisorForm.reset()
|
|
189
|
-
for (const name of ['fullName', 'company']) qipAdvisorForm.elements.namedItem(name).setCustomValidity('')
|
|
190
|
-
clearDraft()
|
|
191
|
-
})
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const qipGuideDialog = document.querySelector('.qip-guide-dialog')
|
|
195
|
-
if (qipGuideDialog) {
|
|
196
|
-
const { categories, articles } = qipModuleGuides
|
|
197
|
-
const query = qipGuideDialog.querySelector('.qip-guide-query')
|
|
198
|
-
const group = qipGuideDialog.querySelector('.qip-guide-group')
|
|
199
|
-
const mobile = qipGuideDialog.querySelector('.qip-guide-mobile')
|
|
200
|
-
const list = qipGuideDialog.querySelector('.qip-guide-results')
|
|
201
|
-
const content = qipGuideDialog.querySelector('.qip-guide-content')
|
|
202
|
-
let active = 'start'
|
|
203
|
-
let displayed
|
|
204
|
-
group.replaceChildren(...categories.map(([id, label]) => new Option(label, id)))
|
|
205
|
-
|
|
206
|
-
const buttons = new Map(articles.map(article => {
|
|
207
|
-
const button = document.createElement('button')
|
|
208
|
-
button.type = 'button'
|
|
209
|
-
button.textContent = article.title
|
|
210
|
-
const arrow = document.createElement('span')
|
|
211
|
-
arrow.setAttribute('aria-hidden', 'true')
|
|
212
|
-
arrow.textContent = '›'
|
|
213
|
-
button.append(arrow)
|
|
214
|
-
button.addEventListener('click', () => render(article.id))
|
|
215
|
-
list.append(button)
|
|
216
|
-
return [article.id, button]
|
|
217
|
-
}))
|
|
218
|
-
|
|
219
|
-
function render(preferred = active) {
|
|
220
|
-
const words = query.value.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)
|
|
221
|
-
const matches = articles.filter(article =>
|
|
222
|
-
(group.value === 'all' || article.group === group.value) &&
|
|
223
|
-
words.every(word => article.search.toLocaleLowerCase().includes(word)))
|
|
224
|
-
const selected = matches.find(article => article.id === preferred) ?? matches[0]
|
|
225
|
-
active = selected?.id
|
|
226
|
-
const visible = new Set(matches.map(article => article.id))
|
|
227
|
-
for (const [id, button] of buttons) {
|
|
228
|
-
button.hidden = !visible.has(id)
|
|
229
|
-
if (id === active) button.setAttribute('aria-current', 'true')
|
|
230
|
-
else button.removeAttribute('aria-current')
|
|
231
|
-
}
|
|
232
|
-
mobile.replaceChildren(...matches.map(article => new Option(article.title, article.id)))
|
|
233
|
-
if (active) mobile.value = active
|
|
234
|
-
mobile.disabled = !selected
|
|
235
|
-
if (displayed === active) return
|
|
236
|
-
displayed = active
|
|
237
|
-
if (selected) content.innerHTML = selected.html
|
|
238
|
-
else {
|
|
239
|
-
const empty = document.createElement('p')
|
|
240
|
-
empty.setAttribute('role', 'status')
|
|
241
|
-
empty.textContent = '没有匹配的指南。试试「手册」「来料」或「小质」。'
|
|
242
|
-
content.replaceChildren(empty)
|
|
243
|
-
}
|
|
244
|
-
content.scrollTop = 0
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
query.addEventListener('input', () => render())
|
|
248
|
-
group.addEventListener('change', () => { list.scrollTop = 0; render() })
|
|
249
|
-
mobile.addEventListener('change', () => render(mobile.value))
|
|
250
|
-
document.querySelectorAll('.qip-install-open, [data-qip-guide]').forEach(trigger => {
|
|
251
|
-
trigger.addEventListener('click', event => {
|
|
252
|
-
event.preventDefault()
|
|
253
|
-
query.value = ''
|
|
254
|
-
group.value = 'all'
|
|
255
|
-
render(trigger.dataset.qipGuide || 'start')
|
|
256
|
-
if (!qipGuideDialog.open) qipGuideDialog.showModal()
|
|
257
|
-
list.scrollTop = 0
|
|
258
|
-
buttons.get(active)?.scrollIntoView({ block: 'nearest' })
|
|
259
|
-
})
|
|
260
|
-
})
|
|
261
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// The captured styles position slides individually. Preserve the spacing and
|
|
4
|
+
// reuse the original arrow controls without loading the site's online runtime.
|
|
5
|
+
document.querySelectorAll('.ud__carousel').forEach(carousel => {
|
|
6
|
+
const track = carousel.querySelector('.ud__carousel__track')
|
|
7
|
+
if (!track) return
|
|
8
|
+
const slides = [...track.children].filter(slide => slide.classList.contains('ud__carousel__slide'))
|
|
9
|
+
const offsets = slides.map(slide => Number(slide.style.transform.match(/translate3d\((-?[\d.]+)px/)?.[1]))
|
|
10
|
+
if (slides.length < 2 || !offsets.every(Number.isFinite)) return
|
|
11
|
+
|
|
12
|
+
const step = offsets[1] - offsets[0]
|
|
13
|
+
if (!step) return
|
|
14
|
+
const controls = carousel.parentElement.matches('.solutions__carousel-wrapper, .logowalls__carousel-wrapper') ? carousel.parentElement : carousel
|
|
15
|
+
let current = 0
|
|
16
|
+
const indicators = [...carousel.querySelectorAll('.ud__carousel__indicator-item')]
|
|
17
|
+
const initial = Math.max(0, indicators.findIndex(item => item.classList.contains('ud__carousel__indicator-item-active')))
|
|
18
|
+
const indicatorClasses = indicators.map(item => item.className)
|
|
19
|
+
|
|
20
|
+
function move(delta) {
|
|
21
|
+
current += delta
|
|
22
|
+
const period = slides.length * Math.abs(step)
|
|
23
|
+
const first = Math.min(...offsets)
|
|
24
|
+
slides.forEach((slide, index) => {
|
|
25
|
+
const offset = ((offsets[index] - first - current * step) % period + period) % period + first
|
|
26
|
+
slide.style.transform = `translate3d(${offset}px, 0px, 0px)`
|
|
27
|
+
})
|
|
28
|
+
const active = ((initial + current) % indicators.length + indicators.length) % indicators.length
|
|
29
|
+
indicators.forEach((item, index) => {
|
|
30
|
+
item.className = index === active ? indicatorClasses[initial] : indicatorClasses.find((_, j) => j !== initial) ?? indicatorClasses[initial]
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
controls.querySelectorAll('.ud__carousel__prev-switcher, .solutions__nav-left button, .logowalls__nav-left button').forEach(button => {
|
|
35
|
+
button.setAttribute('aria-label', '上一张')
|
|
36
|
+
button.addEventListener('click', () => move(-1))
|
|
37
|
+
})
|
|
38
|
+
controls.querySelectorAll('.ud__carousel__next-switcher, .solutions__nav-right button, .logowalls__nav-right button').forEach(button => {
|
|
39
|
+
button.setAttribute('aria-label', '下一张')
|
|
40
|
+
button.addEventListener('click', () => move(1))
|
|
41
|
+
})
|
|
42
|
+
indicators.forEach((item, index) => item.addEventListener('click', () => {
|
|
43
|
+
const position = ((initial + current) % indicators.length + indicators.length) % indicators.length
|
|
44
|
+
move(index - position)
|
|
45
|
+
}))
|
|
46
|
+
let startX
|
|
47
|
+
track.addEventListener('touchstart', event => { startX = event.changedTouches[0]?.clientX }, { passive: true })
|
|
48
|
+
track.addEventListener('touchend', event => {
|
|
49
|
+
const shift = event.changedTouches[0]?.clientX - startX
|
|
50
|
+
if (Math.abs(shift) > 45) move(shift < 0 ? 1 : -1)
|
|
51
|
+
}, { passive: true })
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
document.querySelector('.top-banner-container__close')?.addEventListener('click', event => {
|
|
55
|
+
event.currentTarget.closest('[class*="top-banner-container"]').parentElement.hidden = true
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
const sectionTargets = ['.solutions', '.skus', '.section-3', '.supports']
|
|
60
|
+
const sectionTabs = [...document.querySelectorAll('.nav-bar__item')]
|
|
61
|
+
sectionTabs.forEach((tab, index) => {
|
|
62
|
+
const target = document.querySelector(sectionTargets[index] || ':not(*)')
|
|
63
|
+
if (!target) return
|
|
64
|
+
const activate = () => {
|
|
65
|
+
sectionTabs.forEach(item => item.classList.toggle('active', item === tab))
|
|
66
|
+
target.scrollIntoView({ behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'instant' : 'smooth' })
|
|
67
|
+
}
|
|
68
|
+
tab.tabIndex = 0
|
|
69
|
+
tab.setAttribute('role', 'button')
|
|
70
|
+
tab.addEventListener('click', activate)
|
|
71
|
+
tab.addEventListener('keydown', event => {
|
|
72
|
+
if (event.key !== 'Enter' && event.key !== ' ') return
|
|
73
|
+
event.preventDefault()
|
|
74
|
+
activate()
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
document.querySelectorAll('.industries').forEach(section => {
|
|
79
|
+
const track = section.querySelector('.industries__pc-list')
|
|
80
|
+
const cards = track ? [...track.querySelectorAll('.industries__pc-item')] : []
|
|
81
|
+
if (cards.length < 2) return
|
|
82
|
+
let selected = Math.max(0, cards.findIndex(card => card.classList.contains('active')))
|
|
83
|
+
const initial = selected
|
|
84
|
+
const base = Number(cards[0].style.transform.match(/translate3d\((-?[\d.]+)px/)?.[1]) || 0
|
|
85
|
+
function select(index) {
|
|
86
|
+
selected = (index + cards.length) % cards.length
|
|
87
|
+
const step = cards[1].offsetLeft - cards[0].offsetLeft || 240
|
|
88
|
+
cards.forEach((card, i) => {
|
|
89
|
+
card.classList.toggle('active', selected === i)
|
|
90
|
+
card.style.transform = `translate3d(${base - (selected - initial) * step}px, 0px, 0px)`
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
section.querySelectorAll('button.industries__nav').forEach((button, index) => {
|
|
94
|
+
button.setAttribute('aria-label', index ? '下一位' : '上一位')
|
|
95
|
+
button.addEventListener('click', () => select(selected + (index ? 1 : -1)))
|
|
96
|
+
})
|
|
97
|
+
cards.forEach((card, index) => card.addEventListener('click', event => {
|
|
98
|
+
if (!event.target.closest('a, button')) select(index)
|
|
99
|
+
}))
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
const qipRail = document.getElementById('qip-scene-rail')
|
|
103
|
+
if (qipRail) {
|
|
104
|
+
const prev = document.querySelector('.qip-scene-prev')
|
|
105
|
+
const next = document.querySelector('.qip-scene-next')
|
|
106
|
+
const update = () => {
|
|
107
|
+
prev.disabled = qipRail.scrollLeft <= 2
|
|
108
|
+
next.disabled = qipRail.scrollWidth - qipRail.clientWidth - qipRail.scrollLeft <= 2
|
|
109
|
+
}
|
|
110
|
+
const move = direction => {
|
|
111
|
+
const step = qipRail.children[1].offsetLeft - qipRail.children[0].offsetLeft
|
|
112
|
+
qipRail.scrollBy({ left: direction * step, behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'instant' : 'smooth' })
|
|
113
|
+
}
|
|
114
|
+
prev.addEventListener('click', () => move(-1))
|
|
115
|
+
next.addEventListener('click', () => move(1))
|
|
116
|
+
qipRail.addEventListener('scroll', update, { passive: true })
|
|
117
|
+
qipRail.addEventListener('keydown', event => {
|
|
118
|
+
if (event.target !== qipRail || !['ArrowLeft','ArrowRight'].includes(event.key)) return
|
|
119
|
+
event.preventDefault()
|
|
120
|
+
move(event.key === 'ArrowRight' ? 1 : -1)
|
|
121
|
+
})
|
|
122
|
+
new ResizeObserver(update).observe(qipRail)
|
|
123
|
+
update()
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
document.querySelectorAll('.qip-contact-open').forEach(button => {
|
|
127
|
+
const dialog = document.getElementById(button.getAttribute('aria-controls'))
|
|
128
|
+
if (!dialog) return
|
|
129
|
+
button.addEventListener('click', () => {
|
|
130
|
+
if (!dialog.open) dialog.showModal()
|
|
131
|
+
})
|
|
132
|
+
})
|
|
133
|
+
document.querySelectorAll('.qip-contact-dialog, .qip-install-dialog').forEach(dialog => {
|
|
134
|
+
dialog.addEventListener('click', event => {
|
|
135
|
+
if (event.target !== dialog) return
|
|
136
|
+
const rect = dialog.getBoundingClientRect()
|
|
137
|
+
if (event.clientX < rect.left || event.clientX > rect.right ||
|
|
138
|
+
event.clientY < rect.top || event.clientY > rect.bottom) dialog.close()
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
const qipAdvisorForm = document.getElementById('qip-advisor-form')
|
|
143
|
+
if (qipAdvisorForm) {
|
|
144
|
+
const result = document.getElementById('qip-advisor-result')
|
|
145
|
+
const download = result.querySelector('.qip-advisor-download')
|
|
146
|
+
const fields = [
|
|
147
|
+
['fullName', '姓名'],
|
|
148
|
+
['phone', '手机号'],
|
|
149
|
+
['company', '企业名称'],
|
|
150
|
+
['companySize', '公司规模'],
|
|
151
|
+
['role', '职位']
|
|
152
|
+
]
|
|
153
|
+
let draft = ''
|
|
154
|
+
const clearDraft = () => {
|
|
155
|
+
draft = ''
|
|
156
|
+
result.hidden = true
|
|
157
|
+
}
|
|
158
|
+
qipAdvisorForm.addEventListener('input', event => {
|
|
159
|
+
event.target.setCustomValidity?.('')
|
|
160
|
+
clearDraft()
|
|
161
|
+
})
|
|
162
|
+
qipAdvisorForm.addEventListener('submit', event => {
|
|
163
|
+
event.preventDefault()
|
|
164
|
+
for (const name of ['fullName', 'company']) {
|
|
165
|
+
const input = qipAdvisorForm.elements.namedItem(name)
|
|
166
|
+
input.setCustomValidity(input.value.trim() ? '' : '请填写此项')
|
|
167
|
+
}
|
|
168
|
+
if (!qipAdvisorForm.reportValidity()) return
|
|
169
|
+
const data = new FormData(qipAdvisorForm)
|
|
170
|
+
const rows = fields.map(([name, label]) => {
|
|
171
|
+
const value = data.get(name).trim()
|
|
172
|
+
return label + ':' + (name === 'phone' ? '+86 ' : '') + value
|
|
173
|
+
})
|
|
174
|
+
draft = ['全质开源质量平台顾问预约单', '', ...rows].join('\n')
|
|
175
|
+
result.hidden = false
|
|
176
|
+
download.focus()
|
|
177
|
+
})
|
|
178
|
+
download.addEventListener('click', () => {
|
|
179
|
+
if (!draft) return
|
|
180
|
+
const url = URL.createObjectURL(new Blob([draft], { type: 'text/plain;charset=utf-8' }))
|
|
181
|
+
const link = document.createElement('a')
|
|
182
|
+
link.href = url
|
|
183
|
+
link.download = '全质顾问预约单.txt'
|
|
184
|
+
link.click()
|
|
185
|
+
setTimeout(() => URL.revokeObjectURL(url), 1000)
|
|
186
|
+
})
|
|
187
|
+
qipAdvisorForm.closest('dialog').addEventListener('close', () => {
|
|
188
|
+
qipAdvisorForm.reset()
|
|
189
|
+
for (const name of ['fullName', 'company']) qipAdvisorForm.elements.namedItem(name).setCustomValidity('')
|
|
190
|
+
clearDraft()
|
|
191
|
+
})
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const qipGuideDialog = document.querySelector('.qip-guide-dialog')
|
|
195
|
+
if (qipGuideDialog) {
|
|
196
|
+
const { categories, articles } = qipModuleGuides
|
|
197
|
+
const query = qipGuideDialog.querySelector('.qip-guide-query')
|
|
198
|
+
const group = qipGuideDialog.querySelector('.qip-guide-group')
|
|
199
|
+
const mobile = qipGuideDialog.querySelector('.qip-guide-mobile')
|
|
200
|
+
const list = qipGuideDialog.querySelector('.qip-guide-results')
|
|
201
|
+
const content = qipGuideDialog.querySelector('.qip-guide-content')
|
|
202
|
+
let active = 'start'
|
|
203
|
+
let displayed
|
|
204
|
+
group.replaceChildren(...categories.map(([id, label]) => new Option(label, id)))
|
|
205
|
+
|
|
206
|
+
const buttons = new Map(articles.map(article => {
|
|
207
|
+
const button = document.createElement('button')
|
|
208
|
+
button.type = 'button'
|
|
209
|
+
button.textContent = article.title
|
|
210
|
+
const arrow = document.createElement('span')
|
|
211
|
+
arrow.setAttribute('aria-hidden', 'true')
|
|
212
|
+
arrow.textContent = '›'
|
|
213
|
+
button.append(arrow)
|
|
214
|
+
button.addEventListener('click', () => render(article.id))
|
|
215
|
+
list.append(button)
|
|
216
|
+
return [article.id, button]
|
|
217
|
+
}))
|
|
218
|
+
|
|
219
|
+
function render(preferred = active) {
|
|
220
|
+
const words = query.value.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)
|
|
221
|
+
const matches = articles.filter(article =>
|
|
222
|
+
(group.value === 'all' || article.group === group.value) &&
|
|
223
|
+
words.every(word => article.search.toLocaleLowerCase().includes(word)))
|
|
224
|
+
const selected = matches.find(article => article.id === preferred) ?? matches[0]
|
|
225
|
+
active = selected?.id
|
|
226
|
+
const visible = new Set(matches.map(article => article.id))
|
|
227
|
+
for (const [id, button] of buttons) {
|
|
228
|
+
button.hidden = !visible.has(id)
|
|
229
|
+
if (id === active) button.setAttribute('aria-current', 'true')
|
|
230
|
+
else button.removeAttribute('aria-current')
|
|
231
|
+
}
|
|
232
|
+
mobile.replaceChildren(...matches.map(article => new Option(article.title, article.id)))
|
|
233
|
+
if (active) mobile.value = active
|
|
234
|
+
mobile.disabled = !selected
|
|
235
|
+
if (displayed === active) return
|
|
236
|
+
displayed = active
|
|
237
|
+
if (selected) content.innerHTML = selected.html
|
|
238
|
+
else {
|
|
239
|
+
const empty = document.createElement('p')
|
|
240
|
+
empty.setAttribute('role', 'status')
|
|
241
|
+
empty.textContent = '没有匹配的指南。试试「手册」「来料」或「小质」。'
|
|
242
|
+
content.replaceChildren(empty)
|
|
243
|
+
}
|
|
244
|
+
content.scrollTop = 0
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
query.addEventListener('input', () => render())
|
|
248
|
+
group.addEventListener('change', () => { list.scrollTop = 0; render() })
|
|
249
|
+
mobile.addEventListener('change', () => render(mobile.value))
|
|
250
|
+
document.querySelectorAll('.qip-install-open, [data-qip-guide]').forEach(trigger => {
|
|
251
|
+
trigger.addEventListener('click', event => {
|
|
252
|
+
event.preventDefault()
|
|
253
|
+
query.value = ''
|
|
254
|
+
group.value = 'all'
|
|
255
|
+
render(trigger.dataset.qipGuide || 'start')
|
|
256
|
+
if (!qipGuideDialog.open) qipGuideDialog.showModal()
|
|
257
|
+
list.scrollTop = 0
|
|
258
|
+
buttons.get(active)?.scrollIntoView({ block: 'nearest' })
|
|
259
|
+
})
|
|
260
|
+
})
|
|
261
|
+
}
|