Commit fdf9e632 by 前端

活动记录联调

1 parent 0d1a3246
import { http } from '@/main'
const url = '/rop-scrm-entmicro/router'
// 获取活动记录列表
const getActivityRecord = params => {
params.method = 'entmicro.api.business.activityRecord.page'
return http({
url: url,
method: 'GET',
data: params,
sign: true
})
}
// 新增活动记录列表
const addActivityRecord = params => {
params.method = 'entmicro.api.business.activityRecord.add'
return http({
url: url,
method: 'post',
data: params,
sign: true
})
}
// 更新活动记录列表
const updateActivityRecord = params => {
params.method = 'entmicro.api.business.activityRecord.update'
return http({
url: url,
method: 'post',
data: params,
sign: true
})
}
// 查询活动记录
const getActivityRecordDetail = params => {
params.method = 'entmicro.api.business.activityRecord.detail'
return http({
url: url,
method: 'post',
data: params,
sign: true
})
}
// 删除活动记录
const delActivityRecord = params => {
params.method = 'entmicro.api.business.activityRecord.delete'
return http({
url: url,
method: 'post',
data: params,
sign: true
})
}
export default {
getActivityRecord,
addActivityRecord,
getActivityRecordDetail,
delActivityRecord,
updateActivityRecord
}
......@@ -16,6 +16,18 @@ const staticRoutes = Object.freeze([
component: resolve => require([`@/views/activityRecord/index.vue`], resolve),
meta: {}
},
{
name: 'addRecord',
path: '/activityRecord/addRecord',
component: resolve => require([`@/views/activityRecord/addRecord.vue`], resolve),
meta: {}
},
{
name: 'viewRecord',
path: '/activityRecord/viewRecord',
component: resolve => require([`@/views/activityRecord/viewRecord.vue`], resolve),
meta: {}
},
// 众筹订单
{
......
<template>
<div>
<el-form :model="recordForm" :rules="recordRules" ref="ruleForm">
<div>活动记录</div>
<div>
<el-form-item label="活动名称" prop="name">
<el-input v-model="recordForm.name"></el-input>
</el-form-item>
<el-button type="primary">查询</el-button>
<div class="gl-form-page">
<el-form :model="recordForm" :rules="recordRules" ref="recordForm" label-width="154px">
<div class="record-box">
<div class="title">活动记录</div>
<div class="record-form">
<el-form-item class="activity-name" label="活动ID:" prop="activityName">
<el-input v-model="recordForm.crowdFundActivityId" :disabled="routeInfo.addOrEdit == 2"></el-input>
<el-button size="small" type="primary" :disabled="routeInfo.addOrEdit == 2">查询</el-button>
</el-form-item>
<!-- 活动详情 -->
<div class="activity-detail">
<div class="activity-detail-left">
<div class="activity-detail-content activity-bottom">
<div class="activity-title">活动名称:</div>
<div class="activity-content">{{ recordForm.activityName }}</div>
</div>
<div class="activity-detail-content">
<div class="activity-title">活动地址:</div>
<div class="activity-content">{{ recordForm.province }}-{{ recordForm.city }}</div>
</div>
</div>
<div class="activity-detail-right">
<div class="activity-detail-content activity-bottom">
<div class="activity-title">主办方:</div>
<div class="activity-content">{{ recordForm.merchantName }}</div>
</div>
<div class="activity-detail-content">
<div class="activity-title">活动时间:</div>
<div class="activity-content">{{ recordForm.beginTime }}-{{ recordForm.endTime }}</div>
</div>
</div>
</div>
<el-form-item label="活动介绍:" prop="activityEvent">
<el-input type="textarea" v-model="recordForm.activityEvent" maxlength="500" :disabled="routeInfo.addOrEdit == 2"></el-input>
</el-form-item>
</div>
</div>
<div class="record-box">
<div class="title">素材</div>
<div class="record-form">
<el-form-item label="活动视频:">
<template v-if="!recordForm.videoUrl">
<div class="upload-img">
<i class="el-icon-plus avatar-uploader-desc-icon"></i>
<div class="avatar-uploader-desc-word">上传视频</div>
<input type="file" class="upload-video" style="opacity: 0" accept=".mp4" @change="e => handleVideoChange(e)" />
</div>
</template>
<template v-else>
<div class="video-box">
<video id="video" width="100%" height="100%" preload loop muted>
<source :src="recordForm.videoUrl" type="video/mp4" />
</video>
<div class="mask">
<div class="video-pane-close" @click="handleEnlarge(recordForm.videoUrl, 'video')">
<img src="../../assets/material/view.png" alt="" />
</div>
<div class="video-pane-close" @click="close('radio')">
<img src="../../assets/material/dele.png" alt="" />
</div>
</div>
</div>
</template>
<div class="text-tip">建议大小:30M以内</div>
</el-form-item>
<el-form-item label="活动图片:" class="add-img">
<div class="activity-img-box">
<template v-if="recordForm.imageUrl && recordForm.imageUrl.length > 0">
<div v-for="(item, index) in recordForm.imageUrl" :key="index">
<div class="video-box">
<img class="photo-activity" :src="item" alt="" />
<div class="mask">
<div class="video-pane-close" @click="handleEnlarge(item)">
<img src="../../assets/material/view.png" alt="" />
</div>
<div class="video-pane-close" @click="close('img', index)">
<img src="../../assets/material/dele.png" alt="" />
</div>
</div>
</div>
</div>
</template>
<template v-if="recordForm.imageUrl && recordForm.imageUrl.length < 9">
<div class="upload-img">
<i class="el-icon-plus avatar-uploader-desc-icon"></i>
<div class="avatar-uploader-desc-word">上传照片</div>
<input type="file" class="upload-img" style="opacity: 0" accept=".jpg, .jpeg, .png" @change="e => handleImgChange(e)" />
</div>
</template>
</div>
<div class="text-tip">最多可上传9张</div>
</el-form-item>
</div>
</div>
<el-form-item label="活动形式" prop="desc">
<el-input type="textarea" v-model="ruleForm.desc"></el-input>
</el-form-item>
<div>素材</div>
</el-form>
<GLFooter>
<el-button @click="handleCancel" size="medium">取消</el-button>
<el-button type="primary" @click="handleConfirm" size="medium" :loading="loading">保存</el-button>
</GLFooter>
<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>
export default {}
export default {
data() {
return {
recordForm: {
crowdFundActivityId: '',
activityEvent: '',
imageUrl: [],
videoUrl: '',
videoImage: ''
},
recordRules: {
activityName: [{ required: true, message: '请输入活动ID', trigger: 'blur' }],
activityEvent: [
{ required: true, message: '请输入活动介绍', trigger: 'blur' },
{ max: 500, message: '最多输入500个字符', trigger: 'blur' }
]
},
dialogVisibleImg: false,
dialogSrc: '',
dialogType: '',
routeInfo: {}
}
},
created() {
this.routeInfo = this.$route.query
console.log(this.$route.query)
this.routeInfo.addOrEdit != 1 ? this.getActivityRecordDetail(this.routeInfo.id) : ''
},
methods: {
// 获取活动记录详情
getActivityRecordDetail(id) {
this.$apis.record.getActivityRecordDetail({ Id: id }).then(res => {
console.log(res)
if (res) {
this.recordForm = res
this.recordForm.imageUrl = this.recordForm.imageUrl.split(',')
}
console.log(this.recordForm, '==')
})
},
// 上传图片
handleImgChange(e) {
this.$notify({
title: '提示',
message: '图片上传中,请稍后'
})
document.querySelector('.upload-img').value = ''
var file = e.srcElement.files[0]
var reader = new FileReader()
// 默认1MB
const limitSize = 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
if (this.recordForm.imgUrl.length > 9) {
this.$message.error('最多上传9张图片')
return
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const arrBase64 = imgFile.split(',')
const splitStr = file.name.split('.')
const fileUrl = splitStr[splitStr.length - 1] + '@' + arrBase64[1]
this.$apis.common.uploadImgApi({ file: fileUrl }).then(res => {
if (res) {
this.$notify({
title: '提示',
message: '图片上传成功',
type: 'success'
})
console.log(res)
this.recordForm.imgUrl.push(res)
}
})
}
},
// 上传视频
handleVideoChange(e) {
this.$notify({
title: '提示',
message: '视频上传中,请稍后'
})
let file = e.srcElement.files[0]
var reader = new FileReader()
// 默认50MB
const limitSize = 50
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
return
}
document.querySelector('.upload-video').value = ''
reader.readAsDataURL(file)
reader.onload = e => {
const videoFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + videoFile.split(',')[1]
this.$apis.common.uploadVideoApi({ file: base64 }).then(res => {
if (res) {
this.$notify({
title: '提示',
message: '视频上传成功',
type: 'success'
})
console.log(res)
this.recordForm.videoUrl = res
this.$nextTick(() => {
this.getImgUrl(this.recordForm.videoUrl).then(imgUrl => {
console.log(imgUrl)
this.recordForm.videoImage = imgUrl
})
})
}
})
}
},
// 获取视频第一帧base64
getImgUrl(url, multiple = 3) {
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')
console.log(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)
// 转换成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.uploadImgApi({ file: base64 }).then(res => {
resolve(res)
})
}
})
},
// 预览图文
handleEnlarge(src, type) {
this.dialogVisibleImg = true
this.dialogSrc = src
this.dialogType = type ? type : 'img'
},
// 删除图片/视频
close(type, index) {
switch (type) {
case 'radio':
this.recordForm.videoUrl = ''
this.recordForm.videoImage = ''
break
case 'img':
this.recordForm.imgUrl.splice(index, 1)
break
default:
this.recordForm.videoUrl = ''
}
},
handleCancel() {
this.$router.go(-1)
},
handleConfirm() {
this.$refs['recordForm'].validate(valid => {
if (!valid) {
this.$message.error('请填写必填属性')
return
}
})
if (!this.recordForm.videoUrl && !this.recordForm.imgUrl.length) {
this.$message.error('请至少填写活动视频或者活动图片其中一项')
return
}
console.log(this.recordForm)
let params = JSON.parse(JSON.stringify(this.recordForm))
// 创建
if (this.routeInfo.addOrEdit == 1) {
params.merchantNo = this.$globalState.session.merchantId
this.$apis.record.addActivityRecord(params).then(res => {
console.log(res)
})
} else {
// 编辑
params.id = this.routeInfo.id
this.$apis.record.updateActivityRecord(params).then(res => {
console.log(res)
})
}
}
}
}
</script>
<style></style>
<style lang="scss" scoped>
.record-box {
width: 100%;
background-color: #fff;
margin-bottom: 16px;
}
.record-form {
padding: 32px 0;
}
.activity-name {
position: relative;
.el-button {
position: absolute;
top: 4px;
left: 460px;
}
}
.title {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 16px;
padding: 15px 0 15px 20px;
border-bottom: 1px solid #d8d8d8;
}
.upload-img {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 104px;
height: 104px;
background: rgba(0, 0, 0, 0.04);
border: 1px dashed rgba(0, 0, 0, 0.15);
border-radius: 4px;
input {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
.text-tip {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 14rpx;
color: #999999;
}
.avatar-uploader-desc-word {
font-weight: 400;
font-size: 28rpx;
color: #666666;
}
.video-box {
position: relative;
width: 104px;
height: 104px;
border-radius: 4px;
margin-right: 8px;
&:hover .mask {
opacity: 1;
}
.video {
position: absolute;
object-fit: fill;
}
.photo-activity {
position: absolute;
width: 104px;
height: 104px;
}
.mask {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
background: rgba(0, 0, 0, 0.5);
color: #ffffff;
opacity: 0;
top: 0;
right: 0;
width: 100%;
height: 100%;
z-index: 999;
.video-pane-close {
width: 14px;
height: 14px;
cursor: pointer;
margin-right: 8px;
}
}
}
.activity-img-box {
display: flex;
}
.activity-detail {
display: flex;
justify-content: space-around;
margin: 0 0 20px 154px;
background: #f9f9f9;
padding: 20px 0;
max-width: 600px;
&-content {
display: flex;
.activity-title {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #666666;
}
.activity-content {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
.activity-bottom {
margin-bottom: 20px;
}
}
/deep/ .el-form {
padding-left: 0;
}
.image-dialog {
/deep/ {
.el-dialog__header {
border-bottom: 0px;
padding: 0px;
}
}
}
.add-img {
/deep/ .el-form-item__content {
width: 100%;
}
}
</style>
<template>
<div class="role-home-page">
<div class="top_widget">
<div class="add-btn">
<!-- <GLButton :size="size" fn="创建角色" icon="el-icon-plus" type="primary" @click="toCreatePage" mode="el-button">创建角色</GLButton> -->
<el-button size="small" icon="el-icon-plus" type="primary" @click="toCreatePage">新建活动记录</el-button>
<el-button size="small" icon="el-icon-plus" type="primary" @click="toCreatePage(1)">新增活动记录</el-button>
</div>
<div class="table_widget">
<div>
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" :searchSelectObj="searchSelectObj" @handleOk="toFindData" @handleRest="reSetFindData"></GLCombiForm>
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" :searchSelectObj="searchSelectObj" @handleOk="handleSearch" @handleRest="handleRest"></GLCombiForm>
</div>
<GLTable ref="table" :pageConf="pageConf" :tableParams="tableParams">
<div slot="statusName" class="dot" slot-scope="scope">
<span :class="roleStatus[scope.scope.statusName]"></span>
{{ scope.scope.statusName }}
<GLTable ref="recordTable" :pageConf="pageConf" :getListApi="getListApi" :noDataImg="url" :tableParams="tableParams" :searchForm="searchForm">
<!-- 活动时间 -->
<div slot="activityTime" slot-scope="scope">
<span>{{ scope.scope.beginTime }}至{{ scope.scope.endTime }}</span>
</div>
<!-- 省市 -->
<div slot="province" slot-scope="scope">
<span>{{ scope.scope.province }}-{{ scope.scope.city }}</span>
</div>
<!-- 状态 -->
<div slot="status" class="dot" slot-scope="scope">
<span :class="recordStatus[scope.scope.status]"></span>
{{ scope.scope.status }}
</div>
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope.scope"></GLTableButton>
<!-- <GLTableButton :buttonList="buttonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton> -->
<el-button type="text" @click="toLookPage(scope.scope)">查看</el-button>
<el-button type="text" @click="toCreatePage(2, scope.scope)">编辑</el-button>
<el-button type="text" @click="todelete(scope.scope)">删除</el-button>
</template>
</GLTable>
</div>
</div>
</template>
<script>
const roleStatus = {
const recordStatus = {
正常: 'normal',
草稿: 'draft'
}
......@@ -29,134 +41,147 @@ export default {
name: '',
data() {
return {
roleStatus: roleStatus,
recordStatus: recordStatus,
searchForm: {
activityName: '',
storeName: ''
merchantName: ''
},
searchFormData: [
{
label: '活动名称',
name: 'merchantName',
name: 'activityName',
type: 'input',
isClear: true
},
{
label: '门店名称',
name: 'corpAlias',
name: 'merchantName',
type: 'input',
isClear: true
}
],
//表格配置
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
tableParams: {
tableOption: {
width: '150'
},
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data',
// tableOption: false,
tableColumns: [
{
label: '活动名称',
prop: 'roleName',
prop: 'activityName',
minWidth: '250'
},
{
label: '门店名称',
prop: 'roleCode',
prop: 'merchantName',
minWidth: '220'
},
{
label: '活动时间',
prop: 'statusName',
addHtml: 'activityTime',
prop: 'beginTime',
minWidth: '220'
},
{
label: '省市',
prop: 'createdTime',
addHtml: 'province',
prop: 'province',
minWidth: '180'
},
{
label: '参与人数',
prop: 'updatedTime',
prop: 'participants',
minWidth: '180'
},
{
label: '活动状态',
prop: 'updatedTime',
prop: 'status',
addHtml: 'status',
minWidth: '180'
},
{
label: '操作',
prop: 'auth-button',
width: '180',
addHtml: 'auth-button',
fixed: 'right'
}
]
},
tableData: [
{
id: 1,
activityName: 'dff',
merchantName: 888,
beginTime: '2021-2-2',
endTime: '2021-12-2',
province: 'hunan',
city: 'yiyang',
updatedTime: 2,
status: 1
}
],
buttonList: [
{
type: 'GLButton',
name: row => {
return '查看'
},
name: '查看',
attrs: {
type: 'text',
fn: '查看'
},
condition: row => {
return true
fn: '查看活动记录'
},
listeners: {
click: this.toLookPage
click: row => this.toLookPage(row)
}
},
{
type: 'GLButton',
name: row => {
return '编辑'
},
name: '编辑',
attrs: {
type: 'text',
fn: '编辑'
},
condition: row => {
return true
fn: '新增活动记录'
},
listeners: {
click: this.toEditPage
click: row => this.toCreatePage(2, row)
}
},
{
type: 'el-button',
name: row => {
return '删除'
},
condition: row => {
return row.delFlag
},
name: '删除',
attrs: {
type: 'text'
type: 'text',
fn: '删除活动记录'
},
listeners: {
click: this.todelete
click: row => this.todelete(row)
}
}
],
tableData: [],
merchantList: [],
tableTotal: 0,
accountLevel: 1,
list: [],
distoryTable: true
// 表格
getListApi: this.$apis.record.getActivityRecord
}
},
methods: {
// 查询
toFindData() {
this.getTableData()
},
// 去创建角色页面
toCreatePage() {
this.$router.push('/role/create')
// 去创建/修改页面
toCreatePage(addOrEdit, scope) {
let params = {
addOrEdit: addOrEdit,
$title: encodeURI(addOrEdit == 1 ? '创建活动记录' : '编辑活动记录'),
id: scope ? scope.id : ''
}
this.$router.push({
path: '/activityRecord/addRecord',
query: params
})
},
// 去修改角色页面
toEditPage(row) {
this.$router.push('/role/create/' + row.id)
// 去查看页面
toLookPage(scope) {
let params = {
id: scope.id
}
this.$router.push({
path: '/activityRecord/viewRecord',
query: params
})
},
// 去删除草稿
todelete(row) {
......@@ -166,9 +191,8 @@ export default {
customClass: 'gl-message-box',
type: 'warning'
}).then(() => {
this.$apis.role.deleteRole({ id: row.id }).then(res => {
this.$apis.record.delActivityRecord({ id: row.id }).then(res => {
if (res) {
this.getTableData()
this.$message({
type: 'success',
message: '删除成功!'
......@@ -176,11 +200,24 @@ export default {
}
})
})
},
handleRest() {
this.searchForm = {
activityName: '',
merchantName: ''
}
this.handleSearch()
},
handleSearch() {
this.$refs.recordTable.refreshTable()
}
}
}
</script>
<style lang="scss" scoped>
.add-btn {
margin-bottom: 16px;
}
.role-home-page {
box-sizing: border-box;
display: flex;
......
<template>
<div>
<div class="record-box">
<div class="title">活动记录</div>
<div class="record-form">
<div class="record-flex record-center record-bottom">
<div class="record-type">活动ID:</div>
<div class="record-text">{{ recordForm.crowdFundActivityId }}</div>
<el-button size="small" type="primary">更新数据</el-button>
</div>
<!-- 活动详情 -->
<div class="activity-detail">
<div class="activity-detail-left">
<div class="activity-detail-content activity-bottom">
<div class="activity-title">活动名称:</div>
<div class="activity-content">{{ recordForm.activityName }}</div>
</div>
<div class="activity-detail-content">
<div class="activity-title">活动地址:</div>
<div class="activity-content">{{ recordForm.province }}-{{ recordForm.city }}</div>
</div>
</div>
<div class="activity-detail-right">
<div class="activity-detail-content activity-bottom">
<div class="activity-title">主办方:</div>
<div class="activity-content">{{ recordForm.merchantName }}</div>
</div>
<div class="activity-detail-content">
<div class="activity-title">活动时间:</div>
<div class="activity-content">{{ recordForm.beginTime }}-{{ recordForm.endTime }}</div>
</div>
</div>
</div>
<div class="record-flex">
<div class="record-type">活动介绍:</div>
<div>{{ recordForm.activityEvent }}</div>
</div>
</div>
</div>
<div class="record-box">
<div class="title">活动素材</div>
<div class="record-form">
<div class="record-flex record-bottom">
<div class="record-type">活动视频:</div>
<div v-if="recordForm.videoUrl">
<div class="video-box">
<video width="100%" height="100%" preload loop muted>
<source :src="recordForm.videoUrl" type="video/mp4" />
</video>
<div class="mask">
<div class="video-pane-close" @click="handleEnlarge(recordForm.videoUrl, 'video')">
<img src="../../assets/material/view.png" alt="" />
</div>
</div>
</div>
</div>
</div>
<div class="record-flex">
<div class="record-type">活动图片:</div>
<div class="record-flex" v-if="recordForm.imageUrl && recordForm.imageUrl.length > 0">
<div v-for="(item, index) in recordForm.imageUrl" :key="index">
<div class="video-box">
<img class="photo-activity" :src="item" alt="" />
<div class="mask">
<div class="video-pane-close" @click="handleEnlarge(item)">
<img src="../../assets/material/view.png" alt="" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="record-flex">
<el-button class="back-btn" size="medium" type="primary" @click="goback">返回</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>
export default {
data() {
return {
recordForm: {
name: '',
desc: '',
imageUrl: ['https://scrm.test.glsx.com.cn/group1/M00/03/60/wKgD3mOfzE2AWDPFAABLPhZhrpM684.png', 'https://scrm.test.glsx.com.cn/group1/M00/03/60/wKgD3mOfzE2AWDPFAABLPhZhrpM684.png'],
videoUrl: 'https://scrm.test.glsx.com.cn/group1/M00/03/5E/wKgD3mOcNtuAAF2VAAjFv3YDi0M222.mp4'
},
dialogVisibleImg: false
}
},
created() {
this.routeInfo = this.$route.query
this.getActivityRecordDetail(this.routeInfo.id)
},
methods: {
// 获取活动记录详情
getActivityRecordDetail(id) {
this.$apis.record.getActivityRecordDetail({ Id: id }).then(res => {
console.log(res)
if (res) {
this.recordForm = res
this.recordForm.imageUrl = this.recordForm.imageUrl.split(',')
}
console.log(this.recordForm, '==')
})
},
// 预览图文
handleEnlarge(src, type) {
this.dialogVisibleImg = true
this.dialogSrc = src
this.dialogType = type ? type : 'img'
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style lang="scss" scoped>
.record-box {
width: 100%;
background-color: #fff;
margin-bottom: 16px;
}
.title {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 16px;
padding: 15px 0 15px 20px;
border-bottom: 1px solid #d8d8d8;
}
.record-form {
padding: 32px 0;
}
.record-flex {
display: flex;
}
.record-center {
align-items: center;
}
.record-bottom {
margin-bottom: 10px;
}
.record-text {
margin-right: 20px;
}
.back-btn {
margin: auto;
}
.record-introducer {
display: flex;
padding-right: 100px;
&-left {
width: 665px;
text-align: right;
}
}
.record-type {
width: 154px;
text-align: right;
}
.activity-detail {
display: flex;
justify-content: space-around;
margin: 0 0 20px 154px;
background: #f9f9f9;
padding: 20px 0;
max-width: 600px;
&-content {
display: flex;
.activity-title {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #666666;
}
.activity-content {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
.activity-bottom {
margin-bottom: 20px;
}
}
.video-box {
position: relative;
width: 104px;
height: 104px;
border-radius: 4px;
margin-right: 8px;
&:hover .mask {
opacity: 1;
}
.video {
position: absolute;
object-fit: fill;
}
.photo-activity {
position: absolute;
width: 104px;
height: 104px;
}
.mask {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
background: rgba(0, 0, 0, 0.5);
color: #ffffff;
opacity: 0;
top: 0;
right: 0;
width: 100%;
height: 100%;
z-index: 999;
.video-pane-close {
width: 14px;
height: 14px;
cursor: pointer;
margin-right: 8px;
}
}
}
.image-dialog {
/deep/ {
.el-dialog__header {
border-bottom: 0px;
padding: 0px;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!