diff --git a/README.md b/README.md
index 01becd566f9b23308d76914dd0544dc89850a4b6..a23f67921256852ac4c243afc0387814bcdd7653 100644
--- a/README.md
+++ b/README.md
@@ -71,4 +71,4 @@
> 当然项目中还使用很多不知道姓名的大神的代码, 在这里就不一一感谢
## 先睹为快
- ![](dome.jpg)
+ ![](https://raw.githubusercontent.com/baiy/Ctool/master/dome.jpg)
diff --git a/public/img/icon_utools.png b/public/img/icon_utools.png
index 37ac92521c6f7b345bb6a98c40a2859758e8eb62..4d78c7ff96c0b340cf6940e019f0c28b73f0189b 100644
Binary files a/public/img/icon_utools.png and b/public/img/icon_utools.png differ
diff --git a/public/tool.html b/public/tool.html
index c1e26057bd5df659fb12099408f20b7298a6a0ef..32388de503dc997000412e4ddf21a44620a1983e 100644
--- a/public/tool.html
+++ b/public/tool.html
@@ -7,7 +7,7 @@
+
diff --git a/public/tool_preload.js b/public/tool_preload.js
deleted file mode 100644
index f630233d36d866108e758bd9256f3ffc3d30b025..0000000000000000000000000000000000000000
--- a/public/tool_preload.js
+++ /dev/null
@@ -1,23 +0,0 @@
-const {remote} = require("electron");
-const browserWindow = remote.getCurrentWindow()
-browserWindow.webContents.on('before-input-event', (event, input) => {
- // mac 关闭支持
- if (process.platform === "darwin") {
- if (input.meta && (['q', 'w'].includes(input.key.toLowerCase()))) {
- event.preventDefault()
- browserWindow.blur()
- browserWindow.close()
- }
- }
-})
-browserWindow.once('ready-to-show', () => {
- browserWindow.show()
-})
-
-window.ctool = {}
-window.ctool.isDevToolsOpened = function () {
- return browserWindow.webContents.isDevToolsOpened();
-}
-window.ctool.toggleDevTools = function () {
- return browserWindow.webContents.toggleDevTools();
-}
\ No newline at end of file
diff --git a/public/utools.html b/public/utools.html
deleted file mode 100644
index 55e3f4b9d3bd3832f0b39e5856b5cbf7bd1c895a..0000000000000000000000000000000000000000
--- a/public/utools.html
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
Ctool 程序开发常用工具
-
-
-
-
-
\ No newline at end of file
diff --git a/src/adapter/utools/plugin.json b/src/adapter/utools/plugin.json
index 3c5065b5866fac47ae08a73785da8449171fcad3..6d5aacfc5cf7ca75182a954c8c3d021d2fd99f00 100644
--- a/src/adapter/utools/plugin.json
+++ b/src/adapter/utools/plugin.json
@@ -3,11 +3,14 @@
"description": "Ctool 程序开发常用工具",
"author": "baiy",
"homepage": "https://github.com/baiy/Ctool",
- "main": "utools.html",
+ "main": "tool.html",
"version": "##version##",
- "logo": "img/icon128.png",
+ "logo": "img/icon_utools.png",
"pluginSetting": {
"single": true
},
+ "development": {
+ "main": "http://localhost:8081/tool.html"
+ },
"features": "##features##"
}
\ No newline at end of file
diff --git a/src/config.js b/src/config.js
index 8971dfd59ac5f4be6c2d372cccf090de88cb5ae2..54ba6286d71ea5916439d88b856f70345873058a 100644
--- a/src/config.js
+++ b/src/config.js
@@ -7,8 +7,18 @@ const category = [
]
const tool = [
- {'name': 'hash', 'title': '哈希(hash)', 'cat': ['encryption']},
- {'name': 'encrypt', 'title': '加密/解密', 'cat': ['encryption']},
+ {
+ 'name': 'hash',
+ 'title': '哈希(hash)',
+ 'cat': ['encryption'],
+ 'keyword': ['md5', 'sha1', 'sha256', 'sha512', 'sm3']
+ },
+ {
+ 'name': 'encrypt',
+ 'title': '加密/解密',
+ 'cat': ['encryption'],
+ 'keyword': ['AES', 'DES', 'RC4', 'Rabbit', 'TripleDes', 'sm2']
+ },
{'name': 'base64', 'title': 'BASE64编码', 'cat': ['encryption']},
{'name': 'json', 'title': 'JSON工具', 'cat': ['conversion', 'serialize']},
{'name': 'url', 'title': 'URL编码', 'cat': ['conversion']},
diff --git a/src/helper.js b/src/helper.js
index e7969a18e1df32ef32274e04c06a88ae2d8f9cab..28de92948b38a81ac0c448d305d021a2f6ffef58 100644
--- a/src/helper.js
+++ b/src/helper.js
@@ -45,6 +45,7 @@ export const stat = function (action, data = {}) {
{
v: env('version'),
a: action,
+ p:env('platform'),
r: Math.random()
},
data
diff --git a/src/tool.js b/src/tool.js
index e8c61874cfb00d716fb9feb11d44f8627fa235c4..c45de37307634b34a63b10c052a72861b84a7944 100644
--- a/src/tool.js
+++ b/src/tool.js
@@ -3,38 +3,25 @@ import ViewUI from 'view-design'
import 'view-design/dist/styles/iview.css'
import router from './tool.router'
import optionBlock from './components/optionBlock'
-import model, {plugin as modelPlugin} from './tool/model'
+import {plugin as modelPlugin} from './tool/model'
import App from './tool.vue'
import {isUtools} from './helper'
-import config from "./tool/config";
-
-Vue.config.productionTip = false
-
-Vue.use(ViewUI)
-Vue.use(modelPlugin)
-Vue.component('option-block', optionBlock);
(function () {
- if (isUtools) {
- let tool = window.utools.db.get("_current_tool_");
- if (tool && tool.data) {
- let cat = config.getToolDefaultCategory(tool.data);
- if (cat) {
- model.setCategoryHistory(cat)
- model.setToolHistory(cat, tool.data)
- }
- }
- }
-
if (document.body.clientWidth > 900 || isUtools) {
console.log('调整窗口大小')
const page = document.getElementById('page')
page.style.width = 'auto'
- page.style.padding = '0 50px'
page.style.height = 'auto'
- page.style.minHeight = '600px'
}
})()
+
+Vue.config.productionTip = false
+
+Vue.use(ViewUI)
+Vue.use(modelPlugin)
+Vue.component('option-block', optionBlock);
+
new Vue({
router,
render: h => h(App),
diff --git a/src/tool.vue b/src/tool.vue
index 979262fda329efe3ddd32e7112e7847a0bc17a23..d656338395fe09beca9fdf245a842fadec06123e 100644
--- a/src/tool.vue
+++ b/src/tool.vue
@@ -126,6 +126,24 @@ export default {
},
},
created () {
+ if (this.isUtools){
+ window.utools.onPluginEnter(({code}) => {
+ let tool = "";
+ if (code.indexOf('ctool-') !== -1) {
+ tool = code.replace(/ctool-/g, "")
+ }
+ if (tool && this.currentTool !== tool) {
+ let cat = config.getToolDefaultCategory(tool);
+ if (cat) {
+ model.setCategoryHistory(cat)
+ model.setToolHistory(cat, tool)
+ this.currentCategory = cat;
+ this.currentTool = tool;
+ }
+ }
+ })
+ }
+
this.currentCategory = model.getCategoryHistory()
this.currentTool = model.getToolHistory(this.currentCategory)
this.$Message.config({
diff --git a/src/tool/adapter.js b/src/tool/adapter.js
index 974c538204aca4c2baacc64efffa6024d27cc497..4a94bd320a2bf02102fc40028b05ef94e8eb4810 100644
--- a/src/tool/adapter.js
+++ b/src/tool/adapter.js
@@ -47,10 +47,11 @@ const utoolsConfigWrite = () => {
"cmds": ['ctool', '程序开发常用工具']
},
...toolConfig.tool.map((item) => {
+ let keyword = item.hasOwnProperty("keyword") ? item['keyword'] : [];
return {
"code": "ctool-" + item.name,
"explain": item.title,
- "cmds": [item.name, item.title, "ctool-" + item.name]
+ "cmds": Array.from(new Set([item.name, item.title, "ctool-" + item.name, ...keyword]))
}
})
]
diff --git a/src/views/setting/block.vue b/src/views/setting/block.vue
index ae72b89427a5f756a04ec90138a87ebb90f1db5c..8b03abe88f003358cfdab31a0de700c515405dd4 100644
--- a/src/views/setting/block.vue
+++ b/src/views/setting/block.vue
@@ -12,9 +12,6 @@
|
-
-
-