Skip to content

Commit cabf5b8

Browse files
committed
add(view): 中文排版指北页面
1 parent 7659232 commit cabf5b8

File tree

3 files changed

+112
-1
lines changed

3 files changed

+112
-1
lines changed

admin/src/permission.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (store.getters.roles.length === 0 && sessionStorage.getItem('roles')) {
1717
// router.addRoutes(routeAdmin)
1818
// router.addRoutes(routeSuper)
1919

20-
const whiteList = ['/login', '/index', '/line', '/home', '/404', '/', '', '/md'] // 不重定向白名单
20+
const whiteList = ['/login', '/index', '/line', '/home', '/404', '/', '', '/md', 'out'] // 不重定向白名单
2121
router.beforeEach((to, from, next) => {
2222
NProgress.start()
2323
if (getToken()) {

admin/src/router/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const routeBase = [
2828
{ path: '/line', name: 'line', component: () => import('@/views/home/line'), hidden: true },
2929
{ path: '/home', component: () => import('@/views/home/home'), hidden: true },
3030
{ path: '/md', name: 'md', component: () => import('@/views/markdown/index'), hidden: true },
31+
{ path: '/out', name: 'out', component: () => import('@/views/home/out'), hidden: true },
3132
{ path: '/websocket', name: 'websocket', component: () => import('@/views/home/websocket'), hidden: true },
3233
{ path: '/echarts', name: 'echarts', component: () => import('@/views/echarts/index'), hidden: true },
3334
// { path: '/index', component: () => import('@/views/home/index'), hidden: true },

admin/src/views/home/out.vue

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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="11">
8+
<span>输入的内容</span>
9+
</el-col>
10+
<el-col :span="2">
11+
<span>&nbsp;</span>
12+
</el-col>
13+
<el-col :span="11">
14+
<span>输出的内容</span>
15+
</el-col>
16+
</el-form-item>
17+
<el-form-item label="" prop="input">
18+
<el-col :span="11">
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="onSubmit('form')">输出</el-button>
24+
<br><br><br>&nbsp;
25+
<el-button type="warning" @click="resetForm('form')">清空</el-button>
26+
</el-col>
27+
<el-col :span="11">
28+
<el-input v-model="output" :rows="20" type="textarea"/>
29+
</el-col>
30+
</el-form-item>
31+
<el-form-item>
32+
<el-col :span="10">&nbsp;</el-col>
33+
<el-col :span="14">&nbsp;</el-col>
34+
<el-col :span="0">&nbsp;</el-col>
35+
</el-form-item>
36+
</el-form>
37+
</div>
38+
</template>
39+
40+
<script>
41+
import request from '@/utils/request'
42+
43+
export default {
44+
name: 'Lines',
45+
data() {
46+
return {
47+
form: {
48+
input: '',
49+
output: ''
50+
},
51+
rules: {
52+
input: [
53+
{ required: true, message: '请输入内容', trigger: 'blur' }
54+
]
55+
},
56+
loading: false,
57+
isShow: false,
58+
output: ''
59+
}
60+
},
61+
created() {},
62+
methods: {
63+
onSubmit(form) {
64+
this.$refs[form].validate((valid) => {
65+
if (valid) {
66+
this.loading = true
67+
request.post('/api/output', { input: this.form.input }).then(res => {
68+
// this.loading = false
69+
// console.log(res.data)
70+
if (res.data.to) {
71+
this.to = res.data.to
72+
}
73+
this.output = res.data.output
74+
}).catch(err => {
75+
return err
76+
// console.log(err)
77+
})
78+
setTimeout(() => {
79+
this.loading = false
80+
}, 500)
81+
} else {
82+
// this.$message('error submit!')
83+
// console.log('error submit!!')
84+
return false
85+
}
86+
})
87+
},
88+
onCancel() {
89+
this.$message({
90+
message: 'cancel!',
91+
type: 'warning'
92+
})
93+
},
94+
resetForm(formName) {
95+
this.$refs[formName].resetFields()
96+
}
97+
}
98+
}
99+
</script>
100+
101+
<style scoped>
102+
.el-input {
103+
width: 97%;
104+
margin-bottom: 3%;
105+
}
106+
107+
.input-with-select .el-input-group__prepend {
108+
background-color: #fff;
109+
}
110+
</style>

0 commit comments

Comments
 (0)