Commit 796ca205 by 前端

Merge branch 'xuyl_dev_v3.2.0' into 'master'

合并代码3.2代码到master

See merge request !33
2 parents 0e166c61 e16ce999
...@@ -9,12 +9,14 @@ ...@@ -9,12 +9,14 @@
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"axios": "^0.18.0",
"core-js": "^3.4.4", "core-js": "^3.4.4",
"dayjs": "^1.10.7", "dayjs": "^1.10.7",
"el-tree-transfer": "^2.2.6", "el-tree-transfer": "^2.2.6",
"element-ui": "^2.4.5", "element-ui": "^2.4.5",
"glsx-common": "^1.4.6", "glsx-common": "^2.0.4",
"glsx-components": "^1.2.5", "glsx-components": "^1.2.5",
"vod-js-sdk-v6": "^1.5.0",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",
"vuex": "^3.1.2" "vuex": "^3.1.2"
......
/** 上传
* @param {*} baseURL method url 获取签名接口参数
* @param {*} uploadEvent(eventType, callback)
* eventType : media_upload 媒体上传完成, media_progress 媒体上传进度,cover_upload 图片上传完成, cover_progress 图片上传进度
* @returns params.url = 'rop-scrm-shopmall/router' params.data.method = 'scrm.api.shopmall.livebroadcast.uploadsignature'
*/
//npm install vod-js-sdk-v6
import TcVod from 'vod-js-sdk-v6'
import { http } from '@/main'
// 请求配置
const SIGN = {
v: '1.0.0',
source: 'scm-home',
format: 'json',
appKey: '48e5e13229b82c1b4e6e8c96151f0637'
}
const SECRET = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
const REQUEST = {
timeout: 180000,
responseType: 'json',
baseURL: 'http://scrm.dev.glsx.com.cn',
withCredentials: true
}
// const RESPONSE = {
// code_key: ['code', 'returnCode'],
// code_message_map: {},
// code_success_value: '0',
// data_key: 'data',
// errId_logout_value: '21',
// message_key: 'message'
// }
class GlsxUpload {
constructor(params) {
this.initParam = params
}
init() {
return new Promise((resolve, reject) => {
if (this.tcVod) return resolve({ status: 0, msg: 'init successful' })
const { params: { data, url } = {} } = this.initParam || {}
console.log(data)
return http({
data,
url: url,
returnAll: true
})
.then(res => {
if (res.code == '0') {
this.tcVod = new TcVod({
getSignature: () => {
return res.data
}
})
}
if (this.tcVod) return resolve({ status: 0, msg: 'init successful' })
reject({ status: -1, msg: 'init failed' })
})
.catch(err => {
reject({ status: -1, msg: 'init failed' })
})
})
}
uploaded(file, img) {
return new Promise((resolve, reject) => {
if (!file) return reject({ status: -1, msg: 'file is required' })
let params = {
mediaFile: file
}
if (img) params.coverFile = img
this.uploader = this.tcVod.upload(params)
this.uploader
.done()
.then(doneResult => {
resolve(doneResult)
})
.catch(err => {
reject(err)
})
})
}
uploadEvent(eventType, callback) {
if (!eventType) callback({ status: -1, msg: 'eventType is required' })
try {
this.uploader.on(eventType, info => {
callback(info)
})
} catch (err) {
callback(err)
}
}
uploadCancel() {
this.uploader.cancel()
}
}
export default GlsxUpload
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2022-11-23 14:46:30
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-23 17:39:26
* @FilePath: \live\src\api\modules\common.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { http_common } from '@/main'
const pictureUpload = params => {
params.method = 'glsx.accounts.biz.common.pictureUpload'
return http_common({
url: '/router?method=glsx.accounts.biz.common.pictureUpload',
method: 'POST',
data: params,
sign: true,
noSignAttr: ['file']
})
}
export default {
pictureUpload
}
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2022-11-24 16:20:21
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-29 10:23:34
* @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 consoleExport = params => {
params.method = `scrm.api.shopmall.livebroadcast.console.export`
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,
consoleExport
}
...@@ -32,4 +32,16 @@ const LiveRoomDetailApi = params => { ...@@ -32,4 +32,16 @@ const LiveRoomDetailApi = params => {
sign: true, sign: true,
}) })
} }
export default { getListApi, addOrUpdataLiveRoomApi, LiveRoomDetailApi } // 删除直播间
const deleteLiveRoomApi = params => {
params.method = `${defaultPath}delete`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getListApi, addOrUpdataLiveRoomApi, LiveRoomDetailApi,deleteLiveRoomApi }
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
}
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2022-11-23 15:53:36
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-24 16:07:41
* @FilePath: \live\src\api\uploadApi.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import GlsxUpload from './glsxUpload'
const upload = new GlsxUpload({
params: {
data: { method: 'scrm.api.shopmall.tencentcloudmedia.uploadsignature' },
url: 'rop-scrm-shopmall/router'
}
})
export default upload
<!--
* @Author: yangming yangming@didihu.com.cn
* @Date: 2022-11-28 10:12:36
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-28 10:25:09
* @FilePath: \live\src\components\big-view\index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="view-panel">
<img :src="dialogSrc" width="100%" v-if="dialogType == 'img'" />
<video width="100%" autoplay controls :src="dialogSrc" v-else></video>
</div>
</template>
<script>
export default {
name: 'view',
data() {
return {
dialogVisibleImg: true
}
},
props: {
dialogType: String,
dialogSrc: String
},
methods: {
test() {
console.log('点击了按钮')
this.$messenger.send({ message: { from: 11, message: '11111' } })
}
}
}
</script>
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* @version: * @version:
* @Author: limin * @Author: limin
* @Date: 2021-06-07 14:12:32 * @Date: 2021-06-07 14:12:32
* @LastEditors: limin * @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2021-09-07 14:38:52 * @LastEditTime: 2022-11-23 17:38:30
*/ */
// 根据环境引入不同配置 process.env.VUE_APP_ENV // 根据环境引入不同配置 process.env.VUE_APP_ENV
// let request = require('@/http/request.js') // let request = require('@/http/request.js')
...@@ -20,8 +20,8 @@ export const fetchConfig = function(isEnv = true) { ...@@ -20,8 +20,8 @@ export const fetchConfig = function(isEnv = true) {
// } // }
//return window.fetch('https://', {}).then(res => res.json()) //return window.fetch('https://', {}).then(res => res.json())
// request({ url: 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/oss_commodity_center', method: 'get' }) // request({ url: 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/oss_commodity_center', method: 'get' })
return new Http().get('https://oss-config.test.glsx.com.cn/mock/6351298f6a118b4ff787ef2b/live/config') // return new Http().get('https://oss-config.test.glsx.com.cn/mock/6351298f6a118b4ff787ef2b/live/config')
// return new Http().get('https://oss-config.dev.glsx.com.cn/mock/6324135a4edfe442ee0530ae/live/config') return new Http().get('https://oss-config.dev.glsx.com.cn/mock/6324135a4edfe442ee0530ae/live/config')
} }
export const config = { export const config = {
install(vue, cfg) { install(vue, cfg) {
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* @version: 1.0.0 * @version: 1.0.0
* @Author: limin * @Author: limin
* @Date: 2021-08-13 14:12:11 * @Date: 2021-08-13 14:12:11
* @LastEditors: limin * @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2021-09-24 10:41:31 * @LastEditTime: 2022-11-23 17:20:32
* @FilePath: \scrm\scrm-sub-blog\src\main.js * @FilePath: \scrm\scrm-sub-blog\src\main.js
*/ */
import Vue from 'vue' import Vue from 'vue'
......
/*
* @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)
})
}
})
}
}
}
...@@ -15,6 +15,18 @@ const staticRoutes = Object.freeze([ ...@@ -15,6 +15,18 @@ const staticRoutes = Object.freeze([
path: '/liveList/jumpLive', path: '/liveList/jumpLive',
component: resolve => require([`@/views/liveList/jumpLive.vue`], resolve), component: resolve => require([`@/views/liveList/jumpLive.vue`], resolve),
meta: {} meta: {}
},
{
name: 'shortVideo',
path: '/shortVideo/index',
component: resolve => require([`@/views/shortVideo/index.vue`], resolve),
meta: {}
},
{
name: 'uploadVideo',
path: '/shortVideo/uploadVideo',
component: resolve => require([`@/views/shortVideo/uploadVideo.vue`], resolve),
meta: {}
} }
]) ])
export default staticRoutes export default staticRoutes
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2022-11-23 11:06:49
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-12-01 10:13:27
* @FilePath: \live\src\setup\qiankun.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import Vue from 'vue' import Vue from 'vue'
import { message, messageBox } from '@/plugins/element.js' import { message, messageBox } from '@/plugins/element.js'
import { fetchConfig } from '@/config' import { fetchConfig } from '@/config'
...@@ -20,7 +28,7 @@ export async function bootstrap({ history, common, messenger, globalState }) { ...@@ -20,7 +28,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-12-01 10:06:04
* @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,29 @@ export function dateFormat (dateTime, format = 'YYYY-MM-DD HH:mm') { ...@@ -22,4 +30,29 @@ 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)
}
export function GetDateDiff(time1, time2 = new Date()) {
let startTime = new Date(time1) //开始时间
let endTime = new Date(time2) //结束时间
let date = endTime.getTime() - startTime.getTime() //时间差秒
//计算出相差天数
let days = Math.floor(date / (24 * 3600 * 1000))
//计算出小时数
let leave1 = date % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
let hours = Math.floor(leave1 / (3600 * 1000))
//计算相差分钟数
let leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数
let minutes = Math.floor(leave2 / (60 * 1000)) //计算相差秒数
let leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数
let seconds = Math.round(leave3 / 1000)
return days + '天' + hours + '时' + minutes + '分' + seconds + '秒'
}
<template>
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<!-- 表格区域 开始 -->
<div class="live-table-header">
<h2>
已累计
<label>{{ peopleNum }}</label>
人观看&nbsp;&nbsp;
<label>{{ roomNum }}</label>
次观看
</h2>
<el-button :size="size" type="primary" plain @click="detailexport">导出</el-button>
</div>
<GLTable ref="classifyRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div slot="nickname" slot-scope="scope">
<div class="nickname-border">
<img :src="scope.scope.avatar" />
<span>{{ scope.scope.nickname }}</span>
</div>
</div>
</GLTable>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import { downloadUrl } from '@/utils'
export default {
name: 'LiveIndex',
props: {
roomNum: Number,
peopleNum: {
type: Number,
default: 0
}
},
data() {
return {
size: 'small',
url: url,
searchForm: {
nickname: '',
phone: '',
sourceShopName: ''
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '微信昵称',
name: 'nickname',
type: 'input',
maxlength: 20
},
{
label: '手机号',
name: 'phone',
type: 'input',
maxlength: 20
},
{
label: '来源门店',
name: 'sourceShopName',
type: 'input',
maxlength: 20
}
],
// 表格
getListApi: this.$apis.console.detailpage,
tableParams: {
listName: 'list',
tableColumns: [
{
label: '微信昵称',
prop: 'nickname',
addHtml: 'nickname'
},
{
label: '手机号',
prop: 'phone'
},
{
label: '访问来源',
prop: 'visitSource'
},
{
label: '来源门店',
prop: 'sourceShopName'
},
{
label: '观看时长',
prop: 'visitDuration'
},
{
label: '最后浏览',
prop: 'lastVisitTime',
width: 200
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
}
},
inject: ['elFormItem'],
methods: {
detailexport() {
const getParams = Object.assign(this.getParams(), {
pageSize: 1000000,
currentPage: 1
})
this.$apis.console.detailexport(getParams).then(res => {
res && downloadUrl(res)
})
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
params.id = this.$route.query.id
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 = {}
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;
align-items: center;
margin-bottom: 10px;
color: #333333;
font-size: 16px;
label {
color: #5850ff;
}
}
}
.nickname-border {
display: flex;
align-items: center;
img {
width: 36px;
height: 36px;
margin-right: 10px;
}
}
</style>
<template>
<div class="live-room">
<div class="container">
<div>
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
</div>
<!-- 表格区域 开始 -->
<div class="live-table-header">
<h2>短视频列表</h2>
<el-button :size="size" type="primary" @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', scope.scope.status == 1 ? 'back-green' : 'back-grey']"></span>
<span>{{ scope.scope.statusStr || '--' }}</span>
</div>
<div slot="coverUrl" slot-scope="scope">
<div class="image-popover" @click="handleLook(scope.scope)">
<img :src="scope.scope.coverUrl" />
</div>
</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
<el-dialog class="image-dialog" :visible.sync="dialogVisibleImg" width="30%">
<big-view ref="viewForm" v-if="dialogVisibleImg" :dialogSrc="dialogSrc" :dialogType="dialogType"></big-view>
</el-dialog>
<GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisibleDel = false" type="error" content="是否确认删除短视频?" :visible.sync="dialogVisibleDel" mode="small"></GLDialog>
</div>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import bigView from '@/components/big-view'
export default {
name: 'LiveIndex',
components: {
bigView
},
data() {
return {
dialogVisibleDel: false,
dialogVisibleImg: false,
dialogType: '',
selectItem: '',
size: 'small',
url: url,
searchForm: {
term: '',
status: ''
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '短视频搜索',
name: 'term',
type: 'input',
placeholder: '请输入关键字',
maxlength: 20
},
{
label: '状态',
name: 'status',
type: 'select',
width: '215px',
optionList: [
{ confId: '', confName: '全部' },
{ confId: '0', confName: '未上传' },
{ confId: '1', confName: '已上传' },
{ confId: '2', confName: '已删除' }
],
optionId: 'confId',
optionLabel: 'confName'
}
],
// 表格
getListApi: this.$apis.shortVideo.tencentcloudmediaPage,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '编号',
prop: 'fileId'
},
{
label: '视频名称',
prop: 'fileName'
},
{
label: '宣传文案',
prop: 'introduction'
},
{
label: '封面图',
prop: 'coverUrl',
addHtml: 'coverUrl'
},
{
label: '创建日期',
prop: 'createdDate'
},
{
label: '状态',
prop: 'status',
addHtml: 'status'
}
]
},
tableButtonList: [
{
type: 'el-button',
name: '预览',
attrs: {
type: 'text'
},
condition: row => {
return row.status == 1
},
listeners: {
click: row => {
this.handleView(row)
}
}
},
{
type: 'el-button',
name: '编辑',
attrs: {
type: 'text'
},
condition: row => {
return row.status == 2 || row.status == 0
},
listeners: {
click: row => {
this.$router.push(`/shortVideo/uploadVideo?id=${row.id}`)
}
}
},
{
type: 'el-button',
name: '删除',
attrs: {
type: 'text'
},
condition: row => {
return row.status == 0 || row.status == 1
},
listeners: {
click: row => {
this.handleDelete(row)
}
}
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }
}
},
mounted() {},
methods: {
handleDelete(row) {
this.selectItem = row
this.dialogVisibleDel = true
},
pageClick() {
this.$router.push(`/shortVideo/uploadVideo`)
},
handleView(row) {
this.dialogType = 'video'
this.dialogVisibleImg = true
this.dialogSrc = row.mediaUrl
},
handleLook(row) {
this.dialogType = 'img'
this.dialogVisibleImg = true
this.dialogSrc = row.coverUrl
},
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() {
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 = {
term: '',
status: ''
}
this.handleSearch()
}
}
}
</script>
<style lang="scss" scoped>
.live-table-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
h2 {
font-weight: 600;
font-size: 16px;
color: #333333;
}
}
.table-circle {
margin-right: 5px;
}
.image-popover {
cursor: pointer;
img {
width: 36px;
height: 36px;
}
}
</style>
<template>
<div class="broadcast-container" v-loading="loading">
<div class="broadcast-content">
<div class="edit-title">上传视频</div>
<div class="broadcast-panel gl-form-page">
<el-form ref="uploadForm" :model="uploadForm" label-width="120px" :rules="uploadRules">
<el-form-item label="视频名称:" class="dis-in-block" prop="fileName">
<el-input v-model="uploadForm.fileName" placeholder="请输入内容"></el-input>
</el-form-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-form-item>
<el-form-item label="视频:" class="dis-in-block" prop="mediaUrl">
<div class="activity-img muti-imgs img-w-h">
<div class="add-border" v-show="!uploadForm.mediaUrl">
<div class="add-icon"><i class="el-icon-plus"></i></div>
<div class="add-text">上传</div>
</div>
<div class="video-panel" v-if="uploadForm.mediaUrl">
<video id="video" width="100%" height="100%" preload loop muted>
<source :src="uploadForm.mediaUrl" type="video/mp4" />
</video>
<i class="el-icon-video-play" @click="handleLook('video')"></i>
<i class="el-icon-close" @click="uploadForm.mediaUrl = ''"></i>
</div>
<input v-if="!uploadForm.mediaUrl" type="file" class="activity-Input img-w-h" accept="video/*" @change="e => handleVideoChange(e)" style="opacity: 0" />
</div>
</el-form-item>
<el-form-item label="封面:" class="dis-in-block" prop="coverUrl">
<div class="activity-img muti-imgs img-w-h">
<div class="add-border" v-show="!uploadForm.coverUrl">
<div class="add-icon"><i class="el-icon-plus"></i></div>
<div class="add-text">上传</div>
</div>
<img class="img-w-h" :src="uploadForm.coverUrl" v-show="uploadForm.coverUrl" />
<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>
</div>
</div>
<div class="broadcast-footer">
<el-button type="primary" @click="handleUp" class="ok-btn">
提交
</el-button>
<el-button class="cancel-btn" @click="handleClose">
取消
</el-button>
</div>
<el-dialog class="image-dialog" :visible.sync="dialogVisibleImg" width="30%">
<big-view ref="viewForm" v-if="dialogVisibleImg" :dialogSrc="dialogSrc" :dialogType="dialogType"></big-view>
</el-dialog>
</div>
</template>
<script>
import upload from '@/api/uploadApi'
import uploadMixin from '@/mixins/upload'
// const upload = new GlsxUpload({ baseURL: 'http://scrm.dev.glsx.com.cn' })
import bigView from '@/components/big-view'
export default {
name: 'uploadVideo',
mixins: [uploadMixin],
components: {
bigView
},
data() {
return {
limitSize: 20,
size: 'small',
dialogVisibleImg: false,
loading: false,
uploadForm: {
id: ''
},
dialogSrc: '',
dialogType: '',
uploadRules: {
fileName: [{ required: true, message: '请输入视频名称', trigger: 'blur' }],
mediaUrl: [{ required: true, message: '请选择视频', trigger: 'blur' }],
coverUrl: [{ required: true, message: '请选择封面', trigger: 'blur' }]
}
}
},
methods: {
handleImgDelete() {
this.uploadForm.coverUrl = ''
},
handleLook(type) {
this.dialogType = type
this.dialogVisibleImg = true
this.dialogSrc = type == 'img' ? this.uploadForm.coverUrl : this.uploadForm.mediaUrl
},
handleClose() {
this.$router.push('/shortVideo/index')
},
handleVideoChange(e) {
const self = this
let file = e.target.files[0]
const isLt = file.size / 1024 / 1024 < this.limitSize
if (!isLt) {
this.$message.error('上传视频大小不能超过' + this.limitSize + 'MB!')
return true
}
self.loading = true
upload.init().then(res => {
if (res.status == 0) {
upload
.uploaded(file)
.then(res => {
self.$refs['uploadForm'].clearValidate('mediaUrl')
const videoUrl = res.video.url
self.$set(self.uploadForm, 'mediaUrl', videoUrl)
self.$set(self.uploadForm, 'fileId', res.fileId)
self.$nextTick(() => {
self.getImgUrl(videoUrl).then(res => {
self.$set(self.uploadForm, 'coverUrl', res)
})
})
self.loading = false
})
.finally(end => {
console.log(end)
})
upload.uploadEvent('', res => {
console.log(res, '视频上传完成')
})
upload.uploadEvent('media_progress', res => {
console.log(res)
})
}
})
},
// // 图片
handleImgChange(e) {
var reader = new FileReader()
var fileInfo = e.srcElement.files[0]
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 => {
this.$refs['uploadForm'].clearValidate('coverUrl')
this.$set(this.uploadForm, 'coverUrl', res)
})
}
},
handleUp() {
this.$refs['uploadForm'].validate(valid => {
if (valid) {
this.$apis.shortVideo.tencentcloudmediaUpdate(this.uploadForm).then(res => {
if (res) {
this.$router.push('/shortVideo/index')
this.$message({
type: 'success',
message: '操作成功!'
})
}
})
}
})
},
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>
<style lang="scss" scoped>
.broadcast-content {
background: #fff;
height: calc(100vh - 136px);
.edit-title {
font-weight: 600;
font-size: 16px;
color: #333333;
text-align: left;
line-height: 58px;
height: 58px;
padding-left: 20px;
border-bottom: 1px solid #e5e5e5;
}
}
.broadcast-footer {
margin-top: 16px;
text-align: center;
}
.broadcast-panel {
margin-top: 20px;
.activity-img {
width: 104px;
height: 104px;
background: rgba(0, 0, 0, 0.04);
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px;
cursor: pointer;
position: relative;
input {
cursor: pointer;
font-size: 0;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
}
.add-border {
text-align: center;
color: rgba(0, 0, 0, 0.45);
.add-icon {
margin-top: 20px;
height: 20px;
font-size: 17px;
}
.add-text {
height: 30px;
font-size: 12px;
}
}
}
.img-btns,
img {
width: 100%;
height: 100%;
}
.video-panel {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
position: relative;
video {
position: absolute;
object-fit: fill;
}
.el-icon-video-play {
z-index: 10;
font-size: 20px;
color: #fff;
cursor: pointer;
}
.el-icon-close {
position: absolute;
top: 0px;
right: 0px;
background: #000000;
color: #fff;
}
}
}
.video-dialog {
z-index: 2001;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: auto;
background: rgba($color: #000000, $alpha: 0.5);
&-panel {
background: #000000;
position: absolute;
top: 100px;
left: 50%;
transform: translateX(-50%);
height: calc(100% - 200px);
width: auto;
box-sizing: border-box;
padding: 10px 20px 20px;
overflow: hidden;
.video-close {
display: flex;
justify-content: flex-end;
height: 40px;
i {
cursor: pointer;
font-size: 25px;
color: #5850ff;
}
}
}
}
</style>
...@@ -9,7 +9,7 @@ const cdn = { ...@@ -9,7 +9,7 @@ const cdn = {
js: [`${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`, `${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`, `${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`, `${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`, `${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`] js: [`${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`, `${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`, `${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`, `${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`, `${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`]
} }
module.exports = { module.exports = {
outputDir: `../dist/${packageName}`, outputDir: `dist`,
publicPath, publicPath,
assetsDir: 'static', assetsDir: 'static',
productionSourceMap: false, productionSourceMap: false,
...@@ -32,7 +32,6 @@ module.exports = { ...@@ -32,7 +32,6 @@ module.exports = {
'element-ui': 'ELEMENT', 'element-ui': 'ELEMENT',
'vue-router': 'VueRouter', 'vue-router': 'VueRouter',
vuex: 'Vuex', vuex: 'Vuex',
axios: 'axios',
echarts: 'echarts' echarts: 'echarts'
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!