npmapps 1.0.25 → 1.0.26
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/app/.codegraph/daemon.pid +6 -0
- package/app/.eslintrc.js +19 -0
- package/app/README.md +24 -0
- package/app/babel.config.js +5 -0
- package/app/devtool-windows-amd64.zip +0 -0
- package/app/docs/superpowers/plans/2026-05-29-quill-editor.md +836 -0
- package/app/docs/superpowers/specs/2026-05-29-quill-editor-design.md +210 -0
- package/app/docs/superpowers/specs/2026-06-06-lazy-cascader-design.md +400 -0
- package/app/jsconfig.json +19 -0
- package/app/package-lock.json +21347 -0
- package/app/package.json +63 -0
- package/app/postcss.config.js +10 -0
- package/app/public/favicon.ico +0 -0
- package/app/public/index.html +17 -0
- package/app/public//344/270/200/351/224/256/351/273/221/346/232/227.html +136 -0
- package/app/src/App.vue +110 -0
- package/app/src/assets/bpmn-camunda.jpg +0 -0
- package/app/src/assets/css/diagram.less +17 -0
- package/app/src/assets/icon/Icon.less +31 -0
- package/app/src/assets/icon/font/app-codes.css +26 -0
- package/app/src/assets/icon/font/app.eot +0 -0
- package/app/src/assets/icon/font/app.svg +60 -0
- package/app/src/assets/icon/font/app.ttf +0 -0
- package/app/src/assets/icon/font/app.woff +0 -0
- package/app/src/assets/icon/font/app.woff2 +0 -0
- package/app/src/assets/icon/font/config.json +248 -0
- package/app/src/assets/icon/font/source/raw/align-bottom-tool.svg +30 -0
- package/app/src/assets/icon/font/source/raw/align-horizontal-center-tool.svg +85 -0
- package/app/src/assets/icon/font/source/raw/align-left-tool.svg +84 -0
- package/app/src/assets/icon/font/source/raw/align-right-tool.svg +80 -0
- package/app/src/assets/icon/font/source/raw/align-top-tool.svg +84 -0
- package/app/src/assets/icon/font/source/raw/align-vertical-center-tool.svg +89 -0
- package/app/src/assets/icon/font/source/raw/distribute-horizontally-tool.svg +95 -0
- package/app/src/assets/icon/font/source/raw/distribute-vertically-tool.svg +99 -0
- package/app/src/assets/icon/font/source/raw/set-color-tool.svg +111 -0
- package/app/src/assets/icon/font/source/symbols/align-bottom-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/align-horizontal-center-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/align-left-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/align-right-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/align-top-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/align-vertical-center-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/distribute-horizontally-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/distribute-vertically-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/set-color-tool.svg +63 -0
- package/app/src/assets/logo.png +0 -0
- package/app/src/components/EllTable/README.md +70 -0
- package/app/src/components/EllTable/article.md +184 -0
- package/app/src/components/EllTable/index.js +213 -0
- package/app/src/components/FormulaEditor/FunctionSelector.vue +123 -0
- package/app/src/components/FormulaEditor/OperatorSelector.vue +184 -0
- package/app/src/components/FormulaEditor/ParameterSelector.vue +123 -0
- package/app/src/components/FormulaEditor/api.js +69 -0
- package/app/src/components/FormulaEditor/index.vue +435 -0
- package/app/src/components/HelloWorld.vue +58 -0
- package/app/src/components/PageHeader/index.vue +158 -0
- package/app/src/components/Splitter/README.md +144 -0
- package/app/src/components/Splitter/example.vue +88 -0
- package/app/src/components/Splitter/index.vue +203 -0
- package/app/src/components/diagram/ToolBar.vue +357 -0
- package/app/src/components/diagram/customTranslate/customTranslate.js +12 -0
- package/app/src/components/diagram/customTranslate/translationsGerman.js +241 -0
- package/app/src/components/diagram/index.vue +261 -0
- package/app/src/components/diagram/xmlData.js +29 -0
- package/app/src/directives/filldown.js +155 -0
- package/app/src/directives/filldownTable.js +291 -0
- package/app/src/main.js +40 -0
- package/app/src/router/index.js +63 -0
- package/app/src/store/index.js +23 -0
- package/app/src/utils/winBox.js +23 -0
- package/app/src/views/Extend/A.vue +12 -0
- package/app/src/views/Extend/B.vue +10 -0
- package/app/src/views/Extend/MagicalComponentsForELFormItem.vue +87 -0
- package/app/src/views/Extend/index.vue +59 -0
- package/app/src/views/Extend/tableMouseHorizontalWheel.vue +193 -0
- package/app/src/views/Home.vue +37 -0
- package/app/src/views/RouterJump.vue +155 -0
- package/app/src/views/css.vue +57 -0
- package/app/src/views/cssComponents/EllipsisText.vue +83 -0
- package/app/src/views/cssComponents/HoverCard.vue +79 -0
- package/app/src/views/cssComponents/TableHover.vue +140 -0
- package/app/src/views/cssComponents/inputSlo.vue +52 -0
- package/app/src/views/cssComponents/tableFixed.vue +158 -0
- package/app/src/views/echarts/echart-dome.vue +82 -0
- package/app/src/views/echarts/index.vue +118 -0
- package/app/src/views/echarts/pei3d.vue +667 -0
- package/app/src/views/element/bpmn/index.vue +18 -0
- package/app/src/views/element/components/attendanceCycle/index.vue +131 -0
- package/app/src/views/element/components/attendanceGroup/index.vue +147 -0
- package/app/src/views/element/components/attendancePersonnel/index.vue +158 -0
- package/app/src/views/element/components/companyCalendar/index.vue +147 -0
- package/app/src/views/element/components/shift/index.vue +147 -0
- package/app/src/views/element/components/shiftRotationSystem/index.vue +147 -0
- package/app/src/views/element/elTableJsx/columnManagement.vue +340 -0
- package/app/src/views/element/elTableJsx/dialogInput.vue +71 -0
- package/app/src/views/element/elTableJsx/elTableJsx.vue +1826 -0
- package/app/src/views/element/elTableJsx/formTable.vue +598 -0
- package/app/src/views/element/elTableJsx/index.vue +29 -0
- package/app/src/views/element/elTableJsx/simpleTable.vue +192 -0
- package/app/src/views/element/elTableJsx.zip +0 -0
- package/app/src/views/element/index.vue +44 -0
- package/app/src/views/element/lazyCascader/LazyCascader.vue +302 -0
- package/app/src/views/element/lazyCascader/data.js +205 -0
- package/app/src/views/element/lazyCascader/index.vue +315 -0
- package/app/src/views/element/quillEditor/README.md +163 -0
- package/app/src/views/element/quillEditor/example.vue +314 -0
- package/app/src/views/element/quillEditor/index.vue +409 -0
- package/app/src/views/element/quillEditor/toolbar.js +122 -0
- package/app/vue.config.js +15 -0
- package/package.json +1 -1
- package/app/wujie-vue3-child/.claude/settings.local.json +0 -8
- package/app/wujie-vue3-child/.vscode/extensions.json +0 -3
- package/app/wujie-vue3-child/PROJECT_MEMORY.md +0 -427
- package/app/wujie-vue3-child/README.md +0 -5
- package/app/wujie-vue3-child/index.html +0 -13
- package/app/wujie-vue3-child/package-lock.json +0 -5744
- package/app/wujie-vue3-child/package.json +0 -28
- package/app/wujie-vue3-child/public/vite.svg +0 -1
- package/app/wujie-vue3-child/src/App.vue +0 -130
- package/app/wujie-vue3-child/src/assets/vue.svg +0 -1
- package/app/wujie-vue3-child/src/components/HelloWorld.vue +0 -43
- package/app/wujie-vue3-child/src/components/SmartAnchorTabs/index.jsx +0 -224
- package/app/wujie-vue3-child/src/components/SmartAnchorTabs/style.css +0 -154
- package/app/wujie-vue3-child/src/components/tags-view.vue +0 -193
- package/app/wujie-vue3-child/src/components/tags-view1.vue +0 -131
- package/app/wujie-vue3-child/src/directives/aiLoading.js +0 -182
- package/app/wujie-vue3-child/src/hooks/useClickOutside.js +0 -11
- package/app/wujie-vue3-child/src/hooks/useTableDragSort.js +0 -28
- package/app/wujie-vue3-child/src/main.js +0 -18
- package/app/wujie-vue3-child/src/router/index.js +0 -104
- package/app/wujie-vue3-child/src/store/tagsViewStroe.js +0 -34
- package/app/wujie-vue3-child/src/style.css +0 -171
- package/app/wujie-vue3-child/src/views/aiCoach/collapseExpand/index.jsx +0 -108
- package/app/wujie-vue3-child/src/views/aiCoach/collapseExpand/index.module.scss +0 -97
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/README.md +0 -836
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/REFLEX_EXAMPLES.md +0 -728
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentPersonnelSelector.jsx +0 -687
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentPersonnelSelector.module.scss +0 -560
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelector.jsx +0 -570
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelector.module.scss +0 -330
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelectorV2.jsx +0 -378
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelectorV2.module.scss +0 -228
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/OptionsSelector.jsx +0 -399
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/OptionsSelector.module.scss +0 -252
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PersonnelSelector.jsx +0 -585
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PersonnelSelector.module.scss +0 -331
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PopoverSelector.jsx +0 -392
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PopoverSelector.module.scss +0 -39
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/README.md +0 -248
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/SelectorTrigger.jsx +0 -194
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/index.jsx +0 -1459
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/mockData.js +0 -301
- package/app/wujie-vue3-child/src/views/aiCoach/dialogueSegment/index.jsx +0 -182
- package/app/wujie-vue3-child/src/views/aiCoach/dialogueSegment/index.module.scss +0 -28
- package/app/wujie-vue3-child/src/views/aiCoach/index.jsx +0 -375
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ChartsPanel/index.jsx +0 -121
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ChartsPanel/index.module.scss +0 -76
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/DonutChart/index.jsx +0 -104
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/PracticeTable/index.jsx +0 -75
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/PracticeTable/index.module.scss +0 -12
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankBarChart/index.jsx +0 -62
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankBarChart/index.module.scss +0 -43
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingGroup/index.jsx +0 -29
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingGroup/index.module.scss +0 -5
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingList/index.jsx +0 -58
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingList/index.module.scss +0 -85
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ScriptStatsPanel/index.jsx +0 -92
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ScriptStatsPanel/index.module.scss +0 -56
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/StatCardsRow/index.jsx +0 -40
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/StatCardsRow/index.module.scss +0 -53
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/echarts/EchartsDonut.jsx +0 -106
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/echarts/EchartsRankBar.jsx +0 -132
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/index.jsx +0 -176
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/index.module.scss +0 -96
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/CoachReport/index.jsx +0 -162
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/CoachReport/index.module.scss +0 -16
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ComprehensiveEvaluation/index.jsx +0 -29
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ComprehensiveEvaluation/index.module.scss +0 -25
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueBubble/index.jsx +0 -106
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueBubble/index.module.scss +0 -164
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueRecord/index.jsx +0 -182
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueRecord/index.module.scss +0 -203
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionDetail/index.jsx +0 -145
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionDetail/index.module.scss +0 -126
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionScores/index.jsx +0 -67
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionScores/index.module.scss +0 -105
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ReportHeader/index.jsx +0 -81
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ReportHeader/index.module.scss +0 -47
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/RoleInfo/index.jsx +0 -64
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/RoleInfo/index.module.scss +0 -85
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ScoreBadge/index.jsx +0 -39
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ScoreBadge/index.module.scss +0 -44
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/SubDimensionItem/index.jsx +0 -83
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/SubDimensionItem/index.module.scss +0 -101
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/index.jsx +0 -50
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/index.module.scss +0 -25
- package/app/wujie-vue3-child/src/views/aiCoach/scriptTable/index.jsx +0 -196
- package/app/wujie-vue3-child/src/views/aiCoach/scriptTable/index.module.scss +0 -41
- package/app/wujie-vue3-child/src/views/aiCoach/scriptTable/inputColumn/index.jsx +0 -183
- package/app/wujie-vue3-child/src/views/aiCoach/scriptTable/inputColumn/index.module.scss +0 -115
- package/app/wujie-vue3-child/src/views/child-to-parent.vue +0 -117
- package/app/wujie-vue3-child/src/views/home.vue +0 -53
- package/app/wujie-vue3-child/src/views/jsx/btnSelect/btnSelect.vue +0 -169
- package/app/wujie-vue3-child/src/views/jsx/btnSelect/index.vue +0 -69
- package/app/wujie-vue3-child/src/views/jsx/com.vue +0 -44
- package/app/wujie-vue3-child/src/views/jsx/dialog.jsx +0 -66
- package/app/wujie-vue3-child/src/views/jsx/index.vue +0 -72
- package/app/wujie-vue3-child/src/views/jsx/props.vue +0 -33
- package/app/wujie-vue3-child/src/views/parent-to-child.vue +0 -225
- package/app/wujie-vue3-child/src/views/phone-code.vue +0 -318
- package/app/wujie-vue3-child/src/views/router-jump.vue +0 -123
- package/app/wujie-vue3-child/src/views/test.vue +0 -192
- package/app/wujie-vue3-child/vite.config.js +0 -15
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref } from 'vue'
|
|
2
|
-
import DialogueSegment from './dialogueSegment/index.jsx'
|
|
3
|
-
import PracticeStatus from './practiceStatus/index.jsx'
|
|
4
|
-
import ReportDetail from './reportDetail/index.jsx'
|
|
5
|
-
import DepartmentPersonnel from './departmentPersonnel/index.jsx'
|
|
6
|
-
import { aiLoading } from '../../directives/aiLoading'
|
|
7
|
-
import SmartAnchorTabs from '../../components/SmartAnchorTabs/index.jsx'
|
|
8
|
-
|
|
9
|
-
export default defineComponent({
|
|
10
|
-
// 智能教练
|
|
11
|
-
name: 'AiCoach',
|
|
12
|
-
|
|
13
|
-
setup() {
|
|
14
|
-
const activeTab = ref('dialogue-segment')
|
|
15
|
-
const aiLoadingTab = ref('directive-usage')
|
|
16
|
-
|
|
17
|
-
// SmartAnchorTabs 演示数据
|
|
18
|
-
const anchorTabsPosition = ref('left')
|
|
19
|
-
const anchorTabsMode = ref('anchor')
|
|
20
|
-
const anchorTabsData = [
|
|
21
|
-
{
|
|
22
|
-
label: '基本信息',
|
|
23
|
-
key: 'basic-info',
|
|
24
|
-
content: '这里是基本信息的内容区域。可以放置表单、文字等。'
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
label: '场景设置',
|
|
28
|
-
key: 'scenario-settings',
|
|
29
|
-
content: '这里是场景设置的内容区域。'
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
label: 'AI参考资料',
|
|
33
|
-
key: 'ai-reference',
|
|
34
|
-
content: '这里是AI参考资料的内容区域。可以上传文档等。'
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
label: '高级配置',
|
|
38
|
-
key: 'advanced-config',
|
|
39
|
-
content: '这里是高级配置的内容区域。'
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: '其他设置',
|
|
43
|
-
key: 'other-settings',
|
|
44
|
-
content: '这里是其他设置的内容区域。'
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
|
|
48
|
-
// v-aiLoading 指令演示用状态:
|
|
49
|
-
// simpleLoading:基础布尔用法 v-aiLoading="loading"
|
|
50
|
-
// advancedLoading:对象用法 v-aiLoading="{ loading, text, class }"
|
|
51
|
-
const simpleLoading = ref(false)
|
|
52
|
-
const advancedLoading = ref(false)
|
|
53
|
-
|
|
54
|
-
const toggleSimpleLoading = () => {
|
|
55
|
-
simpleLoading.value = !simpleLoading.value
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const toggleAdvancedLoading = () => {
|
|
59
|
-
advancedLoading.value = !advancedLoading.value
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const functionDemoTargetRef = ref(null)
|
|
63
|
-
const functionDemoLoading = ref(false)
|
|
64
|
-
let functionDemoStop = null
|
|
65
|
-
|
|
66
|
-
const triggerFunctionDemo = () => {
|
|
67
|
-
if (functionDemoLoading.value) {
|
|
68
|
-
if (functionDemoStop) {
|
|
69
|
-
functionDemoStop()
|
|
70
|
-
}
|
|
71
|
-
functionDemoLoading.value = false
|
|
72
|
-
functionDemoStop = null
|
|
73
|
-
return
|
|
74
|
-
}
|
|
75
|
-
if (!functionDemoTargetRef.value) return
|
|
76
|
-
functionDemoLoading.value = true
|
|
77
|
-
const { stop } = aiLoading(functionDemoTargetRef, {
|
|
78
|
-
text: 'AI生成中...',
|
|
79
|
-
loaderType: 'ring',
|
|
80
|
-
gradient: true,
|
|
81
|
-
borderColor: '#409eff'
|
|
82
|
-
})
|
|
83
|
-
functionDemoStop = stop
|
|
84
|
-
setTimeout(() => {
|
|
85
|
-
if (functionDemoStop) {
|
|
86
|
-
functionDemoStop()
|
|
87
|
-
functionDemoStop = null
|
|
88
|
-
}
|
|
89
|
-
functionDemoLoading.value = false
|
|
90
|
-
}, 1500)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return () => {
|
|
94
|
-
return <div style={{ padding: '30px' }}>
|
|
95
|
-
<el-tabs v-model={activeTab.value} type="border-card">
|
|
96
|
-
<el-tab-pane label="对话环节" name="dialogue-segment">
|
|
97
|
-
<DialogueSegment />
|
|
98
|
-
</el-tab-pane>
|
|
99
|
-
<el-tab-pane label="练习情况" name="practice-status">
|
|
100
|
-
<PracticeStatus />
|
|
101
|
-
</el-tab-pane>
|
|
102
|
-
<el-tab-pane label="报告详情" name="report-detail">
|
|
103
|
-
<ReportDetail />
|
|
104
|
-
</el-tab-pane>
|
|
105
|
-
<el-tab-pane label="部门人员" name="department-personnel">
|
|
106
|
-
<DepartmentPersonnel />
|
|
107
|
-
</el-tab-pane>
|
|
108
|
-
<el-tab-pane label="AI Loading 用例" name="ai-loading-examples">
|
|
109
|
-
<div style={{ padding: '16px 0' }}>
|
|
110
|
-
<el-tabs v-model={aiLoadingTab.value} type="card">
|
|
111
|
-
<el-tab-pane label="指令用法" name="directive-usage">
|
|
112
|
-
<div style={{ display: 'flex', gap: '24px' }}>
|
|
113
|
-
<div style={{ flex: 1 }}>
|
|
114
|
-
<h3 style={{ margin: 0, marginBottom: '8px' }}>基础用法:v-aiLoading="loading"</h3>
|
|
115
|
-
<p style={{ margin: 0, marginBottom: '12px', color: '#666', fontSize: '13px' }}>
|
|
116
|
-
通过布尔变量控制是否显示 AI Loading 遮罩。
|
|
117
|
-
</p>
|
|
118
|
-
<el-button type="primary" onClick={toggleSimpleLoading}>
|
|
119
|
-
{simpleLoading.value ? '结束加载' : '开始加载'}
|
|
120
|
-
</el-button>
|
|
121
|
-
<div
|
|
122
|
-
v-ai-loading={simpleLoading.value}
|
|
123
|
-
style={{
|
|
124
|
-
marginTop: '16px',
|
|
125
|
-
padding: '16px',
|
|
126
|
-
border: '1px solid #ebeef5',
|
|
127
|
-
borderRadius: '4px',
|
|
128
|
-
minHeight: '80px'
|
|
129
|
-
}}
|
|
130
|
-
>
|
|
131
|
-
当 loading 为 true 时,这个区域上会显示 AI Loading 遮罩。
|
|
132
|
-
</div>
|
|
133
|
-
<pre
|
|
134
|
-
style={{
|
|
135
|
-
marginTop: '16px',
|
|
136
|
-
fontSize: '12px',
|
|
137
|
-
background: '#f9fafb',
|
|
138
|
-
padding: '12px',
|
|
139
|
-
borderRadius: '4px',
|
|
140
|
-
whiteSpace: 'pre-wrap'
|
|
141
|
-
}}
|
|
142
|
-
>
|
|
143
|
-
{`<div v-aiLoading="loading">
|
|
144
|
-
内容区域
|
|
145
|
-
</div>`}
|
|
146
|
-
</pre>
|
|
147
|
-
</div>
|
|
148
|
-
<div style={{ flex: 1 }}>
|
|
149
|
-
<h3 style={{ margin: 0, marginBottom: '8px' }}>高级用法:对象参数</h3>
|
|
150
|
-
<p style={{ margin: 0, marginBottom: '12px', color: '#666', fontSize: '13px' }}>
|
|
151
|
-
通过对象同时配置 loading、提示文案 text、loader 样式、边框颜色和渐变背景。
|
|
152
|
-
</p>
|
|
153
|
-
<el-button type="primary" onClick={toggleAdvancedLoading}>
|
|
154
|
-
{advancedLoading.value ? '结束加载' : '开始加载'}
|
|
155
|
-
</el-button>
|
|
156
|
-
<div
|
|
157
|
-
class={['ai-loading-demo-card', advancedLoading.value ? 'ai-loading-demo-card--active' : '']}
|
|
158
|
-
v-ai-loading={{
|
|
159
|
-
loading: advancedLoading.value,
|
|
160
|
-
text: 'AI智能生成中...',
|
|
161
|
-
loaderType: 'ring',
|
|
162
|
-
gradient: true,
|
|
163
|
-
borderColor: '#ff7e67'
|
|
164
|
-
}}
|
|
165
|
-
style={{
|
|
166
|
-
marginTop: '16px',
|
|
167
|
-
padding: '16px',
|
|
168
|
-
border: '1px solid #ebeef5',
|
|
169
|
-
borderRadius: '4px',
|
|
170
|
-
minHeight: '80px'
|
|
171
|
-
}}
|
|
172
|
-
>
|
|
173
|
-
使用对象形式,可以自定义文案、圆环边框颜色和淡色渐变背景。
|
|
174
|
-
</div>
|
|
175
|
-
<pre
|
|
176
|
-
style={{
|
|
177
|
-
marginTop: '16px',
|
|
178
|
-
fontSize: '12px',
|
|
179
|
-
background: '#f9fafb',
|
|
180
|
-
padding: '12px',
|
|
181
|
-
borderRadius: '4px',
|
|
182
|
-
whiteSpace: 'pre-wrap'
|
|
183
|
-
}}
|
|
184
|
-
>
|
|
185
|
-
{`<!-- 条形 loading + 默认渐变背景 -->
|
|
186
|
-
<div v-aiLoading="{ loading }"></div>
|
|
187
|
-
|
|
188
|
-
<!-- 圆环 loading,带有有色边框并旋转 -->
|
|
189
|
-
<div
|
|
190
|
-
v-aiLoading="{ loading: loading, loaderType: 'ring', borderColor: '#ff7e67' }"
|
|
191
|
-
></div>
|
|
192
|
-
|
|
193
|
-
<!-- 圆环 loading + 自定义文案 + 动态渐变背景 -->
|
|
194
|
-
<div
|
|
195
|
-
v-aiLoading="{
|
|
196
|
-
loading: loading,
|
|
197
|
-
text: 'AI智能生成中...',
|
|
198
|
-
loaderType: 'ring',
|
|
199
|
-
gradient: true,
|
|
200
|
-
borderColor: '#ff7e67'
|
|
201
|
-
}"
|
|
202
|
-
></div>`}
|
|
203
|
-
</pre>
|
|
204
|
-
</div>
|
|
205
|
-
</div>
|
|
206
|
-
</el-tab-pane>
|
|
207
|
-
<el-tab-pane label="函数式用法" name="function-usage">
|
|
208
|
-
<div style={{ display: 'flex', gap: '24px' }}>
|
|
209
|
-
<div style={{ flex: 1 }}>
|
|
210
|
-
<h3 style={{ margin: 0, marginBottom: '8px' }}>基础函数式调用</h3>
|
|
211
|
-
<p style={{ margin: 0, marginBottom: '12px', color: '#666', fontSize: '13px' }}>
|
|
212
|
-
通过 aiLoading(target, options) 手动控制某个区域的 AI Loading 开启和关闭。
|
|
213
|
-
</p>
|
|
214
|
-
<el-button type="primary" onClick={triggerFunctionDemo}>
|
|
215
|
-
{functionDemoLoading.value ? '结束加载' : '开始加载'}
|
|
216
|
-
</el-button>
|
|
217
|
-
<div
|
|
218
|
-
ref={functionDemoTargetRef}
|
|
219
|
-
style={{
|
|
220
|
-
marginTop: '16px',
|
|
221
|
-
padding: '16px',
|
|
222
|
-
border: '1px dashed #dcdfe6',
|
|
223
|
-
borderRadius: '4px',
|
|
224
|
-
minHeight: '80px'
|
|
225
|
-
}}
|
|
226
|
-
>
|
|
227
|
-
这是函数式调用示例绑定的区域。
|
|
228
|
-
</div>
|
|
229
|
-
</div>
|
|
230
|
-
<div style={{ flex: 1 }}>
|
|
231
|
-
<h3 style={{ margin: 0, marginBottom: '8px' }}>函数式用法示例代码</h3>
|
|
232
|
-
<pre
|
|
233
|
-
style={{
|
|
234
|
-
marginTop: '16px',
|
|
235
|
-
fontSize: '12px',
|
|
236
|
-
background: '#f9fafb',
|
|
237
|
-
padding: '12px',
|
|
238
|
-
borderRadius: '4px',
|
|
239
|
-
whiteSpace: 'pre-wrap'
|
|
240
|
-
}}
|
|
241
|
-
>
|
|
242
|
-
{`import { ref } from 'vue'
|
|
243
|
-
import { aiLoading } from '@/directives/aiLoading'
|
|
244
|
-
|
|
245
|
-
const targetRef = ref(null)
|
|
246
|
-
let stopLoading = null
|
|
247
|
-
|
|
248
|
-
const start = () => {
|
|
249
|
-
if (stopLoading) {
|
|
250
|
-
stopLoading()
|
|
251
|
-
stopLoading = null
|
|
252
|
-
return
|
|
253
|
-
}
|
|
254
|
-
const { stop } = aiLoading(targetRef, {
|
|
255
|
-
text: 'AI生成中...',
|
|
256
|
-
loaderType: 'ring',
|
|
257
|
-
gradient: true,
|
|
258
|
-
borderColor: '#409eff'
|
|
259
|
-
})
|
|
260
|
-
stopLoading = stop
|
|
261
|
-
}`}</pre>
|
|
262
|
-
</div>
|
|
263
|
-
</div>
|
|
264
|
-
</el-tab-pane>
|
|
265
|
-
<el-tab-pane label="全局配置" name="global-config">
|
|
266
|
-
<div style={{ display: 'flex', gap: '24px' }}>
|
|
267
|
-
<div style={{ flex: 1 }}>
|
|
268
|
-
<h3 style={{ margin: 0, marginBottom: '8px' }}>入口注册</h3>
|
|
269
|
-
<p style={{ margin: 0, marginBottom: '12px', color: '#666', fontSize: '13px' }}>
|
|
270
|
-
在 main.js 中全局注册 v-aiLoading 指令和样式文件后,即可在任意页面使用。
|
|
271
|
-
</p>
|
|
272
|
-
<pre
|
|
273
|
-
style={{
|
|
274
|
-
marginTop: '16px',
|
|
275
|
-
fontSize: '12px',
|
|
276
|
-
background: '#f9fafb',
|
|
277
|
-
padding: '12px',
|
|
278
|
-
borderRadius: '4px',
|
|
279
|
-
whiteSpace: 'pre-wrap'
|
|
280
|
-
}}
|
|
281
|
-
>
|
|
282
|
-
{`import { createApp } from 'vue'
|
|
283
|
-
import App from './App.vue'
|
|
284
|
-
import './style.css'
|
|
285
|
-
import { aiLoadingDirective } from './directives/aiLoading'
|
|
286
|
-
|
|
287
|
-
const app = createApp(App)
|
|
288
|
-
|
|
289
|
-
app.directive('aiLoading', aiLoadingDirective)
|
|
290
|
-
|
|
291
|
-
app.mount('#app')`}</pre>
|
|
292
|
-
</div>
|
|
293
|
-
<div style={{ flex: 1 }}>
|
|
294
|
-
<h3 style={{ margin: 0, marginBottom: '8px' }}>可配置选项总览</h3>
|
|
295
|
-
<pre
|
|
296
|
-
style={{
|
|
297
|
-
marginTop: '16px',
|
|
298
|
-
fontSize: '12px',
|
|
299
|
-
background: '#f9fafb',
|
|
300
|
-
padding: '12px',
|
|
301
|
-
borderRadius: '4px',
|
|
302
|
-
whiteSpace: 'pre-wrap'
|
|
303
|
-
}}
|
|
304
|
-
>
|
|
305
|
-
{`// 指令和函数式 options 一致:
|
|
306
|
-
// {
|
|
307
|
-
// loading: boolean, // 指令必填,函数式内部自动填 true/false
|
|
308
|
-
// text?: string, // 提示文案,默认 'AI生成中'
|
|
309
|
-
// loaderType?: 'bars' | 'ring', // 条形 / 圆环
|
|
310
|
-
// gradient?: boolean | string, // true: 默认渐变; false: 纯白;
|
|
311
|
-
// // string: 自定义渐变背景
|
|
312
|
-
// borderColor?: string, // 圆环边框颜色
|
|
313
|
-
// class?: string // 自定义遮罩 class
|
|
314
|
-
// }`}</pre>
|
|
315
|
-
</div>
|
|
316
|
-
</div>
|
|
317
|
-
</el-tab-pane>
|
|
318
|
-
</el-tabs>
|
|
319
|
-
</div>
|
|
320
|
-
</el-tab-pane>
|
|
321
|
-
<el-tab-pane label="Smart Anchor Tabs 用例" name="smart-anchor-tabs">
|
|
322
|
-
<div style={{ padding: '16px 0' }}>
|
|
323
|
-
<div style={{ marginBottom: '20px', display: 'flex', gap: '20px', alignItems: 'center' }}>
|
|
324
|
-
<div>
|
|
325
|
-
<span style={{ marginRight: '8px' }}>布局位置:</span>
|
|
326
|
-
<el-radio-group v-model={anchorTabsPosition.value}>
|
|
327
|
-
<el-radio-button label="left">左侧</el-radio-button>
|
|
328
|
-
<el-radio-button label="right">右侧</el-radio-button>
|
|
329
|
-
<el-radio-button label="top">顶部</el-radio-button>
|
|
330
|
-
</el-radio-group>
|
|
331
|
-
</div>
|
|
332
|
-
<div>
|
|
333
|
-
<span style={{ marginRight: '8px' }}>模式:</span>
|
|
334
|
-
<el-radio-group v-model={anchorTabsMode.value}>
|
|
335
|
-
<el-radio-button label="anchor">滚动锚点</el-radio-button>
|
|
336
|
-
<el-radio-button label="switch">组件切换</el-radio-button>
|
|
337
|
-
</el-radio-group>
|
|
338
|
-
</div>
|
|
339
|
-
</div>
|
|
340
|
-
|
|
341
|
-
<div style={{ height: '500px', border: '1px solid #dcdfe6', borderRadius: '4px' }}>
|
|
342
|
-
<SmartAnchorTabs
|
|
343
|
-
tabs={anchorTabsData}
|
|
344
|
-
position={anchorTabsPosition.value}
|
|
345
|
-
mode={anchorTabsMode.value}
|
|
346
|
-
height="100%"
|
|
347
|
-
>
|
|
348
|
-
{{
|
|
349
|
-
default: ({ tab }) => (
|
|
350
|
-
<div style={{ minHeight: '300px' }}>
|
|
351
|
-
<h3>{tab.label}</h3>
|
|
352
|
-
<p>{tab.content}</p>
|
|
353
|
-
{/* 模拟长内容 */}
|
|
354
|
-
<div style={{ color: '#909399', fontSize: '14px', lineHeight: '1.6' }}>
|
|
355
|
-
{Array.from({ length: 5 }).map((_, i) => (
|
|
356
|
-
<p key={i}>
|
|
357
|
-
这是 {tab.label} 的模拟内容段落 {i + 1}。
|
|
358
|
-
SmartAnchorTabs 组件支持平滑滚动定位,
|
|
359
|
-
并且在滚动时会自动更新左侧导航的高亮状态。
|
|
360
|
-
切换到 switch 模式则只显示当前内容。
|
|
361
|
-
</p>
|
|
362
|
-
))}
|
|
363
|
-
</div>
|
|
364
|
-
</div>
|
|
365
|
-
)
|
|
366
|
-
}}
|
|
367
|
-
</SmartAnchorTabs>
|
|
368
|
-
</div>
|
|
369
|
-
</div>
|
|
370
|
-
</el-tab-pane>
|
|
371
|
-
</el-tabs>
|
|
372
|
-
</div>
|
|
373
|
-
}
|
|
374
|
-
},
|
|
375
|
-
})
|
package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ChartsPanel/index.jsx
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref } from 'vue'
|
|
2
|
-
import styles from './index.module.scss'
|
|
3
|
-
import DonutChart from '../DonutChart'
|
|
4
|
-
import RankBarChart from '../RankBarChart'
|
|
5
|
-
import EchartsDonut from '../echarts/EchartsDonut.jsx'
|
|
6
|
-
import EchartsRankBar from '../echarts/EchartsRankBar.jsx'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 练习情况统计(3个面板)
|
|
10
|
-
* - 左:进度统计(环形图 + 图例)
|
|
11
|
-
* - 中:学员练习时长排名(条形排行)
|
|
12
|
-
* - 右:学员最高一次均分排名(条形排行)
|
|
13
|
-
*/
|
|
14
|
-
export default defineComponent({
|
|
15
|
-
name: 'PracticeStatusChartsPanel',
|
|
16
|
-
props: {
|
|
17
|
-
useEcharts: {
|
|
18
|
-
type: Boolean,
|
|
19
|
-
default: false,
|
|
20
|
-
},
|
|
21
|
-
progress: {
|
|
22
|
-
type: Array,
|
|
23
|
-
default: () => [],
|
|
24
|
-
},
|
|
25
|
-
durationRank: {
|
|
26
|
-
type: Array,
|
|
27
|
-
default: () => [],
|
|
28
|
-
},
|
|
29
|
-
scoreRank: {
|
|
30
|
-
type: Array,
|
|
31
|
-
default: () => [],
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
setup(props) {
|
|
35
|
-
const hiddenLegend = ref([]) // 存储被隐藏的图例名称
|
|
36
|
-
|
|
37
|
-
const toggleLegend = (name) => {
|
|
38
|
-
if (!props.useEcharts) return // 只有 Echarts 模式下支持
|
|
39
|
-
if (hiddenLegend.value.includes(name)) {
|
|
40
|
-
hiddenLegend.value = hiddenLegend.value.filter((n) => n !== name)
|
|
41
|
-
} else {
|
|
42
|
-
hiddenLegend.value.push(name)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return () => (
|
|
47
|
-
<div>
|
|
48
|
-
<div class={styles.grid3}>
|
|
49
|
-
<div class={styles.panel}>
|
|
50
|
-
<div class={styles.panelHeader}>
|
|
51
|
-
<div class={styles.panelTitle}>进度统计</div>
|
|
52
|
-
<div class={styles.legend}>
|
|
53
|
-
{props.progress.map((it, idx) => {
|
|
54
|
-
const isHidden = hiddenLegend.value.includes(it.name)
|
|
55
|
-
return (
|
|
56
|
-
<span
|
|
57
|
-
class={[styles.legendItem, isHidden && props.useEcharts ? styles.legendHidden : '']}
|
|
58
|
-
key={`${it.name}-${idx}`}
|
|
59
|
-
onClick={() => toggleLegend(it.name)}
|
|
60
|
-
style={{ cursor: props.useEcharts ? 'pointer' : 'default', opacity: isHidden && props.useEcharts ? 0.5 : 1 }}
|
|
61
|
-
>
|
|
62
|
-
<i class={styles.dot} style={{ background: it.color }} />
|
|
63
|
-
<span>{it.name}</span>
|
|
64
|
-
</span>
|
|
65
|
-
)
|
|
66
|
-
})}
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
<div class={styles.pieWrap}>
|
|
70
|
-
{props.useEcharts ? (
|
|
71
|
-
<EchartsDonut series={props.progress} height={200} hiddenLegend={hiddenLegend.value} />
|
|
72
|
-
) : (
|
|
73
|
-
<DonutChart series={props.progress} />
|
|
74
|
-
)}
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
|
|
78
|
-
<div class={styles.panel}>
|
|
79
|
-
<div class={styles.panelHeader}>
|
|
80
|
-
<div class={styles.panelTitle}>学员练习时长排名</div>
|
|
81
|
-
</div>
|
|
82
|
-
{props.useEcharts ? (
|
|
83
|
-
<EchartsRankBar
|
|
84
|
-
data={props.durationRank}
|
|
85
|
-
valueFormatter={(v) => `${v.toFixed(1)}`}
|
|
86
|
-
height={300}
|
|
87
|
-
/>
|
|
88
|
-
) : (
|
|
89
|
-
<RankBarChart
|
|
90
|
-
data={props.durationRank}
|
|
91
|
-
valueFormatter={(v) => `${v.toFixed(1)}`}
|
|
92
|
-
height={300}
|
|
93
|
-
/>
|
|
94
|
-
)}
|
|
95
|
-
</div>
|
|
96
|
-
|
|
97
|
-
<div class={styles.panel}>
|
|
98
|
-
<div class={styles.panelHeader}>
|
|
99
|
-
<div class={styles.panelTitle}>学员最高一次均分排名</div>
|
|
100
|
-
</div>
|
|
101
|
-
{props.useEcharts ? (
|
|
102
|
-
<EchartsRankBar
|
|
103
|
-
data={props.scoreRank}
|
|
104
|
-
valueFormatter={(v) => `${v}`}
|
|
105
|
-
height={300}
|
|
106
|
-
max={100}
|
|
107
|
-
/>
|
|
108
|
-
) : (
|
|
109
|
-
<RankBarChart
|
|
110
|
-
data={props.scoreRank}
|
|
111
|
-
valueFormatter={(v) => `${v}`}
|
|
112
|
-
height={300}
|
|
113
|
-
/>
|
|
114
|
-
)}
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
)
|
|
119
|
-
},
|
|
120
|
-
})
|
|
121
|
-
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
.grid3 {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-template-columns: 1.2fr 1fr 1fr;
|
|
4
|
-
gap: 10px;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.chartCard {
|
|
8
|
-
background: #fff;
|
|
9
|
-
border-radius: 8px;
|
|
10
|
-
padding: 16px;
|
|
11
|
-
border: 1px solid #ebeef5;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/* Alias for component usage */
|
|
15
|
-
.panel {
|
|
16
|
-
composes: chartCard;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.chartHeader {
|
|
20
|
-
display: flex;
|
|
21
|
-
justify-content: space-between;
|
|
22
|
-
align-items: center;
|
|
23
|
-
margin-bottom: 12px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/* Alias for component usage */
|
|
27
|
-
.panelHeader {
|
|
28
|
-
composes: chartHeader;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.chartTitle {
|
|
32
|
-
font-size: 14px;
|
|
33
|
-
font-weight: 600;
|
|
34
|
-
color: #303133;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/* Alias for component usage */
|
|
38
|
-
.panelTitle {
|
|
39
|
-
composes: chartTitle;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.chartLegend {
|
|
43
|
-
display: flex;
|
|
44
|
-
gap: 16px;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/* Alias for component usage */
|
|
48
|
-
.legend {
|
|
49
|
-
composes: chartLegend;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.legendItem {
|
|
53
|
-
display: flex;
|
|
54
|
-
align-items: center;
|
|
55
|
-
font-size: 12px;
|
|
56
|
-
color: #606266;
|
|
57
|
-
cursor: pointer;
|
|
58
|
-
transition: opacity 0.3s;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.legendHidden {
|
|
62
|
-
opacity: 0.5;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.dot {
|
|
66
|
-
width: 8px;
|
|
67
|
-
height: 8px;
|
|
68
|
-
border-radius: 50%;
|
|
69
|
-
margin-right: 6px;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.pieWrap {
|
|
73
|
-
display: flex;
|
|
74
|
-
justify-content: center;
|
|
75
|
-
align-items: center;
|
|
76
|
-
}
|
package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/DonutChart/index.jsx
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { defineComponent, computed } from 'vue'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 轻量环形图(不依赖图表库)
|
|
5
|
-
* - 使用 SVG stroke-dasharray 实现
|
|
6
|
-
* - 适合做“进度统计”等概览图
|
|
7
|
-
*/
|
|
8
|
-
export default defineComponent({
|
|
9
|
-
name: 'PracticeStatusDonutChart',
|
|
10
|
-
props: {
|
|
11
|
-
series: {
|
|
12
|
-
type: Array,
|
|
13
|
-
default: () => [],
|
|
14
|
-
},
|
|
15
|
-
size: {
|
|
16
|
-
type: Number,
|
|
17
|
-
default: 170,
|
|
18
|
-
},
|
|
19
|
-
thickness: {
|
|
20
|
-
type: Number,
|
|
21
|
-
default: 18,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
setup(props) {
|
|
25
|
-
const normalized = computed(() => {
|
|
26
|
-
const safe = (props.series || []).map((s) => ({
|
|
27
|
-
name: s?.name ?? '',
|
|
28
|
-
value: Number(s?.value ?? 0),
|
|
29
|
-
color: s?.color ?? '#ff7a00',
|
|
30
|
-
}))
|
|
31
|
-
const total = safe.reduce((sum, cur) => sum + (Number.isFinite(cur.value) ? cur.value : 0), 0)
|
|
32
|
-
if (total <= 0) {
|
|
33
|
-
return {
|
|
34
|
-
total: 0,
|
|
35
|
-
list: safe.map((s) => ({ ...s, percent: 0 })),
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return {
|
|
39
|
-
total,
|
|
40
|
-
list: safe.map((s) => ({ ...s, percent: s.value / total })),
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
const geometry = computed(() => {
|
|
45
|
-
const size = props.size
|
|
46
|
-
const thickness = props.thickness
|
|
47
|
-
const r = (size - thickness) / 2
|
|
48
|
-
const c = 2 * Math.PI * r
|
|
49
|
-
return { size, thickness, r, c }
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
const segments = computed(() => {
|
|
53
|
-
const { c } = geometry.value
|
|
54
|
-
let offset = 0
|
|
55
|
-
const list = normalized.value.list.map((s) => {
|
|
56
|
-
const len = c * s.percent
|
|
57
|
-
const seg = {
|
|
58
|
-
...s,
|
|
59
|
-
len,
|
|
60
|
-
offset,
|
|
61
|
-
dasharray: `${len} ${Math.max(0, c - len)}`,
|
|
62
|
-
dashoffset: -offset,
|
|
63
|
-
}
|
|
64
|
-
offset += len
|
|
65
|
-
return seg
|
|
66
|
-
})
|
|
67
|
-
return list
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
return () => {
|
|
71
|
-
const { size, thickness, r } = geometry.value
|
|
72
|
-
const cx = size / 2
|
|
73
|
-
const cy = size / 2
|
|
74
|
-
return (
|
|
75
|
-
<svg width={size} height={size} viewBox={`0 0 ${size} ${size}`}>
|
|
76
|
-
<circle
|
|
77
|
-
cx={cx}
|
|
78
|
-
cy={cy}
|
|
79
|
-
r={r}
|
|
80
|
-
fill="none"
|
|
81
|
-
stroke="#f2f6fc"
|
|
82
|
-
stroke-width={thickness}
|
|
83
|
-
/>
|
|
84
|
-
{segments.value.map((s, idx) => (
|
|
85
|
-
<circle
|
|
86
|
-
key={`${s.name}-${idx}`}
|
|
87
|
-
cx={cx}
|
|
88
|
-
cy={cy}
|
|
89
|
-
r={r}
|
|
90
|
-
fill="none"
|
|
91
|
-
stroke={s.color}
|
|
92
|
-
stroke-width={thickness}
|
|
93
|
-
stroke-linecap="round"
|
|
94
|
-
stroke-dasharray={s.dasharray}
|
|
95
|
-
stroke-dashoffset={s.dashoffset}
|
|
96
|
-
transform={`rotate(-90 ${cx} ${cy})`}
|
|
97
|
-
/>
|
|
98
|
-
))}
|
|
99
|
-
</svg>
|
|
100
|
-
)
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
})
|
|
104
|
-
|