Commit f5a852c0 by 前端

Merge branch 'ym_v3.2.0' into 'v3.2.0'

fixed

See merge request !7
2 parents 18425f6a f2bae989
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn * @Author: yangming yangming@didihu.com.cn
* @Date: 2022-11-23 11:06:49 * @Date: 2022-11-23 11:06:49
* @LastEditors: yangming yangming@didihu.com.cn * @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-29 10:19:37 * @LastEditTime: 2022-11-29 16:59:43
* @FilePath: \live\src\setup\qiankun.js * @FilePath: \live\src\setup\qiankun.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -27,7 +27,7 @@ export async function bootstrap({ history, common, messenger, globalState }) { ...@@ -27,7 +27,7 @@ export async function bootstrap({ history, common, messenger, globalState }) {
Vue.prototype.$common = common Vue.prototype.$common = common
Vue.prototype.$message = message Vue.prototype.$message = message
Vue.prototype.$messageBox = messageBox Vue.prototype.$messageBox = messageBox
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: 'scrm-base-f90349f8-701a-47a4-858c-85792bb91e09-rop' } }) Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http_common = new common.Http({ response, signWay: 'md5', request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } }) Vue.prototype.$http_common = new common.Http({ response, signWay: 'md5', request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState // Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] }) Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
......
...@@ -11,9 +11,11 @@ ...@@ -11,9 +11,11 @@
<el-button :size="size" type="primary" plain @click="detailexport">导出</el-button> <el-button :size="size" type="primary" plain @click="detailexport">导出</el-button>
</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="nickname" slot-scope="scope">
<span :class="['table-circle', 'm-r-8', scope.scope.status == 1 ? 'back-blue' : 'back-grey']"></span> <div class="nickname-border">
<span>{{ scope.scope.statusStr || '--' }}</span> <img :src="scope.scope.coverUrl" />
<span>{{ scope.scope.nickname }}</span>
</div>
</div> </div>
</GLTable> </GLTable>
</div> </div>
...@@ -66,7 +68,8 @@ export default { ...@@ -66,7 +68,8 @@ export default {
tableColumns: [ tableColumns: [
{ {
label: '微信昵称', label: '微信昵称',
prop: 'nickname' prop: 'nickname',
addHtml: 'nickname'
}, },
{ {
label: '手机号', label: '手机号',
...@@ -159,4 +162,13 @@ export default { ...@@ -159,4 +162,13 @@ export default {
} }
} }
} }
.nickname-border {
display: flex;
align-items: center;
img {
width: 36px;
height: 36px;
margin-right: 10px;
}
}
</style> </style>
<template>
<div class="live-main">
<div class="container">
<div class="look-container">
<div class="look-left">
<div class="look-left-b">
<img :src="room.liveVideoCover" />
</div>
<div class="look-left-content">
<div class="look-title">{{ room.name }}</div>
<div class="look-desc">开播时间:{{ getBetween }}</div>
<div class="look-desc">房间号:{{ room.id }}</div>
<div class="look-status">直播已结束{{ endTime }}</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>{{ baseInfo.visitPeakOnlineValue }}</span>
</div>
<div class="data-desc">
<span>观看人数</span>
<span>{{ baseInfo.visitNumberOfPeople }}</span>
</div>
<div class="data-desc data-desc-jump">
<span>观看次数</span>
<span>
{{ baseInfo.visitNumberOfTimes }}
<a @click="handleLook">查看</a>
</span>
</div>
<div class="data-desc">
<span>平均观看时长</span>
<span>{{ baseInfo.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>{{ baseInfo.interactNumberOfPeople }}</span>
</div>
<div class="data-desc">
<span>评论次数</span>
<span>{{ baseInfo.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" plain @click="detailexport">导出</el-button>
</div>
<GLTable ref="classifyRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<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="room.name" :hasFooter="false" :visible.sync="dialogVisible" mode="big">
<record ref="recordForm" v-if="dialogVisible" :visitSource="visitSource" :roomNum="roomNum"></record>
</GLDialog>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import record from './components/record.vue'
import { downloadUrl, GetDateDiff } from '@/utils'
export default {
name: 'LiveIndex',
components: {
record
},
data() {
return {
roomNum: 0,
roomId: '',
endTime: '',
dialogVisible: false,
visitSource: '',
dialogObj: {
show: false
},
size: 'small',
url: url,
baseInfo: {},
room: {},
tableSearchForm: { id: '' },
// 表格
getListApi: this.$apis.console.consolePage,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '访问来源',
prop: 'visitSource'
},
{
label: '观看直播总数',
prop: 'totalVisitCnt'
},
{
label: '平均停留时长',
prop: 'averageStayTime'
}
]
},
tableButtonList: [
{
type: 'el-button',
name: '详情',
attrs: {
type: 'text'
},
listeners: {
click: row => {
this.handleLook(row)
}
}
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }
}
},
created() {
this.roomId = this.$route.query.id
this.consoleBasic(this.roomId)
this.consoleInfo(this.roomId)
},
beforeDestroy() {
clearInterval(this.timer)
},
computed: {
getBetween() {
const startTimeStr = this.room.startTimeStr
const endTimeStr = this.room.endTimeStr
if (!startTimeStr) return
const [y1, d1] = startTimeStr.split(' ')
const [y2, d2] = endTimeStr.split(' ')
if (y1 == y2) {
return y1 + ' ' + d1.substring(0, 5) + '-' + d2.substring(0, 5)
} else {
return y1 + ' ' + d1.substring(0, 5) + '-' + y2 + ' ' + d2.substring(0, 5)
}
}
},
methods: {
//时间差
getTime() {
this.endTime = GetDateDiff(this.room.endTimeStr)
},
handleLook(row) {
this.visitSource = row.visitSource
this.roomNum = row.totalVisitCnt ? row.totalVisitCnt : this.baseInfo.visitNumberOfTimes
this.dialogVisible = true
},
consoleBasic(id) {
this.$apis.console.consoleBasic({ id }).then(res => {
this.baseInfo = res || {}
})
},
consoleInfo(id) {
this.$apis.console.consoleInfo({ id }).then(res => {
this.room = res || {}
this.timer = setInterval(this.getTime, 1000)
})
},
detailexport() {
this.$apis.console.consoleExport({ id: this.roomId, currentPage: 1, pageSize: 100000 }).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.id = this.roomId
resolve()
})
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.classifyRef.data.length ? (this.$refs.classifyRef.tableHeightValues = '') : this.$refs.classifyRef.setTableHeightFun()
}
}
}
</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 {
img {
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>
<template> <template>
<div class="live-room"> <div class="live-room">
<div class="m-b-20"> <div class="m-b-20">
<el-button <el-button :size="size" type="primary" class="el-icon-plus" @click="goLiveRoom">新建</el-button>
:size="size"
type="primary"
class="el-icon-plus"
@click="goLiveRoom"
>新建
</el-button>
</div> </div>
<div class="container"> <div class="container">
<div> <div>
<GLCombiForm <GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
ref="showSearch"
:rowNumber="1"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"
></GLCombiForm>
</div> </div>
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable <GLTable ref="classifyRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
ref="classifyRef" <div slot="status" slot-scope="scope">
:getListApi="getListApi" <span :class="['table-circle', 'm-r-8', scope.scope.status == 1 ? 'back-blue' : 'back-grey']"></span>
:noDataImg="url" <span>{{ scope.scope.statusStr || '--' }}</span>
:searchForm="tableSearchForm"
:tableParams="tableParams"
:pageConf="pageConf"
:beforeSearchFn="beforeSearchFn"
@setTableFinishFun="setTableFinishFun"
>
<div
slot="status"
slot-scope="scope"
>
<span :class="['table-circle', 'm-r-8', scope.scope.status == 1 ?'back-blue': '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">
...@@ -47,58 +22,20 @@ ...@@ -47,58 +22,20 @@
</div> </div>
<img :src="scope.scope.liveVideoCover" style="width: 36px; height: 36px" slot="reference" /> <img :src="scope.scope.liveVideoCover" style="width: 36px; height: 36px" slot="reference" />
</el-popover> </el-popover>
<span class="name">{{ scope.scope.name }}</span></div> <span class="name">{{ scope.scope.name }}</span>
</div> </div>
<div </div>
class="table-btns" <div class="table-btns" slot="auth-button" slot-scope="scope">
slot="auth-button" <GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
slot-scope="scope"
>
<GLTableButton
:buttonList="tableButtonList"
:buttonItem="scope.scope"
:buttonNum="3"
></GLTableButton>
</div> </div>
</GLTable> </GLTable>
<!-- 表格区域 end --> <!-- 表格区域 end -->
<GLDialog <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">
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 <glsx-combi-form class="edit-form-container" ref="configEditFormRef" :isEdit="true" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="configEditFormData" :formRules="editRule">
class="edit-form-container" <template slot="liveTimeHtml" slot-scope="scope">
ref="configEditFormRef" <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>
:isEdit="true"
:isBlock="true"
:formRef="editChildRef"
:formObj="editForm"
:formData="configEditFormData"
:formRules="editRule"
>
<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>
</template> </template>
</glsx-combi-form> </glsx-combi-form>
</template> </template>
...@@ -107,64 +44,32 @@ ...@@ -107,64 +44,32 @@
<div class="el-form-item--small isBlock"> <div class="el-form-item--small isBlock">
<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 <el-input type="text" readonly v-model="liveDetail.pushPath">
type="text" <i slot="suffix" class="el-input__icon el-icon-document-copy" @click="handleCopy(liveDetail.pushPath)"></i>
readonly
v-model="liveDetail.pushPath"
>
<i
slot="suffix"
class="el-input__icon el-icon-document-copy"
@click="handleCopy(liveDetail.pushPath)"
></i>
</el-input> </el-input>
</div> </div>
</div> </div>
<div class="el-form-item--small isBlock"> <div class="el-form-item--small isBlock">
<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 <el-input type="text" readonly v-model="liveDetail.playPath">
type="text" <i slot="suffix" class="el-input__icon el-icon-document-copy" @click="handleCopy(liveDetail.playPath)"></i>
readonly
v-model="liveDetail.playPath"
>
<i
slot="suffix"
class="el-input__icon el-icon-document-copy"
@click="handleCopy(liveDetail.playPath)"
></i>
</el-input> </el-input>
</div> </div>
</div> </div>
<div class="el-form-item--small isBlock"> <div class="el-form-item--small isBlock">
<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 <el-input type="text" readonly v-model="liveDetail.obsPushUrl">
type="text" <i slot="suffix" class="el-input__icon el-icon-document-copy" @click="handleCopy(liveDetail.obsPushUrl)"></i>
readonly
v-model="liveDetail.obsPushUrl"
>
<i
slot="suffix"
class="el-input__icon el-icon-document-copy"
@click="handleCopy(liveDetail.obsPushUrl)"
></i>
</el-input> </el-input>
</div> </div>
</div> </div>
<div class="el-form-item--small isBlock"> <div class="el-form-item--small isBlock">
<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 <el-input type="text" readonly v-model="liveDetail.obsPushStreamName">
type="text" <i slot="suffix" class="el-input__icon el-icon-document-copy" @click="handleCopy(liveDetail.obsPushStreamName)"></i>
readonly
v-model="liveDetail.obsPushStreamName"
>
<i
slot="suffix"
class="el-input__icon el-icon-document-copy"
@click="handleCopy(liveDetail.obsPushStreamName)"
></i>
</el-input> </el-input>
</div> </div>
</div> </div>
...@@ -172,182 +77,188 @@ ...@@ -172,182 +77,188 @@
</template> </template>
</div> </div>
</GLDialog> </GLDialog>
<GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisibleDel = false" type="error" <GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisibleDel = false" type="error" content="是否确认删除直播间?" :visible.sync="dialogVisibleDel" mode="small"></GLDialog>
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: {
type: 'text'
},
listeners: {
click: row => {
this.$router.push(`/liveList/console?id=${row.id}`)
}
}
},
{
type: 'el-button',
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 this.$apis.live.LiveRoomDetailApi({ id: row.id }).then(res => {
.LiveRoomDetailApi({ id: row.id }) this.liveDetail = res
.then(res => { this.pageClick()
this.liveDetail = res; })
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
...@@ -355,79 +266,77 @@ export default { ...@@ -355,79 +266,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 => {
...@@ -435,33 +344,33 @@ export default { ...@@ -435,33 +344,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!