From 9318415454d50f4b827ba997f3fbb7264637e648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Sun, 1 Jul 2018 00:08:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A1=A8=E5=8D=95=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E6=A0=B7=E5=BC=8F;=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E6=94=AF=E6=8C=81afterUpload=E5=9B=9E=E8=B0=83;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/form/style.scss | 10 ++++---- src/js/meditor/addon/attach.js | 43 ++++++++++++++++++++++++---------- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/src/js/form/style.scss b/src/js/form/style.scss index 6908667..c53dc7d 100644 --- a/src/js/form/style.scss +++ b/src/js/form/style.scss @@ -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:""} &.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;} @@ -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;} diff --git a/src/js/meditor/addon/attach.js b/src/js/meditor/addon/attach.js index d9ffd80..b4935e8 100644 --- a/src/js/meditor/addon/attach.js +++ b/src/js/meditor/addon/attach.js @@ -194,11 +194,15 @@ function uploadFile(vm, tool) { this.uploadQueue[idx].progress = val + '%' }) .then(res => { - return res.data + if (vm.props.afterUpload) { + return vm.props.afterUpload(res) + } else { + return res.data.url + } }) }) - .then(data => { - this.uploadQueue[idx].url = data.url + .then(url => { + this.uploadQueue[idx].url = url }) .catch(err => { Anot.error(err) @@ -209,10 +213,14 @@ function uploadFile(vm, tool) { this.uploadQueue[idx].progress = val + '%' }) .then(res => { - return res.data + if (vm.props.afterUpload) { + return vm.props.afterUpload(res) + } else { + return res.data.url + } }) - .then(data => { - this.uploadQueue[idx].url = data.url + .then(url => { + this.uploadQueue[idx].url = url }) .catch(err => { Anot.error(err) @@ -234,19 +242,30 @@ function uploadScreenshot(vm, blob) { return Promise.reject('something wrong with beforeUpload') } return upload.then(res => { - return res.data + if (vm.props.afterUpload) { + return vm.props.afterUpload(res) + } else { + return res.data.url + } }) }) - .then(data => { - vm.insert(`![截图](${data.url})`) + .then(url => { + vm.insert(`![截图](${url})`) + }) + .catch(err => { + Anot.error(err) }) } else { upload .then(res => { - return res.data + if (vm.props.afterUpload) { + return vm.props.afterUpload(res) + } else { + return res.data.url + } }) - .then(data => { - vm.insert(`![截图](${data.url})`) + .then(url => { + vm.insert(`![截图](${url})`) }) } }