diff --git a/src/js/layer/index.js b/src/js/layer/index.js
index 161da7f..8200f33 100644
--- a/src/js/layer/index.js
+++ b/src/js/layer/index.js
@@ -58,11 +58,16 @@ const close = function(id) {
layerDom[id][1].classList.add('shift')
layerDom[id][0].style.opacity = ''
layerDom[id][1].style.opacity = 0
- setTimeout(_ => {
- document.body.removeChild(layerDom[id][0])
- delete layerDom[id]
- delete Anot.vmodels[id]
- }, 200)
+ setTimeout(
+ (_ => {
+ return function() {
+ document.body.removeChild(layerDom[_][0])
+ delete layerDom[_]
+ delete Anot.vmodels[_]
+ }
+ })(id),
+ 200
+ )
} catch (err) {}
}
document.body.style.overflow = ''
diff --git a/src/js/meditor/addon/attach.js b/src/js/meditor/addon/attach.js
index 85a8d82..3452141 100644
--- a/src/js/meditor/addon/attach.js
+++ b/src/js/meditor/addon/attach.js
@@ -209,7 +209,7 @@ const fixCont = function(vm, tool) {
- -
+
-
@@ -359,25 +359,32 @@ function showDialog(elem, vm, tool) {
attachAlt: '',
uploadQueue: [], //当前上传的列表
attachList: [], //附件管理列表
- switchTab: function(id) {
+ switchTab(id) {
this.tab = id
if (id === 3) {
this.attachList.clear()
- if (cache[tool].length) {
- this.attachList = cache[tool]
- } else {
- getAttach(vm, function(json) {
- if (json) {
- cache[tool] = json.data.list.map(function(it) {
- it.thumb =
- tool === 'image'
- ? ''
- : ''
- return it
+ if (vm.props.getAttachList) {
+ vm.props
+ .getAttachList(tool)
+ .then(list => {
+ list.forEach(it => {
+ let ext = it.name.slice(it.name.lastIndexOf('.'))
+ it.isImage = /^\.(jpg|jpeg|png|gif|bmp|webp|ico)$/.test(ext)
+ it.thumb = it.isImage
+ ? ``
+ : ``
})
- this.attachList = json.data.list
- }
- })
+ return list
+ })
+ .then(list => {
+ list = list.filter(it => {
+ if (tool === 'image') {
+ return it.isImage
+ }
+ return true
+ })
+ this.attachList = list
+ })
}
}
},
@@ -408,7 +415,6 @@ function showDialog(elem, vm, tool) {
vm.insert(val)
this.close()
},
-
content: fixCont(vm, tool)
})
}
diff --git a/src/js/meditor/addon/attach.scss b/src/js/meditor/addon/attach.scss
index d9fa3a3..a3b25c8 100644
--- a/src/js/meditor/addon/attach.scss
+++ b/src/js/meditor/addon/attach.scss
@@ -65,16 +65,16 @@
.red {color:#f30;}
}
-
-
+ .manager {overflow:hidden;overflow-y:auto;width:100%;height:255px;padding:10px;
- .manager {overflow:hidden;overflow-y:auto;width:100%;height:320px;padding:10px;}
- .manager .item {float:left;width:22%;height:130px;margin:10px 1.5%;padding:5px;}
- .manager .item:hover {background:#f7f7f7;}
- .manager .thumb {display:block;width:100%;height:100px;}
- .manager .name {overflow:hidden;height:20px;line-height:30px; text-align:center;}
- .manager img {width:100%;height:100%;}
- .manager .attach-icon {display:inline-block;width:100%;height:100px;text-align:center;font:50px/100px "ui font" !important;-webkit-font-smoothing: antialiased;-webkit-text-stroke-width: 0.2px;-moz-osx-font-smoothing: grayscale;}
+ .item {float:left;width:22%;height:130px;margin:10px 1.5%;padding:5px;
+ &:hover {background:#f7f7f7;}
+ }
+ .thumb {display:block;width:100%;height:100px;}
+ .name {overflow:hidden;height:20px;line-height:30px; text-align:center;}
+ img {width:100%;height:100%;}
+ em {line-height:100px;font-size:50px;}
+ }
}
}
\ No newline at end of file