diff --git a/src/pages/config/pages/linkManage/linkType/firstLink.vue b/src/pages/config/pages/linkManage/linkType/firstLink.vue index 025c33e0d..04cf53df1 100644 --- a/src/pages/config/pages/linkManage/linkType/firstLink.vue +++ b/src/pages/config/pages/linkManage/linkType/firstLink.vue @@ -127,7 +127,6 @@ class="upload-demo" :action="uploadUrl" :show-file-list="false" - :limit="1" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload" > @@ -331,11 +330,11 @@ export default { const index = file.name.lastIndexOf('.') const ext = file.name.substr(index + 1) const isJPG = (file.type === 'image/jpeg' || file.type === 'image/png'); - const isType = (ext === 'jpeg' || ext === 'jpg' || ext === 'png') + const isType = (ext === 'jpg' || ext === 'png') const isLt2M = file.size / 1024 / 1024 < 2; if (!isJPG || !isType) { - this.$message.error('上传头像图片只能是 .jpg、.jpeg、.png 格式!'); + this.$message.error('上传头像图片只能是 .jpg、.png 格式!'); } if (!isLt2M) { this.$message.error('上传头像图片大小不能超过 2MB!'); @@ -445,12 +444,16 @@ export default { _this: this, loading: 'Loading' }, res => { + this.Loading = true this.linkList = res.data res.data.forEach(item => { if (item.type === 1) { this.linkListFirst.push(item) } }) + if (this.linkListFirst.length === 0) { + this.Loading = false + } this.linkListFirst.forEach(item => { if (item.icon !== '') { let imgId = { @@ -466,6 +469,7 @@ export default { ) item.icon = src }) + this.Loading = false } }) this.initSortable() diff --git a/src/pages/config/pages/linkManage/linkType/secondLink.vue b/src/pages/config/pages/linkManage/linkType/secondLink.vue index b785a6b94..f5c67b7fb 100644 --- a/src/pages/config/pages/linkManage/linkType/secondLink.vue +++ b/src/pages/config/pages/linkManage/linkType/secondLink.vue @@ -127,7 +127,6 @@ class="avatar-uploader" :action="uploadUrl" :show-file-list="false" - :limit="1" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload"> @@ -443,12 +442,16 @@ export default { _this: this, loading: 'Loading' }, res => { + this.Loading = true this.linkList = res.data res.data.forEach(item => { if (item.type === 2) { this.linkListSecond.push(item) } }) + if (this.linkListSecond.length === 0) { + this.Loading = false + } this.linkListSecond.forEach(item => { if (item.icon !== '') { let imgId = { @@ -456,16 +459,15 @@ export default { } // 图片转base64 getImg(imgId).then(res => { - if (res.ok) { - const src = - "data:image/png;base64," + - btoa( - new Uint8Array(res).reduce( - (data, byte) => data + String.fromCharCode(byte), "") - ) - item.icon = src - } + const src = + "data:image/png;base64," + + btoa( + new Uint8Array(res).reduce( + (data, byte) => data + String.fromCharCode(byte), "") + ) + item.icon = src }) + this.Loading = false } }) this.initSortable()