Commit 02756390 by 杨明

fixed

1 parent 0e166c61
...@@ -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-23 15:53:36
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-11-23 16:36:43
* @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.livebroadcast.uploadsignature' },
url: 'rop-scrm-shopmall/router'
}
})
export default upload
...@@ -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'
......
...@@ -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
<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" 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>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
</div>
</div>
</template>
<script>
import url from '@/assets/empty.png'
export default {
name: 'LiveIndex',
data() {
return {
pickerOptions: {
disabledDate(date) {
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1))
return date < yesterday
}
},
dialogObj: {
show: false
},
size: 'small',
url: url,
searchForm: {
term: '',
status: ''
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '',
name: 'term',
type: 'input',
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.live.getListApi,
tableParams: {
listName: 'list',
tableOption: true,
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'
}
]
},
tableButtonList: [
{
type: 'el-button',
name: '预览',
attrs: {
type: 'text'
}
},
{
type: 'el-button',
name: '编辑',
attrs: {
type: 'text'
},
listeners: {
click: row => {
this.pageClick(row)
}
}
},
{
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: {
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>
.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>
<template>
<div class="broadcast-container">
<div class="broadcast-content">
<div class="edit-title">上传视频</div>
<div class="broadcast-panel">
<el-form ref="uploadForm" :model="uploadForm" label-width="120px">
<div class="broadcast-item">
<el-form-item label="视频名称" class="dis-in-block">
<el-input v-model="uploadForm.name" placeholder="请输入内容"></el-input>
</el-form-item>
</div>
<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.name"></el-input>
</el-form-item>
</div>
<div class="broadcast-item">
<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>
</el-form-item>
</div>
<div class="broadcast-item">
<el-form-item label="封面" class="dis-in-block">
<div class="activity-img muti-imgs img-w-h">
<div class="add-border" v-show="!uploadForm.imgSrc">
<div class="add-icon"><i class="el-icon-plus"></i></div>
<div class="add-text">上传</div>
</div>
<img class="img-w-h" :src="uploadForm.imgSrc" v-show="uploadForm.imgSrc" />
<span class="img-btns" v-show="uploadForm.imgSrc">
<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>
</div>
</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="50%">
<img :src="dialogSrc" width="100%" v-if="dialogType == 'img'" />
<video width="100%" autoplay controls :src="dialogSrc" v-else></video>
</el-dialog>
</div>
</template>
<script>
import upload from '@/api/uploadApi'
// const upload = new GlsxUpload({ baseURL: 'http://scrm.dev.glsx.com.cn' })
export default {
name: 'uploadVideo',
data() {
return {
size: 'small',
dialogVisibleImg: false,
uploadForm: {},
dialogSrc: '',
dialogType: ''
}
},
methods: {
handleImgDelete() {
this.uploadForm.imgSrc = ''
},
handleLook(type) {
this.dialogType = type
this.dialogVisibleImg = true
this.dialogSrc = type == 'img' ? this.uploadForm.imgSrc : this.uploadForm.videoSrc
},
handleClose() {
this.close({ tagName: '/broadcastShort' })
this.$router.push({ name: 'broadcastShort' })
},
handleVideoChange(e) {
const self = this
let file = e.target.files[0]
upload.init().then(res => {
if (res.status == 0) {
upload
.uploaded(file)
.then(res => {
self.$set(self.uploadForm, 'videoSrc', res.video.url)
})
.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.$set(this.uploadForm, 'imgSrc', res)
})
}
},
handleUp() {}
}
}
</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>
...@@ -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!