Commit f84a8d74 by 李伟康

提交代码

1 parent e793b118
import { http } from '@/main' import { http } from '@/main'
const defaultPath = 'scrm.api.shopmall.' const defaultPath = 'scrm.api.shopmall.livebroadcast.'
const getListApi = params => { const getListApi = params => {
params.method = `${defaultPath}classify.page.curMerchant` params.method = `${defaultPath}page`
return http({ return http({
url: 'rop-scrm-shopmall/router', url: 'rop-scrm-shopmall/router',
method: 'GET', method: 'GET',
...@@ -11,7 +11,25 @@ const getListApi = params => { ...@@ -11,7 +11,25 @@ const getListApi = params => {
sign: true sign: true
}) })
} }
/**新增或编辑直播间 */
const addOrUpdataLiveRoomApi = params => {
params.method = `${defaultPath}add.or.update`
export default { getListApi } return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
/** 直播间详情 */
const LiveRoomDetailApi = params => {
params.method = `${defaultPath}detail`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
})
}
export default { getListApi, addOrUpdataLiveRoomApi, LiveRoomDetailApi }
...@@ -19,4 +19,38 @@ html { ...@@ -19,4 +19,38 @@ html {
.live-room.p-t-20 { .live-room.p-t-20 {
padding-top: 20px; padding-top: 20px;
}
\ No newline at end of file \ No newline at end of file
}
.live-room .table-circle {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 4px;
vertical-align: middle;
}
.live-room .back-orange {
background-color: #fdb757;
}
.live-room .back-blue {
background-color: #5850ff;
}
.live-room .back-grey {
background-color: #999999;
}
.live-room .back-green {
background-color: #2cca74;
}
.live-room .back-red {
background-color: #eb4e4e;
}
.live-room .m-r-8 {
margin-right: 8px;
}
.message-Z-zinde,
.live-room .message-Z-zinde {
z-index: 9999 !important;
}
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<div :class="['glsx-combi-form', isEdit ? 'gl-form-page' : '']"> <div :class="['glsx-combi-form', isEdit ? 'gl-form-page' : '']">
<el-form :ref="formRef" :inline="true" :model="formObj" :rules="formRules" size="small" class="glsx-combi-form-block"> <el-form :ref="formRef" :inline="true" :model="formObj" :rules="formRules" size="small" class="glsx-combi-form-block">
<template v-for="(item, index) in formData"> <template v-for="(item, index) in formData">
{{JSON.stringify(formData)}}
<el-form-item v-if="!item.isHide" :key="index" :id="item.name" :labelWidth="isEdit ? '154px' : labelWidth" :class="{ 'no-label': !item.label, isBlock: isBlock }" :style="{ 'margin-bottom': isEdit ? '24px' : '', 'margin-right': isEdit ? '0px' : '30px', ...item.style }" :label="item.label" :prop="item.name"> <el-form-item v-if="!item.isHide" :key="index" :id="item.name" :labelWidth="isEdit ? '154px' : labelWidth" :class="{ 'no-label': !item.label, isBlock: isBlock }" :style="{ 'margin-bottom': isEdit ? '24px' : '', 'margin-right': isEdit ? '0px' : '30px', ...item.style }" :label="item.label" :prop="item.name">
<span v-if="!item.isHide && item.tips" class="tips-block" slot="label"> <span v-if="!item.isHide && item.tips" class="tips-block" slot="label">
<span class="tips-label">{{ item.label }}</span> <span class="tips-label">{{ item.label }}</span>
......
...@@ -32,6 +32,13 @@ ...@@ -32,6 +32,13 @@
@setTableFinishFun="setTableFinishFun" @setTableFinishFun="setTableFinishFun"
> >
<div <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
class="table-btns" class="table-btns"
slot="auth-button" slot="auth-button"
slot-scope="scope" slot-scope="scope"
...@@ -45,15 +52,81 @@ ...@@ -45,15 +52,81 @@
</GLTable> </GLTable>
<!-- 表格区域 end --> <!-- 表格区域 end -->
<GLDialog <GLDialog
ref="dialogRef"
v-if="dialogObj.show" v-if="dialogObj.show"
:bigTitle="dialogObj.title" :title="dialogObj.type? '新建直播间' : '详情'"
mode="big"
:visible.sync="dialogObj.show" :visible.sync="dialogObj.show"
:close-on-click-modal="false" :close-on-click-modal="false"
@onOk="dialogObj.show = false" @onOk="handleCreateLiveRoom"
@onCancel="dialogObj.show = false" @onCancel="dialogObj.show = false"
:hasFooter="dialogObj.type == 1"
> >
<div class="dialog-look"> <div class="dialog-content">
<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"
>
<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>
</glsx-combi-form>
</template>
<template v-else>
<div class="el-form glsx-combi-form-block el-form--inline box">
<div class="el-form-item--small isBlock">
<label class="el-form-item__label">推流地址:</label>
<div class="el-form-item__content">
<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>
</el-input>
</div>
</div>
<div class="el-form-item--small isBlock">
<label class="el-form-item__label">播放地址:</label>
<div class="el-form-item__content">
<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>
</el-input>
</div>
</div>
</div>
</template>
</div> </div>
</GLDialog> </GLDialog>
</div> </div>
...@@ -63,38 +136,49 @@ ...@@ -63,38 +136,49 @@
<script> <script>
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
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: {
disabledDate (date) {
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1))
return date < yesterday
}
},
dialogObj: { dialogObj: {
show: false show: false
}, },
size: 'small', size: 'small',
url: url, url: url,
searchForm: { searchForm: {
classifyName: '', term: '',
createDate: [] status: ''
}, },
tableSearchForm: {}, tableSearchForm: {},
// 搜索 // 搜索
searchFormData: [ searchFormData: [
{ {
label: '直播间搜索', label: '直播间搜索',
name: 'classifyName', name: 'term',
type: 'input', type: 'input',
maxlength: 20 maxlength: 20
}, },
{ {
label: '直播状态', label: '直播状态',
name: 'type', name: 'status',
type: 'select', type: 'select',
width: '215px', width: '215px',
optionList: [], optionList: [
{ confId: '', confName: '全部' },
{ confId: '0', confName: '未开始' },
{ confId: '1', confName: '进行中' },
{ confId: '2', confName: '已结束' },
],
optionId: 'confId', optionId: 'confId',
optionLabel: 'confName', optionLabel: 'confName'
optionsName: 'statusList'
} }
], ],
// 表格 // 表格
...@@ -105,23 +189,20 @@ export default { ...@@ -105,23 +189,20 @@ export default {
tableColumns: [ tableColumns: [
{ {
label: '房间号', label: '房间号',
prop: 'classifyName' prop: 'roomNumber'
}, },
{ {
label: '直播间名称', label: '直播间名称',
prop: 'classifyName' prop: 'name'
}, },
{ {
label: '最近开播', label: '最近开播',
prop: 'classifyName' prop: 'liveTime'
}, },
{ {
label: '直播状态', label: '直播状态',
prop: 'createdDate', prop: 'status',
// width: '180', addHtml: 'status',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
} }
] ]
}, },
...@@ -134,12 +215,44 @@ export default { ...@@ -134,12 +215,44 @@ export default {
}, },
listeners: { listeners: {
click: row => { click: row => {
this.pageClick() 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' } pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
editChildRef: 'editChildRef',
editForm: {
name: '',
liveTime: []
},
configEditFormData: [
{
label: '直播间标题',
name: 'name',
type: 'input',
maxlength: 100,
},
{
label: '开播时间',
name: 'liveTime',
type: 'datePicker',
addHtml: 'liveTimeHtml'
}
],
editRule: {
name: [{ required: true, message: '请输入直播间标题', trigger: 'change' }],
liveTime: [{ required: true, message: '请选择开播时间', trigger: 'change' }],
},
liveDetail: {}
} }
}, },
...@@ -149,8 +262,12 @@ export default { ...@@ -149,8 +262,12 @@ export default {
methods: { methods: {
pageClick (type) { pageClick (type) {
this.editForm = {
name: '',
liveTime: []
}
this.dialogObj = { this.dialogObj = {
title: type == 1 ? '新建直播间' : '详情', type,
show: true show: true
} }
}, },
...@@ -179,10 +296,83 @@ export default { ...@@ -179,10 +296,83 @@ export default {
createDate: [] createDate: []
} }
this.handleSearch() this.handleSearch()
},
handleTimeChange (e) {
this.editForm.liveTime = e
},
handleCopy (txt) {
this.$message({
message: '复制成功',
type: 'success',
customClass: 'message-Z-zinde'
})
const input = document.createElement('input')
document.body.appendChild(input)
input.setAttribute('value', txt)
input.select()
document.execCommand('Copy')
document.body.removeChild(input)
},
handleCreateLiveRoom () {
this.$refs.configEditFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
let { name, liveTime } = this.editForm,
params = {
name
}
if (liveTime.length) {
let [startTimeStr, endTimeStr] = liveTime
params.startTimeStr = startTimeStr
params.endTimeStr = endTimeStr
}
this.loading = true
this.$apis.live
.addOrUpdataLiveRoomApi(params)
.then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message ? res.message : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleSearch()
this.dialogObj.show = false
}
})
.finally(() => {
this.loading = false
})
}
})
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.dialog-content {
.box {
padding-left: 20px;
.isBlock {
margin-bottom: 20px;
}
.el-form-item__content {
cursor: pointer;
}
.el-form-item__label {
width: 154px;
}
.el-input {
width: 284px;
height: 32px;
background: #ffffff;
border-radius: 4px;
/deep/.el-input__inner {
height: 100%;
}
/deep/.el-input__icon {
line-height: 32px;
}
}
}
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!