Commit 39f2e24d by 杨明

fixed

1 parent 1d179998
import { http } from '@/main'
//分页查询媒体文件列表
const dropdownList = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.dropdown.list`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
//删除媒体文件
const tencentcloudmediaDelete = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.delete`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
//新增或编辑媒体文件
const tencentcloudmediaUpdate = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.add.or.update`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
//媒体文件详情
const tencentcloudmediaDetail = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.detail`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
//分页查询媒体文件列表
const tencentcloudmediaPage = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.page`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
export default {
dropdownList,
tencentcloudmediaPage,
tencentcloudmediaDetail,
tencentcloudmediaUpdate,
tencentcloudmediaDelete
}
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2022-11-24 14:42:00
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-24 15:14: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) {
console.log(url)
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 () => {
console.log(video.clientWidth)
canvas.width = video.clientWidth // 获取视频宽度
canvas.height = video.clientHeight // 获取视频高度
// 利用canvas对象方法绘图
ctx.drawImage(video, 0, 0, video.clientWidth, video.clientHeight)
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 = '1.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)
})
}
})
}
}
}
<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="pageClick">导出</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'
export default {
name: 'LiveIndex',
data() {
return {
size: 'small',
url: url,
searchForm: {
term: '',
status: ''
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '微信昵称',
name: 'term',
type: 'input',
maxlength: 20
},
{
label: '手机号',
name: 'term',
type: 'input',
maxlength: 20
},
{
label: '来源门店',
name: 'term',
type: 'input',
maxlength: 20
}
],
// 表格
getListApi: this.$apis.live.getListApi,
tableParams: {
listName: 'list',
tableColumns: [
{
label: '微信昵称',
prop: 'roomNumber'
},
{
label: '手机号',
prop: 'name'
},
{
label: '访问来源',
prop: 'liveTime'
},
{
label: '来源门店',
prop: 'status',
addHtml: 'status'
},
{
label: '是否观看',
prop: 'status',
addHtml: 'status'
},
{
label: '观看时长',
prop: 'status',
addHtml: 'status'
},
{
label: '最后浏览',
prop: 'status',
addHtml: 'status'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
}
},
mounted() {},
methods: {
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>
.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">测试</div>
<div class="look-desc">开播时间:2022-08-31 14:20-14:34</div>
<div class="look-desc">房间号:60</div>
<div class="look-status">直播已结束00:03:34</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">0</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">0</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>1</span>
</div>
<div class="data-desc">
<span>观看人数</span>
<span>1</span>
</div>
<div class="data-desc data-desc-jump">
<span>观看次数</span>
<span>
1
<a @click="handleLook">查看</a>
</span>
</div>
<div class="data-desc">
<span>平均观看时长</span>
<span>1</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>1</span>
</div>
<div class="data-desc">
<span>评论次数</span>
<span>1</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="pageClick">导出</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,
searchForm: {
term: '',
status: ''
},
// 表格
getListApi: this.$apis.live.getListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '访问来源',
prop: 'roomNumber'
},
{
label: '观看直播总数',
prop: 'name'
},
{
label: '平均停留时长',
prop: 'liveTime'
}
]
},
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: {
handleLook() {
this.dialogVisible = true
},
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>
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<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',
...@@ -82,20 +76,20 @@ export default { ...@@ -82,20 +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: 'status'
}, },
{ {
label: '创建日期', label: '创建日期',
prop: 'status', prop: 'createdDate',
addHtml: 'status' addHtml: 'status'
}, },
{ {
...@@ -136,11 +130,7 @@ export default { ...@@ -136,11 +130,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,6 +142,10 @@ export default { ...@@ -152,6 +142,10 @@ 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')
}, },
......
...@@ -6,41 +6,41 @@ ...@@ -6,41 +6,41 @@
<el-form ref="uploadForm" :model="uploadForm" label-width="120px"> <el-form ref="uploadForm" :model="uploadForm" label-width="120px">
<div class="broadcast-item"> <div class="broadcast-item">
<el-form-item label="视频名称" class="dis-in-block"> <el-form-item label="视频名称" class="dis-in-block">
<el-input v-model="uploadForm.name" placeholder="请输入内容"></el-input> <el-input v-model="uploadForm.fileName" placeholder="请输入内容"></el-input>
</el-form-item> </el-form-item>
</div> </div>
<div class="broadcast-item"> <div class="broadcast-item">
<el-form-item label="宣传文案" class="dis-in-block"> <el-form-item label="宣传文案" class="dis-in-block">
<el-input type="textarea" rows="2" placeholder="请输入内容" class="desc-input" v-model="uploadForm.name"></el-input> <el-input type="textarea" rows="2" placeholder="请输入内容" class="desc-input" v-model="uploadForm.introduction"></el-input>
</el-form-item> </el-form-item>
</div> </div>
<div class="broadcast-item"> <div class="broadcast-item">
<el-form-item label="视频" class="dis-in-block"> <el-form-item label="视频" class="dis-in-block">
<div class="activity-img muti-imgs img-w-h"> <div class="activity-img muti-imgs img-w-h">
<div class="add-border" v-show="!uploadForm.videoSrc"> <div class="add-border" v-show="!uploadForm.mediaUrl">
<div class="add-icon"><i class="el-icon-plus"></i></div> <div class="add-icon"><i class="el-icon-plus"></i></div>
<div class="add-text">上传</div> <div class="add-text">上传</div>
</div> </div>
<div class="video-panel" v-if="uploadForm.videoSrc"> <div class="video-panel" v-if="uploadForm.mediaUrl">
<video id="video" width="100%" height="100%" preload loop muted> <video id="video" width="100%" height="100%" preload loop muted>
<source :src="uploadForm.videoSrc" type="video/mp4" /> <source :src="uploadForm.mediaUrl" type="video/mp4" />
</video> </video>
<i class="el-icon-video-play" @click="handleLook('video')"></i> <i class="el-icon-video-play" @click="handleLook('video')"></i>
<i class="el-icon-close" @click="uploadForm.videoSrc = ''"></i> <i class="el-icon-close" @click="uploadForm.mediaUrl = ''"></i>
</div> </div>
<input v-if="!uploadForm.videoSrc" type="file" class="activity-Input img-w-h" accept="video/*" @change="e => handleVideoChange(e)" style="opacity: 0" /> <input v-if="!uploadForm.mediaUrl" type="file" class="activity-Input img-w-h" accept="video/*" @change="e => handleVideoChange(e)" style="opacity: 0" />
</div> </div>
</el-form-item> </el-form-item>
</div> </div>
<div class="broadcast-item"> <div class="broadcast-item">
<el-form-item label="封面" class="dis-in-block"> <el-form-item label="封面" class="dis-in-block">
<div class="activity-img muti-imgs img-w-h"> <div class="activity-img muti-imgs img-w-h">
<div class="add-border" v-show="!uploadForm.imgSrc"> <div class="add-border" v-show="!uploadForm.coverUrl">
<div class="add-icon"><i class="el-icon-plus"></i></div> <div class="add-icon"><i class="el-icon-plus"></i></div>
<div class="add-text">上传</div> <div class="add-text">上传</div>
</div> </div>
<img class="img-w-h" :src="uploadForm.imgSrc" v-show="uploadForm.imgSrc" /> <img class="img-w-h" :src="uploadForm.coverUrl" v-show="uploadForm.coverUrl" />
<span class="img-btns" v-show="uploadForm.imgSrc"> <span class="img-btns" v-show="uploadForm.coverUrl">
<span class="btn-item"> <span class="btn-item">
<i @click="handleImgDelete" class="el-icon-delete" /> <i @click="handleImgDelete" class="el-icon-delete" />
<i @click="handleLook('img')" class="el-icon-zoom-in" /> <i @click="handleLook('img')" class="el-icon-zoom-in" />
...@@ -70,9 +70,11 @@ ...@@ -70,9 +70,11 @@
<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',
...@@ -84,16 +86,15 @@ export default { ...@@ -84,16 +86,15 @@ export default {
}, },
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
...@@ -103,7 +104,13 @@ export default { ...@@ -103,7 +104,13 @@ export default {
upload upload
.uploaded(file) .uploaded(file)
.then(res => { .then(res => {
self.$set(self.uploadForm, 'videoSrc', res.video.url) 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 +133,14 @@ export default { ...@@ -126,11 +133,14 @@ 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.$set(this.uploadForm, 'coverUrl', res)
}) })
} }
}, },
handleUp() {} handleUp() {}
},
mounted() {
this.getImgUrl()
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!