1
0

navigation.js 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. const TOOL_ENTRIES = [
  2. { view: 'bootloader', label: 'BootLoader升级', icon: 'icon-chip', iconSrc: '/assets/icons/chip-white.png' },
  3. { view: 'crc', label: 'CRC与哈希计算', icon: 'icon-crc', iconSrc: '/assets/icons/hash-white.png' },
  4. { view: 'filter', label: '滤波器计算', icon: 'icon-filter', iconSrc: '/assets/icons/funnel-white.png' },
  5. { view: 'reactance', label: '电抗计算', icon: 'icon-reactance', iconSrc: '/assets/icons/audio-waveform-white.png' },
  6. { view: 'smdCode', label: '贴片电阻/容代码', icon: 'icon-smd', iconSrc: '/assets/icons/microchip-white.png' },
  7. { view: 'refrigeration', label: '制冷计算', icon: 'icon-snow', iconSrc: '/assets/icons/snowflake-white.png' },
  8. { view: 'threePhasePower', label: '三相功率计算', icon: 'icon-three-phase', iconSrc: '/assets/icons/zap-white.png' }
  9. ]
  10. function getToolEntries() {
  11. return TOOL_ENTRIES.map((item) => ({ ...item }))
  12. }
  13. function isToolView(view) {
  14. return TOOL_ENTRIES.some((item) => item.view === view)
  15. }
  16. function getToolEntry(view) {
  17. return TOOL_ENTRIES.find((item) => item.view === view) || null
  18. }
  19. function getToolTitle(view) {
  20. const entry = getToolEntry(view)
  21. return entry ? entry.label : ''
  22. }
  23. module.exports = {
  24. getToolEntry,
  25. getToolEntries,
  26. getToolTitle,
  27. isToolView
  28. }