Commit f84a8d74 by 李伟康

提交代码

1 parent e793b118
import { http } from '@/main'
const defaultPath = 'scrm.api.shopmall.'
const defaultPath = 'scrm.api.shopmall.livebroadcast.'
const getListApi = params => {
params.method = `${defaultPath}classify.page.curMerchant`
params.method = `${defaultPath}page`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
......@@ -11,7 +11,25 @@ const getListApi = params => {
sign: true
})
}
export default { getListApi }
/**新增或编辑直播间 */
const addOrUpdataLiveRoomApi = params => {
params.method = `${defaultPath}add.or.update`
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 {
.live-room.p-t-20 {
padding-top: 20px;
}
\ 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 @@
<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">
<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">
<span v-if="!item.isHide && item.tips" class="tips-block" slot="label">
<span class="tips-label">{{ item.label }}</span>
......
......@@ -32,6 +32,13 @@
@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
class="table-btns"
slot="auth-button"
slot-scope="scope"
......@@ -45,15 +52,81 @@
</GLTable>
<!-- 表格区域 end -->
<GLDialog
ref="dialogRef"
v-if="dialogObj.show"
:bigTitle="dialogObj.title"
mode="big"
:title="dialogObj.type? '新建直播间' : '详情'"
:visible.sync="dialogObj.show"
:close-on-click-modal="false"
@onOk="dialogObj.show = false"
@onOk="handleCreateLiveRoom"
@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>
</GLDialog>
</div>
......@@ -63,38 +136,49 @@
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
export default {
name: 'LiveIndex',
data () {
return {
pickerOptions: {
disabledDate (date) {
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1))
return date < yesterday
}
},
dialogObj: {
show: false
},
size: 'small',
url: url,
searchForm: {
classifyName: '',
createDate: []
term: '',
status: ''
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '直播间搜索',
name: 'classifyName',
name: 'term',
type: 'input',
maxlength: 20
},
{
label: '直播状态',
name: 'type',
name: 'status',
type: 'select',
width: '215px',
optionList: [],
optionList: [
{ confId: '', confName: '全部' },
{ confId: '0', confName: '未开始' },
{ confId: '1', confName: '进行中' },
{ confId: '2', confName: '已结束' },
],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'statusList'
optionLabel: 'confName'
}
],
// 表格
......@@ -105,23 +189,20 @@ export default {
tableColumns: [
{
label: '房间号',
prop: 'classifyName'
prop: 'roomNumber'
},
{
label: '直播间名称',
prop: 'classifyName'
prop: 'name'
},
{
label: '最近开播',
prop: 'classifyName'
prop: 'liveTime'
},
{
label: '直播状态',
prop: 'createdDate',
// width: '180',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
prop: 'status',
addHtml: 'status',
}
]
},
......@@ -134,12 +215,44 @@ export default {
},
listeners: {
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 {
methods: {
pageClick (type) {
this.editForm = {
name: '',
liveTime: []
}
this.dialogObj = {
title: type == 1 ? '新建直播间' : '详情',
type,
show: true
}
},
......@@ -179,10 +296,83 @@ export default {
createDate: []
}
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>
<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>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!