element-ui, fontawesome5

This commit is contained in:
chenqiang 2025-08-27 10:40:19 +08:00
parent d88eabe3ac
commit 24477e43d8
5 changed files with 299 additions and 35 deletions

27
.npmrc Normal file
View File

@ -0,0 +1,27 @@
# 主npm镜像源
egistry=https://registry.npmmirror.com/
# Electron相关镜像源
electron_mirror=https://npmmirror.com/mirrors/electron/
# Node.js源码镜像
disturl=https://npmmirror.com/dist
# 其他常用工具的镜像源
phantomjs_cdnurl=https://npmmirror.com/mirrors/phantomjs
sass_binary_site=https://npmmirror.com/mirrors/node-sass
# 配置Electron构建环境
electron_builder_binaries_mirror=https://npmmirror.com/mirrors/electron-builder-binaries/
# 配置SQLite3构建参数解决之前遇到的构建问题
npm_config_target=11.5.0
npm_config_runtime=electron
npm_config_disturl=https://electronjs.org/headers
npm_config_build_from_source=true
# 其他优化配置
fetch-retries=3
fetch-retry-factor=10
fetch-retry-mintimeout=60000
fetch-retry-maxtimeout=120000

107
package-lock.json generated
View File

@ -1413,6 +1413,48 @@
}
}
},
"@fortawesome/fontawesome-common-types": {
"version": "0.2.36",
"resolved": "https://registry.npmmirror.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.36.tgz",
"integrity": "sha512-a/7BiSgobHAgBWeN7N0w+lAhInrGxksn13uK7231n2m8EDPE3BMCl9NZLTGrj9ZXfCmC6LM0QLqXidIizVQ6yg=="
},
"@fortawesome/fontawesome-svg-core": {
"version": "1.2.36",
"resolved": "https://registry.npmmirror.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.36.tgz",
"integrity": "sha512-YUcsLQKYb6DmaJjIHdDWpBIGCcyE/W+p/LMGvjQem55Mm2XWVAP5kWTMKWLv9lwpCVjpLxPyOMOyUocP1GxrtA==",
"requires": {
"@fortawesome/fontawesome-common-types": "^0.2.36"
}
},
"@fortawesome/free-brands-svg-icons": {
"version": "5.15.4",
"resolved": "https://registry.npmmirror.com/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-5.15.4.tgz",
"integrity": "sha512-f1witbwycL9cTENJegcmcZRYyawAFbm8+c6IirLmwbbpqz46wyjbQYLuxOc7weXFXfB7QR8/Vd2u5R3q6JYD9g==",
"requires": {
"@fortawesome/fontawesome-common-types": "^0.2.36"
}
},
"@fortawesome/free-regular-svg-icons": {
"version": "5.15.4",
"resolved": "https://registry.npmmirror.com/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-5.15.4.tgz",
"integrity": "sha512-9VNNnU3CXHy9XednJ3wzQp6SwNwT3XaM26oS4Rp391GsxVYA+0oDR2J194YCIWf7jNRCYKjUCOduxdceLrx+xw==",
"requires": {
"@fortawesome/fontawesome-common-types": "^0.2.36"
}
},
"@fortawesome/free-solid-svg-icons": {
"version": "5.15.4",
"resolved": "https://registry.npmmirror.com/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.15.4.tgz",
"integrity": "sha512-JLmQfz6tdtwxoihXLg6lT78BorrFyCf59SAwBM6qV/0zXyVeDygJVb3fk+j5Qat+Yvcxp1buLTY5iDh1ZSAQ8w==",
"requires": {
"@fortawesome/fontawesome-common-types": "^0.2.36"
}
},
"@fortawesome/vue-fontawesome": {
"version": "2.0.10",
"resolved": "https://registry.npmmirror.com/@fortawesome/vue-fontawesome/-/vue-fontawesome-2.0.10.tgz",
"integrity": "sha512-OTETSXz+3ygD2OK2/vy82cmUBpuJqeOAg4gfnnv+f2Rir1tDIhQg026Q3NQxznq83ZLz8iNqGG9XJm26inpDeg=="
},
"@gar/promisify": {
"version": "1.1.3",
"resolved": "https://registry.npmmirror.com/@gar/promisify/-/promisify-1.1.3.tgz",
@ -3128,6 +3170,14 @@
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==",
"dev": true
},
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-1.8.5.tgz",
"integrity": "sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==",
"requires": {
"babel-runtime": "6.x"
}
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
@ -3200,6 +3250,11 @@
"integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==",
"dev": true
},
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "https://registry.npmmirror.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg=="
},
"babel-loader": {
"version": "8.4.1",
"resolved": "https://registry.npmmirror.com/babel-loader/-/babel-loader-8.4.1.tgz",
@ -3251,6 +3306,22 @@
"@babel/helper-define-polyfill-provider": "^0.6.5"
}
},
"babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.npmmirror.com/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g==",
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
},
"dependencies": {
"core-js": {
"version": "2.6.12",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-2.6.12.tgz",
"integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ=="
}
}
},
"balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz",
@ -5360,8 +5431,7 @@
"deepmerge": {
"version": "1.5.2",
"resolved": "https://registry.npmmirror.com/deepmerge/-/deepmerge-1.5.2.tgz",
"integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==",
"dev": true
"integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ=="
},
"default-gateway": {
"version": "5.0.5",
@ -6132,6 +6202,19 @@
"integrity": "sha512-Xoz0uMrim9ZETCQt8UgM5FxQF9+imA7PBpokoGcZloA1uw2LeHzTlip5cb5KOAsXZLjh/moN2vReN3ZjJmjI9A==",
"dev": true
},
"element-ui": {
"version": "2.15.14",
"resolved": "https://registry.npmmirror.com/element-ui/-/element-ui-2.15.14.tgz",
"integrity": "sha512-2v9fHL0ZGINotOlRIAJD5YuVB8V7WKxrE9Qy7dXhRipa035+kF7WuU/z+tEmLVPBcJ0zt8mOu1DKpWcVzBK8IA==",
"requires": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
"deepmerge": "^1.2.0",
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.0",
"throttle-debounce": "^1.0.1"
}
},
"elliptic": {
"version": "6.6.1",
"resolved": "https://registry.npmmirror.com/elliptic/-/elliptic-6.6.1.tgz",
@ -10164,6 +10247,11 @@
"integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==",
"dev": true
},
"normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/normalize-wheel/-/normalize-wheel-1.0.1.tgz",
"integrity": "sha512-1OnlAPZ3zgrk8B91HyRj+eVv+kS5u+Z0SCsak6Xil/kmgEia50ga7zfkumayonZrImffAxPU/5WcyGhzetHNPA=="
},
"npm-bundled": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/npm-bundled/-/npm-bundled-1.1.2.tgz",
@ -12295,6 +12383,11 @@
"regenerate": "^1.4.2"
}
},
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
},
"regex-not": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/regex-not/-/regex-not-1.0.2.tgz",
@ -12536,6 +12629,11 @@
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
"dev": true
},
"resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.npmmirror.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
"integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg=="
},
"resolve": {
"version": "1.22.10",
"resolved": "https://registry.npmmirror.com/resolve/-/resolve-1.22.10.tgz",
@ -14142,6 +14240,11 @@
}
}
},
"throttle-debounce": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/throttle-debounce/-/throttle-debounce-1.1.0.tgz",
"integrity": "sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg=="
},
"through2": {
"version": "2.0.5",
"resolved": "https://registry.npmmirror.com/through2/-/through2-2.0.5.tgz",

View File

@ -14,8 +14,14 @@
},
"main": "background.js",
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.36",
"@fortawesome/free-brands-svg-icons": "^5.15.4",
"@fortawesome/free-regular-svg-icons": "^5.15.4",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/vue-fontawesome": "^2.0.10",
"argon2": "^0.25.1",
"core-js": "^3.6.5",
"element-ui": "^2.15.14",
"sqlite3": "^4.2.0",
"vue": "^2.6.11",
"vue-router": "^3.2.0",

View File

@ -4,9 +4,27 @@ import App from './App.vue'
import router from './router'
import store from './store'
// 导入Element UI
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// 导入FontAwesome
import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { fas } from '@fortawesome/free-solid-svg-icons'
import { far } from '@fortawesome/free-regular-svg-icons'
import { fab } from '@fortawesome/free-brands-svg-icons'
// In Vue CLI Electron Builder projects, we need to be careful about how we access Electron APIs
// Do not directly require('electron') in main.js for renderer process
// 注册Element UI
Vue.use(ElementUI)
// 注册FontAwesome图标库
library.add(fas, far, fab)
Vue.component('font-awesome-icon', FontAwesomeIcon)
Vue.config.productionTip = false
new Vue({

View File

@ -1,47 +1,118 @@
<template>
<div class="home">
<img alt="Vue logo" src="../assets/logo.png">
<h1>Argon2 Test</h1>
<!-- 测试FontAwesome图标 -->
<div class="icon-test">
<h3>FontAwesome 图标测试</h3>
<div class="icons">
<font-awesome-icon :icon="['fas', 'calculator']" class="icon" size="3x" />
<font-awesome-icon :icon="['far', 'file-alt']" class="icon" size="3x" />
<font-awesome-icon :icon="['fab', 'vuejs']" class="icon" size="3x" />
<font-awesome-icon :icon="['fas', 'database']" class="icon" size="3x" />
<font-awesome-icon :icon="['fas', 'lock']" class="icon" size="3x" />
<font-awesome-icon :icon="['fas', 'key']" class="icon" size="3x" />
<font-awesome-icon :icon="['fas', 'user']" class="icon" size="3x" />
</div>
</div>
<!-- 测试Element UI组件 -->
<div class="element-test">
<h3>Element UI 组件测试</h3>
<el-card class="card-test">
<template slot="header">
<div class="card-header">
<span>Argon2哈希计算</span>
<el-button type="primary" size="small" @click="showDialog">打开对话框</el-button>
</div>
</template>
<div class="input-container">
<label for="inputString">输入字符串</label>
<input
id="inputString"
<el-input
v-model="inputString"
type="text"
placeholder="请输入要计算哈希的字符串"
@input="onInputChange"
>
prefix-icon="el-icon-lock"
clearable
style="width: 300px;"
/>
</div>
<div v-if="result" class="result-container">
<h3>计算结果</h3>
<el-alert title="计算结果" type="success" :closable="false">
<pre>{{ result }}</pre>
</el-alert>
</div>
<div v-if="error" class="error-container">
<p>{{ error }}</p>
<el-alert :title="error" type="error" show-icon :closable="false" />
</div>
</el-card>
</div>
<!-- Element UI对话框 -->
<el-dialog
title="组件测试对话框"
:visible.sync="dialogVisible"
width="50%"
:before-close="handleClose"
>
<div>
<p>这是一个Element UI对话框组件</p>
<!-- 切换为Element UI图标选择 -->
<el-select v-model="selectedIconId" placeholder="选择一个图标">
<el-option v-for="icon in simplifiedIconOptions" :key="icon.id" :label="icon.label" :value="icon.id" />
</el-select>
<div style="margin-top: 20px;">
<!-- 使用Element UI图标 -->
<i v-if="selectedIconId" :class="getElementIcon(selectedIconId)" style="font-size: 32px;"></i>
<span v-else>请选择一个图标</span>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="dialogVisible = false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
// FontAwesome
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
export default {
name: 'Home',
components: {
FontAwesomeIcon
},
data() {
return {
inputString: '',
result: '',
error: ''
error: '',
dialogVisible: false,
// 使ID
selectedIconId: 'file',
//
simplifiedIconOptions: [
{ id: 'file', label: '文件', elementIcon: 'el-icon-document' },
{ id: 'lock', label: '锁', elementIcon: 'el-icon-lock' },
{ id: 'key', label: '钥匙', elementIcon: 'el-icon-key' },
{ id: 'user', label: '用户', elementIcon: 'el-icon-user' },
{ id: 'database', label: '数据库', elementIcon: 'el-icon-data-line' },
{ id: 'search', label: '搜索', elementIcon: 'el-icon-search' },
{ id: 'edit', label: '编辑', elementIcon: 'el-icon-edit' },
{ id: 'delete', label: '删除', elementIcon: 'el-icon-delete' }
]
}
},
methods: {
async onInputChange() {
//
if (this.inputString.trim()) {
try {
this.error = ''
// window.electron
if (typeof window !== 'undefined' && window.electron && window.electron.ipcRenderer) {
const result = await window.electron.ipcRenderer.invoke('argon2Test', this.inputString)
this.result = result
@ -56,6 +127,21 @@ export default {
this.result = ''
this.error = ''
}
},
showDialog() {
this.dialogVisible = true
},
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done()
})
.catch(_ => {})
},
// IDElement UI
getElementIcon(iconId) {
const icon = this.simplifiedIconOptions.find(item => item.id === iconId)
return icon ? icon.elementIcon : ''
}
}
}
@ -67,36 +153,60 @@ export default {
padding: 20px;
}
.input-container {
.icon-test {
margin: 20px 0;
}
input {
padding: 8px 12px;
font-size: 16px;
width: 300px;
border: 1px solid #ddd;
border-radius: 4px;
.icons {
display: flex;
justify-content: center;
gap: 20px;
margin-top: 10px;
}
.icon {
color: #409EFF;
}
.element-test {
margin-top: 30px;
}
.card-test {
max-width: 800px;
margin: 0 auto;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.input-container {
margin: 20px 0;
display: flex;
justify-content: center;
}
.result-container {
margin-top: 20px;
padding: 15px;
background-color: #f5f5f5;
border-radius: 4px;
text-align: left;
max-width: 800px;
margin-left: auto;
margin-right: auto;
}
.error-container {
margin-top: 20px;
color: red;
}
pre {
white-space: pre-wrap;
word-wrap: break-word;
background-color: #f5f5f5;
padding: 10px;
border-radius: 4px;
}
.dialog-footer button:first-child {
margin-right: 10px;
}
</style>