iconConverter.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /**
  2. * 图标转换工具
  3. * 提供ICO格式图标转换的相关功能
  4. */
  5. /**
  6. * 获取在线图标转换工具列表
  7. * @returns {Array} 在线转换工具列表
  8. */
  9. export function getOnlineConverters() {
  10. return [
  11. {
  12. name: 'Favicon Generator',
  13. url: 'https://www.favicon-generator.org/',
  14. description: '功能全面的图标转换工具,支持多种尺寸和格式'
  15. },
  16. {
  17. name: 'Convertio',
  18. url: 'https://convertio.co/zh/png-ico/',
  19. description: '简单易用的PNG转ICO工具,支持多种格式互转'
  20. },
  21. {
  22. name: 'ICO Convert',
  23. url: 'https://icoconvert.com/',
  24. description: '专业的ICO转换工具,支持多尺寸图标打包'
  25. },
  26. {
  27. name: 'RealFaviconGenerator',
  28. url: 'https://realfavicongenerator.net/',
  29. description: '针对各种设备和平台优化的图标生成工具'
  30. }
  31. ];
  32. }
  33. /**
  34. * 打开在线ICO转换工具
  35. * @param {String} url - 在线工具URL
  36. */
  37. export function openConverter(url) {
  38. // #ifdef H5
  39. window.open(url, '_blank');
  40. // #endif
  41. // #ifndef H5
  42. // 复制URL到剪贴板
  43. uni.setClipboardData({
  44. data: url,
  45. success: function() {
  46. uni.showToast({
  47. title: '链接已复制到剪贴板',
  48. icon: 'none'
  49. });
  50. }
  51. });
  52. // #endif
  53. }
  54. /**
  55. * 获取图标尺寸建议
  56. * @returns {Array} 图标尺寸建议列表
  57. */
  58. export function getIconSizeTips() {
  59. return [
  60. {
  61. size: '16x16',
  62. usage: '浏览器标签图标、收藏夹图标'
  63. },
  64. {
  65. size: '32x32',
  66. usage: '标准Windows图标、文件资源管理器'
  67. },
  68. {
  69. size: '48x48',
  70. usage: 'Windows桌面图标、应用商店图标'
  71. },
  72. {
  73. size: '64x64',
  74. usage: '高DPI设备的图标'
  75. },
  76. {
  77. size: '128x128',
  78. usage: 'Mac OS应用图标、高分辨率设备'
  79. },
  80. {
  81. size: '256x256',
  82. usage: '现代操作系统大图标、应用商店图标'
  83. }
  84. ];
  85. }
  86. export default {
  87. getOnlineConverters,
  88. openConverter,
  89. getIconSizeTips
  90. }