1
0

tool-navigation.js 1.2 KB

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