Commit 1a3d134d by xuyl

更新直播间页面代码

1 parent e6281a9c
...@@ -32,4 +32,16 @@ const LiveRoomDetailApi = params => { ...@@ -32,4 +32,16 @@ const LiveRoomDetailApi = params => {
sign: true, sign: true,
}) })
} }
export default { getListApi, addOrUpdataLiveRoomApi, LiveRoomDetailApi } // 删除直播间
const deleteLiveRoomApi = params => {
params.method = `${defaultPath}delete`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getListApi, addOrUpdataLiveRoomApi, LiveRoomDetailApi,deleteLiveRoomApi }
<template>
<div class="live-main">
<div class="container">
<div class="look-container">
<div class="look-left">
<div class="look-left-b"></div>
<div class="look-left-content">
<div class="look-title">{{ room.name }}</div>
<div class="look-desc">开播时间:{{ room.startTimeStr }}</div>
<div class="look-desc">房间号:{{ room.id }}</div>
<div class="look-status">直播已结束{{ room.name }}</div>
</div>
</div>
<div class="look-right">
<div class="look-item">
<div class="look-item-icon"><img src="@/assets/look.png" alt="" /></div>
<div class="look-item-text">观看</div>
<div class="look-item-num">{{ room.totalVisitCnt }}</div>
</div>
<div class="look-item">
<div class="look-item-icon"><img src="@/assets/online.png" alt="" /></div>
<div class="look-item-text">在线</div>
<div class="look-item-num">{{ room.totalOnlineCnt }}</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="container-header">基本信息</div>
<div class="data-container">
<div class="data-container-left">
<div class="data-title">
<img src="@/assets/eyes.png" alt="" />
<span>观看数据</span>
</div>
<div class="data-desc">
<span>峰值在线人数</span>
<span>{{ base.visitPeakOnlineValue }}</span>
</div>
<div class="data-desc">
<span>观看人数</span>
<span>{{ base.visitNumberOfPeople }}</span>
</div>
<div class="data-desc data-desc-jump">
<span>观看次数</span>
<span>
{{ base.visitNumberOfTimes }}
<a @click="handleLook">查看</a>
</span>
</div>
<div class="data-desc">
<span>平均观看时长</span>
<span>{{ base.visitAverageTime }}</span>
</div>
</div>
<div class="data-container-right">
<div class="data-title">
<img src="@/assets/message.png" alt="" />
<span>互动数据</span>
</div>
<div class="data-desc">
<span>评论人数</span>
<span>{{ base.interactNumberOfPeople }}</span>
</div>
<div class="data-desc">
<span>评论次数</span>
<span>{{ base.interactNumberOfTimes }}</span>
</div>
</div>
</div>
</div>
<div class="container">
<div class="container-header">流量数据</div>
<!-- 表格区域 开始 -->
<div class="container-tabel">
<div class="live-table-header">
<h2>数据列表</h2>
<el-button :size="size" type="primary" class="el-icon-plus" @click="detailexport">导出</el-button>
</div>
<GLTable ref="classifyRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="1"></GLTableButton>
</div>
</GLTable>
</div>
</div>
<GLDialog width="1158px" bigTitle="提示" :hasFooter="false" :visible.sync="dialogVisible" mode="big">
<record ref="recordForm"></record>
</GLDialog>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import record from './components/record.vue'
export default {
name: 'LiveIndex',
components: {
record
},
data() {
return {
dialogVisible: false,
dialogObj: {
show: false
},
size: 'small',
url: url,
base: {},
room: {},
searchForm: {
term: '',
status: ''
},
// 表格
getListApi: this.$apis.live.getListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '访问来源',
prop: 'visitSource'
},
{
label: '观看直播总数',
prop: 'totalVisitCnt'
},
{
label: '平均停留时长',
prop: 'averageStayTime'
}
]
},
tableButtonList: [
{
type: 'el-button',
name: '详情',
attrs: {
type: 'text'
},
condition: row => {
return row.status == 0
},
listeners: {
click: row => {
this.$apis.live.LiveRoomDetailApi({ id: row.id }).then(res => {
console.log(JSON.parse(JSON.stringify(res)))
this.liveDetail = res
this.pageClick()
})
}
}
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
}
},
mounted() {},
methods: {
detailexport() {
this.$apis.console.detailexport({}).then(res => {
downloadUrl(res)
})
},
pageClick() {
this.$router.push('/shortVideo/uploadVideo')
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.classifyRef.data.length ? (this.$refs.classifyRef.tableHeightValues = '') : this.$refs.classifyRef.setTableHeightFun()
},
handleSearch() {
this.$refs.classifyRef.refreshTable()
},
handleReset() {
this.searchForm = {
classifyName: '',
createDate: []
}
this.handleSearch()
}
}
}
</script>
<style lang="scss" scoped>
@mixin title() {
font-weight: 600;
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
}
@mixin text() {
font-size: 14px;
color: #666666;
}
.live-main {
.container {
margin-bottom: 16px;
background: #fff;
}
.container-tabel {
padding: 20px;
}
.container-header {
height: 58px;
line-height: 58px;
border-bottom: 1px solid #e5e5e5;
padding-left: 20px;
}
.look-container {
display: flex;
justify-content: space-between;
padding: 20px 120px 20px 20px;
align-items: center;
.look-left {
display: flex;
.look-left-b {
width: 260px;
height: 170px;
}
.look-left-content {
margin-left: 20px;
.look-title {
@include title();
margin-bottom: 8px;
}
.look-desc {
@include text();
line-height: 20px;
}
.look-status {
margin-top: 20px;
display: inline-block;
background: #eeedff;
border-radius: 4px;
font-size: 14px;
color: #5850ff;
padding: 4px 10px;
}
}
}
.look-right {
display: flex;
.look-item {
text-align: center;
margin-left: 20px;
&-icon {
width: 40px;
height: 40px;
}
&-text {
@include text();
line-height: 24px;
}
&-num {
font-weight: 600;
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
}
}
}
}
.data-container {
padding: 20px 40px;
display: flex;
&-left {
margin-right: 100px;
}
.data-title {
@include title();
font-size: 14px;
line-height: 24px;
transform: translateX(-20px);
display: flex;
align-items: center;
img {
width: 16px;
height: 16px;
margin-right: 5px;
}
}
.data-desc {
display: flex;
justify-content: space-between;
width: 200px;
line-height: 24px;
@include text();
&.data-desc-jump {
width: 238px;
a {
color: #5850ff;
font-size: 14px;
margin-left: 4px;
cursor: pointer;
}
}
span {
&:last-child {
@include title();
}
}
}
}
}
.live-table-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
h2 {
font-weight: 600;
font-size: 16px;
color: #333333;
}
}
</style>
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="baseInfoContainer" v-if="false"> <div class="baseInfoContainer" v-if="activePage =='1'">
<div class="baseTitle">基本信息</div> <div class="baseTitle">基本信息</div>
<div class="baseFrame"> <div class="baseFrame">
<el-form :model="baseForm" :rules="baseRules" ref="baseForm" label-width="100px"> <el-form :model="baseForm" :rules="baseRules" ref="baseForm" label-width="100px">
...@@ -25,35 +25,41 @@ ...@@ -25,35 +25,41 @@
</el-form-item> </el-form-item>
<el-form-item label="开播时间" prop="timeStr"> <el-form-item label="开播时间" prop="timeStr">
<el-date-picker <el-date-picker
required type="datetimerange"
v-model="baseForm.timeStr" v-model="baseForm.timeStr"
type="daterange" required
value-format="“yyyy-MM-dd”"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期"> end-placeholder="结束日期"
</el-date-picker> value-format="yyyy-MM-dd HH:mm:ss"
:default-time="['00:00:00', '23:59:59']"
popper-class="pickerWrapZ1"
></el-date-picker>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</div> </div>
<div class="configContainer" v-if="activePage =='1'">
<div class="configContainer" v-if="activePage =='2'">
<div class="baseInfo baseSpace"> <div class="baseInfo baseSpace">
<div class="baseTitle"> <div class="baseTitle">
基本信息 基本信息
</div> </div>
<div class="spaceFrame paddingSpace"> <div class="spaceFrame paddingSpace">
<div class="displayImage"> <div class="displayImage">
<template v-if="hasShowTime"> <i v-show="liveRoom.shareCardCover" class="el-icon-close deleteIcon"
@click="liveRoom.shareCardCover = ''"></i>
<template v-if="liveRoom.shareCardCover || liveRoom.shareCardPaper">
<div class="timeline">{{ time }}</div> <div class="timeline">{{ time }}</div>
<div class="tainer"> <div class="tainer">
<div class="avator"> <div class="avator">
<img src="../../assets/live/avtar.png"> <img src="../../assets/live/avtar.png">
</div> </div>
<div class="liveContainer"> <div class="liveContainer">
<div class="img"><img src="../../assets/live/DJcarlife.png"></div> <div class="imgYai"><img src="../../assets/live/DJcarlife.png"></div>
<div class="shareText">{{ liveRoom.copywriting }}</div> <div class="shareText">{{ liveRoom.shareCardPaper }}</div>
<div class="shareImg"><img v-if="liveRoom.shareCardCover" :src="liveRoom.shareCardCover" /></div> <div class="shareImg"><img v-if="liveRoom.shareCardCover" :src="liveRoom.shareCardCover" /></div>
<div class="shareIcon"> <div class="shareIcon">
<div><img src="../../assets/live/icon.png"></div> <div><img src="../../assets/live/icon.png"></div>
...@@ -67,7 +73,7 @@ ...@@ -67,7 +73,7 @@
<div class="title">分享卡片封面</div> <div class="title">分享卡片封面</div>
<div class="intro"> <div class="intro">
<p>用户在微信对话框内分享的直播间将以分享卡片的形式呈现</p> <p>用户在微信对话框内分享的直播间将以分享卡片的形式呈现</p>
<p>建议尺寸:800像素*640像素,图片大小不得超过1M。</p> <p>建议尺寸:800像素*640像素,图片大小不得超过10M。</p>
</div> </div>
<el-button class="upload-panel"> <el-button class="upload-panel">
上传图片 上传图片
...@@ -77,7 +83,7 @@ ...@@ -77,7 +83,7 @@
<div class="copywriting"> <div class="copywriting">
<p>分享文案:</p> <p>分享文案:</p>
<div> <div>
<el-input maxlength="20" clearable v-model="liveRoom.copywriting" <el-input maxlength="20" clearable v-model="liveRoom.shareCardPaper"
placeholder="请输入分享文案"></el-input> placeholder="请输入分享文案"></el-input>
</div> </div>
</div> </div>
...@@ -91,10 +97,14 @@ ...@@ -91,10 +97,14 @@
直播封面样式 直播封面样式
</div> </div>
<div class="spaceFrame paddingSpace"> <div class="spaceFrame paddingSpace">
<div class="forn">
<div class="liveContainerStyle"> <div class="liveContainerStyle">
<template> <i v-show="liveRoom.liveVideoCover" class="el-icon-close deleteIcon"
@click="liveRoom.liveVideoCover = ''"></i>
<div>
<div style="display: flex">
<div class="leftCon"><img v-show="liveRoom.liveVideoCover" :src="liveRoom.liveVideoCover"></div> <div class="leftCon"><img v-show="liveRoom.liveVideoCover" :src="liveRoom.liveVideoCover"></div>
<div class="rightCon"> <div class="rightCon" v-show="liveRoom.liveVideoCover">
<div class="img"><img src="../../assets/live/DJcarlife.png"></div> <div class="img"><img src="../../assets/live/DJcarlife.png"></div>
<p class="title">直播卡片</p> <p class="title">直播卡片</p>
<div class="white"> <div class="white">
...@@ -102,13 +112,17 @@ ...@@ -102,13 +112,17 @@
<div></div> <div></div>
</div> </div>
</div> </div>
</template>
</div> </div>
</div>
</div>
</div>
<div class="displayIro"> <div class="displayIro">
<div class="title">直播卡片封面</div> <div class="title">直播卡片封面</div>
<div class="intro"> <div class="intro">
<p>图片大小建议为800像素*800像素。</p> <p>图片大小建议为800像素*800像素。</p>
<p>图片大小不超过300KB。</p> <p>图片大小不超过10M。</p>
<p>图片内容遵循平台规范后更容易被推荐。</p> <p>图片内容遵循平台规范后更容易被推荐。</p>
</div> </div>
<el-button class="upload-panel"> <el-button class="upload-panel">
...@@ -120,7 +134,6 @@ ...@@ -120,7 +134,6 @@
</div> </div>
</div> </div>
</div>
<div class="baseInfo baseSpace"> <div class="baseInfo baseSpace">
<div class="baseTitle"> <div class="baseTitle">
...@@ -128,30 +141,34 @@ ...@@ -128,30 +141,34 @@
</div> </div>
<div class="spaceFrameNew paddingSpace"> <div class="spaceFrameNew paddingSpace">
<div class="select"> <div class="select">
<el-radio v-model="videoPicture" label="picture">预告图</el-radio> <el-radio v-model="liveRoom.preLiveMediaType" :label="0">预告图</el-radio>
<el-radio v-model="videoPicture" label="video">预告视频</el-radio> <el-radio v-model="liveRoom.preLiveMediaType" :label="1">预告视频</el-radio>
</div> </div>
<div class="photosContent" v-if="videoPicture=='picture'"> <div class="photosContent" v-if="liveRoom.preLiveMediaType=='0'">
<div class="trailerImage"> <div class="trailerImage">
<div class="imgDisplay"> <div class="imgDisplay">
<img v-show="liveRoom.preLiveMediaFile" :src="liveRoom.preLiveMediaFile" /> <i v-show="liveRoom.preLiveMediaFilePic" class="el-icon-close deleteIcon"
@click="liveRoom.preLiveMediaFilePic = ''"></i>
<img v-show="liveRoom.preLiveMediaFilePic" :src="liveRoom.preLiveMediaFilePic" />
</div> </div>
<div class="displayIro"> <div class="displayIro">
<div class="title">预告图</div> <div class="title">预告图</div>
<div class="intro"> <div class="intro">
<p>图片建议大小为750像素*1624像素</p> <p>图片建议大小为750像素*1624像素</p>
<p>图片大小不超过1M</p> <p>图片大小不超过10M</p>
</div> </div>
<el-button class="upload-panel"> <el-button class="upload-panel">
上传图片 上传图片
<input type="file" style="opacity: 0" ref="avatar" accept="*" <input type="file" style="opacity: 0" ref="avatar" accept="*"
@change="uploadAvatar($event,'preLiveMediaFile')" /> @change="uploadAvatar($event,'preLiveMediaFilePic')" />
</el-button> </el-button>
</div> </div>
</div> </div>
<div class="preview"> <div class="preview">
<div class="imgDisplay"> <div class="imgDisplay">
<img :src="liveRoom.preLiveMediaCover" /> <i v-show="liveRoom.preLiveMediaCoverPic" class="el-icon-close deleteIcon"
@click="liveRoom.preLiveMediaCoverPic = ''"></i>
<img v-show="liveRoom.preLiveMediaCoverPic" :src="liveRoom.preLiveMediaCoverPic" />
</div> </div>
<div class="displayIro"> <div class="displayIro">
<div class="title">预告预览图</div> <div class="title">预告预览图</div>
...@@ -162,17 +179,22 @@ ...@@ -162,17 +179,22 @@
<el-button class="upload-panel"> <el-button class="upload-panel">
上传图片 上传图片
<input type="file" style="opacity: 0" ref="avatar" accept="*" <input type="file" style="opacity: 0" ref="avatar" accept="*"
@change="uploadAvatar($event,'preLiveMediaCover')" /> @change="uploadAvatar($event,'preLiveMediaCoverPic')" />
</el-button> </el-button>
</div> </div>
</div> </div>
</div> </div>
<div class="videoContent" v-if="videoPicture=='video'"> <div class="videoContent" v-if="liveRoom.preLiveMediaType=='1'">
<div class="teaserVideo"> <div class="teaserVideo">
ccc <div class="video-panel" v-if="liveRoom.preLiveMediaFileVid">
<video id="video" width="100%" height="100%" preload loop muted> <video id="video" width="100%" height="100%" preload loop muted>
<source :src="liveRoom.preLiveMediaFile" type="video/mp4" /> <source :src="liveRoom.preLiveMediaFileVid" type="video/mp4" />
</video> </video>
<i class="el-icon-video-play" @click="handleLook('video')"></i>
<i class="el-icon-close" @click="liveRoom.preLiveMediaFileVid = ''"></i>
</div>
<div style="width:100%;height:100%" v-else>
</div>
<div class="displayIro"> <div class="displayIro">
<p class="title">预告视频</p> <p class="title">预告视频</p>
<p class="intro">视频大小不超过30M</p> <p class="intro">视频大小不超过30M</p>
...@@ -183,16 +205,22 @@ ...@@ -183,16 +205,22 @@
</el-button> </el-button>
</div> </div>
<div class="teaserVideoCover"> <div class="teaserVideoCover">
<img /> <div style="width:100%;height:100%;position: relative">
<i v-show="liveRoom.preLiveMediaCoverVid" class="el-icon-close deleteIcon"
@click="liveRoom.preLiveMediaCoverVid = ''"></i>
<img class="img-w-h" :src="liveRoom.preLiveMediaCoverVid" v-show="liveRoom.preLiveMediaCoverVid" />
<span class="img-btns" v-show="liveRoom.preLiveMediaCoverVid">
</span>
</div>
<div class="displayIro"> <div class="displayIro">
<p class="title">预告视频封面</p> <p class="title">预告视频封面</p>
<p class="intro">图片建议大小为375像素*282像素</p> <p class="intro">图片建议大小为375像素*282像素</p>
<p class="intro">图片大小不超过300KB</p> <p class="intro">图片大小不超过10M</p>
</div> </div>
<el-button class="upload-panel"> <el-button class="upload-panel">
上传图片 上传图片
<input type="file" style="opacity: 0" ref="avatar" accept="*" <input type="file" style="opacity: 0" ref="avatar" accept="*"
@change="uploadAvatar($event,'preLiveMediaCover')" /> @change="uploadAvatar($event,'preLiveMediaCoverVid')" />
</el-button> </el-button>
</div> </div>
</div> </div>
...@@ -205,8 +233,11 @@ ...@@ -205,8 +233,11 @@
</div> </div>
<div class="spaceFrame paddingSpace"> <div class="spaceFrame paddingSpace">
<div class="liveRoomBackground"> <div class="liveRoomBackground">
<div class="bgmDisplay"> <div class="bgmDisplay">
<div class="back" :style="{'background':backgroundData.bgc}"> <div class="back" :style="{'background':backgroundData.bgc}">
<i v-if="hasMediaCover" class="el-icon-close deleteIcon"
@click="liveRoom.liveBackgroundWall = ''"></i>
<img v-if="hasMediaCover" :src="liveRoom.liveBackgroundWall"> <img v-if="hasMediaCover" :src="liveRoom.liveBackgroundWall">
</div> </div>
<div class="sort"> <div class="sort">
...@@ -220,7 +251,7 @@ ...@@ -220,7 +251,7 @@
<div class="title">直播间背景墙</div> <div class="title">直播间背景墙</div>
<div class="intro"> <div class="intro">
<p>直播间背景墙是每个直播间的默认背景。</p> <p>直播间背景墙是每个直播间的默认背景。</p>
<p>建议尺寸:600像素*1300像素,图片大小不得超过3M。</p> <p>建议尺寸:600像素*1300像素,图片大小不得超过10M。</p>
</div> </div>
<el-button class="upload-panel"> <el-button class="upload-panel">
上传图片 上传图片
...@@ -233,33 +264,46 @@ ...@@ -233,33 +264,46 @@
</div> </div>
</div> </div>
</div>
<div class="foot"> <div class="foot">
<div class="baseBtn" v-if="false"> <div class="baseBtn" v-if="activePage =='1'">
<el-button @click="saveBase">草稿</el-button> <el-button v-show="showDraft" @click="handleCreateorEdit('1')">草稿</el-button>
<el-button @click="previousNextStep('next')" type="primary">下一步</el-button> <el-button @click="previousNextStep('next')" type="primary">下一步</el-button>
</div> </div>
<div class="configBtn" v-if="activePage=='1'"> <div class="configBtn" v-if="activePage=='2'">
<el-button @click="saveBase">草稿</el-button> <el-button v-show="showDraft" @click="handleCreateorEdit('1')">草稿</el-button>
<el-button @click="previousNextStep('previous')">上一步</el-button> <el-button @click="previousNextStep('previous')">上一步</el-button>
<el-button type="primary" @click="handleCreate">创建</el-button> <el-button type="primary" @click="handleCreateorEdit">创建</el-button>
</div> </div>
</div> </div>
<el-dialog class="image-dialog" :visible.sync="dialogVisibleImg" width="50%">
<img :src="dialogSrc" width="100%" v-if="dialogType == 'img'" />
<video width="100%" autoplay controls :src="dialogSrc" v-else></video>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import upload from "@/api/uploadApi"; import upload from "@/api/uploadApi";
import uploadMixin from "@/mixins/upload";
export default { export default {
name: "createANewLiveRoom", name: "createANewLiveRoom",
mixins: [uploadMixin],
data() { data() {
return { return {
activePage: 1, activePage: 1,
incomingId: "",
incomingStatus: "",
showDraft: true,
dialogType: "",
dialogVisibleImg: false,
baseForm: { baseForm: {
name: "", name: "",
introduction: "", introduction: "",
timeStr: "" timeStr: []
}, },
saveBaseForm: {}, saveBaseForm: {},
basevalid: "", basevalid: "",
...@@ -272,7 +316,7 @@ export default { ...@@ -272,7 +316,7 @@ export default {
{ required: true, message: "请选择开播时间", trigger: "change" } { required: true, message: "请选择开播时间", trigger: "change" }
] ]
}, },
videoPicture: "picture", // videoPicture: "0",
hasMediaCover: false, hasMediaCover: false,
// 分享卡片 // 分享卡片
backgroundData: { backgroundData: {
...@@ -280,11 +324,11 @@ export default { ...@@ -280,11 +324,11 @@ export default {
sortColor: ["#EDF1F9", "#000000", "#BDE1FF", "#FFDABB"] sortColor: ["#EDF1F9", "#000000", "#BDE1FF", "#FFDABB"]
}, },
time: "", time: "",
hasShowTime: false,
liveRoom: { liveRoom: {
copywriting: "", shareCardPaper: "",
shareCardCover: "", shareCardCover: "",
liveVideoCover: "", liveVideoCover: "",
preLiveMediaType: "0",
preLiveMediaFile: "", preLiveMediaFile: "",
preLiveMediaCover: "", preLiveMediaCover: "",
liveBackgroundWall: "" liveBackgroundWall: ""
...@@ -294,10 +338,12 @@ export default { ...@@ -294,10 +338,12 @@ export default {
watch: { watch: {
"liveRoom.liveBackgroundWall": { "liveRoom.liveBackgroundWall": {
handler(newV, oldV) { handler(newV, oldV) {
if (newV.includes("png")) { if (/\.(jpg|jpeg|png|JPG|PNG)$/.test(newV)) {
this.liveRoom.liveBackgroundWall = newV;
this.hasMediaCover = true; this.hasMediaCover = true;
} else { } else {
this.hasMediaCover = false; this.hasMediaCover = false;
this.backgroundData.bgc = newV || this.backgroundData.bgc;
} }
}, },
immediate: true, immediate: true,
...@@ -307,26 +353,69 @@ export default { ...@@ -307,26 +353,69 @@ export default {
handler(newValue, oldValue) { handler(newValue, oldValue) {
if (newValue.copywriting !== undefined || newValue.shareCardCover !== undefined) { if (newValue.copywriting !== undefined || newValue.shareCardCover !== undefined) {
this.getNowTime(); this.getNowTime();
this.hasShowTime = true;
}
if (!newValue.copywriting && !newValue.shareCardCover) {
this.hasShowTime = false;
} }
}, },
deep: true deep: true
} }
}, },
async created() {
const { id } = this.$route.query.row;
this.incomingId = id;
if (id) {
await this.$apis.live
.LiveRoomDetailApi({ id })
.then(res => {
const status = res.status;
if (status == "0" || status == "1") {
this.showDraft = false;
}
this.incomingStatus = status
console.log('当前的状态是',status)
this.baseForm.name = res.name;
this.baseForm.introduction = res.introduction;
this.$set(this.baseForm, "timeStr", [res.startTimeStr.replace(/\//g, "-"), res.endTimeStr.replace(/\//g, "-")]);
Object.keys(res).forEach(i => {
this.liveRoom[i] = res[i] || this.liveRoom[i];
});
if (res.preLiveMediaType == "0") {
this.liveRoom.preLiveMediaFilePic = res.preLiveMediaFile;
this.liveRoom.preLiveMediaCoverPic = res.preLiveMediaCover;
} else {
this.liveRoom.preLiveMediaFileVid = res.preLiveMediaFile;
this.liveRoom.preLiveMediaCoverVid = res.preLiveMediaCover;
}
});
}
},
mounted() { mounted() {
}, },
methods: { methods: {
handleImgDelete() {
this.uploadForm.coverUrl = "";
},
handleLook(type) {
this.dialogType = type;
this.dialogVisibleImg = true;
this.dialogSrc = type == "img" ? this.liveRoom.preLiveMediaCover : this.liveRoom.preLiveMediaFile;
},
handleVideoChange(e) { handleVideoChange(e) {
const self = this;
let file = e.target.files[0]; let file = e.target.files[0];
self.loading = true;
upload.init().then(res => { upload.init().then(res => {
if (res.status == 0) { if (res.status == 0) {
upload upload
.uploaded(file) .uploaded(file)
.then(res => { .then(res => {
this.$set(this.liveRoom, "preLiveMediaFile", res.video.url); self.loading = false;
const videoUrl = res.video.url;
self.$set(self.liveRoom, "preLiveMediaFileVid", videoUrl);
self.$nextTick(() => {
self.getImgUrl(videoUrl).then(res => {
console.log(res);
self.$set(self.liveRoom, "preLiveMediaCoverVid", res);
});
});
}) })
.finally(end => { .finally(end => {
console.log(end); console.log(end);
...@@ -340,24 +429,73 @@ export default { ...@@ -340,24 +429,73 @@ export default {
} }
}); });
}, },
handleCreate() { async handleCreateorEdit(draftFlag) {
const params = Object.assign(this.baseForm, this.liveRoom); let sucText = "创建直播间成功!";
console.log(params); let errText = "创建直播间失败!";
console.log(this.liveRoom)
const params = Object.assign(this.liveRoom,this.baseForm);
console.log(params)
if (params.preLiveMediaType == "0") {
params.preLiveMediaFile = params.preLiveMediaFilePic || "";
params.preLiveMediaCover = params.preLiveMediaCoverPic || "";
} else {
params.preLiveMediaFile = params.preLiveMediaFileVid || "";
params.preLiveMediaCover = params.preLiveMediaCoverVid || "";
}
if (params.timeStr) {
params.startTimeStr = params.timeStr[0] || "";
params.endTimeStr = params.timeStr[1] || "";
}
delete params.preLiveMediaFilePic;
delete params.preLiveMediaCoverPic;
delete params.preLiveMediaFileVid;
delete params.preLiveMediaCoverVid;
delete params.timeStr;
if (draftFlag == "1") {
this.activePage == "1" && this.getFormValidation();
if (this.basevalid) {
params.draftFlag = "1";
sucText = "草稿保存成功!";
errText = "草稿保存失败!";
} else {
return false;
}
}
// 24 属于新建
console.log(!!this.incomingStatus && (this.incomingStatus == "2" || this.incomingStatus == "4"))
if (!!this.incomingStatus && (this.incomingStatus == "2" || this.incomingStatus == "4")) {
delete params.id;
}
// 01 就是属于编辑
if (this.incomingId && this.incomingStatus == "0" ) {
params.id = this.incomingId;
sucText = "编辑成功!";
errText = "编辑失败!";
}
// 3反复草稿
if (!!this.incomingStatus && this.incomingStatus == "3" && !params.draftFlag) {
delete params.id;
}
console.log(this.liveRoom);
await this.$apis.live.addOrUpdataLiveRoomApi(params).then(res => {
if (res.code == "0") {
this.$message.success(sucText);
this.$router.push(
{ path: "./index" }
);
} else {
this.$message.error(errText);
}
});
}, },
changeBGC(item) { changeBGC(item) {
this.backgroundData.bgc = item; this.backgroundData.bgc = item;
this.liveRoom.liveBackgroundWall = item; this.liveRoom.liveBackgroundWall = item;
}, },
saveBase() {
this.getFormValidation();
if (this.basevalid) {
this.saveBaseForm = Object.assign(this.baseForm, this.liveRoom);
this.$message.success("保存草稿成功");
}
},
previousNextStep(step) { previousNextStep(step) {
if (step == "next") { if (step == "next") {
this.getFormValidation(); this.getFormValidation();
console.log(this.baseForm);
if (this.basevalid) { if (this.basevalid) {
this.activePage = "2"; this.activePage = "2";
} }
...@@ -391,6 +529,11 @@ export default { ...@@ -391,6 +529,11 @@ export default {
this.$message.error("上传格式不正确"); this.$message.error("上传格式不正确");
return false; return false;
} }
const size = file.size / 1024 / 1024;
if (size > 10) {
this.$message.error("图片体积需小于10M");
return;
}
var reader = new FileReader(); var reader = new FileReader();
var fileInfo = e.srcElement.files[0]; var fileInfo = e.srcElement.files[0];
reader.readAsDataURL(fileInfo); reader.readAsDataURL(fileInfo);
...@@ -398,7 +541,6 @@ export default { ...@@ -398,7 +541,6 @@ export default {
const imgFile = e.target.result; const imgFile = e.target.result;
const base64 = fileInfo.name.split(".")[1] + "@" + imgFile.split(",")[1]; const base64 = fileInfo.name.split(".")[1] + "@" + imgFile.split(",")[1];
this.$apis.common.pictureUpload({ file: base64 }).then(res => { this.$apis.common.pictureUpload({ file: base64 }).then(res => {
console.log(res);
this.$set(this.liveRoom, refName, res); this.$set(this.liveRoom, refName, res);
}); });
}; };
...@@ -408,6 +550,7 @@ export default { ...@@ -408,6 +550,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.upload-panel { .upload-panel {
cursor: pointer; cursor: pointer;
background: rgba(0, 0, 0, 0.04); background: rgba(0, 0, 0, 0.04);
...@@ -580,10 +723,11 @@ export default { ...@@ -580,10 +723,11 @@ export default {
display: flex; display: flex;
.displayImage { .displayImage {
width: 266px; width: 280px;
height: 261px; height: 280px;
background: #F7F7F7; background: #F7F7F7;
margin-right: 35px; margin-right: 35px;
position: relative;
.timeline { .timeline {
text-align: center; text-align: center;
...@@ -596,6 +740,8 @@ export default { ...@@ -596,6 +740,8 @@ export default {
display: flex; display: flex;
.avator { .avator {
width: 26px;
height: 26px;
margin-left: 16px; margin-left: 16px;
} }
...@@ -605,6 +751,10 @@ export default { ...@@ -605,6 +751,10 @@ export default {
width: 62%; width: 62%;
height: 100%; height: 100%;
.imgYai {
width: 85px;
}
.shareText { .shareText {
font-size: 12px; font-size: 12px;
color: #333333; color: #333333;
...@@ -616,6 +766,7 @@ export default { ...@@ -616,6 +766,7 @@ export default {
height: 128px; height: 128px;
background: #F7F7F7; background: #F7F7F7;
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
...@@ -644,11 +795,15 @@ export default { ...@@ -644,11 +795,15 @@ export default {
} }
} }
.forn {
display: flex;
.liveContainerStyle { .liveContainerStyle {
background: #F7F7F7; background: #F7F7F7;
padding: 15px; padding: 15px;
margin-right: 35px; margin-right: 35px;
display: flex; display: flex;
position: relative;
.leftCon { .leftCon {
width: 160px; width: 160px;
...@@ -685,6 +840,7 @@ export default { ...@@ -685,6 +840,7 @@ export default {
} }
} }
} }
}
} }
...@@ -709,6 +865,7 @@ export default { ...@@ -709,6 +865,7 @@ export default {
width: 200px; width: 200px;
height: 433px; height: 433px;
margin-right: 35px; margin-right: 35px;
position: relative;
img { img {
height: 100%; height: 100%;
...@@ -722,6 +879,7 @@ export default { ...@@ -722,6 +879,7 @@ export default {
background: #F7F7F7; background: #F7F7F7;
width: 160px; width: 160px;
height: 160px; height: 160px;
position: relative;
img { img {
width: 100%; width: 100%;
...@@ -736,6 +894,7 @@ export default { ...@@ -736,6 +894,7 @@ export default {
.bgmDisplay { .bgmDisplay {
margin-right: 35px; margin-right: 35px;
position: relative;
.back { .back {
width: 200px; width: 200px;
...@@ -757,6 +916,7 @@ export default { ...@@ -757,6 +916,7 @@ export default {
width: 40px; width: 40px;
height: 40px; height: 40px;
cursor: pointer; cursor: pointer;
border-radius: 2px;
} }
} }
} }
...@@ -766,20 +926,59 @@ img { ...@@ -766,20 +926,59 @@ img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.videoContent{
.videoContent {
display: flex; display: flex;
margin-top: 10px; margin-top: 10px;
height: 440px; height: 440px;
.teaserVideo{
.teaserVideo {
width: 200px; width: 200px;
height: 150px; height: 150px;
background: #F7F7F7; background: #F7F7F7;
} }
.teaserVideoCover{
.teaserVideoCover {
margin-left: 150px; margin-left: 150px;
width: 200px; width: 200px;
height: 150px; height: 150px;
background: #F7F7F7; background: #F7F7F7;
} }
} }
.video-panel {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
position: relative;
video {
position: absolute;
object-fit: fill;
}
.el-icon-video-play {
z-index: 10;
font-size: 20px;
color: #fff;
cursor: pointer;
}
.el-icon-close {
position: absolute;
top: 0px;
right: 0px;
background: #000000;
color: #fff;
}
}
.deleteIcon {
position: absolute;
right: 0;
top: 0;
cursor: pointer;
}
</style> </style>
...@@ -39,6 +39,16 @@ ...@@ -39,6 +39,16 @@
<span :class="['table-circle', 'm-r-8', scope.scope.status == 1 ?'back-blue': 'back-grey']"></span> <span :class="['table-circle', 'm-r-8', scope.scope.status == 1 ?'back-blue': 'back-grey']"></span>
<span>{{ scope.scope.statusStr || "--" }}</span> <span>{{ scope.scope.statusStr || "--" }}</span>
</div> </div>
<div slot="name" slot-scope="scope">
<div class="bgmName">
<el-popover placement="bottom" width="400" trigger="hover">
<div class="qrCode-popover">
<img :src="scope.scope.liveVideoCover" style="width: 360px; height: 360px" />
</div>
<img :src="scope.scope.liveVideoCover" style="width: 36px; height: 36px" slot="reference" />
</el-popover>
<span class="name">{{ scope.scope.name }}</span></div>
</div>
<div <div
class="table-btns" class="table-btns"
slot="auth-button" slot="auth-button"
...@@ -47,7 +57,7 @@ ...@@ -47,7 +57,7 @@
<GLTableButton <GLTableButton
:buttonList="tableButtonList" :buttonList="tableButtonList"
:buttonItem="scope.scope" :buttonItem="scope.scope"
:buttonNum="1" :buttonNum="3"
></GLTableButton> ></GLTableButton>
</div> </div>
</GLTable> </GLTable>
...@@ -126,10 +136,44 @@ ...@@ -126,10 +136,44 @@
</el-input> </el-input>
</div> </div>
</div> </div>
<div class="el-form-item--small isBlock">
<label class="el-form-item__label">OBS推流地址:</label>
<div class="el-form-item__content">
<el-input
type="text"
readonly
v-model="liveDetail.obsPushUrl"
>
<i
slot="suffix"
class="el-input__icon el-icon-document-copy"
@click="handleCopy(liveDetail.obsPushUrl)"
></i>
</el-input>
</div>
</div>
<div class="el-form-item--small isBlock">
<label class="el-form-item__label">OBS推流名称:</label>
<div class="el-form-item__content">
<el-input
type="text"
readonly
v-model="liveDetail.obsPushStreamName"
>
<i
slot="suffix"
class="el-input__icon el-icon-document-copy"
@click="handleCopy(liveDetail.obsPushStreamName)"
></i>
</el-input>
</div>
</div>
</div> </div>
</template> </template>
</div> </div>
</GLDialog> </GLDialog>
<GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisibleDel = false" type="error"
content="是否确认删除直播间?" :visible.sync="dialogVisibleDel" mode="small"></GLDialog>
</div> </div>
</div> </div>
</template> </template>
...@@ -151,6 +195,7 @@ export default { ...@@ -151,6 +195,7 @@ export default {
dialogObj: { dialogObj: {
show: false show: false
}, },
dialogVisibleDel: false,
size: "small", size: "small",
url: url, url: url,
searchForm: { searchForm: {
...@@ -174,8 +219,10 @@ export default { ...@@ -174,8 +219,10 @@ export default {
optionList: [ optionList: [
{ confId: "", confName: "全部" }, { confId: "", confName: "全部" },
{ confId: "0", confName: "未开始" }, { confId: "0", confName: "未开始" },
{ confId: "1", confName: "进行中" }, { confId: "1", confName: "直播中" },
{ confId: "2", confName: "已结束" } { confId: "2", confName: "已结束" },
{ confId: "3", confName: "草稿" },
{ confId: "4", confName: "过期" }
], ],
optionId: "confId", optionId: "confId",
optionLabel: "confName" optionLabel: "confName"
...@@ -193,7 +240,8 @@ export default { ...@@ -193,7 +240,8 @@ export default {
}, },
{ {
label: "直播间名称", label: "直播间名称",
prop: "name" prop: "name",
addHtml: "name"
}, },
{ {
label: "最近开播", label: "最近开播",
...@@ -203,28 +251,65 @@ export default { ...@@ -203,28 +251,65 @@ export default {
label: "直播状态", label: "直播状态",
prop: "status", prop: "status",
addHtml: "status" addHtml: "status"
},
{
label: "访问总数",
prop: "totalVisitCnt",
width: "150"
} }
] ]
}, },
tableButtonList: [ tableButtonList: [
{ {
type: "el-button", type: "el-button",
name: "详情", name: "推流地址",
attrs: { attrs: {
type: "text" type: "text"
}, },
condition: row => {
return row.status !== 1;
},
listeners: { listeners: {
click: row => { click: row => {
this.$apis.live this.$apis.live
.LiveRoomDetailApi({ id: row.id }) .LiveRoomDetailApi({ id: row.id })
.then(res => { .then(res => {
console.log(JSON.parse(JSON.stringify(res)));
this.liveDetail = res; this.liveDetail = res;
this.pageClick(); this.pageClick();
}); });
} }
} }
},
{
type: "el-button",
name: "删除",
attrs: {
type: "text"
},
condition: row => {
return row.status !== 1;
},
listeners: {
click: row => {
this.handleDelete(row);
}
}
},
{
type: "el-button",
name: "编辑",
attrs: {
type: "text"
},
condition: row => {
return row.status !== 1;
},
listeners: {
click: row => {
this.goLiveRoom(row);
}
}
} }
], ],
pageConf: { pageSize: "pageSize", pageNum: "currentPage", totalCount: "total" }, pageConf: { pageSize: "pageSize", pageNum: "currentPage", totalCount: "total" },
...@@ -261,9 +346,35 @@ export default { ...@@ -261,9 +346,35 @@ export default {
}, },
methods: { methods: {
goLiveRoom() { handleSure() {
const { id } = this.selectItem;
this.$apis.live
.deleteLiveRoomApi({
id
})
.then(res => {
if (res) {
this.$message({
type: "success",
message: "删除成功!"
});
}
this.handleSearch();
});
this.dialogVisibleDel = false;
},
handleDelete(row) {
this.selectItem = row;
this.dialogVisibleDel = true;
},
goLiveRoom(row) {
this.$router.push( this.$router.push(
{ path: "./createANewLiveRoom" } {
path: "./createANewLiveRoom",
query: {
row
}
}
); );
}, },
pageClick(type) { pageClick(type) {
...@@ -354,6 +465,15 @@ export default { ...@@ -354,6 +465,15 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.bgmName {
display: flex;
align-items: center;
.name {
margin-left: 8px;
}
}
.dialog-content { .dialog-content {
.box { .box {
padding-left: 20px; padding-left: 20px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!