This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

优化表单组件的样式;编辑器支持afterUpload回调;

old
宇天 2018-07-01 00:08:48 +08:00
parent 565db7ee12
commit 9318415454
2 changed files with 36 additions and 17 deletions

View File

@ -54,10 +54,10 @@
} }
.do-radio {position:relative;display:inline-block;width:auto;height:30px;padding:0 10px;line-height:30px;text-align:center;cursor:default;font-size:14px; .do-radio {position:relative;display:inline-block;width:auto;height:30px;padding-right:10px;line-height:30px;text-align:center;cursor:default;font-size:14px;
&__box {float:left;width:20px;height:20px;margin:5px;border:1px solid nth($cgr, 1);border-radius:50%;} &__box {float:left;width:20px;height:20px;margin:5px;margin-left:0;border:1px solid nth($cgr, 1);border-radius:50%;}
&.checked &__box::after {display:block;width:14px;height:14px;margin:2px;border-radius:50%;content:""} &.checked &__box::after {display:block;width:14px;height:14px;margin:2px;border-radius:50%;content:""}
&.teal &__box {border-color:nth($ct, 1); &.teal &__box {border-color:nth($ct, 1);
@ -115,7 +115,7 @@
.do-switch {position:relative;display:inline-block;width:40px;height:30px;cursor:default; .do-switch {position:relative;display:inline-block;width:50px;height:30px;padding-right:10px;cursor:default;
&__label {position:relative;display:inline-block;width:100%;height:16px;margin:7px 0;background:nth($cp, 3);border-radius:12px;} &__label {position:relative;display:inline-block;width:100%;height:16px;margin:7px 0;background:nth($cp, 3);border-radius:12px;}
@ -164,10 +164,10 @@
} }
.do-checkbox {position:relative;display:inline-block;width:auto;height:30px;padding:0 10px;line-height:30px;text-align:center;cursor:default;font-size:14px; .do-checkbox {position:relative;display:inline-block;width:auto;height:30px;padding-right:10px;line-height:30px;text-align:center;cursor:default;font-size:14px;
&__box {float:left;width:20px;height:20px;margin:5px;line-height:18px;border:1px solid nth($cgr, 1);border-radius:3px;font-size:18px;text-align:center; &__box {float:left;width:20px;height:20px;margin:5px;margin-right:0;line-height:18px;border:1px solid nth($cgr, 1);border-radius:3px;font-size:18px;text-align:center;
} }
&.checked &__box {color:#fff;font-weight:bold;} &.checked &__box {color:#fff;font-weight:bold;}

View File

@ -194,11 +194,15 @@ function uploadFile(vm, tool) {
this.uploadQueue[idx].progress = val + '%' this.uploadQueue[idx].progress = val + '%'
}) })
.then(res => { .then(res => {
return res.data if (vm.props.afterUpload) {
return vm.props.afterUpload(res)
} else {
return res.data.url
}
}) })
}) })
.then(data => { .then(url => {
this.uploadQueue[idx].url = data.url this.uploadQueue[idx].url = url
}) })
.catch(err => { .catch(err => {
Anot.error(err) Anot.error(err)
@ -209,10 +213,14 @@ function uploadFile(vm, tool) {
this.uploadQueue[idx].progress = val + '%' this.uploadQueue[idx].progress = val + '%'
}) })
.then(res => { .then(res => {
return res.data if (vm.props.afterUpload) {
return vm.props.afterUpload(res)
} else {
return res.data.url
}
}) })
.then(data => { .then(url => {
this.uploadQueue[idx].url = data.url this.uploadQueue[idx].url = url
}) })
.catch(err => { .catch(err => {
Anot.error(err) Anot.error(err)
@ -234,19 +242,30 @@ function uploadScreenshot(vm, blob) {
return Promise.reject('something wrong with beforeUpload') return Promise.reject('something wrong with beforeUpload')
} }
return upload.then(res => { return upload.then(res => {
return res.data if (vm.props.afterUpload) {
return vm.props.afterUpload(res)
} else {
return res.data.url
}
}) })
}) })
.then(data => { .then(url => {
vm.insert(`![截图](${data.url})`) vm.insert(`![截图](${url})`)
})
.catch(err => {
Anot.error(err)
}) })
} else { } else {
upload upload
.then(res => { .then(res => {
return res.data if (vm.props.afterUpload) {
return vm.props.afterUpload(res)
} else {
return res.data.url
}
}) })
.then(data => { .then(url => {
vm.insert(`![截图](${data.url})`) vm.insert(`![截图](${url})`)
}) })
} }
} }