Commit 3a534f40 by 杨明

fixed

1 parent 39f2e24d
/*
* @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
}
...@@ -4,7 +4,7 @@ const dropdownList = params => { ...@@ -4,7 +4,7 @@ const dropdownList = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.dropdown.list` params.method = `scrm.api.shopmall.tencentcloudmedia.dropdown.list`
return http({ return http({
url: 'rop-scrm-shopmall/router', url: 'rop-scrm-shopmall/router',
method: 'GET', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
...@@ -14,7 +14,7 @@ const tencentcloudmediaDelete = params => { ...@@ -14,7 +14,7 @@ const tencentcloudmediaDelete = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.delete` params.method = `scrm.api.shopmall.tencentcloudmedia.delete`
return http({ return http({
url: 'rop-scrm-shopmall/router', url: 'rop-scrm-shopmall/router',
method: 'GET', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
...@@ -24,7 +24,7 @@ const tencentcloudmediaUpdate = params => { ...@@ -24,7 +24,7 @@ const tencentcloudmediaUpdate = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.add.or.update` params.method = `scrm.api.shopmall.tencentcloudmedia.add.or.update`
return http({ return http({
url: 'rop-scrm-shopmall/router', url: 'rop-scrm-shopmall/router',
method: 'GET', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
...@@ -34,7 +34,7 @@ const tencentcloudmediaDetail = params => { ...@@ -34,7 +34,7 @@ const tencentcloudmediaDetail = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.detail` params.method = `scrm.api.shopmall.tencentcloudmedia.detail`
return http({ return http({
url: 'rop-scrm-shopmall/router', url: 'rop-scrm-shopmall/router',
method: 'GET', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
...@@ -44,7 +44,7 @@ const tencentcloudmediaPage = params => { ...@@ -44,7 +44,7 @@ const tencentcloudmediaPage = params => {
params.method = `scrm.api.shopmall.tencentcloudmedia.page` params.method = `scrm.api.shopmall.tencentcloudmedia.page`
return http({ return http({
url: 'rop-scrm-shopmall/router', url: 'rop-scrm-shopmall/router',
method: 'GET', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
* @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
*/ */
import GlsxUpload from './glsxUpload' import GlsxUpload from './glsxUpload'
const upload = new GlsxUpload({ const upload = new GlsxUpload({
params: { params: {
data: { method: 'scrm.api.shopmall.livebroadcast.uploadsignature' }, data: { method: 'scrm.api.shopmall.tencentcloudmedia.uploadsignature' },
url: 'rop-scrm-shopmall/router' url: 'rop-scrm-shopmall/router'
} }
}) })
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn * @Author: yangming yangming@didihu.com.cn
* @Date: 2022-11-24 14:42:00 * @Date: 2022-11-24 14:42:00
* @LastEditors: yangming yangming@didihu.com.cn * @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-24 15:14:31 * @LastEditTime: 2022-11-24 17:18:31
* @FilePath: \live\src\mixins\upload.js * @FilePath: \live\src\mixins\upload.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
*/ */
...@@ -11,8 +11,7 @@ export default { ...@@ -11,8 +11,7 @@ export default {
return {} return {}
}, },
methods: { methods: {
getImgUrl(url) { getImgUrl(url, multiple = 3) {
console.log(url)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
var canvas = document.createElement('canvas') // 获取 canvas 对象 var canvas = document.createElement('canvas') // 获取 canvas 对象
const ctx = canvas.getContext('2d') // 绘制2d const ctx = canvas.getContext('2d') // 绘制2d
...@@ -21,11 +20,10 @@ export default { ...@@ -21,11 +20,10 @@ export default {
video.crossOrigin = 'anonymous' // 解决跨域问题,也就是提示污染资源无法转换视频 video.crossOrigin = 'anonymous' // 解决跨域问题,也就是提示污染资源无法转换视频
video.currentTime = 1 // 第一帧 video.currentTime = 1 // 第一帧
video.oncanplay = async () => { video.oncanplay = async () => {
console.log(video.clientWidth) canvas.width = video.clientWidth * multiple // 获取视频宽度
canvas.width = video.clientWidth // 获取视频宽度 canvas.height = video.clientHeight * multiple // 获取视频高度
canvas.height = video.clientHeight // 获取视频高度
// 利用canvas对象方法绘图 // 利用canvas对象方法绘图
ctx.drawImage(video, 0, 0, video.clientWidth, video.clientHeight) ctx.drawImage(video, 0, 0, video.clientWidth * multiple, video.clientHeight * multiple)
console.log(canvas, 'canvas') console.log(canvas, 'canvas')
// 转换成base64形式 // 转换成base64形式
var oGrayImg = canvas.toDataURL('image/png') // 截取后的视频封面 var oGrayImg = canvas.toDataURL('image/png') // 截取后的视频封面
...@@ -36,7 +34,7 @@ export default { ...@@ -36,7 +34,7 @@ export default {
}) })
}, },
//将base64转换为文件 //将base64转换为文件
dataURLtoFile(dataurl, filename = '1.png') { dataURLtoFile(dataurl, filename = 'file.png') {
var arr = dataurl.split(','), var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1], mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]), bstr = atob(arr[1]),
......
...@@ -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
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-25 13:48:47
* @FilePath: \live\src\utils\index.js
* @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) clearTimeout(timeout)
timeout = setTimeout(()=>{ timeout = setTimeout(() => {
func.call(this, event) func.call(this, event)
},wait) }, wait)
}
} }
}
export function dateFormat (dateTime, format = 'YYYY-MM-DD HH:mm') { export function dateFormat(dateTime, format = 'YYYY-MM-DD HH:mm') {
const date = new Date(dateTime) const date = new Date(dateTime)
const config = { const config = {
YYYY: date.getFullYear(), YYYY: date.getFullYear(),
...@@ -22,4 +30,11 @@ export function dateFormat (dateTime, format = 'YYYY-MM-DD HH:mm') { ...@@ -22,4 +30,11 @@ export function dateFormat (dateTime, format = 'YYYY-MM-DD HH:mm') {
format = format.replace(key, config[key]) format = format.replace(key, config[key])
} }
return format return format
}
\ No newline at end of file \ No newline at end of file
}
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)
}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<div class="live-table-header"> <div class="live-table-header">
<h2>短视频列表</h2> <h2>短视频列表</h2>
<el-button :size="size" type="primary" class="el-icon-plus" @click="pageClick">导出</el-button> <el-button :size="size" type="primary" class="el-icon-plus" @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="status" slot-scope="scope">
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<script> <script>
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
import { downloadUrl } from '@/utils'
export default { export default {
name: 'LiveIndex', name: 'LiveIndex',
...@@ -34,19 +34,19 @@ export default { ...@@ -34,19 +34,19 @@ export default {
searchFormData: [ searchFormData: [
{ {
label: '微信昵称', label: '微信昵称',
name: 'term', name: 'nickname',
type: 'input', type: 'input',
maxlength: 20 maxlength: 20
}, },
{ {
label: '手机号', label: '手机号',
name: 'term', name: 'phone',
type: 'input', type: 'input',
maxlength: 20 maxlength: 20
}, },
{ {
label: '来源门店', label: '来源门店',
name: 'term', name: 'visitSource',
type: 'input', type: 'input',
maxlength: 20 maxlength: 20
} }
...@@ -58,20 +58,19 @@ export default { ...@@ -58,20 +58,19 @@ export default {
tableColumns: [ tableColumns: [
{ {
label: '微信昵称', label: '微信昵称',
prop: 'roomNumber' prop: 'nickname'
}, },
{ {
label: '手机号', label: '手机号',
prop: 'name' prop: 'phone'
}, },
{ {
label: '访问来源', label: '访问来源',
prop: 'liveTime' prop: 'visitSource'
}, },
{ {
label: '来源门店', label: '来源门店',
prop: 'status', prop: 'sourceShopName'
addHtml: 'status'
}, },
{ {
label: '是否观看', label: '是否观看',
...@@ -80,12 +79,12 @@ export default { ...@@ -80,12 +79,12 @@ export default {
}, },
{ {
label: '观看时长', label: '观看时长',
prop: 'status', prop: 'visitDuration',
addHtml: 'status' addHtml: 'status'
}, },
{ {
label: '最后浏览', label: '最后浏览',
prop: 'status', prop: 'lastVisitTime',
addHtml: 'status' addHtml: 'status'
} }
] ]
...@@ -97,8 +96,10 @@ export default { ...@@ -97,8 +96,10 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
pageClick() { detailexport() {
this.$router.push('/shortVideo/uploadVideo') this.$apis.console.detailexport({}).then(res => {
downloadUrl(res)
})
}, },
getParams() { getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm)) var params = JSON.parse(JSON.stringify(this.searchForm))
......
...@@ -5,22 +5,22 @@ ...@@ -5,22 +5,22 @@
<div class="look-left"> <div class="look-left">
<div class="look-left-b"></div> <div class="look-left-b"></div>
<div class="look-left-content"> <div class="look-left-content">
<div class="look-title">测试</div> <div class="look-title">{{ room.name }}</div>
<div class="look-desc">开播时间:2022-08-31 14:20-14:34</div> <div class="look-desc">开播时间:{{ room.startTimeStr }}</div>
<div class="look-desc">房间号:60</div> <div class="look-desc">房间号:{{ room.id }}</div>
<div class="look-status">直播已结束00:03:34</div> <div class="look-status">直播已结束{{ room.name }}</div>
</div> </div>
</div> </div>
<div class="look-right"> <div class="look-right">
<div class="look-item"> <div class="look-item">
<div class="look-item-icon"><img src="@/assets/look.png" alt="" /></div> <div class="look-item-icon"><img src="@/assets/look.png" alt="" /></div>
<div class="look-item-text">观看</div> <div class="look-item-text">观看</div>
<div class="look-item-num">0</div> <div class="look-item-num">{{ room.totalVisitCnt }}</div>
</div> </div>
<div class="look-item"> <div class="look-item">
<div class="look-item-icon"><img src="@/assets/online.png" alt="" /></div> <div class="look-item-icon"><img src="@/assets/online.png" alt="" /></div>
<div class="look-item-text">在线</div> <div class="look-item-text">在线</div>
<div class="look-item-num">0</div> <div class="look-item-num">{{ room.totalOnlineCnt }}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -35,22 +35,22 @@ ...@@ -35,22 +35,22 @@
</div> </div>
<div class="data-desc"> <div class="data-desc">
<span>峰值在线人数</span> <span>峰值在线人数</span>
<span>1</span> <span>{{ base.visitPeakOnlineValue }}</span>
</div> </div>
<div class="data-desc"> <div class="data-desc">
<span>观看人数</span> <span>观看人数</span>
<span>1</span> <span>{{ base.visitNumberOfPeople }}</span>
</div> </div>
<div class="data-desc data-desc-jump"> <div class="data-desc data-desc-jump">
<span>观看次数</span> <span>观看次数</span>
<span> <span>
1 {{ base.visitNumberOfTimes }}
<a @click="handleLook">查看</a> <a @click="handleLook">查看</a>
</span> </span>
</div> </div>
<div class="data-desc"> <div class="data-desc">
<span>平均观看时长</span> <span>平均观看时长</span>
<span>1</span> <span>{{ base.visitAverageTime }}</span>
</div> </div>
</div> </div>
<div class="data-container-right"> <div class="data-container-right">
...@@ -60,11 +60,11 @@ ...@@ -60,11 +60,11 @@
</div> </div>
<div class="data-desc"> <div class="data-desc">
<span>评论人数</span> <span>评论人数</span>
<span>1</span> <span>{{ base.interactNumberOfPeople }}</span>
</div> </div>
<div class="data-desc"> <div class="data-desc">
<span>评论次数</span> <span>评论次数</span>
<span>1</span> <span>{{ base.interactNumberOfTimes }}</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<div class="container-tabel"> <div class="container-tabel">
<div class="live-table-header"> <div class="live-table-header">
<h2>数据列表</h2> <h2>数据列表</h2>
<el-button :size="size" type="primary" class="el-icon-plus" @click="pageClick">导出</el-button> <el-button :size="size" type="primary" class="el-icon-plus" @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 class="table-btns" slot="auth-button" slot-scope="scope"> <div class="table-btns" slot="auth-button" slot-scope="scope">
...@@ -106,6 +106,8 @@ export default { ...@@ -106,6 +106,8 @@ export default {
}, },
size: 'small', size: 'small',
url: url, url: url,
base: {},
room: {},
searchForm: { searchForm: {
term: '', term: '',
status: '' status: ''
...@@ -118,15 +120,15 @@ export default { ...@@ -118,15 +120,15 @@ export default {
tableColumns: [ tableColumns: [
{ {
label: '访问来源', label: '访问来源',
prop: 'roomNumber' prop: 'visitSource'
}, },
{ {
label: '观看直播总数', label: '观看直播总数',
prop: 'name' prop: 'totalVisitCnt'
}, },
{ {
label: '平均停留时长', label: '平均停留时长',
prop: 'liveTime' prop: 'averageStayTime'
} }
] ]
}, },
...@@ -158,8 +160,10 @@ export default { ...@@ -158,8 +160,10 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
handleLook() { detailexport() {
this.dialogVisible = true this.$apis.console.detailexport({}).then(res => {
downloadUrl(res)
})
}, },
pageClick() { pageClick() {
this.$router.push('/shortVideo/uploadVideo') this.$router.push('/shortVideo/uploadVideo')
......
...@@ -12,14 +12,14 @@ ...@@ -12,14 +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> <GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisibleDel = false" type="error" content="是否确认删除短视频?" :visible.sync="dialogVisibleDel" mode="small"></GLDialog>
</div> </div>
</div> </div>
</template> </template>
...@@ -65,7 +65,7 @@ export default { ...@@ -65,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,
...@@ -85,12 +85,11 @@ export default { ...@@ -85,12 +85,11 @@ export default {
{ {
label: '封面图', label: '封面图',
prop: 'coverUrl', prop: 'coverUrl',
addHtml: 'status' addHtml: 'coverUrl'
}, },
{ {
label: '创建日期', label: '创建日期',
prop: 'createdDate', prop: 'createdDate'
addHtml: 'status'
}, },
{ {
label: '状态', label: '状态',
...@@ -115,7 +114,7 @@ export default { ...@@ -115,7 +114,7 @@ export default {
}, },
listeners: { listeners: {
click: row => { click: row => {
this.pageClick(row) this.$router.push(`/shortVideo/uploadVideo?id=${row.id}`)
} }
} }
}, },
...@@ -147,7 +146,25 @@ export default { ...@@ -147,7 +146,25 @@ export default {
this.dialogVisibleDel = true 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))
...@@ -170,8 +187,8 @@ export default { ...@@ -170,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.fileName" placeholder="请输入内容"></el-input>
</el-form-item> </el-form-item>
</div> <el-form-item label="宣传文案:" class="dis-in-block">
<div class="broadcast-item">
<el-form-item label="宣传文案" class="dis-in-block">
<el-input type="textarea" rows="2" placeholder="请输入内容" class="desc-input" v-model="uploadForm.introduction"></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> <el-form-item label="视频:" class="dis-in-block" prop="mediaUrl">
<div class="broadcast-item">
<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.mediaUrl"> <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>
...@@ -31,9 +26,7 @@ ...@@ -31,9 +26,7 @@
<input v-if="!uploadForm.mediaUrl" 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> <el-form-item label="封面:" class="dis-in-block" prop="coverUrl">
<div class="broadcast-item">
<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.coverUrl"> <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>
...@@ -49,7 +42,6 @@ ...@@ -49,7 +42,6 @@
<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" /> <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> </el-form-item>
</div>
</el-form> </el-form>
</div> </div>
</div> </div>
...@@ -79,9 +71,17 @@ export default { ...@@ -79,9 +71,17 @@ export default {
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: {
...@@ -99,11 +99,14 @@ export default { ...@@ -99,11 +99,14 @@ export default {
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.loading = false
self.$refs['uploadForm'].clearValidate('mediaUrl')
const videoUrl = res.video.url const videoUrl = res.video.url
self.$set(self.uploadForm, 'mediaUrl', videoUrl) self.$set(self.uploadForm, 'mediaUrl', videoUrl)
self.$nextTick(() => { self.$nextTick(() => {
...@@ -133,14 +136,33 @@ export default { ...@@ -133,14 +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.$refs['uploadForm'].clearValidate('coverUrl')
this.$set(this.uploadForm, 'coverUrl', res)
})
}
},
handleUp() {
this.$refs['uploadForm'].validate(valid => {
if (valid) {
this.$apis.shortVideo.tencentcloudmediaUpdate().then(res => {
this.$set(this.uploadForm, 'coverUrl', res) this.$set(this.uploadForm, 'coverUrl', res)
}) })
} }
})
}, },
handleUp() {} mediaDetail() {
const { id } = this.uploadForm
this.$apis.shortVideo.tencentcloudmediaDetail(id).then(res => {
this.uploadForm = res
})
}
}, },
mounted() { mounted() {
this.getImgUrl() 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!