提交 0bb31b84 编写于 作者: B baiy 提交者: ninecents

update package

上级 8011e959
此差异已折叠。
{
"name": "c-tool",
"version": "1.9.1",
"version": "1.0.1",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --port 8081",
"build": "vue-cli-service build",
"report": "vue-cli-service build --report",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@babel/parser": "^7.16.2",
"@prettier/plugin-php": "^0.17.6",
"@typescript-eslint/typescript-estree": "^5.3.0",
"angular-html-parser": "^1.8.0",
"axios": "^0.21.4",
"ajax-request": "^1.2.3",
"babel-runtime": "^6.26.0",
"bignumber.js": "^9.0.1",
"code-formatter": "0.0.1",
"codemirror": "^5.63.3",
"codemirror-graphql": "^1.1.0",
"cron-parser": "^2.16.3",
"cronstrue": "^1.122.0",
"cron-parser": "^2.15.0",
"cronstrue": "^1.94.0",
"crypto-js": "^3.3.0",
"diff-match-patch": "^1.0.5",
"file": "^0.2.2",
"graphql": "15.5.0",
"diff": "^4.0.2",
"ipinyinjs": "^1.0.0",
"jian_fan": "^1.0.3",
"jimp": "^0.16.1",
"js-base64": "^2.6.4",
"js-htmlencode": "^0.3.0",
"js-yaml": "^3.14.1",
"jsbarcode": "^3.11.5",
"json-to-properties": "^1.1.3",
"json5": "^2.2.0",
"jsonlint": "^1.6.3",
"jsrsasign": "^10.4.1",
"jsrsasign-util": "^1.0.5",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"mime-types": "^2.1.33",
"moment": "^2.29.1",
"php-array-reader": "^1.3.2",
"is-url": "^1.2.4",
"iview": "^3.5.4",
"js-base64": "^2.6.2",
"lscache": "^1.3.0",
"moment": "^2.27.0",
"php-array-reader": "^1.2.0",
"phparr": "^0.2.0",
"postcss": "^8.3.11",
"postcss-less": "^5.0.0",
"postcss-scss": "^4.0.2",
"prettier": "^2.4.1",
"prettier-plugin-sql": "^0.3.0",
"properties-to-json": "^0.1.7",
"qrcode": "^1.4.4",
"qrcode-parser": "^1.2.0",
"query-string": "^6.14.1",
"query-string": "^6.13.1",
"radix.js": "0.0.1",
"serialize-php": "^1.1.2",
"sm-crypto": "^0.1.4",
"system": "^2.0.1",
"typescript": "^4.4.4",
"uglify-js": "3.14.3",
"uuid": "^8.3.2",
"view-design": "^4.6.1",
"vue": "^2.6.14",
"vue-i18n": "^8.26.7",
"vue-router": "^3.5.3",
"x2js": "github:abdolence/x2js",
"xml-formatter": "^2.5.1"
"vue": "^2.6.11",
"vue-prismjs": "^1.2.0",
"vue-router": "^3.3.4"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.12.1",
......@@ -72,11 +39,8 @@
"babel-eslint": "^10.1.0",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.2.3",
"less": "^2.7.3",
"less-loader": "^5.0.0",
"utools-api-types": "^2.3.0",
"vue-cli-plugin-iview": "^1.0.6",
"vue-template-compiler": "^2.6.14"
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
......@@ -99,9 +63,6 @@
},
"parserOptions": {
"parser": "babel-eslint"
},
"globals": {
"__": "writable"
}
},
"postcss": {
......
<template>
<div>
<Tabs v-model="current.operation">
<TabPane :label="$t('qrCode_generate_title')" name="generate">
<Row :gutter="16">
<Col span="14">
<Input v-model="current.generateInput" :rows="14" type="textarea" :placeholder="$t('qrCode_generate_input')"></Input>
</Col>
<Col span="10" style="text-align: center;">
<img v-if="generateOutput" @click="()=>$clipboardCopyImages(generateOutput)" style="width:300px;cursor:pointer" :src="generateOutput" />
</Col>
</Row>
</TabPane>
<TabPane :label="$t('qrCode_reader_title')" name="reader">
<Row :gutter="16">
<Col span="14">
<input-block style="margin-bottom: 10px" bottom="0px" right="10px">
<pasteClipboardFlie @on-paste-image="handleUpload">
<Input v-model="current.readerInput" :rows="3" type="textarea" :placeholder="$t('qrCode_reader_input')"></Input>
</pasteClipboardFlie>
<Upload slot="extra" action="#" :before-upload="handleUpload">
<Button size="small" type="primary" icon="ios-cloud-upload-outline">{{ $t('qrCode_reader_upload') }}</Button>
</Upload>
</input-block>
<Input v-model="readerOutput" :rows="8" type="textarea" :placeholder="$t('qrCode_reader_output')"></Input>
</Col>
<Col span="10" style="text-align: center" v-html="readerInputImg" />
</Row>
</TabPane>
</Tabs>
</div>
<div>
<Tabs v-model="current.operation">
<TabPane label="二维码生成" name="generate">
<Row :gutter="16">
<Col span="14">
<Input v-model="current.generateInput" :rows="14" type="textarea" placeholder="内容"></Input>
<option-block>
<FormItem>
<Button type="primary" @click="generate()">生成</Button>
</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>
<FormItem>
<Checkbox v-model="current.generateIsShort">生成短连接</Checkbox>
</FormItem>
<FormItem v-if="current.generateIsShort">
<Alert>短链接API由 t.cn 提供</Alert>
</FormItem>
</option-block>
</Col>
<Col span="10">
<div style="text-align: center" v-html="current.generateOutput"></div>
<p style="text-align: center" v-if="current.generateIsShort && current.generateShortUrl">
短连接:{{current.generateShortUrl}}</p>
</Col>
</Row>
</TabPane>
<TabPane label="二维码解析" name="reader">
<Row :gutter="16">
<Col span="14">
<Input v-model="current.readerInput" :rows="5" type="textarea" placeholder="请输入二维码图片地址或点击下方按钮上传图片"></Input>
<option-block>
<FormItem>
<Button type="primary" @click="reader()">解析</Button>
</FormItem>
<FormItem>
<Upload action="#" :before-upload="handleUpload">
<Button icon="ios-cloud-upload-outline">上传图片</Button>
</Upload>
</FormItem>
</option-block>
<Input v-model="current.readerOutput" :rows="5" type="textarea" placeholder="解析结果"></Input>
</Col>
<Col span="10" style="text-align: center" v-html="readerInputImg"></Col>
</Row>
</TabPane>
</Tabs>
</div>
</template>
<script>
import generator from 'qrcode'
import qrcodeParser from 'qrcode-parser'
import model from '../../tool/model'
import Jimp from 'jimp';
import pasteClipboardFlie from './components/pasteClipboardFlie';
import generator from 'qrcode'
import qrcodeParser from 'qrcode-parser'
import request from 'ajax-request'
import cache from '../../tool/cache'
import isUrl from 'is-url'
import { trim } from '../../helper'
const generateHistoryCacheName = 'qrCodeGenerateHistoryCacheName'
const generateHistoryMaxLength = 15
class generateHistory {
data = []
export default {
components: {
pasteClipboardFlie,
},
computed: {
readerInputImg() {
if (this.current.readerInput) {
return `<img style="width:300px" src="${this.current.readerInput}" />`
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 ''
return false
}
},
watch: {
"current.generateInput"() {
this.generate()
},
"current.readerInput"() {
this.reader()
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)
}
},
created() {
let feature = model.getToolCurrentFeature('generate')
if (feature === 'generate') {
this.current.operation = feature;
this.$initToolData('generateInput')
} else if (feature === 'reader') {
this.current.operation = feature;
this.$initToolData('readerInput')
} else {
this.$initToolData()
getValue (index) {
return this.data[index]
}
},
methods: {
generate() {
if (!this.current.generateInput) {
this.generateOutput = "";
return;
}
generator.toDataURL(this.current.generateInput, (error, url) => {
if (error) {
this.generateOutput = this.$t("qrCode_generate_error", [error]);
return;
}
this.generateOutput = url
this.$saveToolData(this.current)
})
lists () {
return this.data
}
length () {
return this.data.length
}
clear () {
this.data = []
cache.remove(generateHistoryCacheName)
}
}
export default {
computed: {
readerInputImg () {
if (this.current.readerInput) {
return `<img style="width:300px" src="${this.current.readerInput}" />`
}
return ''
},
},
reader() {
if (!this.current.readerInput) {
this.readerOutput = "";
return
}
this.getReaderImagePngBase64(this.current.readerInput).then((result) => {
this.readerOutput = result
this.$saveToolData(this.current)
}).catch(e => {
this.readerOutput = this.$t('qrCode_reader_error', [e.message])
})
created () {
this.generateHistory = new generateHistory()
this.current = Object.assign(this.current, this.$getToolData())
},
getReaderImagePngBase64(input) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open('GET', input);
xhr.responseType = 'blob';
xhr.onload = () => {
if (xhr.status >= 200 && xhr.status < 300) {
let blob = xhr.response;
const myReader = new FileReader();
myReader.readAsArrayBuffer(blob);
myReader.addEventListener('loadend', e => {
const buffer = e.target.result;
try {
Jimp.read(buffer, (err, image) => {
if (err) {
return reject(err);
}
image.getBase64Async("image/png").then((img) => {
return qrcodeParser(img)
}).then((c) => {
resolve(c.data)
}).catch((e) => {
reject(e);
})
});
} catch (e) {
reject(e);
}
});
} else {
reject(new Error(this.$t('qrCode_reader_parsing_failure').toString()));
methods: {
history (index) {
if (index === 'clear') {
this.generateHistory.clear()
return
}
let history = this.generateHistory.getValue(index)
this.current.generateInput = history.input
this.current.generateIsShort = history.isShort
this.generate(false)
},
generate (insertHistory = true) {
if (!this.current.generateInput) return
if (this.current.generateIsShort) {
if (!isUrl(this.current.generateInput)) {
return this.$Message.error('生成短连接的内容是url')
}
};
xhr.onerror = () => reject(new Error(this.$t('qrCode_reader_parsing_failure').toString()));
xhr.send();
})
request({
url: 'http://api.t.sina.com.cn/short_url/shorten.json',
data: { 'source': '2815391962', 'url_long': this.current.generateInput },
}, (err, res, result) => {
if (err) return this.$Message.error('二维码短连接生成错误:' + err)
result = JSON.parse(result)
if (!result[0]['url_short']) {
return this.$Message.error('短连接生成错误')
} else {
this.current.generateShortUrl = result[0]['url_short']
this.generateHandle(this.current.generateShortUrl)
}
})
} else {
this.current.generateShortUrl = ''
this.generateHandle(this.current.generateInput)
}
if (insertHistory) {
this.generateHistory.push({
input: this.current.generateInput,
isShort: this.current.generateIsShort,
})
}
this.$saveToolData(this.current)
},
reader () {
if (!this.current.readerInput) {
return
}
qrcodeParser(this.current.readerInput).then((c) => {
this.current.readerOutput = c.data
this.$saveToolData(this.current)
this.$Message.success('解析成功')
}).catch(() => {
return this.$Message.error('图片解析错误')
})
},
generateHandle (str) {
generator.toDataURL(str, (error, url) => {
if (error) return this.$Message.error('二维码生成错误:' + error)
this.$Message.success('生成成功')
this.current.generateOutput = `<img style="width:300px" src="${url}" />`
})
},
handleUpload (file) {
let r = new FileReader()
r.readAsDataURL(file)
r.onloadend = () => {
this.current.readerInput = r.result
this.reader()
}
return false
},
substr (str) {
str = trim(str.replace(/[\r\n]/g, ''))
const strLength = 100
return str.length > strLength ? str.substr(0, strLength) + '...' : str
},
},
handleUpload(file) {
if (this.current.operation !== "reader"){
return;
}
let r = new FileReader()
r.readAsDataURL(file)
r.onloadend = () => {
this.current.readerInput = r.result
data () {
return {
generateHistory: {},
current: {
generateInput: '',
generateOutput: '',
generateIsShort: false,
generateShortUrl: '',
readerInput: '',
readerOutput: '',
operation: 'generate',
},
}
return false
}
},
data() {
return {
readerOutput: "",
generateOutput: "",
current: {
generateInput: '',
readerInput: '',
operation: 'generate',
},
}
},
}
</script>
},
}
</script>
\ No newline at end of file
<template>
<div>
<Tabs name="default">
<TabPane :label="$t('time_diff_tool')" name="default">
<option-block>
<FormItem>
<DatePicker transfer v-model="current.poor.input1" :options="options" type="datetime"
format="yyyy-MM-dd HH:mm:ss"></DatePicker>
</FormItem>
<FormItem>
{{ $t('time_and') }}
</FormItem>
<FormItem>
<DatePicker transfer v-model="current.poor.input2" :options="options" type="datetime"
format="yyyy-MM-dd HH:mm:ss"></DatePicker>
</FormItem>
<FormItem>
{{ $t('time_diff') }}
</FormItem>
<FormItem>
<Input v-model="poor">
<Select transfer v-model="current.poor.unit" slot="append" style="width: 80px">
<Option v-for="v in poorUnit" :value="v.v" :key="v.v">{{ v.n }}</Option>
</Select>
</Input>
</FormItem>
</option-block>
</TabPane>
</Tabs>
<div>
<Tabs name="default">
<TabPane label="差值计算器" name="default">
<option-block>
<FormItem>
<DatePicker transfer v-model="current.poor.input1" :options="options" type="datetime"
format="yyyy-MM-dd HH:mm:ss"></DatePicker>
</FormItem>
<FormItem>
</FormItem>
<FormItem>
<DatePicker transfer v-model="current.poor.input2" :options="options" type="datetime"
format="yyyy-MM-dd HH:mm:ss"></DatePicker>
</FormItem>
<FormItem>
相差
</FormItem>
<FormItem>
<Input v-model="poor">
<Select transfer v-model="current.poor.unit" slot="append" style="width: 60px">
<Option v-for="v in poorUnit" :value="v.v" :key="v.v">{{v.n}}</Option>
</Select>
</Input>
</FormItem>
</option-block>
</TabPane>
</Tabs>
<Tabs name="default">
<TabPane :label="$t('time_operation')" name="default">
<option-block>
<FormItem>
<DatePicker transfer v-model="current.duration.input" :options="options" type="datetime"
format="yyyy-MM-dd HH:mm:ss"></DatePicker>
</FormItem>
<FormItem>
<Select transfer v-model="current.duration.type" style="width: 100px">
<Option value="+">{{ $t('time_add') }}</Option>
<Option value="-">{{ $t('time_reduce') }}</Option>
</Select>
</FormItem>
<FormItem>
<Input v-model="current.duration.length" type="number" number>
<Select transfer v-model="current.duration.unit" slot="append" style="width: 80px">
<Option v-for="v in poorUnit" :value="v.v" :key="v.v">{{ v.n }}</Option>
</Select>
</Input>
</FormItem>
<FormItem>
{{ $t('time_after')}}, {{ $t('time_is') }} <strong>{{ duration }}</strong>
</FormItem>
</option-block>
</TabPane>
</Tabs>
</div>
<Tabs name="default">
<TabPane label="时间操作" name="default">
<option-block>
<FormItem>
<DatePicker transfer v-model="current.duration.input" :options="options" type="datetime"
format="yyyy-MM-dd HH:mm:ss"></DatePicker>
</FormItem>
<FormItem>
<Select transfer v-model="current.duration.type" style="width: 60px">
<Option value="+">添加</Option>
<Option value="-">减少</Option>
</Select>
</FormItem>
<FormItem>
<Input v-model="current.duration.length" type="number" number>
<Select transfer v-model="current.duration.unit" slot="append" style="width: 60px">
<Option v-for="v in poorUnit" :value="v.v" :key="v.v">{{v.n}}</Option>
</Select>
</Input>
</FormItem>
<FormItem>
后, 为 <strong>{{duration}}</strong>
</FormItem>
</option-block>
</TabPane>
</Tabs>
</div>
</template>
<script>
import moment from 'moment'
import moment from 'moment'
export default {
created() {
this.$initToolData()
},
computed: {
poor() {
let a = moment(this.current.poor.input1)
let b = moment(this.current.poor.input2)
this.$saveToolData(this.current)
return b.diff(a, this.current.poor.unit)
export default {
created () {
this.current = Object.assign(this.current, this.$getToolData())
},
duration() {
if (!this.current.duration.length){
return "";
}
let rate = this.getRate(this.current.duration.unit)
let result;
if (rate === 0) {
if (!Number.isInteger(this.current.duration.length)){
return this.$t('time_error',[this.$t('time_error_duration_length')])
}
computed: {
poor () {
let a = moment(this.current.poor.input1)
let b = moment(this.current.poor.input2)
this.$saveToolData(this.current)
return b.diff(a, this.current.poor.unit)
},
duration () {
this.$saveToolData(this.current)
const type = this.current.duration.type === '+' ? 'add' : 'subtract'
result = moment(this.current.duration.input)[type](this.current.duration.length, this.current.duration.unit)
} else {
result = moment(
moment(this.current.duration.input).unix() * 1000
+ (rate * this.current.duration.length) * (this.current.duration.type === '+' ? 1 : -1)
)
}
this.$saveToolData(this.current)
return result.format('YYYY-MM-DD HH:mm:ss');
return moment(this.current.duration.input)[type](this.current.duration.length, this.current.duration.unit).
format('YYYY-MM-DD HH:mm:ss')
},
},
},
methods: {
getRate(unit) {
for (let item of this.poorUnit) {
if (item.v === unit) {
return parseInt(item.rate)
}
}
return 0;
}
},
data() {
return {
options: {
shortcuts: [
{
text: this.$t('time_current_time'),
value() {
return moment().toDate()
data () {
return {
options: {
shortcuts: [
{
text: '当前时间',
value () {
return moment().toDate()
},
},
},
{
text: this.$t('time_current_date'),
value() {
return moment(moment().format('YYYY-MM-DD')).toDate()
{
text: '当前日期',
value () {
return moment(moment().format('YYYY-MM-DD')).toDate()
},
},
},
{
text: this.$t('time_current_month_date'),
value() {
return moment(moment().format('YYYY-MM-01')).toDate()
{
text: '当月日期',
value () {
return moment(moment().format('YYYY-MM-01')).toDate()
},
},
},
{
text: this.$t('time_current_year_date'),
value() {
return moment(moment().format('YYYY-01-01')).toDate()
{
text: '当年日期',
value () {
return moment(moment().format('YYYY-01-01')).toDate()
},
},
},
],
},
poorUnit: [
{v: 'years', n: this.$t('time_year'), rate: 0},
{v: 'months', n: this.$t('time_month'), rate: 0},
{v: 'weeks', n: this.$t('time_week'), rate: 1000 * 60 * 60 * 24 * 7},
{v: 'days', n: this.$t('time_day'), rate: 1000 * 60 * 60 * 24},
{v: 'hours', n: this.$t('time_hour'), rate: 1000 * 60 * 60},
{v: 'minutes', n: this.$t('time_minute'), rate: 1000 * 60},
{v: 'seconds', n: this.$t('time_second'), rate: 1000},
],
current: {
poor: {
input1: moment(moment().format('YYYY-MM-DD')).toDate(),
input2: moment(moment().format('YYYY-MM-DD')).add(1, 'd').toDate(),
unit: 'seconds',
],
},
duration: {
input: moment(moment().format('YYYY-MM-DD')).toDate(),
unit: 'days',
type: '+',
length: 1,
poorUnit: [
{ v: 'years', n: '' },
{ v: 'months', n: '' },
{ v: 'weeks', n: '' },
{ v: 'days', n: '' },
{ v: 'hours', n: '小时' },
{ v: 'minutes', n: '分钟' },
{ v: 'seconds', n: '' },
],
current: {
poor: {
input1: moment(moment().format('YYYY-MM-DD')).toDate(),
input2: moment(moment().format('YYYY-MM-DD')).add(1, 'd').toDate(),
unit: 'seconds',
},
duration: {
input: moment(moment().format('YYYY-MM-DD')).toDate(),
unit: 'days',
type: '+',
length: 1,
},
},
},
}
},
}
</script>
}
},
}
</script>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册