Commit 8a4f9fc0 authored by levante's avatar levante

finish all features

parent 0d965ac4
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
'path', 'path',
{ {
validateTrigger: 'blur', validateTrigger: 'blur',
rules: [{ required: true, message: '请填写此项!' }] rules: [{validator: pathValidate}]
} }
]" ]"
/> />
...@@ -239,6 +239,19 @@ export default { ...@@ -239,6 +239,19 @@ export default {
this.getBusinessOptions() this.getBusinessOptions()
}, },
methods: { methods: {
pathValidate(t, value, callback) {
console.log(t, value, callback)
if (!value || value == undefined) {
callback('请填写此项')
} else {
if (!value.startsWith('/')) {
callback('请输入正确的路径!')
} else{
callback()
}
}
},
onEdit(id) { onEdit(id) {
this.rowLoop = [{ this.rowLoop = [{
name: '', name: '',
......
...@@ -171,8 +171,8 @@ ...@@ -171,8 +171,8 @@
'callBackPath', 'callBackPath',
{ {
validateTrigger: 'blur', validateTrigger: 'blur',
rules: [{ required: true, message: '请填写此项!' }] rules: [{validator: pathValidate}]
} },
]" ]"
/> />
</a-form-item> </a-form-item>
...@@ -290,6 +290,19 @@ export default { ...@@ -290,6 +290,19 @@ export default {
this.getBusinessOptions() this.getBusinessOptions()
}, },
methods: { methods: {
pathValidate(t, value, callback) {
console.log(t, value, callback)
if (!value || value == undefined) {
callback('请填写此项')
} else {
if (!value.startsWith('/')) {
callback('请输入正确的路径!')
} else{
callback()
}
}
},
cancelModal() { cancelModal() {
this.form.resetFields() this.form.resetFields()
this.current = 0 this.current = 0
...@@ -419,7 +432,6 @@ export default { ...@@ -419,7 +432,6 @@ export default {
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
if (!err) { if (!err) {
let formContent = this.form.getFieldsValue() let formContent = this.form.getFieldsValue()
// console.log(formContent)
let paramsJson = [] let paramsJson = []
let finalParse = {} let finalParse = {}
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
</a-form-item> </a-form-item>
<a-form-item label="系统地址" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> <a-form-item label="系统地址" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input v-decorator="['url', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}, {validator: formatValidate}]}]" /> <a-input v-decorator="['url', {validateTrigger:'blur', rules: [{validator: urlValidate}]}]" />
</a-form-item> </a-form-item>
</div> </div>
<div v-show="current == 1"> <div v-show="current == 1">
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</a-form-item> </a-form-item>
<a-form-item label="授权路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> <a-form-item label="授权路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input v-decorator="['authPath', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}]}]" /> <a-input v-decorator="['authPath', {validateTrigger:'blur', rules: [{required: true, message: '请填写此项!'}, {validator: pathValidate}]}]" />
</a-form-item> </a-form-item>
<a-form-item label="授权方法" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> <a-form-item label="授权方法" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
...@@ -210,12 +210,36 @@ export default { ...@@ -210,12 +210,36 @@ export default {
this.getList() this.getList()
}, },
methods: { methods: {
formatValidate(type, value, callback) { urlValidate(type, value, callback) {
console.log(type, value)
const filter = /^[A-Za-z]:[\w]+$/i const regex = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/|www\.)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/
if(!filter.test(value)){
callback('请输入正确的路径!') if (!value || value == undefined) {
callback('请填写此项')
} else {
if (!regex.test(value)) {
callback('请输入正确的地址!')
} else{
callback()
}
}
// if(!value.startsWith('/')) {
// callback('请输入正确的路径!')
// }
},
pathValidate(t, value, callback) {
console.log(t, value, callback)
if (!value || value == undefined) {
callback('请填写此项')
} else {
if (!value.startsWith('/')) {
callback('请输入正确的路径!')
} else{
callback()
}
} }
}, },
cancelModal() { cancelModal() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment