Skip to content

Commit 39b70ed

Browse files
authored
Merge pull request #7 from lisgroup/develop
Merge Banch Develop
2 parents 5e809c1 + cebe515 commit 39b70ed

36 files changed

+620
-272
lines changed

admin/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
"lint": "eslint --ext .js,.vue src",
1313
"build": "vue-cli-service build && npm run move && npm run git",
1414
"move": "rm -rf ../laravel/public/static && cp -r dist/* ../laravel/public",
15-
"git": "git add ../laravel/public/static/* && git add ../laravel/public/index.html && git commit -m \"chore(view): 构建前端\"",
15+
"git": "git add ../laravel/public/static/* && git add ../laravel/public/index.html && git commit -m \"chore(view): Build front end\"",
1616
"test:unit": "jest --clearCache && vue-cli-service test:unit",
1717
"test:ci": "npm run lint && npm run test:unit",
1818
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
1919
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -w -r 0"
2020
},
2121
"dependencies": {
22-
"axios": "^0.19.2",
22+
"axios": ">=0.21.1",
2323
"echarts": "^4.8.0",
2424
"element-ui": "2.7.2",
2525
"js-cookie": "2.2.0",
2626
"layui-src": "^2.5.5",
27-
"mavon-editor": "^2.9.0",
27+
"mavon-editor": "^2.9.1",
2828
"normalize.css": "7.0.0",
2929
"nprogress": "0.2.0",
3030
"path-to-regexp": "2.4.0",

admin/src/components/common/navBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<el-col :xs="6" :sm="6" :md="4" :lg="4" :xl="4">
1313
<div class="grid-content">
1414
<el-menu-item index="1">
15-
<router-link :to="{name: 'md'}">Markdown</router-link>
15+
<router-link :to="{name: 'tool'}">在线工具</router-link>
1616
</el-menu-item>
1717
</div>
1818
</el-col>

admin/src/permission.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import getPageTitle from '@/utils/get-page-title'
99
NProgress.configure({ showSpinner: false }) // NProgress Configuration
1010

1111
// 不重定向白名单
12-
const whiteList = ['/login', '/index', '/bus', '/line', '/home', '/404', '/', '', '/echarts', '/md', '/out', '/excel', '/upload']
12+
const whiteList = ['/login', '/index', '/bus', '/tool', '/line', '/home', '/404', '/', '', '/echarts', '/md', '/out', '/excel', '/upload']
1313
router.beforeEach(async(to, from, next) => {
1414
// start progress bar
1515
NProgress.start()

admin/src/router/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,9 @@ export const asyncRoutes = [...routeAdmin, ...routeSuper, ...routeTest]
212212

213213
// 基础路由
214214
const routeBase = [
215-
{ path: '/', name: 'bus', component: () => import('@/views/home/index'), hidden: true },
215+
{ path: '/', name: 'index', component: () => import('@/views/home/index'), hidden: true },
216216
{ path: '/bus', name: 'bus', component: () => import('@/views/home/index'), hidden: true },
217+
{ path: '/tool', name: 'tool', component: () => import('@/views/home/tool'), hidden: true },
217218
{ path: '/line', name: 'line', component: () => import('@/views/home/line'), hidden: true },
218219
{ path: '/home', component: () => import('@/views/home/home'), hidden: true },
219220
{ path: '/md', name: 'md', component: () => import('@/views/markdown/index'), hidden: true },

admin/src/views/home/tool.vue

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
<template>
2+
<div>
3+
<nav-bar />
4+
5+
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
6+
<el-form-item label="" prop="description">
7+
<el-col :span="10">
8+
<span>输入的内容</span>
9+
</el-col>
10+
<el-col :span="2">
11+
<span>&nbsp;</span>
12+
</el-col>
13+
<el-col :span="10">
14+
<span>输出的内容</span>
15+
</el-col>
16+
</el-form-item>
17+
<el-form-item label="" prop="input">
18+
<el-col :span="10">
19+
<el-input v-model="form.input" :rows="20" type="textarea" />
20+
</el-col>
21+
<el-col :span="2">
22+
<span>&nbsp;在线工具输出</span><br><br>&nbsp;
23+
<el-button type="primary" @click="copyInput">复制输入</el-button>
24+
<br><br>&nbsp;
25+
<el-button type="primary" @click="copyOutput">复制输出</el-button>
26+
<br><br>&nbsp;
27+
<el-button type="warning" @click="resetForm('form')">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</el-button>
28+
</el-col>
29+
<el-col :span="11">
30+
<el-input v-model="output" :rows="20" type="textarea" />
31+
</el-col>
32+
</el-form-item>
33+
<el-form-item>
34+
<el-col :span="10">&nbsp;</el-col>
35+
<el-col :span="14">&nbsp;</el-col>
36+
<el-col :span="0">&nbsp;</el-col>
37+
</el-form-item>
38+
</el-form>
39+
<el-row>
40+
<el-col :span="4">&nbsp;</el-col>
41+
<el-col :span="2">
42+
<el-button @click="onSubmit('form', 'hex_to_string')">16进制转中文</el-button>
43+
</el-col>
44+
<el-col :span="2">
45+
<el-button @click="onSubmit('form', 'string_to_hex')">中文转16进制</el-button>
46+
</el-col>
47+
<el-col :span="2">
48+
<el-button @click="onSubmit('form', 'openid_secret')">OpenId转秘钥</el-button>
49+
</el-col>
50+
<el-col :span="2">
51+
<el-button @click="onSubmit('form', 'base64_encode')">Base64 Encode</el-button>
52+
</el-col>
53+
<el-col :span="2">
54+
<el-button @click="onSubmit('form', 'base64_decode')">Base64 Decode</el-button>
55+
</el-col>
56+
<el-col :span="2">
57+
<el-button @click="onSubmit('form', 'url_encode')">Url Encode</el-button>
58+
</el-col>
59+
<el-col :span="2">
60+
<el-button @click="onSubmit('form', 'url_decode')">Url Decode</el-button>
61+
</el-col>
62+
</el-row>
63+
<Footer />
64+
</div>
65+
</template>
66+
67+
<script>
68+
import request from '@/utils/request'
69+
import { Footer } from '../../layout/components'
70+
71+
export default {
72+
name: 'Lines',
73+
components: {
74+
Footer
75+
},
76+
data() {
77+
return {
78+
form: {
79+
input: '',
80+
output: ''
81+
},
82+
convert: '',
83+
rules: {
84+
input: [
85+
{ required: true, message: '请输入内容', trigger: 'blur' }
86+
]
87+
},
88+
loading: false,
89+
isShow: false,
90+
output: ''
91+
}
92+
},
93+
created() {},
94+
methods: {
95+
copyInput() {
96+
const that = this
97+
that.$copyText(this.form.input).then(function(e) {
98+
that.$message({
99+
message: '输入内容复制成功',
100+
type: 'success'
101+
})
102+
}, function(e) {
103+
this.$message({
104+
message: '复制失败',
105+
type: 'error'
106+
})
107+
console.log(e)
108+
})
109+
},
110+
copyOutput() {
111+
const that = this
112+
this.$copyText(this.output).then(function(e) {
113+
that.$message({
114+
message: '输出内容复制成功',
115+
type: 'success'
116+
})
117+
// console.log(e)
118+
}, function(e) {
119+
this.$message({
120+
message: '复制失败',
121+
type: 'error'
122+
})
123+
console.log(e)
124+
})
125+
},
126+
onSubmit(form, func) {
127+
this.$refs[form].validate((valid) => {
128+
if (valid) {
129+
this.loading = true
130+
const uri = '/api/tool'
131+
request.post(uri, { operation: func, input: this.form.input }).then(res => {
132+
// this.loading = false
133+
// console.log(res.data)
134+
if (res.data.to) {
135+
this.to = res.data.to
136+
}
137+
this.output = res.data.output
138+
}).catch(err => {
139+
return err
140+
// console.log(err)
141+
})
142+
setTimeout(() => {
143+
this.loading = false
144+
}, 500)
145+
} else {
146+
// this.$message('error submit!')
147+
// console.log('error submit!!')
148+
return false
149+
}
150+
})
151+
this.convert = ''
152+
},
153+
onCancel() {
154+
this.$message({
155+
message: 'cancel!',
156+
type: 'warning'
157+
})
158+
},
159+
resetForm(formName) {
160+
this.$refs[formName].resetFields()
161+
}
162+
}
163+
}
164+
</script>
165+
166+
<style scoped>
167+
.el-input {
168+
width: 97%;
169+
margin-bottom: 3%;
170+
}
171+
172+
.input-with-select .el-input-group__prepend {
173+
background-color: #fff;
174+
}
175+
</style>

laravel/app/Helper/functions.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,55 @@ function isName($name)
8383
return preg_match('/^[\x{2E80}-\x{FE4F}]{2,16}$/u', $name);
8484
}
8585
}
86+
87+
/**
88+
* 下划线转驼峰
89+
* @param $str
90+
* @return string|string[]|null
91+
*/
92+
function convertUnderline($str)
93+
{
94+
$str = preg_replace_callback('/([-_]+([a-z]{1}))/i', function($matches) {
95+
return strtoupper($matches[2]);
96+
}, $str);
97+
return $str;
98+
}
99+
100+
/**
101+
* 驼峰转下划线
102+
* @param $str
103+
* @return string|string[]|null
104+
*/
105+
function humpToLine($str)
106+
{
107+
$str = preg_replace_callback('/([A-Z]{1})/', function($matches) {
108+
return '_'.strtolower($matches[0]);
109+
}, $str);
110+
return $str;
111+
}
112+
113+
/**
114+
* 加密算法: AES/ECB/PKCS5Padding
115+
* @param $aesKey
116+
* @param $data
117+
* @param string $iv
118+
* @return string
119+
*/
120+
function aesEncrypt($aesKey, $data, $iv = '')
121+
{
122+
$encrypted = openssl_encrypt($data, 'aes-128-ecb', $aesKey, OPENSSL_RAW_DATA, $iv);
123+
return base64_encode($encrypted);
124+
}
125+
126+
/**
127+
* 解密算法: AES/ECB/PKCS5Padding
128+
* @param $aesKey
129+
* @param $data
130+
* @param string $iv
131+
* @return false|string
132+
*/
133+
function aesDecrypt($aesKey, $data, $iv = '')
134+
{
135+
$encrypted = base64_decode($data);
136+
return openssl_decrypt($encrypted, 'aes-128-ecb', $aesKey, OPENSSL_RAW_DATA, $iv);
137+
}

0 commit comments

Comments
 (0)