Commit 1ee699f1 by chenwq

feat: 添加视频播放控制,优化媒体展示样式

1 parent bb2f7fe0
......@@ -73,6 +73,13 @@ function getActionLink(action) {
};
}
function maskPhone(phone) {
if (!phone)
return "-";
const str = String(phone);
return str.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
}
export function getBasicRows(info = {}) {
const basicInfo = info.basicInfo || {};
return [
......@@ -88,7 +95,7 @@ export function getCustomerRows(info = {}) {
return [
{ label: "所属门店", value: getValue(customerInfo.storeName) },
{ label: "客户名称", value: getValue(customerInfo.customerName) },
{ label: "客户手机号", value: getValue(customerInfo.customerPhone) },
{ label: "客户手机号", value: maskPhone(customerInfo.customerPhone) },
];
}
......
......@@ -87,7 +87,8 @@
<video v-else
class="message-video"
controls
:src="media.url">
:src="media.url"
@play="handleVideoPlay">
</video>
<div v-if="media.name"
class="media-name"
......@@ -180,6 +181,15 @@ export default {
},
methods: {
pauseOtherVideos(videos, currentVideo) {
if (!videos || !videos.length)
return;
videos.forEach((video) => {
if (video && video !== currentVideo && !video.paused) {
video.pause();
}
});
},
initInfo() {
const snapshotInfo = this.detailInfo && this.detailInfo.snapshotInfo;
if (!snapshotInfo) {
......@@ -194,6 +204,11 @@ export default {
.filter(item => item.type === "image")
.map(item => item.url);
},
handleVideoPlay(event) {
const wrapper = this.$el && this.$el.querySelector(".strategy-detail-dialog");
const videos = wrapper ? wrapper.querySelectorAll("video") : [];
this.pauseOtherVideos(Array.prototype.slice.call(videos), event.target);
},
handleDetailConfirm() {
this.$emit("handleDetailConfirm");
},
......@@ -211,7 +226,9 @@ export default {
padding-right: 6px;
color: #303133;
font-size: 13px;
[class^="el-icon-"] {
color: #ffffff;
}
.detail-section {
margin-bottom: 18px;
......@@ -292,17 +309,17 @@ export default {
}
.message-media-item {
width: 240px;
width: 180px;
}
.message-image,
.message-video {
width: 240px;
height: 180px;
width: 180px;
height: 120px;
border-radius: 4px;
background: #fff;
border: 1px solid #ebeef5;
object-fit: cover;
object-fit: contain;
display: block;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!