提交 a669a11f 编写于 作者: B baiy 提交者: ninecents

添加uuid生成工具 #37

上级 c444b73c
......@@ -35,6 +35,7 @@
"serialize-php": "^1.1.2",
"sm-crypto": "^0.1.4",
"system": "^2.0.1",
"uuid": "^8.3.2",
"view-design": "^4.3.2",
"vue": "^2.6.12",
"vue-codemirror": "^4.0.6",
......@@ -11533,6 +11534,15 @@
"request": "^2.34"
}
},
"node_modules/request/node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true,
"bin": {
"uuid": "bin/uuid"
}
},
"node_modules/require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
......@@ -12349,6 +12359,15 @@
"node": ">=0.8.0"
}
},
"node_modules/sockjs/node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true,
"bin": {
"uuid": "bin/uuid"
}
},
"node_modules/sort-keys": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz",
......@@ -13907,12 +13926,11 @@
}
},
"node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true,
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "bin/uuid"
"uuid": "dist/bin/uuid"
}
},
"node_modules/v-click-outside-x": {
......@@ -14764,6 +14782,15 @@
"node": ">= 6"
}
},
"node_modules/webpack-log/node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true,
"bin": {
"uuid": "bin/uuid"
}
},
"node_modules/webpack-merge": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz",
......@@ -24613,6 +24640,14 @@
"tough-cookie": "~2.5.0",
"tunnel-agent": "^0.6.0",
"uuid": "^3.3.2"
},
"dependencies": {
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
}
}
},
"request-promise-core": {
......@@ -25299,6 +25334,14 @@
"faye-websocket": "^0.10.0",
"uuid": "^3.4.0",
"websocket-driver": "0.6.5"
},
"dependencies": {
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
}
}
},
"sockjs-client": {
......@@ -26631,10 +26674,9 @@
"dev": true
},
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
},
"v-click-outside-x": {
"version": "3.7.1",
......@@ -27309,6 +27351,14 @@
"requires": {
"ansi-colors": "^3.0.0",
"uuid": "^3.3.2"
},
"dependencies": {
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
}
}
},
"webpack-merge": {
......@@ -85,6 +85,10 @@ const routes = [
{
path: '/tool/json',
component: r => require(['./views/tool/json.vue'], r)
},
{
path: '/tool/uuid',
component: r => require(['./views/tool/uuid.vue'], r)
}
]
......
......@@ -6,9 +6,9 @@ export const TOOL_DATA_EXPIRY = 3600 * 24
// 徽章过期时间(天)
export const BADGE_EXPIRY = 10
// 分类徽章
export const BADGE_CATEGORY = []
export const BADGE_CATEGORY = ['serialize','other']
// 工具徽章
export const BADGE_TOOL = []
export const BADGE_TOOL = ['uuid','serializeConversion']
// 默认常用工具
export const DEFAULT_COMMON_TOOL = [
'hash', 'encrypt', 'json', 'base64', 'url', 'timestamp',
......@@ -45,6 +45,7 @@ const tool = [
{'name': 'websocket', 'title': 'websocket调试', 'cat': ['other']},
{'name': 'unit', 'title': '单位换算', 'cat': ['other']},
{'name': 'time', 'title': '时间计算器', 'cat': ['other']},
{'name': 'uuid', 'title': 'UUID生成', 'cat': ['other']},
]
// 徽章是否显示
......
<template>
<div>
<option-block>
<FormItem>
<Input v-model="current.amount">
<div slot="prepend" style="width: 70px">生成数量</div>
</Input>
</FormItem>
<FormItem>
<Input v-model="current.delimiter">
<div slot="prepend" style="width: 70px">分隔符</div>
</Input>
</FormItem>
<FormItem>
<Checkbox v-model="current.filterLine">过滤中划线(-)</Checkbox>
</FormItem>
<FormItem>
<Checkbox v-model="current.isUpper">大写字母</Checkbox>
</FormItem>
<FormItem>
<Checkbox v-model="current.isAddQuote">添加引号</Checkbox>
</FormItem>
<FormItem>
<Checkbox v-model="current.uint8Array">Uint8 Array</Checkbox>
</FormItem>
<FormItem>
<Button type="primary" @click="handle()">生成</Button>
</FormItem>
</option-block>
<Input v-model="current.output" :rows="12" type="textarea" placeholder="结果"></Input>
</div>
</template>
<script>
import {v4 as uuidV4,parse as uuidParse} from 'uuid';
export default {
created() {
this.current = Object.assign(this.current, this.$getToolData())
},
methods: {
handle() {
let result = [];
for (let i = 0, l = this.current.amount; i < l; i++) {
result.push(this.current.isAddQuote ? '"' + this.generate() + '"' : this.generate());
}
this.current.output = result.join(this.current.delimiter.replace(/\\n/g, "\n"));
this.$saveToolData(this.current);
},
generate() {
let uuid = uuidV4()
if(this.current.uint8Array){
return "["+uuidParse(uuid).toString()+"]"
}
if (this.current.filterLine) {
uuid = uuid.replace(/-/g, "")
}
uuid = this.current.isUpper ? uuid.toUpperCase() : uuid.toLowerCase()
return uuid;
}
},
data() {
return {
current: {
amount: 10,
delimiter: ",\\n",
filterLine: false,
isAddQuote: false,
isUpper: false,
uint8Array: false,
output: ""
}
}
},
}
</script>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册