Commit 1b0eb879 by 前端

Merge branch 'xuyl_dev_v3.2.0' into 'v3.2.0'

优化直播间

See merge request !8
2 parents f5a852c0 bcdbd3e9
<template> <template>
<div class="createANewLiveRoom"> <div class="createANewLiveRoom" v-loading="loading">
<div class="header"> <div class="header">
<div class="step"> <div class="step">
<div class="baseinfo"> <div class="baseinfo">
...@@ -15,13 +15,14 @@ ...@@ -15,13 +15,14 @@
</div> </div>
<div class="baseInfoContainer" v-if="activePage =='1'"> <div class="baseInfoContainer" v-if="activePage =='1'">
<div class="baseTitle">基本信息</div> <div class="baseTitle">基本信息</div>
<div class="baseFrame"> <div class="baseFrame gl-from-page">
<el-form :model="baseForm" :rules="baseRules" ref="baseForm" label-width="100px"> <el-form :model="baseForm" :rules="baseRules" ref="baseForm" label-width="100px">
<el-form-item label="直播间名称" prop="name"> <el-form-item label="直播间名称" prop="name">
<el-input v-model="baseForm.name"></el-input> <el-input v-model="baseForm.name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="直播间简介"> <el-form-item label="直播间简介">
<el-input type="textarea" v-model="baseForm.introduction"></el-input> <el-input type="textarea" v-model="baseForm.introduction" maxlength="200"
show-word-limit autosize></el-input>
</el-form-item> </el-form-item>
<el-form-item label="开播时间" prop="timeStr"> <el-form-item label="开播时间" prop="timeStr">
<el-date-picker <el-date-picker
...@@ -31,6 +32,7 @@ ...@@ -31,6 +32,7 @@
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
:default-time="['00:00:00', '23:59:59']" :default-time="['00:00:00', '23:59:59']"
popper-class="pickerWrapZ1" popper-class="pickerWrapZ1"
...@@ -141,8 +143,8 @@ ...@@ -141,8 +143,8 @@
</div> </div>
<div class="spaceFrameNew paddingSpace"> <div class="spaceFrameNew paddingSpace">
<div class="select"> <div class="select">
<el-radio v-model="liveRoom.preLiveMediaType" :label="0">预告图</el-radio> <el-radio v-model="liveRoom.preLiveMediaType" :label="'0'">预告图</el-radio>
<el-radio v-model="liveRoom.preLiveMediaType" :label="1">预告视频</el-radio> <el-radio v-model="liveRoom.preLiveMediaType" :label="'1'">预告视频</el-radio>
</div> </div>
<div class="photosContent" v-if="liveRoom.preLiveMediaType=='0'"> <div class="photosContent" v-if="liveRoom.preLiveMediaType=='0'">
<div class="trailerImage"> <div class="trailerImage">
...@@ -294,9 +296,15 @@ export default { ...@@ -294,9 +296,15 @@ export default {
mixins: [uploadMixin], mixins: [uploadMixin],
data() { data() {
return { return {
loading:false,
activePage: 1, activePage: 1,
incomingId: "", incomingId: "",
incomingStatus: "", incomingStatus: "",
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now() - 24 * 60 * 60 * 1000;
},
},
showDraft: true, showDraft: true,
dialogType: "", dialogType: "",
dialogVisibleImg: false, dialogVisibleImg: false,
...@@ -361,6 +369,7 @@ export default { ...@@ -361,6 +369,7 @@ export default {
async created() { async created() {
const { id } = this.$route.query.row; const { id } = this.$route.query.row;
this.incomingId = id; this.incomingId = id;
console.log(this.$route.query.row)
if (id) { if (id) {
await this.$apis.live await this.$apis.live
.LiveRoomDetailApi({ id }) .LiveRoomDetailApi({ id })
...@@ -412,7 +421,6 @@ export default { ...@@ -412,7 +421,6 @@ export default {
self.$set(self.liveRoom, "preLiveMediaFileVid", videoUrl); self.$set(self.liveRoom, "preLiveMediaFileVid", videoUrl);
self.$nextTick(() => { self.$nextTick(() => {
self.getImgUrl(videoUrl).then(res => { self.getImgUrl(videoUrl).then(res => {
console.log(res);
self.$set(self.liveRoom, "preLiveMediaCoverVid", res); self.$set(self.liveRoom, "preLiveMediaCoverVid", res);
}); });
}); });
...@@ -462,7 +470,6 @@ export default { ...@@ -462,7 +470,6 @@ export default {
} }
} }
// 24 属于新建 // 24 属于新建
console.log(!!this.incomingStatus && (this.incomingStatus == "2" || this.incomingStatus == "4"))
if (!!this.incomingStatus && (this.incomingStatus == "2" || this.incomingStatus == "4")) { if (!!this.incomingStatus && (this.incomingStatus == "2" || this.incomingStatus == "4")) {
delete params.id; delete params.id;
} }
...@@ -553,12 +560,12 @@ export default { ...@@ -553,12 +560,12 @@ export default {
.upload-panel { .upload-panel {
cursor: pointer; cursor: pointer;
background: rgba(0, 0, 0, 0.04);
background-size: 100% 100%; background-size: 100% 100%;
border: 1px solid rgba(0, 0, 0, 0.15); border: 1px solid #5850FF;
border-radius: 4px; border-radius: 4px;
text-align: center; text-align: center;
position: relative; position: relative;
color: #5850FF;
.upload-view { .upload-view {
width: 100%; width: 100%;
...@@ -617,6 +624,7 @@ export default { ...@@ -617,6 +624,7 @@ export default {
font-size: 14px; font-size: 14px;
color: #666666; color: #666666;
margin: 16px 0; margin: 16px 0;
line-height: 24px;
} }
.copywriting { .copywriting {
......
...@@ -5,14 +5,18 @@ ...@@ -5,14 +5,18 @@
</div> </div>
<div class="container"> <div class="container">
<div> <div>
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm> <GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData"
@handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
</div> </div>
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable ref="classifyRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun"> <GLTable ref="classifyRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm"
:tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn"
@setTableFinishFun="setTableFinishFun">
<div slot="status" slot-scope="scope"> <div slot="status" slot-scope="scope">
<span :class="['table-circle', 'm-r-8', scope.scope.status == 1 ? 'back-blue' : 'back-grey']"></span> <span
<span>{{ scope.scope.statusStr || '--' }}</span> :class="['table-circle', 'm-r-8', scope.scope.status == 1 ? 'back-blue' : scope.scope.status == 3 ? 'back-orange' : 'back-grey']"></span>
<span>{{ scope.scope.statusStr || "--" }}</span>
</div> </div>
<div slot="name" slot-scope="scope"> <div slot="name" slot-scope="scope">
<div class="bgmName"> <div class="bgmName">
...@@ -30,12 +34,20 @@ ...@@ -30,12 +34,20 @@
</div> </div>
</GLTable> </GLTable>
<!-- 表格区域 end --> <!-- 表格区域 end -->
<GLDialog ref="dialogRef" v-if="dialogObj.show" :title="dialogObj.type ? '新建直播间' : '详情'" :visible.sync="dialogObj.show" :close-on-click-modal="false" @onOk="handleCreateLiveRoom" @onCancel="dialogObj.show = false" :hasFooter="dialogObj.type == 1"> <GLDialog ref="dialogRef" v-if="dialogObj.show" :title="dialogObj.type ? '新建直播间' : '详情'"
:visible.sync="dialogObj.show" :close-on-click-modal="false" @onOk="handleCreateLiveRoom"
@onCancel="dialogObj.show = false" :hasFooter="dialogObj.type == 1">
<div class="dialog-content"> <div class="dialog-content">
<template v-if="dialogObj.type == 1"> <template v-if="dialogObj.type == 1">
<glsx-combi-form class="edit-form-container" ref="configEditFormRef" :isEdit="true" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="configEditFormData" :formRules="editRule"> <glsx-combi-form class="edit-form-container" ref="configEditFormRef" :isEdit="true" :isBlock="true"
:formRef="editChildRef" :formObj="editForm" :formData="configEditFormData"
:formRules="editRule">
<template slot="liveTimeHtml" slot-scope="scope"> <template slot="liveTimeHtml" slot-scope="scope">
<el-date-picker v-model="editForm.liveTime" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']" @change="e => handleTimeChange(e, scope)" :picker-options="pickerOptions"></el-date-picker> <el-date-picker v-model="editForm.liveTime" type="datetimerange" range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']"
@change="e => handleTimeChange(e, scope)"
:picker-options="pickerOptions"></el-date-picker>
</template> </template>
</glsx-combi-form> </glsx-combi-form>
</template> </template>
...@@ -45,7 +57,8 @@ ...@@ -45,7 +57,8 @@
<label class="el-form-item__label">推流地址:</label> <label class="el-form-item__label">推流地址:</label>
<div class="el-form-item__content"> <div class="el-form-item__content">
<el-input type="text" readonly v-model="liveDetail.pushPath"> <el-input type="text" readonly v-model="liveDetail.pushPath">
<i slot="suffix" class="el-input__icon el-icon-document-copy" @click="handleCopy(liveDetail.pushPath)"></i> <i slot="suffix" class="el-input__icon el-icon-document-copy"
@click="handleCopy(liveDetail.pushPath)"></i>
</el-input> </el-input>
</div> </div>
</div> </div>
...@@ -53,7 +66,8 @@ ...@@ -53,7 +66,8 @@
<label class="el-form-item__label">播放地址:</label> <label class="el-form-item__label">播放地址:</label>
<div class="el-form-item__content"> <div class="el-form-item__content">
<el-input type="text" readonly v-model="liveDetail.playPath"> <el-input type="text" readonly v-model="liveDetail.playPath">
<i slot="suffix" class="el-input__icon el-icon-document-copy" @click="handleCopy(liveDetail.playPath)"></i> <i slot="suffix" class="el-input__icon el-icon-document-copy"
@click="handleCopy(liveDetail.playPath)"></i>
</el-input> </el-input>
</div> </div>
</div> </div>
...@@ -61,7 +75,8 @@ ...@@ -61,7 +75,8 @@
<label class="el-form-item__label">OBS推流地址:</label> <label class="el-form-item__label">OBS推流地址:</label>
<div class="el-form-item__content"> <div class="el-form-item__content">
<el-input type="text" readonly v-model="liveDetail.obsPushUrl"> <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> <i slot="suffix" class="el-input__icon el-icon-document-copy"
@click="handleCopy(liveDetail.obsPushUrl)"></i>
</el-input> </el-input>
</div> </div>
</div> </div>
...@@ -69,7 +84,8 @@ ...@@ -69,7 +84,8 @@
<label class="el-form-item__label">OBS推流名称:</label> <label class="el-form-item__label">OBS推流名称:</label>
<div class="el-form-item__content"> <div class="el-form-item__content">
<el-input type="text" readonly v-model="liveDetail.obsPushStreamName"> <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> <i slot="suffix" class="el-input__icon el-icon-document-copy"
@click="handleCopy(liveDetail.obsPushStreamName)"></i>
</el-input> </el-input>
</div> </div>
</div> </div>
...@@ -77,188 +93,190 @@ ...@@ -77,188 +93,190 @@
</template> </template>
</div> </div>
</GLDialog> </GLDialog>
<GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisibleDel = false" type="error" content="是否确认删除直播间?" :visible.sync="dialogVisibleDel" mode="small"></GLDialog> <GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisibleDel = false" type="error"
content="是否确认删除直播间?" :visible.sync="dialogVisibleDel" mode="small"></GLDialog>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import url from '@/assets/empty.png' import url from "@/assets/empty.png";
export default { export default {
name: 'LiveIndex', name: "LiveIndex",
data() { data() {
return { return {
pickerOptions: { pickerOptions: {
disabledDate(date) { disabledDate(date) {
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1)) const yesterday = new Date(new Date().setDate(new Date().getDate() - 1));
return date < yesterday return date < yesterday;
} }
}, },
dialogObj: { dialogObj: {
show: false show: false
}, },
dialogVisibleDel: false, dialogVisibleDel: false,
size: 'small', size: "small",
url: url, url: url,
searchForm: { searchForm: {
term: '', term: "",
status: '' status: ""
}, },
tableSearchForm: {}, tableSearchForm: {},
// 搜索 // 搜索
searchFormData: [ searchFormData: [
{ {
label: '直播间搜索', label: "直播间搜索",
name: 'term', name: "term",
type: 'input', type: "input",
maxlength: 20 maxlength: 20
}, },
{ {
label: '直播状态', label: "直播状态",
name: 'status', name: "status",
type: 'select', type: "select",
width: '215px', width: "215px",
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: "3", confName: "草稿" },
{ confId: '4', confName: '过期' } { confId: "4", confName: "过期" }
], ],
optionId: 'confId', optionId: "confId",
optionLabel: 'confName' optionLabel: "confName"
} }
], ],
// 表格 // 表格
getListApi: this.$apis.live.getListApi, getListApi: this.$apis.live.getListApi,
tableParams: { tableParams: {
listName: 'list', listName: "list",
tableOption: true, tableOption: true,
tableColumns: [ tableColumns: [
{ {
label: '房间号', label: "房间号",
prop: 'roomNumber' prop: "roomNumber"
}, },
{ {
label: '直播间名称', label: "直播间名称",
prop: 'name', prop: "name",
addHtml: 'name' addHtml: "name"
}, },
{ {
label: '最近开播', label: "最近开播",
prop: 'liveTime' prop: "liveTime"
}, },
{ {
label: '直播状态', label: "直播状态",
prop: 'status', prop: "status",
addHtml: 'status' addHtml: "status"
}, },
{ {
label: '访问总数', label: "访问总数",
prop: 'totalVisitCnt', prop: "totalVisitCnt",
width: '150' width: "150"
} }
] ]
}, },
tableButtonList: [ tableButtonList: [
{ {
type: 'el-button', type: "el-button",
name: '控制台', name: "控制台",
attrs: { attrs: {
type: 'text' type: "text"
}, },
listeners: { listeners: {
click: row => { click: row => {
this.$router.push(`/liveList/console?id=${row.id}`) this.$router.push(`/liveList/console?id=${row.id}`);
} }
} }
}, },
{ {
type: 'el-button', type: "el-button",
name: '推流地址', name: "推流地址",
attrs: { attrs: {
type: 'text' type: "text"
}, },
condition: row => { condition: row => {
return row.status !== 1 return row.status !== 1;
}, },
listeners: { listeners: {
click: row => { click: row => {
this.$apis.live.LiveRoomDetailApi({ id: row.id }).then(res => { this.$apis.live.LiveRoomDetailApi({ id: row.id }).then(res => {
this.liveDetail = res this.liveDetail = res;
this.pageClick() this.pageClick();
}) });
} }
} }
}, },
{ {
type: 'el-button', type: "el-button",
name: '删除', name: "删除",
attrs: { attrs: {
type: 'text' type: "text"
}, },
condition: row => { condition: row => {
return row.status !== 1 return row.status !== 1;
}, },
listeners: { listeners: {
click: row => { click: row => {
this.handleDelete(row) this.handleDelete(row);
} }
} }
}, },
{ {
type: 'el-button', type: "el-button",
name: '编辑', name: "编辑",
attrs: { attrs: {
type: 'text' type: "text"
}, },
condition: row => { condition: row => {
return row.status !== 1 return row.status !== 1;
}, },
listeners: { listeners: {
click: row => { click: row => {
this.goLiveRoom(row) this.goLiveRoom(row);
} }
} }
} }
], ],
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }, pageConf: { pageSize: "pageSize", pageNum: "currentPage", totalCount: "total" },
editChildRef: 'editChildRef', editChildRef: "editChildRef",
editForm: { editForm: {
name: '', name: "",
liveTime: [] liveTime: []
}, },
configEditFormData: [ configEditFormData: [
{ {
label: '直播间名称', label: "直播间名称",
name: 'name', name: "name",
type: 'input', type: "input",
maxlength: 20 maxlength: 20
}, },
{ {
label: '开播时间', label: "开播时间",
name: 'liveTime', name: "liveTime",
type: 'datePicker', type: "datePicker",
addHtml: 'liveTimeHtml' addHtml: "liveTimeHtml"
} }
], ],
editRule: { editRule: {
name: [{ required: true, message: '请输入直播间名称', trigger: 'change' }], name: [{ required: true, message: "请输入直播间名称", trigger: "change" }],
liveTime: [{ required: true, message: '请选择开播时间', trigger: 'change' }] liveTime: [{ required: true, message: "请选择开播时间", trigger: "change" }]
}, },
liveDetail: {} liveDetail: {}
} };
}, },
mounted() {}, mounted() {
},
methods: { methods: {
handleSure() { handleSure() {
const { id } = this.selectItem const { id } = this.selectItem;
this.$apis.live this.$apis.live
.deleteLiveRoomApi({ .deleteLiveRoomApi({
id id
...@@ -266,77 +284,77 @@ export default { ...@@ -266,77 +284,77 @@ export default {
.then(res => { .then(res => {
if (res) { if (res) {
this.$message({ this.$message({
type: 'success', type: "success",
message: '删除成功!' message: "删除成功!"
}) });
} }
this.handleSearch() this.handleSearch();
}) });
this.dialogVisibleDel = false this.dialogVisibleDel = false;
}, },
handleDelete(row) { handleDelete(row) {
this.selectItem = row this.selectItem = row;
this.dialogVisibleDel = true this.dialogVisibleDel = true;
}, },
goLiveRoom(row) { goLiveRoom(row) {
this.$router.push({ this.$router.push({
path: './createANewLiveRoom', path: "./createANewLiveRoom",
query: { query: {
row row
} }
}) });
}, },
pageClick(type) { pageClick(type) {
this.editForm = { this.editForm = {
name: '', name: "",
liveTime: [] liveTime: []
} };
this.dialogObj = { this.dialogObj = {
type, type,
show: true show: true
} };
}, },
getParams() { getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm)) var params = JSON.parse(JSON.stringify(this.searchForm));
return params return params;
}, },
beforeSearchFn() { beforeSearchFn() {
return new Promise(resolve => { return new Promise(resolve => {
this.tableSearchForm = this.getParams() this.tableSearchForm = this.getParams();
resolve() resolve();
}) });
}, },
setTableFinishFun() { setTableFinishFun() {
//接收到的数据为空 //接收到的数据为空
this.$refs.classifyRef.data.length ? (this.$refs.classifyRef.tableHeightValues = '') : this.$refs.classifyRef.setTableHeightFun() this.$refs.classifyRef.data.length ? (this.$refs.classifyRef.tableHeightValues = "") : this.$refs.classifyRef.setTableHeightFun();
}, },
handleSearch() { handleSearch() {
this.$refs.classifyRef.refreshTable() this.$refs.classifyRef.refreshTable();
}, },
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
classifyName: '', classifyName: "",
createDate: [] createDate: []
} };
this.handleSearch() this.handleSearch();
}, },
handleTimeChange(e) { handleTimeChange(e) {
this.editForm.liveTime = e this.editForm.liveTime = e;
}, },
handleCopy(txt) { handleCopy(txt) {
this.$message({ this.$message({
message: '复制成功', message: "复制成功",
type: 'success', type: "success",
customClass: 'message-Z-zinde' customClass: "message-Z-zinde"
}) });
const input = document.createElement('input') const input = document.createElement("input");
document.body.appendChild(input) document.body.appendChild(input);
input.setAttribute('value', txt) input.setAttribute("value", txt);
input.select() input.select();
document.execCommand('Copy') document.execCommand("Copy");
document.body.removeChild(input) document.body.removeChild(input);
}, },
handleCreateLiveRoom() { handleCreateLiveRoom() {
this.$refs.configEditFormRef.$refs[this.editChildRef].validate(valid => { this.$refs.configEditFormRef.$refs[this.editChildRef].validate(valid => {
...@@ -344,33 +362,33 @@ export default { ...@@ -344,33 +362,33 @@ export default {
let { name, liveTime } = this.editForm, let { name, liveTime } = this.editForm,
params = { params = {
name name
} };
if (liveTime.length) { if (liveTime.length) {
let [startTimeStr, endTimeStr] = liveTime let [startTimeStr, endTimeStr] = liveTime;
params.startTimeStr = startTimeStr params.startTimeStr = startTimeStr;
params.endTimeStr = endTimeStr params.endTimeStr = endTimeStr;
} }
this.loading = true this.loading = true;
this.$apis.live this.$apis.live
.addOrUpdataLiveRoomApi(params) .addOrUpdataLiveRoomApi(params)
.then(res => { .then(res => {
this.$message({ this.$message({
message: res.code == '0' ? '操作成功' : res.message ? res.message : '操作失败', message: res.code == "0" ? "操作成功" : res.message ? res.message : "操作失败",
type: res.code == '0' ? 'success' : 'error' type: res.code == "0" ? "success" : "error"
}) });
if (res.code == '0') { if (res.code == "0") {
this.handleSearch() this.handleSearch();
this.dialogObj.show = false this.dialogObj.show = false;
} }
}) })
.finally(() => { .finally(() => {
this.loading = false this.loading = false;
}) });
} }
}) });
} }
} }
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!