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>
...@@ -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!