You need to sign in or sign up before continuing.
提交 52407cc2 编写于 作者: B baiy 提交者: ninecents

历史记录功能升级 #31

json输入框高度动态设置 #30
上级 1188523e
{ {
"name": "c-tool", "name": "c-tool",
"version": "1.1.0", "version": "1.2.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
...@@ -2954,7 +2954,7 @@ ...@@ -2954,7 +2954,7 @@
}, },
"JSV": { "JSV": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz", "resolved": "https://registry.npm.taobao.org/JSV/download/JSV-4.0.2.tgz",
"integrity": "sha1-0Hf2glVx+CEy+d/67Vh7QCn+/1c=" "integrity": "sha1-0Hf2glVx+CEy+d/67Vh7QCn+/1c="
}, },
"accepts": { "accepts": {
...@@ -3006,7 +3006,7 @@ ...@@ -3006,7 +3006,7 @@
}, },
"ajax-request": { "ajax-request": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/ajax-request/-/ajax-request-1.2.3.tgz", "resolved": "https://registry.npm.taobao.org/ajax-request/download/ajax-request-1.2.3.tgz",
"integrity": "sha1-mfy+wdbSeS+F+pSVNTMr0U9fN5A=", "integrity": "sha1-mfy+wdbSeS+F+pSVNTMr0U9fN5A=",
"requires": { "requires": {
"file-system": "^2.1.1", "file-system": "^2.1.1",
...@@ -3254,9 +3254,9 @@ ...@@ -3254,9 +3254,9 @@
"dev": true "dev": true
}, },
"async-validator": { "async-validator": {
"version": "3.4.0", "version": "3.5.1",
"resolved": "https://registry.npmjs.org/async-validator/-/async-validator-3.4.0.tgz", "resolved": "https://registry.npmjs.org/async-validator/-/async-validator-3.5.1.tgz",
"integrity": "sha512-VrFk4eYiJAWKskEz115iiuCf9O0ftnMMPXrOFMqyzGH2KxO7YwncKyn/FgOOP+0MDHMfXL7gLExagCutaZGigA==" "integrity": "sha512-DDmKA7sdSAJtTVeNZHrnr2yojfFaoeW8MfQN8CeuXg8DDQHTqKk9Fdv38dSvnesHoO8MUwMI2HphOeSyIF+wmQ=="
}, },
"asynckit": { "asynckit": {
"version": "0.4.0", "version": "0.4.0",
...@@ -3414,7 +3414,7 @@ ...@@ -3414,7 +3414,7 @@
}, },
"babel-runtime": { "babel-runtime": {
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "resolved": "http://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"requires": { "requires": {
"core-js": "^2.4.0", "core-js": "^2.4.0",
...@@ -3502,7 +3502,7 @@ ...@@ -3502,7 +3502,7 @@
}, },
"batch-processor": { "batch-processor": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/batch-processor/-/batch-processor-1.0.0.tgz", "resolved": "http://registry.npm.taobao.org/batch-processor/download/batch-processor-1.0.0.tgz",
"integrity": "sha1-dclcMrdI4IUNEMKxaPa9vpiRrOg=" "integrity": "sha1-dclcMrdI4IUNEMKxaPa9vpiRrOg="
}, },
"bcrypt-pbkdf": { "bcrypt-pbkdf": {
...@@ -3783,7 +3783,7 @@ ...@@ -3783,7 +3783,7 @@
}, },
"buffer-fill": { "buffer-fill": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", "resolved": "http://registry.npm.taobao.org/buffer-fill/download/buffer-fill-1.0.0.tgz",
"integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw="
}, },
"buffer-from": { "buffer-from": {
...@@ -4685,18 +4685,18 @@ ...@@ -4685,18 +4685,18 @@
} }
}, },
"cron-parser": { "cron-parser": {
"version": "2.16.3", "version": "2.18.0",
"resolved": "https://registry.npmjs.org/cron-parser/-/cron-parser-2.16.3.tgz", "resolved": "https://registry.npmjs.org/cron-parser/-/cron-parser-2.18.0.tgz",
"integrity": "sha512-XNJBD1QLFeAMUkZtZQuncAAOgJFWNhBdIbwgD22hZxrcWOImBFMKgPC66GzaXpyoJs7UvYLLgPH/8BRk/7gbZg==", "integrity": "sha512-s4odpheTyydAbTBQepsqd2rNWGa2iV3cyo8g7zbI2QQYGLVsfbhmwukayS1XHppe02Oy1fg7mg6xoaraVJeEcg==",
"requires": { "requires": {
"is-nan": "^1.3.0", "is-nan": "^1.3.0",
"moment-timezone": "^0.5.31" "moment-timezone": "^0.5.31"
} }
}, },
"cronstrue": { "cronstrue": {
"version": "1.100.0", "version": "1.105.0",
"resolved": "https://registry.npmjs.org/cronstrue/-/cronstrue-1.100.0.tgz", "resolved": "https://registry.npmjs.org/cronstrue/-/cronstrue-1.105.0.tgz",
"integrity": "sha512-Hz+xjjmq2QgCQhnPxIVM02dwhOt5GwUywjKa17je9JWX4z2E0uecObXCFap8bmJE87JL9mToW/cGw5O06JgigQ==" "integrity": "sha512-Bv8GHi5uJvxtq/9T7lgBwum7UVKMfR+LSPHZXiezP0E5gnODPVRQBAkCwijCIaWEepqmRcxTAxrUFB0UQK2wdw=="
}, },
"cross-spawn": { "cross-spawn": {
"version": "6.0.5", "version": "6.0.5",
...@@ -5321,7 +5321,7 @@ ...@@ -5321,7 +5321,7 @@
}, },
"dijkstrajs": { "dijkstrajs": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.1.tgz", "resolved": "https://registry.npm.taobao.org/dijkstrajs/download/dijkstrajs-1.0.1.tgz",
"integrity": "sha1-082BIh4+pAdCz83lVtTpnpjdxxs=" "integrity": "sha1-082BIh4+pAdCz83lVtTpnpjdxxs="
}, },
"dir-glob": { "dir-glob": {
...@@ -6400,7 +6400,7 @@ ...@@ -6400,7 +6400,7 @@
}, },
"file-match": { "file-match": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/file-match/-/file-match-1.0.2.tgz", "resolved": "https://registry.npm.taobao.org/file-match/download/file-match-1.0.2.tgz",
"integrity": "sha1-ycrSZdLIrfOoFHWw30dYWQafrvc=", "integrity": "sha1-ycrSZdLIrfOoFHWw30dYWQafrvc=",
"requires": { "requires": {
"utils-extend": "^1.0.6" "utils-extend": "^1.0.6"
...@@ -6408,7 +6408,7 @@ ...@@ -6408,7 +6408,7 @@
}, },
"file-system": { "file-system": {
"version": "2.2.2", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/file-system/-/file-system-2.2.2.tgz", "resolved": "https://registry.npm.taobao.org/file-system/download/file-system-2.2.2.tgz",
"integrity": "sha1-fWWDPjojR9zZVqgTxncVPtPt2Yc=", "integrity": "sha1-fWWDPjojR9zZVqgTxncVPtPt2Yc=",
"requires": { "requires": {
"file-match": "^1.0.1", "file-match": "^1.0.1",
...@@ -7395,7 +7395,7 @@ ...@@ -7395,7 +7395,7 @@
}, },
"has-color": { "has-color": {
"version": "0.1.7", "version": "0.1.7",
"resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", "resolved": "https://registry.npm.taobao.org/has-color/download/has-color-0.1.7.tgz",
"integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=" "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8="
}, },
"has-flag": { "has-flag": {
...@@ -7990,7 +7990,7 @@ ...@@ -7990,7 +7990,7 @@
}, },
"ipinyinjs": { "ipinyinjs": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/ipinyinjs/-/ipinyinjs-1.0.0.tgz", "resolved": "https://registry.npm.taobao.org/ipinyinjs/download/ipinyinjs-1.0.0.tgz",
"integrity": "sha1-NlEy7jIB6ncjQigicCXTpDE6q34=" "integrity": "sha1-NlEy7jIB6ncjQigicCXTpDE6q34="
}, },
"is-absolute-url": { "is-absolute-url": {
...@@ -8621,32 +8621,32 @@ ...@@ -8621,32 +8621,32 @@
}, },
"lodash.isarray": { "lodash.isarray": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.3.tgz", "resolved": "https://registry.npm.taobao.org/lodash.isarray/download/lodash.isarray-3.0.3.tgz",
"integrity": "sha1-TboTmi2QfCT9CWhJzkLxnCVSNVM=" "integrity": "sha1-TboTmi2QfCT9CWhJzkLxnCVSNVM="
}, },
"lodash.isboolean": { "lodash.isboolean": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.1.tgz", "resolved": "https://registry.npm.taobao.org/lodash.isboolean/download/lodash.isboolean-3.0.1.tgz",
"integrity": "sha1-78xyujJHQ67YimGIta2qWNnDGaQ=" "integrity": "sha1-78xyujJHQ67YimGIta2qWNnDGaQ="
}, },
"lodash.isnull": { "lodash.isnull": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/lodash.isnull/-/lodash.isnull-3.0.0.tgz", "resolved": "https://registry.npm.taobao.org/lodash.isnull/download/lodash.isnull-3.0.0.tgz",
"integrity": "sha1-+vvlnqHcon7teGU0A53YTC4HxW4=" "integrity": "sha1-+vvlnqHcon7teGU0A53YTC4HxW4="
}, },
"lodash.isnumber": { "lodash.isnumber": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.1.tgz", "resolved": "https://registry.npm.taobao.org/lodash.isnumber/download/lodash.isnumber-3.0.1.tgz",
"integrity": "sha1-YoofPxmOLdzSt+uRY1QLZ3YlWYU=" "integrity": "sha1-YoofPxmOLdzSt+uRY1QLZ3YlWYU="
}, },
"lodash.isobject": { "lodash.isobject": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", "resolved": "https://registry.npm.taobao.org/lodash.isobject/download/lodash.isobject-3.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash.isobject%2Fdownload%2Flodash.isobject-3.0.2.tgz",
"integrity": "sha1-PI+41bW/S/kK4G4U8qUwpO2TXh0=" "integrity": "sha1-PI+41bW/S/kK4G4U8qUwpO2TXh0="
}, },
"lodash.isstring": { "lodash.isstring": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-3.0.1.tgz", "resolved": "https://registry.npm.taobao.org/lodash.isstring/download/lodash.isstring-3.0.1.tgz",
"integrity": "sha1-QWOJROoELvZ61nwpOqVB0/PW5Tw=" "integrity": "sha1-QWOJROoELvZ61nwpOqVB0/PW5Tw="
}, },
"lodash.kebabcase": { "lodash.kebabcase": {
...@@ -8669,7 +8669,7 @@ ...@@ -8669,7 +8669,7 @@
}, },
"lodash.throttle": { "lodash.throttle": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz", "resolved": "http://registry.npm.taobao.org/lodash.throttle/download/lodash.throttle-4.1.1.tgz",
"integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=" "integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ="
}, },
"lodash.transform": { "lodash.transform": {
...@@ -9039,14 +9039,14 @@ ...@@ -9039,14 +9039,14 @@
} }
}, },
"moment": { "moment": {
"version": "2.27.0", "version": "2.29.1",
"resolved": "https://registry.npm.taobao.org/moment/download/moment-2.27.0.tgz?cache=0&sync_timestamp=1592516084857&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmoment%2Fdownload%2Fmoment-2.27.0.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
"integrity": "sha1-i/9OPiaiNiIN/j423nVrbrqgEF0=" "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
}, },
"moment-timezone": { "moment-timezone": {
"version": "0.5.31", "version": "0.5.32",
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.31.tgz", "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.32.tgz",
"integrity": "sha512-+GgHNg8xRhMXfEbv81iDtrVeTcWt0kWmTEY1XQK14dICTXnWJnT0dxdlPspwqF3keKMVPXwayEsk1DI0AA/jdA==", "integrity": "sha512-Z8QNyuQHQAmWucp8Knmgei8YNo28aLjJq6Ma+jy1ZSpSk5nyfRT8xgUbSQvD2+2UajISfenndwvFuH3NGS+nvA==",
"requires": { "requires": {
"moment": ">= 2.9.0" "moment": ">= 2.9.0"
} }
...@@ -9238,7 +9238,7 @@ ...@@ -9238,7 +9238,7 @@
}, },
"nomnom": { "nomnom": {
"version": "1.8.1", "version": "1.8.1",
"resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz", "resolved": "https://registry.npm.taobao.org/nomnom/download/nomnom-1.8.1.tgz",
"integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=",
"requires": { "requires": {
"chalk": "~0.4.0", "chalk": "~0.4.0",
...@@ -9247,12 +9247,12 @@ ...@@ -9247,12 +9247,12 @@
"dependencies": { "dependencies": {
"ansi-styles": { "ansi-styles": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", "resolved": "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-1.0.0.tgz",
"integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=" "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg="
}, },
"chalk": { "chalk": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", "resolved": "https://registry.npm.taobao.org/chalk/download/chalk-0.4.0.tgz",
"integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=",
"requires": { "requires": {
"ansi-styles": "~1.0.0", "ansi-styles": "~1.0.0",
...@@ -9262,7 +9262,7 @@ ...@@ -9262,7 +9262,7 @@
}, },
"strip-ansi": { "strip-ansi": {
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", "resolved": "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-0.1.1.tgz?cache=0&sync_timestamp=1573280518303&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-ansi%2Fdownload%2Fstrip-ansi-0.1.1.tgz",
"integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=" "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE="
} }
} }
...@@ -9816,7 +9816,7 @@ ...@@ -9816,7 +9816,7 @@
}, },
"phparr": { "phparr": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/phparr/-/phparr-0.2.0.tgz", "resolved": "https://registry.npm.taobao.org/phparr/download/phparr-0.2.0.tgz",
"integrity": "sha1-WeqkMXLYSM7x3QMJtHLDfOkRTWU=", "integrity": "sha1-WeqkMXLYSM7x3QMJtHLDfOkRTWU=",
"requires": { "requires": {
"lodash.isarray": "3.0.3", "lodash.isarray": "3.0.3",
...@@ -10731,9 +10731,9 @@ ...@@ -10731,9 +10731,9 @@
"dev": true "dev": true
}, },
"query-string": { "query-string": {
"version": "6.13.1", "version": "6.13.7",
"resolved": "https://registry.npm.taobao.org/query-string/download/query-string-6.13.1.tgz?cache=0&sync_timestamp=1591853346096&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fquery-string%2Fdownload%2Fquery-string-6.13.1.tgz", "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.13.7.tgz",
"integrity": "sha1-2RPM/OO0s6cTmJ/m05Rm2S5xzK0=", "integrity": "sha512-CsGs8ZYb39zu0WLkeOhe0NMePqgYdAuCqxOYKDR5LVCytDZYMGx3Bb+xypvQvPHVPijRXB0HZNFllCzHRe4gEA==",
"requires": { "requires": {
"decode-uri-component": "^0.2.0", "decode-uri-component": "^0.2.0",
"split-on-first": "^1.0.0", "split-on-first": "^1.0.0",
...@@ -10767,7 +10767,7 @@ ...@@ -10767,7 +10767,7 @@
}, },
"radix.js": { "radix.js": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/radix.js/-/radix.js-0.0.1.tgz", "resolved": "https://registry.npm.taobao.org/radix.js/download/radix.js-0.0.1.tgz",
"integrity": "sha1-rvAZaRF+YgL4cZcJX95z+7MQ8C8=" "integrity": "sha1-rvAZaRF+YgL4cZcJX95z+7MQ8C8="
}, },
"randombytes": { "randombytes": {
...@@ -11365,7 +11365,7 @@ ...@@ -11365,7 +11365,7 @@
}, },
"serialize-php": { "serialize-php": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/serialize-php/-/serialize-php-1.1.2.tgz", "resolved": "https://registry.npm.taobao.org/serialize-php/download/serialize-php-1.1.2.tgz",
"integrity": "sha1-rtn4fFazb1hr466Pk2s1VlR/b8o=" "integrity": "sha1-rtn4fFazb1hr466Pk2s1VlR/b8o="
}, },
"serve-index": { "serve-index": {
...@@ -11853,8 +11853,8 @@ ...@@ -11853,8 +11853,8 @@
}, },
"split-on-first": { "split-on-first": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/split-on-first/download/split-on-first-1.1.0.tgz", "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz",
"integrity": "sha1-9hCv7uOxK84dDDBCXnY5i3gkml8=" "integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw=="
}, },
"split-string": { "split-string": {
"version": "3.1.0", "version": "3.1.0",
...@@ -12334,9 +12334,9 @@ ...@@ -12334,9 +12334,9 @@
"dev": true "dev": true
}, },
"tinycolor2": { "tinycolor2": {
"version": "1.4.1", "version": "1.4.2",
"resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz", "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.2.tgz",
"integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g=" "integrity": "sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA=="
}, },
"tmp": { "tmp": {
"version": "0.0.33", "version": "0.0.33",
...@@ -12513,7 +12513,7 @@ ...@@ -12513,7 +12513,7 @@
}, },
"underscore": { "underscore": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", "resolved": "https://registry.npm.taobao.org/underscore/download/underscore-1.6.0.tgz",
"integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=" "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag="
}, },
"unicode-canonical-property-names-ecmascript": { "unicode-canonical-property-names-ecmascript": {
...@@ -12759,7 +12759,7 @@ ...@@ -12759,7 +12759,7 @@
}, },
"utils-extend": { "utils-extend": {
"version": "1.0.8", "version": "1.0.8",
"resolved": "https://registry.npmjs.org/utils-extend/-/utils-extend-1.0.8.tgz", "resolved": "https://registry.npm.taobao.org/utils-extend/download/utils-extend-1.0.8.tgz",
"integrity": "sha1-zP17ZFQPjpDuIe7Fd2nQZRyril8=" "integrity": "sha1-zP17ZFQPjpDuIe7Fd2nQZRyril8="
}, },
"utils-merge": { "utils-merge": {
...@@ -12813,9 +12813,9 @@ ...@@ -12813,9 +12813,9 @@
} }
}, },
"view-design": { "view-design": {
"version": "4.3.2", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/view-design/-/view-design-4.3.2.tgz", "resolved": "https://registry.npmjs.org/view-design/-/view-design-4.4.0.tgz",
"integrity": "sha512-58GH2fu5TVtUeeXWWu0VQXqgV01fGKHXhViw4p80OM/+SzhCJS2qzZYYpVyXaGKQM1OfeJHZrVFA/xLfpXK+0w==", "integrity": "sha512-2+xbda6/USUm9Pn+D25NPsIBg7XVhkFC90Ycs0GcFQ4AHZ1QRwDGOj0PGA3eeL4yuVpigdDfmwmNJAoczYXlPA==",
"requires": { "requires": {
"async-validator": "^3.3.0", "async-validator": "^3.3.0",
"deepmerge": "^2.2.1", "deepmerge": "^2.2.1",
...@@ -12918,9 +12918,9 @@ ...@@ -12918,9 +12918,9 @@
} }
}, },
"vue-router": { "vue-router": {
"version": "3.4.3", "version": "3.4.9",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.4.3.tgz", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.4.9.tgz",
"integrity": "sha512-BADg1mjGWX18Dpmy6bOGzGNnk7B/ZA0RxuA6qedY/YJwirMfKXIDzcccmHbQI0A6k5PzMdMloc0ElHfyOoX35A==" "integrity": "sha512-CGAKWN44RqXW06oC+u4mPgHLQQi2t6vLD/JbGRDAXm0YpMv0bgpKuU5bBd7AvMgfTz9kXVRIWKHqRwGEb8xFkA=="
}, },
"vue-style-loader": { "vue-style-loader": {
"version": "4.1.2", "version": "4.1.2",
......
{ {
"name": "c-tool", "name": "c-tool",
"version": "1.2.0", "version": "1.3.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve --port 8081", "serve": "vue-cli-service serve --port 8081",
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
"js-base64": "^2.6.4", "js-base64": "^2.6.4",
"jsonlint": "^1.6.3", "jsonlint": "^1.6.3",
"lscache": "^1.3.0", "lscache": "^1.3.0",
"moment": "^2.27.0", "moment": "^2.29.1",
"php-array-reader": "^1.2.0", "php-array-reader": "^1.2.0",
"phparr": "^0.2.0", "phparr": "^0.2.0",
"qrcode": "^1.4.4", "qrcode": "^1.4.4",
"qrcode-parser": "^1.2.0", "qrcode-parser": "^1.2.0",
"query-string": "^6.13.1", "query-string": "^6.13.7",
"radix.js": "0.0.1", "radix.js": "0.0.1",
"serialize-php": "^1.1.2", "serialize-php": "^1.1.2",
"sm-crypto": "^0.1.4", "sm-crypto": "^0.1.4",
......
<template> <template>
<div> <div>
<Menu mode="horizontal" theme="light" :active-name="currentCategory" @on-select="categorySelect" style="height: 45px;line-height: 45px;"> <Menu mode="horizontal" theme="light" :active-name="currentCategory" @on-select="categorySelect"
style="height: 45px;line-height: 45px;">
<MenuItem :name="cat.name" v-for="(cat) in category" :key="cat.name"> <MenuItem :name="cat.name" v-for="(cat) in category" :key="cat.name">
<Badge v-if="badgeCategoryIsShow(cat.name)" dot :offset="[15,-10]"> <Badge v-if="badgeCategoryIsShow(cat.name)" dot :offset="[15,-10]">
{{cat.title}} {{ cat.title }}
</Badge> </Badge>
<template v-else> <template v-else>
{{cat.title}} {{ cat.title }}
</template>
</MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_new">
<Icon type="md-expand" :size="24"/>
</MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_feedback">
<Icon type="md-help-circle" :size="24"/>
</MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_setting">
<Icon type="md-settings" :size="24"/>
</MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_about">
<Icon type="logo-github" :size="24"/>
</MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_history">
<Badge v-if="historyLength>0" dot :offset="[10,-3]">
<Icon type="md-time" :size="24"/>
</Badge>
<template v-else>
<Icon type="md-time" :size="24"/>
</template> </template>
</MenuItem> </MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_new"><Icon type="md-expand" :size="24" /></MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_feedback"><Icon type="md-help-circle" :size="24" /></MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_setting"><Icon type="md-settings" :size="24" /></MenuItem>
<MenuItem style="padding: 0 5px;float: right" name="_about"><Icon type="logo-github" :size="24" /></MenuItem>
</Menu> </Menu>
<RadioGroup :value="currentTool" @on-change="toolSelect" style="margin: 10px 0 10px 20px;line-height: 30px;"> <RadioGroup :value="currentTool" @on-change="toolSelect" style="margin: 10px 0 10px 20px;line-height: 30px;">
<Radio :label="tool.name" v-for="(tool) in tools" :key="tool.name"> <Radio :label="tool.name" v-for="(tool) in tools" :key="tool.name">
<Badge v-if="badgeToolIsShow(tool.name)" dot :offset="[5,-5]"> <Badge v-if="badgeToolIsShow(tool.name)" dot :offset="[5,-5]">
{{tool.title}} {{ tool.title }}
</Badge> </Badge>
<template v-else> <template v-else>
{{tool.title}} {{ tool.title }}
</template> </template>
</Radio> </Radio>
</RadioGroup> </RadioGroup>
<div> <div>
<router-view/> <router-view :key="$route.path + $route.query.t"/>
</div> </div>
<Drawer :title="currentToolTitle+' - 历史记录'" v-model="historyShow" :width="100">
<Table ref="historyTable" border :columns="historyColumns" :data="historyData" :height="historyTableHeight">
<template slot-scope="{ row }" slot="_value">
<div>{{ historyValue(row.value) }}}</div>
</template>
<template slot-scope="{ index,row }" slot="_op">
<Button type="primary" size="small" @click="historyView(index)">查看</Button>
<Button type="primary" style="margin-left: 5px" @click="historyLoad(index)" size="small">加载</Button>
</template>
</Table>
<div class="drawer-footer">
<Button type="primary" @click="historyClear">清空历史记录</Button>
</div>
</Drawer>
</div> </div>
</template> </template>
<script> <script>
import config from "./tool/config" import config from './tool/config'
import model from "./tool/model" import model from './tool/model'
import {openTab} from "./helper"; import historyFactory from './tool/history'
import {setLoadHistoryIndex} from './tool/history'
import { openTab } from './helper'
export default { export default {
data() { data () {
return { return {
category: config.category, category: config.category,
currentCategory: "", currentCategory: '',
currentTool: "", currentTool: '',
} historyData: [],
historyShow: false,
historyColumns: [
{
title: '操作时间',
key: 'time',
width:180
},
{
title: '数据',
slot: '_value',
ellipsis:true
},
{
title: '操作',
slot: '_op',
width:150
}
],
}
},
computed: {
tools () {
return config.getToolByCategory(this.currentCategory)
},
historyLength(){
return historyFactory(this.currentTool).length()
},
historyTableHeight() {
// 设置表格高度
return window.innerHeight - 140
}, },
computed: { currentToolTitle(){
tools() { return config.getToolTitle(this.currentTool)
return config.getToolByCategory(this.currentCategory) }
},
watch: {
currentTool (name) {
model.setCurrentTool(name)
this.$router.push('/tool/' + name)
},
},
created () {
this.currentCategory = model.getCategoryHistory()
this.currentTool = model.getToolHistory(this.currentCategory)
this.$Message.config({
top: 150,
})
},
mounted () {},
methods: {
categorySelect (name) {
switch (name) {
case '_feedback':
openTab('https://github.com/baiy/Ctool/issues')
break
case '_about':
openTab('https://github.com/baiy/Ctool')
break
case '_setting':
openTab('/setting.html')
break
case '_new':
openTab(window.location.href)
break
case '_history':
this.history()
break
default:
this.currentCategory = name
model.setCategoryHistory(name)
this.currentTool = model.getToolHistory(this.currentCategory)
break
} }
}, },
watch: { history () {
currentTool(name) { let history = historyFactory(this.currentTool)
model.setCurrentTool(name); if (history.length() < 1) {
this.$router.push("/tool/" + name); return this.$Message.error('暂无历史记录')
} }
this.historyData = history.all()
this.historyShow = true
}, },
created() { historyValue (value) {
this.currentCategory = model.getCategoryHistory(); return JSON.stringify(value)
this.currentTool = model.getToolHistory(this.currentCategory)
this.$Message.config({
top:150
})
}, },
mounted() {}, historyView(index){
methods: { console.log(historyFactory(this.currentTool).get(index))
categorySelect(name) { },
switch (name) { historyClear(){
case "_feedback": historyFactory(this.currentTool).clear()
openTab("https://github.com/baiy/Ctool/issues"); this.historyShow = false;
break; },
case "_about": historyLoad(index){
openTab("https://github.com/baiy/Ctool"); setLoadHistoryIndex(index)
break; this.historyShow = false;
case "_setting": this.$router.push({
openTab("/setting.html"); path:this.$router.currentRoute.fullPath,
break; query:{
case "_new": t:Date.now(),
openTab(window.location.href); },
break; });
default: },
this.currentCategory = name; toolSelect (name) {
model.setCategoryHistory(name); model.setToolHistory(this.currentCategory, name)
this.currentTool = model.getToolHistory(this.currentCategory) this.currentTool = name
break; },
} badgeToolIsShow (tool) {
}, return config.badgeToolIsShow(tool)
toolSelect(name) { },
model.setToolHistory(this.currentCategory, name) badgeCategoryIsShow (cat) {
this.currentTool = name return config.badgeCategoryIsShow(cat)
},
badgeToolIsShow(tool) {
return config.badgeToolIsShow(tool);
},
badgeCategoryIsShow(cat) {
return config.badgeCategoryIsShow(cat);
}
}, },
} },
</script> }
\ No newline at end of file </script>
<style scoped>
.drawer-footer{
width: 100%;
position: absolute;
bottom: 0;
left: 0;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
background: #fff;
}
</style>
\ No newline at end of file
import db from './db' import lsCache from 'lscache'
import {version} from '../helper' import p from '../../package'
const cacheVersion = version.split('.').join('');
// 缓存key添加版本号 // 缓存key添加版本号
const cacheNameConvert = function (name) { const cacheNameConvert = function (name) {
return 'v_' + cacheVersion + '_' + name return 'v_' + (p.version.split('.').join('')) + '_' + name
} }
const cache = { export default {
set(name, value, expiry = 0) { // expiry 过期时间 秒
return db.set(cacheNameConvert(name), value, expiry) set (name, value, expiry = 0) {
}, return lsCache.set(cacheNameConvert(name), value, expiry / 60)
get(name, defaultValue = null) {
let data = db.get(cacheNameConvert(name))
return data === null ? defaultValue : data
}, },
remove(name) { get (name, defaultValue = null) {
db.remove(cacheNameConvert(name)) let data = lsCache.get(cacheNameConvert(name))
return db.remove(cacheNameConvert(name)) return data ? data : defaultValue
}, },
setNoVersion(name, value, expiry = 0) { remove (name) {
return db.set('nv_' + name, value, expiry) lsCache.remove(cacheNameConvert(name))
}, },
getNoVersion(name, defaultValue = null) { setNoVersion (name, value, expiry = 0) {
let data = db.get('nv_' + name) return lsCache.set('nv_' + name, value, expiry / 60)
return data === null ? defaultValue : data
}, },
removeNoVersion(name) { getNoVersion (name, defaultValue = null) {
return db.remove('nv_' + name) let data = lsCache.get('nv_' + name)
return data ? data : defaultValue
}, },
// 清理数据 }
clear() { \ No newline at end of file
setTimeout(() => {
// 清理过期数据
db.clear();
// 清理过期版本数据
clearExpireVersion();
}, 100);
}
};
const clearExpireVersion = () => {
const cache_version_name = "cache_version";
if (cacheVersion === cache.getNoVersion(cache_version_name)) {
return;
}
cache.setNoVersion(cache_version_name, cacheVersion)
for (let key of db.getAllKey()) {
let c = /^v_(\d+)_/.exec(key)
if (c === null) {
continue;
}
if (cacheVersion !== c[1].trim()) {
db.remove(key)
}
}
}
export default cache
\ No newline at end of file
...@@ -2,18 +2,18 @@ import { env, inArray } from '../helper' ...@@ -2,18 +2,18 @@ import { env, inArray } from '../helper'
import cache from './cache' import cache from './cache'
// 工具缓存数据过期时间(秒) // 工具缓存数据过期时间(秒)
export const TOOL_DATA_EXPIRY = 1800 export const TOOL_DATA_EXPIRY = 3600 * 24
// 徽章过期时间(天) // 徽章过期时间(天)
export const BADGE_EXPIRY = 10 export const BADGE_EXPIRY = 10
// 分类徽章 // 分类徽章
export const BADGE_CATEGORY = ['json'] export const BADGE_CATEGORY = []
// 工具徽章 // 工具徽章
export const BADGE_TOOL = ['json'] export const BADGE_TOOL = []
// 默认常用工具 // 默认常用工具
export const DEFAULT_COMMON_TOOL = [ export const DEFAULT_COMMON_TOOL = [
'hash', 'encrypt', 'json' ,'base64', 'url', 'timestamp', 'hash', 'encrypt', 'json', 'base64', 'url', 'timestamp',
'qrCode', 'pinyin', 'ip', 'code', 'unicode', 'qrCode', 'pinyin', 'ip', 'code', 'unicode',
'decimalConvert', 'randomString','diffs' 'decimalConvert', 'randomString', 'diffs',
] ]
const category = [ const category = [
...@@ -28,7 +28,7 @@ const tool = [ ...@@ -28,7 +28,7 @@ const tool = [
{ 'name': 'hash', 'title': '哈希(hash)', cat: ['encryption'] }, { 'name': 'hash', 'title': '哈希(hash)', cat: ['encryption'] },
{ 'name': 'encrypt', 'title': '加密/解密', cat: ['encryption'] }, { 'name': 'encrypt', 'title': '加密/解密', cat: ['encryption'] },
{ 'name': 'base64', 'title': 'BASE64编码', cat: ['encryption'] }, { 'name': 'base64', 'title': 'BASE64编码', cat: ['encryption'] },
{ 'name': 'json', 'title': 'JSON工具', cat: ['conversion','json'] }, { 'name': 'json', 'title': 'JSON工具', cat: ['conversion', 'json'] },
{ 'name': 'url', 'title': 'URL编码', cat: ['conversion'] }, { 'name': 'url', 'title': 'URL编码', cat: ['conversion'] },
{ 'name': 'timestamp', 'title': '时间戳', cat: ['conversion'] }, { 'name': 'timestamp', 'title': '时间戳', cat: ['conversion'] },
{ 'name': 'qrCode', 'title': '二维码', cat: ['other'] }, { 'name': 'qrCode', 'title': '二维码', cat: ['other'] },
...@@ -39,7 +39,11 @@ const tool = [ ...@@ -39,7 +39,11 @@ const tool = [
{ 'name': 'decimalConvert', 'title': '进制转换', cat: ['conversion'] }, { 'name': 'decimalConvert', 'title': '进制转换', cat: ['conversion'] },
{ 'name': 'regex', 'title': '正则表达式', cat: ['other'] }, { 'name': 'regex', 'title': '正则表达式', cat: ['other'] },
{ 'name': 'randomString', 'title': '随机字符生成', cat: ['other'] }, { 'name': 'randomString', 'title': '随机字符生成', cat: ['other'] },
{ 'name': 'phpArraySerialize', 'title': 'PHP数组/序列化', cat: ['conversion','json'] }, {
'name': 'phpArraySerialize',
'title': 'PHP数组/序列化',
cat: ['conversion', 'json'],
},
{ 'name': 'diffs', 'title': '文本差异化对比', cat: ['other'] }, { 'name': 'diffs', 'title': '文本差异化对比', cat: ['other'] },
{ 'name': 'crontab', 'title': 'crontab校验', cat: ['other'] }, { 'name': 'crontab', 'title': 'crontab校验', cat: ['other'] },
{ 'name': 'websocket', 'title': 'websocket调试', cat: ['other'] }, { 'name': 'websocket', 'title': 'websocket调试', cat: ['other'] },
...@@ -49,7 +53,8 @@ const tool = [ ...@@ -49,7 +53,8 @@ const tool = [
// 徽章是否显示 // 徽章是否显示
const badgeIsShow = function () { const badgeIsShow = function () {
return (Date.parse((new Date()).toString()) / 1000) - env('updateTime') < BADGE_EXPIRY * 86400 return (Date.parse((new Date()).toString()) / 1000) - env('updateTime') <
BADGE_EXPIRY * 86400
} }
const getUserCommon = function () { const getUserCommon = function () {
...@@ -58,13 +63,23 @@ const getUserCommon = function () { ...@@ -58,13 +63,23 @@ const getUserCommon = function () {
} }
const setUserCommon = function (tools) { const setUserCommon = function (tools) {
cache.setnNoVersion('user_common', tools) cache.setNoVersion('user_common', tools)
}
const getToolTitle = function (name) {
for (let i = 0; i < tool.length; i++) {
if (tool[i].name === name) {
return tool[i].title
}
}
return ""
} }
export default { export default {
tool, tool,
category, category,
setUserCommon, setUserCommon,
getToolTitle,
getUserCommon, getUserCommon,
getToolByCategory (cat) { getToolByCategory (cat) {
return tool.filter((t) => { return tool.filter((t) => {
...@@ -79,5 +94,5 @@ export default { ...@@ -79,5 +94,5 @@ export default {
}, },
badgeCategoryIsShow (cat) { badgeCategoryIsShow (cat) {
return badgeIsShow() && inArray(cat, BADGE_CATEGORY) return badgeIsShow() && inArray(cat, BADGE_CATEGORY)
} },
} }
\ No newline at end of file
import config from './config' import config from './config'
import clipboard from './clipboard'
import setting from './setting'
import cache from './cache' import cache from './cache'
import history from './history.js' import history from './history.js'
import _ from "lodash";
let fixeInputData;
let toolCurrentFeature = "";
const model = { const model = {
getCategoryHistory() { getCategoryHistory () {
return cache.get('page_category_history', 'common') return cache.get('page_category_history', 'common')
}, },
setCategoryHistory(cat) { setCategoryHistory (cat) {
return cache.set('page_category_history', cat) return cache.set('page_category_history', cat)
}, },
getToolHistory(cat) { getToolHistory (cat) {
let all = cache.get('category_tool_history', {}) let all = cache.get('category_tool_history', {})
if (all[cat]) { if (all[cat]) {
return all[cat] return all[cat]
} }
return config.getToolByCategory(cat)[0]['name'] return config.getToolByCategory(cat)[0]['name']
}, },
setToolHistory(cat, name) { setToolHistory (cat, name) {
let all = cache.get('category_tool_history', {}) let all = cache.get('category_tool_history', {})
all[cat] = name all[cat] = name
return cache.set('category_tool_history', all) return cache.set('category_tool_history', all)
}, },
getCurrentTool() { getCurrentTool () {
return cache.get('current_tool', '') return cache.get('current_tool', '')
}, },
setCurrentTool(name) { setCurrentTool (name) {
return cache.set('current_tool', name) return cache.set('current_tool', name)
},
setFixeInputData: (value) => {
fixeInputData = value;
},
setToolCurrentFeature: (value) => {
toolCurrentFeature = value;
},
getToolCurrentFeature: (def = "") => {
let temp = toolCurrentFeature
toolCurrentFeature = "";
return temp ? temp : def
} }
} }
// 保存历史记录防抖 const clipboardPaste = function () {
let debounceSaveToolData = {}; document.querySelector(
const debounceSaveToolDataMethod = _.debounce(function () { '#clipboard').innerHTML = '<textarea id="clipboard-text"></textarea>'
return history(debounceSaveToolData['tool']).push(debounceSaveToolData['data']) document.querySelector('#clipboard-text').select()
}, 1000) document.execCommand('paste')
let r = document.querySelector('#clipboard-text').value ||
document.querySelector('#clipboard-text').innerHTML
const appendData = async function (field = "", check = "") { document.querySelector('#clipboard').innerHTML = ''
const result = (data = "") => { return r ? r : ''
if (data){
if (
!check
|| (_.isFunction(check) && check(data)) // 函数校验
){
return field ? {[field]: data} : data
}
}
return field ? {} : ""
}
return new Promise(async (resolve) => {
try {
// 使用固定输入数据
if (fixeInputData) {
return resolve(result(fixeInputData))
}
if (setting.autoReadCopy()) {
let paste = (await clipboard.paste()).trim()
if (paste) {
resolve(result(paste))
}
}
resolve(result())
} catch {
resolve(result())
}
});
} }
export const plugin = { export const plugin = {
install: function (Vue) { install: function (Vue) {
Vue.prototype.$initToolData = function (input = "", inputCheck = "", field = "current", isLoadHistory = true) { Vue.prototype.$getToolData = function (clipboardField = '') {
let current = _.cloneDeep(this[field]) let data = history(model.getCurrentTool()).current()
if (isLoadHistory) { let paste = clipboardPaste()
Object.assign(current, this.$getToolData()) if (clipboardField && !data[clipboardField] && paste) {
} data[clipboardField] = paste
if (!input) {
this[field] = current
return;
}
// 初始化默认值
if (!(input in current)){
current[input] = "";
}
// 保存默认值
let inputDefault = current[input]
current[input] = "";
appendData(input, inputCheck).then((append) => {
for (let key of Object.keys(append)) {
if ((key in current) && !current[key]) {
current[key] = append[key]
}
}
if (!current[input]){
// 使用默认值
current[input] = inputDefault
}
this[field] = current
})
}
Vue.prototype.$getToolData = function () {
return _.cloneDeep(history(model.getCurrentTool()).current())
}
Vue.prototype.$saveToolData = function (data, ignoreDebounce = false) {
if (ignoreDebounce) {
return history(model.getCurrentTool()).push(_.cloneDeep(data))
} }
debounceSaveToolData = {tool: model.getCurrentTool(), data: _.cloneDeep(data)} return data
debounceSaveToolDataMethod()
} }
Vue.prototype.$clipboardCopy = function (data, force = false) { Vue.prototype.$saveToolData = function (data) {
if ((setting.autoSaveCopy() || force) && data) { return history(model.getCurrentTool()).push(data)
clipboard.copy(data, () => {
this.$Message.success(this.$t('main_ui_copy_text_ok').toString())
})
}
} }
Vue.prototype.$clipboardCopyImages = function (data, force = false) { Vue.prototype.$clipboardCopy = function (data) {
if ((setting.autoSaveCopy() || force) && data) { if (!data) return
clipboard.copyImage(data, () => { document.querySelector(
this.$Message.success(this.$t('main_ui_copy_image_ok').toString()) '#clipboard').innerHTML = '<textarea id="clipboard-text"></textarea>'
}) document.querySelector('#clipboard-text').value = data
document.querySelector('#clipboard-text').select()
if (document.execCommand('copy')) {
this.$Message.success('结果已复制 ^o^')
} }
document.querySelector('#clipboard').innerHTML = ''
} }
}, },
} }
export default model export default model
\ No newline at end of file
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
this.current = Object.assign(this.current, this.$getToolData('content')) this.current = Object.assign(this.current, this.$getToolData('content'))
}, },
mounted(){ mounted(){
this.codemirror.setSize(null, 350) this.codemirror.setSize(null, window.innerHeight - 200)
}, },
computed: { computed: {
codemirror() { codemirror() {
......
...@@ -9,18 +9,6 @@ ...@@ -9,18 +9,6 @@
<FormItem> <FormItem>
<Button type="primary" @click="generate()">生成</Button> <Button type="primary" @click="generate()">生成</Button>
</FormItem> </FormItem>
<FormItem v-if="generateHistory.length() > 0">
<Dropdown placement="top-start" trigger="click" style="margin-left: 10px" @on-click="history">
<a href="javascript:void(0)">
历史记录
<Icon type="ios-arrow-down"></Icon>
</a>
<DropdownMenu slot="list">
<DropdownItem v-for="(v,i) in generateHistory.lists()" :key="i" :name="i">{{substr(v.input)}}</DropdownItem>
<DropdownItem divided name="clear">清空历史记录</DropdownItem>
</DropdownMenu>
</Dropdown>
</FormItem>
</option-block> </option-block>
</Col> </Col>
<Col span="10"> <Col span="10">
...@@ -53,57 +41,8 @@ ...@@ -53,57 +41,8 @@
<script> <script>
import generator from 'qrcode' import generator from 'qrcode'
import qrcodeParser from 'qrcode-parser' import qrcodeParser from 'qrcode-parser'
import cache from '../../tool/cache'
import { trim } from '../../helper' import { trim } from '../../helper'
const generateHistoryCacheName = 'qrCodeGenerateHistoryCacheName'
const generateHistoryMaxLength = 15
class generateHistory {
data = []
constructor () {
this.data = cache.get(generateHistoryCacheName, [])
}
find (value) {
for (let i = 0; i < this.data.length; i++) {
if (this.data[i].input === value.input && this.data[i].isShort === value.isShort) {
return true
}
}
return false
}
push (value) {
if (this.find(value)) {
return
}
if (this.data.length > generateHistoryMaxLength) {
this.data.pop()
}
this.data.push(value)
cache.set(generateHistoryCacheName, this.data, 86400)
}
getValue (index) {
return this.data[index]
}
lists () {
return this.data
}
length () {
return this.data.length
}
clear () {
this.data = []
cache.remove(generateHistoryCacheName)
}
}
export default { export default {
computed: { computed: {
readerInputImg () { readerInputImg () {
...@@ -114,27 +53,12 @@ ...@@ -114,27 +53,12 @@
}, },
}, },
created () { created () {
this.generateHistory = new generateHistory()
this.current = Object.assign(this.current, this.$getToolData()) this.current = Object.assign(this.current, this.$getToolData())
}, },
methods: { methods: {
history (index) { generate () {
if (index === 'clear') {
this.generateHistory.clear()
return
}
let history = this.generateHistory.getValue(index)
this.current.generateInput = history.input
this.generate(false)
},
generate (insertHistory = true) {
if (!this.current.generateInput) return if (!this.current.generateInput) return
this.generateHandle(this.current.generateInput) this.generateHandle(this.current.generateInput)
if (insertHistory) {
this.generateHistory.push({
input: this.current.generateInput
})
}
this.$saveToolData(this.current) this.$saveToolData(this.current)
}, },
reader () { reader () {
...@@ -173,7 +97,6 @@ ...@@ -173,7 +97,6 @@
}, },
data () { data () {
return { return {
generateHistory: {},
current: { current: {
generateInput: '', generateInput: '',
generateOutput: '', generateOutput: '',
......
<template> <template>
<div> <div>
<option-block style="text-align: center"> <option-block style="text-align: center">
<FormItem> <FormItem>
<RadioGroup v-model="type" type="button" button-style="solid"> <ButtonGroup>
<Radio :style="radioGroupStyle" :label="v.key" v-for="v in categories" :key="v.key">{{ v.name }} <Button :type="current.type === v.key ? 'success' : 'primary'"
</Radio> @click="handle(v.key)"
</RadioGroup> v-for="v in unitLists"
</FormItem> style="padding: 5px 10px 6px;"
</option-block> :key="v.key">{{v.name}}
<option-block style="text-align: center"> </Button>
<FormItem> </ButtonGroup>
<Input v-model="current.input" type="number"></Input> </FormItem>
</FormItem> </option-block>
<FormItem> <option-block style="text-align: center">
<Select v-model="current.from" style="width:200px"> <FormItem>
<template v-if="groups.length > 1"> <Input v-model="current.input" type="number"></Input>
<OptionGroup :label="group.name" v-for="group in groups" :key="group.key"> </FormItem>
<Option v-for="unit in group.list" :value="unit" :key="unit">{{ unitName(unit) }}</Option> <FormItem>
</OptionGroup> <Select v-model="current.from" style="width:200px">
</template> <template v-if="unitGroup[0].name !== ''">
<template v-else> <OptionGroup :label="group.name" v-for="(group,gk) in unitGroup" :key="gk">
<Option v-for="unit in groups[0].list" :value="unit" :key="unit">{{ unitName(unit) }}</Option> <Option v-for="(unit,k) in group.list" :value="unit" :key="k">{{ unitFormat(unit) }}</Option>
</template> </OptionGroup>
</Select> </template>
</FormItem> <template v-else>
<FormItem> <Option v-for="(unit,k) in unitGroup[0].list" :value="unit" :key="k">{{ unitFormat(unit) }}</Option>
<Button icon="md-code-working" @click="exchange()"></Button> </template>
</FormItem> </Select>
<FormItem> </FormItem>
<Select v-model="current.to" style="width:200px"> <FormItem>
<Option value="all">{{ $t('unit_all') }}</Option> <Button icon="md-code-working" @click="exchange()"></Button>
<template v-if="groups.length > 1"> </FormItem>
<OptionGroup :label="group.name" v-for="group in groups" :key="group.key"> <FormItem>
<Option v-for="unit in group.list" :value="unit" :key="unit">{{ unitName(unit) }}</Option> <Select v-model="current.to" style="width:200px">
</OptionGroup> <Option value="all">全部</Option>
</template> <template v-if="unitGroup[0].name !== ''">
<template v-else> <OptionGroup :label="group.name" v-for="(group,gk) in unitGroup" :key="gk">
<Option v-for="unit in groups[0].list" :value="unit" :key="unit">{{ unitName(unit) }}</Option> <Option v-for="(unit,k) in group.list" :value="unit" :key="k">{{ unitFormat(unit) }}</Option>
</template> </OptionGroup>
</Select> </template>
</FormItem> <template v-else>
</option-block> <Option v-for="(unit,k) in unitGroup[0].list" :value="unit" :key="k">
<div v-if="isShowResult" style="padding: 0 30px"> {{ unitFormat(unit) }}
<template v-if="assignResult !== null"> </Option>
<div style="text-align: center;margin-top: 30px;font-size: 18px;font-weight: bold"> </template>
<span style="color: red">{{ current.input }}</span> {{ unitName(current.from) }} = <span </Select>
style="color: red">{{ assignResult }}</span> </FormItem>
{{ unitName(current.to) }} </option-block>
</div> <div v-if="isShowResult" style="padding: 0 30px">
</template> <template v-if="current.to !== 'all' && assignResult">
<CellGroup v-if="current.to === 'all'"> <div style="text-align: center;margin-top: 30px;font-size: 18px;font-weight: bold">
<Row :gutter="16"> <span style="color: red">{{current.input}}</span> {{unitFormat(current.from)}} = <span style="color: red">{{assignResult.num}}</span>
<Col span="12" v-for="(result,unitKey) in output" :key="unitKey"> {{unitFormat(current.to)}}
<Cell :title="result" :extra="unitName(unitKey)"/>
</Col>
</Row>
</CellGroup>
</div> </div>
</template>
<CellGroup v-if="current.to === 'all'">
<Row :gutter="16">
<Col span="12" v-for="(item,k) in result" :key="k">
<Cell :title="item.num" :extra="unitFormat(item.unit)"/>
</Col>
</Row>
</CellGroup>
</div> </div>
</div>
</template> </template>
<script> <script>
import U from './library/unit' import U from './library/unit'
import {getCurrentLocale} from "../../i18n";
export default { export default {
created() { created () {
let history = this.$getToolData() let history = this.$getToolData()
this.type = this.current.type = history['type'] ? history['type'] : 'temperature' this.current.type = history['type'] ? history['type'] : 'temperature'
this.getToolData(this.type) this.getToolData()
},
computed: {
radioGroupStyle() {
return getCurrentLocale() === "en" ? "padding: 0 5px" : "padding: 0 10px";
},
categories() {
return U.CONFIG.map((category) => {
return {name: category.name, key: category.key}
})
},
groups() {
return U.getCategory(this.current.type).group
},
isShowResult() {
return this.current.from && this.current.type && this.current.input
}, },
output() { computed: {
let result = {} unitGroup () {
if (this.isShowResult) { return U.getData(this.current.type).group
this.saveToolData() },
for (let unit of U.getCategory(this.current.type).unit) { isShowResult () {
result[unit.key] = U.calculate( return this.current.from && this.current.type && this.current.input
this.current.type, },
this.current.input, result () {
this.current.from, let r = []
unit.key if (this.isShowResult) {
) this.saveToolData()
this.unitGroup.forEach((Group) => {
Group.list.forEach((unit) => {
let temp = U.calc(
this.current.type,
this.current.input,
this.current.from.split('_')[0],
unit.split('_')[0]
)
r.push({
unit: unit,
num: temp.num,
})
})
})
} }
} return r
return result },
}, assignResult () {
assignResult() { if (this.current.to === 'all') {
if (this.current.to !== 'all') { return {}
if (this.current.to in this.output) {
return this.output[this.current.to]
} }
let unit = this.current.to
for (let i = 0; i < this.result.length; i++) {
if (this.result[i].unit === unit) {
return this.result[i]
}
}
console.log(this.result)
console.log(unit)
console.error('无对应数据')
return null
} }
return null
}
},
watch:{
type(value){
this.handle(value)
}
},
methods: {
handle(v) {
this.getToolData(v)
}, },
saveToolData() { methods: {
let history = this.$getToolData() handle (v) {
history.type = this.current.type this.current.type = v
history.data = history.data ? history.data : {} this.getToolData()
history.data[history.type] = { },
from: this.current.from, saveToolData () {
to: this.current.to, let history = this.$getToolData()
input: this.current.input, history.type = this.current.type
history.data = history.data ? history.data : {}
history.data[history.type] = {
from: this.current.from,
to: this.current.to,
input: this.current.input,
}
this.$saveToolData(history)
},
getToolData () {
let type = this.current.type
let history = this.$getToolData()
let unitHistory = history['data'] && history['data'][type] ? history['data'][type] : null
this.current.from = unitHistory ? unitHistory.from : ''
this.current.to = unitHistory ? unitHistory.to : 'all'
this.current.input = unitHistory ? unitHistory.input : ''
},
unitFormat (unit) {
return unit.split('_').join('')
},
exchange () {
if (this.current.to === 'all') {
return
}
if (!this.current.from || !this.current.to) {
return
}
let temp = this.current.from
this.current.from = this.current.to
this.current.to = temp
} }
this.$saveToolData(history)
},
getToolData(type) {
let history = this.$getToolData()
let unitHistory = history['data'] && history['data'][type] ? history['data'][type] : null
this.current = Object.assign(this.current, {
from : unitHistory ? unitHistory.from : U.getCategory(type).main,
to : unitHistory ? unitHistory.to : 'all',
input : unitHistory ? unitHistory.input : '',
type : type
})
}, },
exchange() { data () {
if (this.current.to === 'all') { return {
return current: {
type: '',
from: '',
to: '',
input: '',
},
unitLists: U.list,
} }
if (!this.current.from || !this.current.to) {
return
}
[this.current.from, this.current.to] = [this.current.to, this.current.from]
}, },
unitName(unitKey) { }
let unit = U.getUnit(this.current.type, unitKey) </script>
return `${unit.name} (${unit['unit']})` \ No newline at end of file
}
},
data() {
return {
current: {
type: '',
from: '',
to: '',
input: '',
},
type:"",
}
},
}
</script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册