提交 66c5a482 编写于 作者: guofeng.chen's avatar guofeng.chen

修改头像加载错误

上级 f7eb70c9
<template> <template>
<div class="course-comment"> <div class="course-comment">
<div class="item" v-for="(item, index) in comments" :key="index"> <div class="item" v-for="(item, index) in comments" :key="index">
<img class="img" :src="item.imageUrl || 'https://file.yunqueyi.com/File/doctor_default.png'" alt="头像" /> <img class="img" :src="item.imageUrl || 'https://file.yunqueyi.com/File/doctor_default.png'" alt="头像" @error="onAvatarError" />
<div class="info-box"> <div class="info-box">
<div class="info-user"> <div class="info-user">
<div class="name">{{ item.doctorName }}</div> <div class="name">{{ item.doctorName }}</div>
...@@ -78,7 +78,7 @@ export default { ...@@ -78,7 +78,7 @@ export default {
item.cList = item.aList; item.cList = item.aList;
} }
this.comments.splice(index, 1, item); this.comments.splice(index, 1, item);
} },
} }
}; };
</script> </script>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="course-teacher-wrapper"> <div class="course-teacher-wrapper">
<div class="basic-title">讲师介绍</div> <div class="basic-title">讲师介绍</div>
<div class="leader-info" v-for="(item,index) in doctorList" :key="index"> <div class="leader-info" v-for="(item,index) in doctorList" :key="index">
<img :src="item.app_image_url" alt="头像" /> <img :src="item.app_image_url" alt="头像" @error="onAvatarError" />
<div class="leader-text"> <div class="leader-text">
<div class="leader-con"> <div class="leader-con">
<span>{{item.name}}</span> <span>{{item.name}}</span>
......
...@@ -81,9 +81,9 @@ export default { ...@@ -81,9 +81,9 @@ export default {
cover.style.height = '100%'; cover.style.height = '100%';
cover.style.background = `url(${coverImg}) no-repeat center center`; cover.style.background = `url(${coverImg}) no-repeat center center`;
cover.style.backgroundSize = '50px auto'; cover.style.backgroundSize = '50px auto';
cover.style.backgroundColor = 'rgba(255, 255, 255, .2)'; cover.style.backgroundColor = 'rgba(255, 255, 255, .8)';
cover.onclick = () => { cover.onclick = () => {
if (!this.$store.getter.logged) { if (!this.$store.getters.logged) {
this.$store.dispatch('goLogin'); this.$store.dispatch('goLogin');
return; return;
} }
......
...@@ -211,6 +211,8 @@ module.exports = { ...@@ -211,6 +211,8 @@ module.exports = {
} }
return null return null
}, },
onAvatarError(e) {
e.target.src = 'https://file.yunqueyi.com/File/doctor_default.png';
},
} }
} }
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册