fix: 修复loading图片地址异常问题

This commit is contained in:
小莫唐尼 2024-07-15 18:40:27 +08:00
parent da141ae10a
commit 62992b2688
2 changed files with 209 additions and 208 deletions

View File

@ -2,10 +2,10 @@
* markdown配置
*/
import {
getAppConfigs
} from '@/config/index.js'
import {getAppConfigs} from '@/config/index.js'
import HaloTokenConfig from '@/config/token.config.js'
import utils from '@/utils/index.js'
export default {
domain: HaloTokenConfig.BASE_API,
tagStyle: {
@ -95,6 +95,6 @@ export default {
},
containStyle: 'font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;padding:12px;font-size: 14px;color: #606266;word-spacing: 0.8px;letter-spacing: 0.8px;border-radius: 6px;background-color:#FFFFFF;',
loadingGif: getAppConfigs().imagesConfig.loadingGifUrl,
emptyGif: getAppConfigs().imagesConfig.loadingEmptyUrl,
loadingGif: utils.checkImageUrl(getAppConfigs().imagesConfig.loadingGifUrl),
emptyGif: utils.checkImageUrl(getAppConfigs().imagesConfig.loadingEmptyUrl),
}

View File

@ -16,8 +16,9 @@
</template>
<script>
import imageCache from '@/utils/imageCache.js';
export default {
import imageCache from '@/utils/imageCache.js';
export default {
name: 'cache-image',
props: {
url: {
@ -30,7 +31,7 @@
},
loadStyle: {
type: Object,
default () {
default() {
return {
backgroundColor: '#ffffff',
color: '#333'
@ -39,7 +40,7 @@
},
loadErrStyle: {
type: Object,
default () {
default() {
return {
color: 'rgba(244, 67, 54,1)'
// backgroundColor: 'rgba(244, 67, 54,0.2)'
@ -64,7 +65,7 @@
},
styles: {
type: Object,
default () {
default() {
return {};
}
},
@ -96,10 +97,10 @@
return this.$tm.vx.getters().getConfigs.imagesConfig
},
loadingImgSrc() {
return this.imagesConfig.loadingGifUrl;
return this.$utils.checkImageUrl(this.imagesConfig.loadingGifUrl);
},
loadingErrorImageSrc() {
return this.imagesConfig.loadingErrUrl
return this.$utils.checkImageUrl(this.imagesConfig.loadingErrUrl)
}
},
watch: {
@ -142,50 +143,50 @@
this.loadStatus = 'error';
}
}
};
};
</script>
<style scoped lang="scss">
.cache-image-wrap {
.cache-image-wrap {
width: 100%;
height: 100%;
}
}
.img-loading,
.img-error {
.img-loading,
.img-error {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
background-color: #f2f2f2;
}
}
.img-load-icon {
.img-load-icon {
font-size: 36rpx;
animation: xhRote 0.8s infinite linear;
}
}
.img-load-text {
.img-load-text {
font-size: 28rpx;
margin-top: 8rpx;
color: inherit;
}
}
.img-error {
.img-error {
font-size: 28rpx;
&-img {
width: 100%;
border-radius: 12rpx;
}
}
}
.img-err-icon {
.img-err-icon {
font-size: 36rpx;
}
}
@keyframes xhRote {
@keyframes xhRote {
0% {
transform: rotate(0deg);
}
@ -193,5 +194,5 @@
100% {
transform: rotate(360deg);
}
}
}
</style>