Commit 1ee699f1 by chenwq

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

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