Commit e6281a9c by xuyl

Merge branch 'v3.2.0' of http://192.168.3.233:8090/saas/live into xuyl_dev_v3.2.0

2 parents effd41d1 1e938621
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2022-11-24 16:20:21
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-25 09:32:28
* @FilePath: \live\src\api\modules\console.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { http } from '@/main'
//基本信息
const consoleBasic = params => {
params.method = `scrm.api.shopmall.livebroadcast.console.basic`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
//流量数据-详情列表导出
const detailexport = params => {
params.method = `scrm.api.shopmall.livebroadcast.console.detailexport`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
//流量数据-详情列表查询(分页)
const detailpage = params => {
params.method = `scrm.api.shopmall.livebroadcast.console.detailpage`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
//直播间信息
const consoleInfo = params => {
params.method = `scrm.api.shopmall.livebroadcast.console.info`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
//分页查询流量数据列表
const consolePage = params => {
params.method = `scrm.api.shopmall.livebroadcast.console.page`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
consoleBasic,
consolePage,
consoleInfo,
detailpage,
detailexport
}
import { http } from '@/main'
//分页查询媒体文件列表
const dropdownList = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.dropdown.list`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
//删除媒体文件
const tencentcloudmediaDelete = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.delete`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
//新增或编辑媒体文件
const tencentcloudmediaUpdate = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.add.or.update`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
//媒体文件详情
const tencentcloudmediaDetail = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.detail`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
//分页查询媒体文件列表
const tencentcloudmediaPage = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.page`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
dropdownList,
tencentcloudmediaPage,
tencentcloudmediaDetail,
tencentcloudmediaUpdate,
tencentcloudmediaDelete
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn * @Author: yangming yangming@didihu.com.cn
* @Date: 2022-11-23 15:53:36 * @Date: 2022-11-23 15:53:36
* @LastEditors: yangming yangming@didihu.com.cn * @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-23 16:36:43 * @LastEditTime: 2022-11-24 16:07:41
* @FilePath: \live\src\api\uploadApi.js * @FilePath: \live\src\api\uploadApi.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
*/ */
......
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2022-11-24 14:42:00
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-24 17:18:31
* @FilePath: \live\src\mixins\upload.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
export default {
data() {
return {}
},
methods: {
getImgUrl(url, multiple = 3) {
return new Promise((resolve, reject) => {
var canvas = document.createElement('canvas') // 获取 canvas 对象
const ctx = canvas.getContext('2d') // 绘制2d
let video = document.getElementById('video')
video.src = url
video.crossOrigin = 'anonymous' // 解决跨域问题,也就是提示污染资源无法转换视频
video.currentTime = 1 // 第一帧
video.oncanplay = async () => {
canvas.width = video.clientWidth * multiple // 获取视频宽度
canvas.height = video.clientHeight * multiple // 获取视频高度
// 利用canvas对象方法绘图
ctx.drawImage(video, 0, 0, video.clientWidth * multiple, video.clientHeight * multiple)
console.log(canvas, 'canvas')
// 转换成base64形式
var oGrayImg = canvas.toDataURL('image/png') // 截取后的视频封面
const file = this.dataURLtoFile(oGrayImg)
const imgUrl = await this.uploadImg(file)
resolve(imgUrl)
}
})
},
//将base64转换为文件
dataURLtoFile(dataurl, filename = 'file.png') {
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
return new File([u8arr], filename, { type: mime })
},
// // 图片上传
uploadImg(fileInfo) {
return new Promise((resolve, reject) => {
var reader = new FileReader()
reader.readAsDataURL(fileInfo)
reader.onload = e => {
const imgFile = e.target.result
const base64 = fileInfo.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
resolve(res)
})
}
})
}
}
}
...@@ -20,7 +20,7 @@ export async function bootstrap({ history, common, messenger, globalState }) { ...@@ -20,7 +20,7 @@ export async function bootstrap({ history, common, messenger, globalState }) {
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: globalState.session.token } }) 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'] })
const routesData = common.utils.deepClone(globalState.routers) const routesData = common.utils.deepClone(globalState.routers)
......
export function debounce(func, wait= 200){ /*
let timeout; * @Author: yangming yangming@didihu.com.cn
return function(event){ * @Date: 2022-11-23 11:06:49
clearTimeout(timeout) * @LastEditors: yangming yangming@didihu.com.cn
timeout = setTimeout(()=>{ * @LastEditTime: 2022-11-25 13:48:47
func.call(this, event) * @FilePath: \live\src\utils\index.js
},wait) * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
export function debounce(func, wait = 200) {
let timeout
return function(event) {
clearTimeout(timeout)
timeout = setTimeout(() => {
func.call(this, event)
}, wait)
} }
} }
export function dateFormat (dateTime, format = 'YYYY-MM-DD HH:mm') {
const date = new Date(dateTime)
const config = {
YYYY: date.getFullYear(),
MM: date.getMonth() + 1, //getMonth() 方法根据本地时间返回指定日期的月份(从 0 到 11)
DD: date.getDate(),
HH: date.getHours(),
mm: date.getMinutes(),
ss: date.getSeconds()
}
for (const key in config) {
format = format.replace(key, config[key])
}
return format
}
\ No newline at end of file \ No newline at end of file
export function dateFormat(dateTime, format = 'YYYY-MM-DD HH:mm') {
const date = new Date(dateTime)
const config = {
YYYY: date.getFullYear(),
MM: date.getMonth() + 1, //getMonth() 方法根据本地时间返回指定日期的月份(从 0 到 11)
DD: date.getDate(),
HH: date.getHours(),
mm: date.getMinutes(),
ss: date.getSeconds()
}
for (const key in config) {
format = format.replace(key, config[key])
}
return format
}
export function downloadUrl(url) {
const link = document.createElement('a')
link.href = url.replace(/(http|https):/, '')
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
<template>
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<!-- 表格区域 开始 -->
<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 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>
</GLTable>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import { downloadUrl } from '@/utils'
export default {
name: 'LiveIndex',
data() {
return {
size: 'small',
url: url,
searchForm: {
term: '',
status: ''
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '微信昵称',
name: 'nickname',
type: 'input',
maxlength: 20
},
{
label: '手机号',
name: 'phone',
type: 'input',
maxlength: 20
},
{
label: '来源门店',
name: 'visitSource',
type: 'input',
maxlength: 20
}
],
// 表格
getListApi: this.$apis.live.getListApi,
tableParams: {
listName: 'list',
tableColumns: [
{
label: '微信昵称',
prop: 'nickname'
},
{
label: '手机号',
prop: 'phone'
},
{
label: '访问来源',
prop: 'visitSource'
},
{
label: '来源门店',
prop: 'sourceShopName'
},
{
label: '是否观看',
prop: 'status',
addHtml: 'status'
},
{
label: '观看时长',
prop: 'visitDuration',
addHtml: 'status'
},
{
label: '最后浏览',
prop: 'lastVisitTime',
addHtml: 'status'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
}
},
mounted() {},
methods: {
detailexport() {
this.$apis.console.detailexport({}).then(res => {
downloadUrl(res)
})
},
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>
.container {
::v-deep {
.el-form-item--small {
width: 25%;
}
}
.live-table-header {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
}
}
</style>
<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>
...@@ -12,13 +12,14 @@ ...@@ -12,13 +12,14 @@
</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 :class="['table-circle', scope.scope.status == 1 ? 'back-blue' : 'back-grey']"></span>
<span>{{ scope.scope.statusStr || '--' }}</span> <span>{{ scope.scope.statusStr || '--' }}</span>
</div> </div>
<div class="table-btns" slot="auth-button" slot-scope="scope"> <div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton> <GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
</div> </div>
</GLTable> </GLTable>
<GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisibleDel = false" type="error" content="是否确认删除短视频?" :visible.sync="dialogVisibleDel" mode="small"></GLDialog>
</div> </div>
</div> </div>
</template> </template>
...@@ -31,15 +32,8 @@ export default { ...@@ -31,15 +32,8 @@ export default {
data() { data() {
return { return {
pickerOptions: { dialogVisibleDel: false,
disabledDate(date) { selectItem: '',
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1))
return date < yesterday
}
},
dialogObj: {
show: false
},
size: 'small', size: 'small',
url: url, url: url,
searchForm: { searchForm: {
...@@ -62,8 +56,8 @@ export default { ...@@ -62,8 +56,8 @@ export default {
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: '已删除' }
], ],
optionId: 'confId', optionId: 'confId',
...@@ -71,7 +65,7 @@ export default { ...@@ -71,7 +65,7 @@ export default {
} }
], ],
// 表格 // 表格
getListApi: this.$apis.live.getListApi, getListApi: this.$apis.shortVideo.tencentcloudmediaPage,
tableParams: { tableParams: {
listName: 'list', listName: 'list',
tableOption: true, tableOption: true,
...@@ -82,21 +76,20 @@ export default { ...@@ -82,21 +76,20 @@ export default {
}, },
{ {
label: '视频名称', label: '视频名称',
prop: 'name' prop: 'fileName'
}, },
{ {
label: '宣传文案', label: '宣传文案',
prop: 'liveTime' prop: 'introduction'
}, },
{ {
label: '封面图', label: '封面图',
prop: 'status', prop: 'coverUrl',
addHtml: 'status' addHtml: 'coverUrl'
}, },
{ {
label: '创建日期', label: '创建日期',
prop: 'status', prop: 'createdDate'
addHtml: 'status'
}, },
{ {
label: '状态', label: '状态',
...@@ -121,7 +114,7 @@ export default { ...@@ -121,7 +114,7 @@ export default {
}, },
listeners: { listeners: {
click: row => { click: row => {
this.pageClick(row) this.$router.push(`/shortVideo/uploadVideo?id=${row.id}`)
} }
} }
}, },
...@@ -136,11 +129,7 @@ export default { ...@@ -136,11 +129,7 @@ export default {
}, },
listeners: { listeners: {
click: row => { click: row => {
this.$apis.live.LiveRoomDetailApi({ id: row.id }).then(res => { this.handleDelete(row)
console.log(JSON.parse(JSON.stringify(res)))
this.liveDetail = res
this.pageClick()
})
} }
} }
} }
...@@ -152,8 +141,30 @@ export default { ...@@ -152,8 +141,30 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
handleDelete(row) {
this.selectItem = row
this.dialogVisibleDel = true
},
pageClick() { pageClick() {
this.$router.push('/shortVideo/uploadVideo') this.$router.push(`/shortVideo/uploadVideo`)
},
handleSure() {
const { id } = this.selectItem
this.$apis.shortVideo
.tencentcloudmediaDelete({
id
})
.then(res => {
if (res) {
this.$message({
type: 'success',
message: '删除成功!'
})
}
this.handleSearch()
})
this.dialogVisibleDel = false
}, },
getParams() { getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm)) var params = JSON.parse(JSON.stringify(this.searchForm))
...@@ -176,8 +187,8 @@ export default { ...@@ -176,8 +187,8 @@ export default {
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
classifyName: '', term: '',
createDate: [] status: ''
} }
this.handleSearch() this.handleSearch()
} }
......
<template> <template>
<div class="broadcast-container"> <div class="broadcast-container" v-loading="loading">
<div class="broadcast-content"> <div class="broadcast-content">
<div class="edit-title">上传视频</div> <div class="edit-title">上传视频</div>
<div class="broadcast-panel"> <div class="broadcast-panel gl-form-page">
<el-form ref="uploadForm" :model="uploadForm" label-width="120px"> <el-form ref="uploadForm" :model="uploadForm" label-width="120px" :rules="uploadRules">
<div class="broadcast-item"> <el-form-item label="视频名称:" class="dis-in-block" prop="fileName">
<el-form-item label="视频名称" class="dis-in-block"> <el-input v-model="uploadForm.fileName" placeholder="请输入内容"></el-input>
<el-input v-model="uploadForm.name" placeholder="请输入内容"></el-input> </el-form-item>
</el-form-item> <el-form-item label="宣传文案:" class="dis-in-block">
</div> <el-input type="textarea" rows="2" placeholder="请输入内容" class="desc-input" v-model="uploadForm.introduction"></el-input>
<div class="broadcast-item"> </el-form-item>
<el-form-item label="宣传文案" class="dis-in-block"> <el-form-item label="视频:" class="dis-in-block" prop="mediaUrl">
<el-input type="textarea" rows="2" placeholder="请输入内容" class="desc-input" v-model="uploadForm.name"></el-input> <div class="activity-img muti-imgs img-w-h">
</el-form-item> <div class="add-border" v-show="!uploadForm.mediaUrl">
</div> <div class="add-icon"><i class="el-icon-plus"></i></div>
<div class="broadcast-item"> <div class="add-text">上传</div>
<el-form-item label="视频" class="dis-in-block">
<div class="activity-img muti-imgs img-w-h">
<div class="add-border" v-show="!uploadForm.videoSrc">
<div class="add-icon"><i class="el-icon-plus"></i></div>
<div class="add-text">上传</div>
</div>
<div class="video-panel" v-if="uploadForm.videoSrc">
<video id="video" width="100%" height="100%" preload loop muted>
<source :src="uploadForm.videoSrc" type="video/mp4" />
</video>
<i class="el-icon-video-play" @click="handleLook('video')"></i>
<i class="el-icon-close" @click="uploadForm.videoSrc = ''"></i>
</div>
<input v-if="!uploadForm.videoSrc" type="file" class="activity-Input img-w-h" accept="video/*" @change="e => handleVideoChange(e)" style="opacity: 0" />
</div> </div>
</el-form-item> <div class="video-panel" v-if="uploadForm.mediaUrl">
</div> <video id="video" width="100%" height="100%" preload loop muted>
<div class="broadcast-item"> <source :src="uploadForm.mediaUrl" type="video/mp4" />
<el-form-item label="封面" class="dis-in-block"> </video>
<div class="activity-img muti-imgs img-w-h"> <i class="el-icon-video-play" @click="handleLook('video')"></i>
<div class="add-border" v-show="!uploadForm.imgSrc"> <i class="el-icon-close" @click="uploadForm.mediaUrl = ''"></i>
<div class="add-icon"><i class="el-icon-plus"></i></div> </div>
<div class="add-text">上传</div> <input v-if="!uploadForm.mediaUrl" type="file" class="activity-Input img-w-h" accept="video/*" @change="e => handleVideoChange(e)" style="opacity: 0" />
</div> </div>
<img class="img-w-h" :src="uploadForm.imgSrc" v-show="uploadForm.imgSrc" /> </el-form-item>
<span class="img-btns" v-show="uploadForm.imgSrc"> <el-form-item label="封面:" class="dis-in-block" prop="coverUrl">
<span class="btn-item"> <div class="activity-img muti-imgs img-w-h">
<i @click="handleImgDelete" class="el-icon-delete" /> <div class="add-border" v-show="!uploadForm.coverUrl">
<i @click="handleLook('img')" class="el-icon-zoom-in" /> <div class="add-icon"><i class="el-icon-plus"></i></div>
</span> <div class="add-text">上传</div>
</span>
<input type="file" class="activity-Input img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleImgChange(e)" style="opacity: 0" />
</div> </div>
</el-form-item> <img class="img-w-h" :src="uploadForm.coverUrl" v-show="uploadForm.coverUrl" />
</div> <span class="img-btns" v-show="uploadForm.coverUrl">
<span class="btn-item">
<i @click="handleImgDelete" class="el-icon-delete" />
<i @click="handleLook('img')" class="el-icon-zoom-in" />
</span>
</span>
<input type="file" class="activity-Input img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleImgChange(e)" style="opacity: 0" />
</div>
</el-form-item>
</el-form> </el-form>
</div> </div>
</div> </div>
...@@ -70,40 +62,58 @@ ...@@ -70,40 +62,58 @@
<script> <script>
import upload from '@/api/uploadApi' import upload from '@/api/uploadApi'
import uploadMixin from '@/mixins/upload'
// const upload = new GlsxUpload({ baseURL: 'http://scrm.dev.glsx.com.cn' }) // const upload = new GlsxUpload({ baseURL: 'http://scrm.dev.glsx.com.cn' })
export default { export default {
name: 'uploadVideo', name: 'uploadVideo',
mixins: [uploadMixin],
data() { data() {
return { return {
size: 'small', size: 'small',
dialogVisibleImg: false, dialogVisibleImg: false,
uploadForm: {}, loading: false,
uploadForm: {
id: ''
},
dialogSrc: '', dialogSrc: '',
dialogType: '' dialogType: '',
uploadRules: {
fileName: [{ required: true, message: '请输入视频名称', trigger: 'blur' }],
mediaUrl: [{ required: true, message: '请选择视频', trigger: 'blur' }],
coverUrl: [{ required: true, message: '请选择封面', trigger: 'blur' }]
}
} }
}, },
methods: { methods: {
handleImgDelete() { handleImgDelete() {
this.uploadForm.imgSrc = '' this.uploadForm.coverUrl = ''
}, },
handleLook(type) { handleLook(type) {
this.dialogType = type this.dialogType = type
this.dialogVisibleImg = true this.dialogVisibleImg = true
this.dialogSrc = type == 'img' ? this.uploadForm.imgSrc : this.uploadForm.videoSrc this.dialogSrc = type == 'img' ? this.uploadForm.coverUrl : this.uploadForm.mediaUrl
}, },
handleClose() { handleClose() {
this.close({ tagName: '/broadcastShort' }) this.$router.push('/shortVideo/index')
this.$router.push({ name: 'broadcastShort' })
}, },
handleVideoChange(e) { handleVideoChange(e) {
const self = this const self = this
let file = e.target.files[0] let file = e.target.files[0]
self.loading = true
upload.init().then(res => { upload.init().then(res => {
if (res.status == 0) { if (res.status == 0) {
upload upload
.uploaded(file) .uploaded(file)
.then(res => { .then(res => {
self.$set(self.uploadForm, 'videoSrc', res.video.url) self.loading = false
self.$refs['uploadForm'].clearValidate('mediaUrl')
const videoUrl = res.video.url
self.$set(self.uploadForm, 'mediaUrl', videoUrl)
self.$nextTick(() => {
self.getImgUrl(videoUrl).then(res => {
self.$set(self.uploadForm, 'coverUrl', res)
})
})
}) })
.finally(end => { .finally(end => {
console.log(end) console.log(end)
...@@ -126,11 +136,33 @@ export default { ...@@ -126,11 +136,33 @@ export default {
const imgFile = e.target.result const imgFile = e.target.result
const base64 = fileInfo.name.split('.')[1] + '@' + imgFile.split(',')[1] const base64 = fileInfo.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64 }).then(res => { this.$apis.common.pictureUpload({ file: base64 }).then(res => {
this.$set(this.uploadForm, 'imgSrc', res) this.$refs['uploadForm'].clearValidate('coverUrl')
this.$set(this.uploadForm, 'coverUrl', res)
}) })
} }
}, },
handleUp() {} handleUp() {
this.$refs['uploadForm'].validate(valid => {
if (valid) {
this.$apis.shortVideo.tencentcloudmediaUpdate().then(res => {
this.$set(this.uploadForm, 'coverUrl', res)
})
}
})
},
mediaDetail() {
const { id } = this.uploadForm
this.$apis.shortVideo.tencentcloudmediaDetail(id).then(res => {
this.uploadForm = res
})
}
},
mounted() {
const { id } = this.$route.query
if (id) {
this.uploadForm.id = id
this.mediaDetail()
}
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!