Commit 14828fcb by zhangquan

联调完成

1 parent de4c9af0
This diff could not be displayed because it is too large.
{ {
"name": "content", "name": "content2",
"version": "1.0.0", "version": "1.0.0",
"description": "A Vue.js project", "description": "A Vue.js project",
"private": true, "private": true,
......
import { http } from '@/main'
const defaultPath = 'scrm.api.busassistant.'
const url = 'rop-scrm-busassistant/router'
// 获取菜单名称
const getMenuListApi = params => {
params.method = `${defaultPath}discover.menu.list`
return http({
url,
data: params,
sign: true
})
}
// 新增菜单
const addMenuApi = params => {
params.method = `${defaultPath}discover.menu.insert`
return http({
url,
data: params,
sign: true
})
}
// 修改菜单
const updateMenuApi = params => {
params.method = `${defaultPath}discover.menu.update`
return http({
url,
data: params,
sign: true
})
}
const getListApi = params => {
params.method = `${defaultPath}discover.content.page`
return http({
url,
data: params,
sign: true
})
}
const getContentTypeListApi = params => {
params.method = `${defaultPath}discover.contentType.list`
return http({
url,
data: params,
sign: true
})
}
const updateStatusApi = params => {
params.method = `${defaultPath}discover.content.updateStatus`
return http({
url,
data: params,
sign: true
})
}
const updateContentTypeApi = params => {
params.method = `${defaultPath}discover.contentType.insertOrUpdate`
return http({
url,
data: params,
sign: true
})
}
const addContentApi = params => {
params.method = `${defaultPath}discover.content.insertOrUpdate`
return http({
url,
data: params,
sign: true
})
}
const getContentDetailApi = params => {
params.method = `${defaultPath}discover.content.detail`
return http({
url,
data: params,
sign: true
})
}
export default {
getMenuListApi,
addMenuApi,
updateMenuApi,
getListApi,
getContentTypeListApi,
updateStatusApi,
updateContentTypeApi,
addContentApi,
getContentDetailApi
}
\ No newline at end of file \ No newline at end of file
import { http } from '@/main'
const defaultPath = 'scrm.api.shopmall.platform.'
const url = 'rop-scrm-shopmall/router'
// 分页查询仓库/销售中商品
const getListApi = params => {
params.method = `${defaultPath}goods.stockroom.page`
return http({
url,
data: params,
sign: true
})
}
export default {
getListApi,
}
...@@ -124,6 +124,7 @@ html { ...@@ -124,6 +124,7 @@ html {
// min-height: calc(100vh - 156px); // min-height: calc(100vh - 156px);
margin-bottom: 16px; margin-bottom: 16px;
} }
.content .approval-container { .content .approval-container {
margin-bottom: 10px; margin-bottom: 10px;
} }
...@@ -272,12 +273,15 @@ html { ...@@ -272,12 +273,15 @@ html {
.content .m-t-10 { .content .m-t-10 {
margin-top: 10px; margin-top: 10px;
} }
.content .m-t-20 { .content .m-t-20 {
margin-top: 20px; margin-top: 20px;
} }
.content .m-b-8 { .content .m-b-8 {
margin-bottom: 8px; margin-bottom: 8px;
} }
.content .m-b-10 { .content .m-b-10 {
margin-bottom: 10px; margin-bottom: 10px;
} }
...@@ -360,9 +364,11 @@ html { ...@@ -360,9 +364,11 @@ html {
.content .txt-grey { .content .txt-grey {
color: #999999; color: #999999;
} }
.content .text-e8 { .content .text-e8 {
color: #eb4e4e !important; color: #eb4e4e !important;
} }
.content .txt-center { .content .txt-center {
text-align: center; text-align: center;
} }
...@@ -407,24 +413,29 @@ html { ...@@ -407,24 +413,29 @@ html {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
.content .flex-align { .content .flex-align {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.content .flex-top { .content .flex-top {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
} }
.content .flex-center { .content .flex-center {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.content .flex-between { .content .flex-between {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
.content .flex-grow { .content .flex-grow {
flex: 1; flex: 1;
} }
...@@ -569,37 +580,48 @@ html { ...@@ -569,37 +580,48 @@ html {
font-size: 14px; font-size: 14px;
color: rgba(0, 0, 0, 0.65); color: rgba(0, 0, 0, 0.65);
} }
.el-message .el-icon-info { .el-message .el-icon-info {
color: #5850ff; color: #5850ff;
font-size: 16px; font-size: 16px;
} }
.content .text-10 { .content .text-10 {
font-size: 10px; font-size: 10px;
} }
.content .text-14 { .content .text-14 {
font-size: 14px; font-size: 14px;
} }
.content .text-16 { .content .text-16 {
font-size: 16px; font-size: 16px;
} }
.content .color-3 { .content .color-3 {
color: #333333; color: #333333;
} }
.content .line-20 { .content .line-20 {
line-height: 20px; line-height: 20px;
} }
.content .weight-6 { .content .weight-6 {
font-weight: 600; font-weight: 600;
} }
.content .weight-5 { .content .weight-5 {
font-weight: 500; font-weight: 500;
} }
.content .weight-4 { .content .weight-4 {
font-weight: 400; font-weight: 400;
} }
.content .mt-10 { .content .mt-10 {
margin-top: 10px; margin-top: 10px;
} }
.el-tooltip__popper.is-light { .el-tooltip__popper.is-light {
background: #ffffff; background: #ffffff;
box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.08); box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.08);
...@@ -607,12 +629,15 @@ html { ...@@ -607,12 +629,15 @@ html {
width: 177px; width: 177px;
box-sizing: border-box; box-sizing: border-box;
} }
.el-tooltip__popper[x-placement^='top'] .popper__arrow { .el-tooltip__popper[x-placement^='top'] .popper__arrow {
border-top-color: #e4e7ed !important; border-top-color: #e4e7ed !important;
} }
.el-tooltip__popper[x-placement^='top'] .popper__arrow:after { .el-tooltip__popper[x-placement^='top'] .popper__arrow:after {
border-top-color: #e4e7ed !important; border-top-color: #e4e7ed !important;
} }
/* tab */ /* tab */
.myMessage { .myMessage {
z-index: 4000 !important; z-index: 4000 !important;
...@@ -658,15 +683,18 @@ html { ...@@ -658,15 +683,18 @@ html {
background-color: #fdb757; background-color: #fdb757;
} }
} }
.loadingClass { .loadingClass {
.el-icon-loading { .el-icon-loading {
font-size: 22px; font-size: 22px;
} }
.el-icon-loading, .el-icon-loading,
.el-loading-text { .el-loading-text {
color: #5850ff !important; color: #5850ff !important;
} }
} }
.scrm-box-f { .scrm-box-f {
background: #ffffff; background: #ffffff;
} }
...@@ -720,3 +748,77 @@ html { ...@@ -720,3 +748,77 @@ html {
vertical-align: middle; vertical-align: middle;
margin-right: 8px; margin-right: 8px;
} }
.operate-wrap {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
.table-title {
height: 32px;
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 16px;
color: #333333;
line-height: 32px;
}
.operate-btn {
.el-button {
margin-left: 8px;
}
.export-btn {
margin-left: 8px;
}
}
}
.global-title-wrap {
background: #fff;
border-radius: 4px 4px 0 0;
.title {
display: inline-block;
box-sizing: border-box;
height: 40px;
line-height: 40px;
padding: 0 32px;
font-weight: 400;
font-size: 16px;
color: #666666;
border-radius: 4px 4px 0 0;
border-top: 1px;
border-left: 1px;
border-right: 1px;
border-style: solid;
border-color: #E5E5E5;
background: #FAFAFA;
text-align: center;
cursor: pointer;
}
.curTitleCla {
font-weight: 600;
color: #5850FF;
background-color: #fff;
border-bottom: 1px solid #fff;
}
}
.global-menu {
.module {
color: #666666;
}
.arrow-right {
font-weight: 600;
margin: 0 3px;
vertical-align: middle;
}
.active {
color: #5850FF;
}
}
\ No newline at end of file \ No newline at end of file
<template>
<div class="upload-ctnr">
<label v-if="name" class="label" for="">{{name}}</label>
<div class="img-item" :style="defaultStyle">
<div v-if="!formObj[attr]" class="add-img" @click.stop="addFile">
<input type="file" class="file" id="file" ref="fileRef" @change="handleFileChange" accept="video/*, image/png, image/jpeg, image/gif, image/jpg" />
<i class="el-icon-plus add"></i>
<p>{{ btnName }}</p>
</div>
<template v-if="formObj[attr] && isImage(formObj[attr])">
<img class="image" :src="formObj[attr]" alt="" />
<div class="operate">
<div class="btn-wrap">
<i class="el-icon-edit-outline" @click="edit" v-if="isEdit"></i>
<i class="el-icon-view" @click="handleLook('img')" v-else></i>
<i class="el-icon-delete" @click="del"></i>
</div>
</div>
</template>
<div v-if="formObj[attr] && !isImage(formObj[attr])" class="video-panel">
<video id="video" width="100%" height="100%" preload loop muted>
<source :src="formObj[attr]" type="video/mp4" />
</video>
<i class="el-icon-video-play" @click="handleLook('video')"></i>
<i class="el-icon-close" @click="del"></i>
</div>
</div>
<span v-if="tip" :class="['tip', {'tip-bottom': placement=='bottom'}]">{{ tip }}</span>
<el-dialog class="image-dialog" :visible.sync="dialogVisibleImg" width="30%">
<big-view ref="viewForm" v-if="dialogVisibleImg" :dialogSrc="formObj[attr]" :dialogType="dialogType"></big-view>
</el-dialog>
</div>
</template>
<script>
import upload from '@/api/uploadApi'
import util from '@/utils/util'
import bigView from '@/components/big-view'
export default {
name: 'Upload',
components: {
bigView
},
props: {
empty: {
type: Boolean,
default: false
},
isEdit: {
type: Boolean,
default: false
},
placement: {
type: String,
default: 'bottom'
},
tip: {
type: String,
default: ''
},
name: {
type: String,
default: ''
},
btnName: {
type: String,
default: '上传'
},
url: {
type: String,
default: ''
},
attr: {
type: String,
default: ''
},
formObj: {
type: Object,
default: ()=>{
return {}
}
},
defaultStyle: {
type: Object,
default: ()=>{
return {}
}
}
},
data() {
return {
dialogVisibleImg: false,
dialogType: ''
}
},
computed: {
},
methods: {
isImage : util.isImage,
handleLook(type) {
this.dialogType = type
this.dialogVisibleImg = true
},
addFile(){
if(this.empty){
this.$emit('clickEvent')
return;
}
this.$refs.fileRef.click()
},
handleFileChange(e) {
var file = e.srcElement.files[0]
if(file.type?.indexOf('image')>-1){
this.uploadImg(e)
}else{
this.uploadVideo(e)
}
},
uploadImg(e) {
var file = e.srcElement.files[0]
var reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
const base64 = file.name.split('.').pop() + '@' + arrBase64[1]
this.$apis.common.pictureUpload({file: base64}).then(res => {
this.formObj[this.attr] = res
console.log(this.formObj, res)
this.$emit('uploadSuccess', {attr : this.attr, url: res})
})
}
},
uploadVideo(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
// }
upload.init().then(res => {
if (res.status == 0) {
upload
.uploaded(file)
.then(res => {
self.formObj[this.attr] = res.video.url
console.log( self.formObj, res.video.url)
self.$emit('uploadSuccess', {attr : this.attr, url: res.video.url})
})
.finally(end => {
console.log(end)
})
upload.uploadEvent('', res => {
console.log(res, '视频上传完成')
})
upload.uploadEvent('media_progress', res => {
console.log(res)
})
}
})
},
del(){
this.formObj[this.attr] = ''
this.$emit('delImage', {attr : this.attr})
},
edit() {
this.$emit('editImage', {attr : this.attr})
}
}
}
</script>
<style lang="scss" scoped>
.upload-ctnr{
display: flex;
align-items: flex-end;
.label{
display: inline-block;
vertical-align: top;
width: 154px;
height: 20px;
font-size: 14px;
color: #333333;
text-align: right;
line-height: 20px;
box-sizing: border-box;
}
.tip {
display: inline-block;
font-size: 14px;
color: #999999;
height: 20px;
line-height: 20px;
margin-left: 8px;
vertical-align: bottom;
}
.tip-bottom{
display: block;
margin-top: 8px;
margin-left: 0;
}
.img-wrap{
display: flex;
}
.img-item{
display: inline-flex;
border: 1px dashed #00000026;
box-sizing: border-box;
width: 104px;
height: 104px;
background: #0000000a;
border-radius: 4px;
position: relative;
&:hover{
.operate{
display: block;
}
}
.image{
width: 100%;
height: 100%;
z-index: 2;
position: relative;
}
.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;
}
}
.add-img{
width: 100%;
height: 100%;
cursor: pointer;
display: inline-flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #666666;
position: relative;
.file{
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
position: absolute;
opacity: 0;
}
.add {
font-size: 18px;
font-weight: 500;
}
p {
margin-top: 12px;
height: 22px;
line-height: 22px;
}
}
.operate{
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.4);
border-radius: 4px;
z-index: 5;
.btn-wrap{
color: #fff;
white-space: nowrap;
position: absolute;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
i{
font-size: 16px;
cursor: pointer;
&:first-child{
margin-right: 12px;
}
}
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<!-- 搜索 --> <!-- 搜索 -->
<template> <template>
<div :class="['glsx-combi-form', isEdit ? 'gl-form-page' : '']"> <div :class="['glsx-combi-form', isEdit ? 'gl-form-page' : '']">
<el-form :ref="formRef" :inline="true" :model="formObj" :rules="formRules" size="small" class="glsx-combi-form-block"> <el-form :ref="formRef" :inline="isInline" :model="formObj" :rules="formRules" size="small" class="glsx-combi-form-block">
<template v-for="(item, index) in formData"> <template v-for="(item, index) in formData">
<slot v-if="item.slotName && item.isHide" :name="item.slotName" :scope="item"></slot>
<el-form-item v-if="!item.isHide" :key="index" :id="item.name" :labelWidth="isEdit ? '154px' : labelWidth" :class="{ 'no-label': !item.label, isBlock: isBlock }" :style="{ 'margin-bottom': isEdit ? '24px' : '', 'margin-right': isEdit ? '0px' : '30px', ...item.style }" :label="item.label" :prop="item.name"> <el-form-item v-if="!item.isHide" :key="index" :id="item.name" :labelWidth="isEdit ? '154px' : labelWidth" :class="{ 'no-label': !item.label, isBlock: isBlock }" :style="{ 'margin-bottom': isEdit ? '24px' : '', 'margin-right': isEdit ? '0px' : '30px', ...item.style }" :label="item.label" :prop="item.name">
<span v-if="!item.isHide && item.tips" class="tips-block" slot="label"> <span v-if="!item.isHide && item.tips" class="tips-block" slot="label">
<span class="tips-label">{{ item.label }}</span> <span class="tips-label">{{ item.label }}</span>
...@@ -143,6 +144,10 @@ export default { ...@@ -143,6 +144,10 @@ export default {
type: String, type: String,
default: '432px' default: '432px'
}, },
isInline: {
type: Boolean,
default: true
},
formRef: { formRef: {
type: String, type: String,
default: 'formRef' default: 'formRef'
......
import { Message } from 'element-ui' import { Message } from 'element-ui'
let util = {} let util = {}
util.isImage = function(url) {
const suffix = url.split('.').pop()
const imageList = ['png','jpeg','jpg','webp','gif']
return imageList.includes(suffix)
}
util.cloneText = function(message) { util.cloneText = function(message) {
let input = document.createElement('input') let input = document.createElement('input')
input.value = message input.value = message
......
<template>
<GLDialog mode="mid" :close-on-click-modal="false" title="新增内容" :visible.sync="visible" @onOk="onOk" :before-close="onCancel" @onCancel="onCancel">
<glsx-combi-form class="glsx-combi-form" ref="videoRef" labelWidth="154px" defaultWidth="432px" :isInline="false" :formObj.sync="formObj" :formData="formData" :formRules="rules">
<div slot="moduleSlot" class="radio-slot">
<el-radio-group @change="menuRadioChange" v-model="formObj.menuId">
<el-radio v-for="item in menuList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group>
</div>
<div slot="zoneSlot" class="radio-slot">
<el-radio-group v-model="formObj.subMenuId">
<el-radio v-for="item in subMenuList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group>
</div>
<div slot="contZoneSlot" class="radio-slot">
<el-radio-group v-model="formObj.type">
<el-radio :label="formObj.type">{{contentType[contentObj.type]}}</el-radio>
</el-radio-group>
</div>
<div slot="businessSlot" class="global-menu">
<span class="module">{{contentObj.menuName}}</span>
<i class="el-icon-arrow-right arrow-right"></i>
<span class="module">{{contentObj.subMenuName}}</span>
<i class="el-icon-arrow-right arrow-right"></i>
<span class="module active">{{contentType[contentObj.type]}}</span>
</div>
<div slot="mainVideoSlot" class="main-video-slot">
<Upload tip="建议尺寸:最大5M" :formObj="formObj" btnName="上传海报" attr="prodImg"></Upload>
</div>
<div slot="linkConfigSlot">
<el-switch v-model="formObj.isLink" active-value="1" inactive-value="2" active-color="#5850FF" inactive-color="#E8E8EA"></el-switch>
<div class="link-tip"> 默认链接内容为特色产品中第一个产品内容详情</div>
</div>
</glsx-combi-form>
</GLDialog>
</template>
<script>
import Upload from '@/components/Upload'
import glsxCombiForm from '@/components/glsx-combi-form'
export default {
name: 'AddVideo',
components: {
glsxCombiForm,
Upload
},
props: {
visible: {
type: Boolean,
default: false
},
contentObj: {
type: Object,
default: ()=>{
return {}
}
}
},
data(){
return {
contentType: {
1: '特色产品',
2: '案例视频',
3: '营销海报',
4: '操作指引'
},
detailVisible: false,
formObj: {
id: '',
menuId: '',
subMenuId: '',
type: '',
proName: '',
prodImg: '',
isLink: '2',
},
formData:[
{
label: '业务模块',
name: 'module',
isHide: true,
addHtml: 'moduleSlot'
},
{
label: '业务专区',
name: 'zone',
isHide: true,
addHtml: 'zoneSlot'
},
{
label: '内容专区',
name: 'contZone',
isHide: true,
addHtml: 'contZoneSlot'
},
{
label: '业务模块',
name: 'business',
isHide: false,
addHtml: 'businessSlot'
},
{
label: '海报标题',
name: 'proName',
isHide: false,
type: 'input'
},
{
label: '海报图片',
name: 'prodImg',
isHide: false,
addHtml: 'mainVideoSlot'
},
{
label: '是否配置链接',
isHide: true,
name: 'isLink',
addHtml: 'linkConfigSlot'
}
],
rules: {
isLink: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
proName: [{ required: true, message: '请输入海报标题', trigger: 'change' }],
business: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
module: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
zone: [{required: true, validator: (rule, value, callback) => {
return callback()
}, trigger: 'change'}],
contZone: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
prodImg: [
{
required: true,
validator: (rule, value, callback) => {
if (!this.formObj.prodImg) {
return callback(new Error('请上传海报图片'))
} else {
return callback()
}
},
trigger: 'change'
}
]
},
menuList: []
}
},
computed: {
subMenuList(){
const target = this.menuList.find(item => item.id == this.formObj.menuId)
return target?.childList || []
}
},
created() {
const {menuId, subMenuId , type} = this.contentObj
this.formObj = {...this.formObj, menuId, subMenuId , type}
if(this.contentObj.id) {
this.formData.forEach(item => {
if(type==5){
item.isHide = !(item.name == 'isLink' || item.name == 'prodImg')
if(item.name == 'prodImg') item.label == 'banner'
}else{
const hideItemList = ['module', 'zone', 'contZone']
if(hideItemList.includes(item.name)){
item.isHide = false
}
if(item.name=='business') item.isHide = true
}
});
console.log(this.formData)
this.getMenuList()
}
},
methods: {
menuRadioChange(e){
const target = this.menuList.find(item => item.id == e)
if(target?.childList?.length) {
this.formObj.subMenuId = target?.childList[0]?.id
}
},
getMenuList() {
this.$apis.discover.getMenuListApi({}).then(res => {
this.getContentDetail()
if(res?.length){
this.menuList = res
}
})
},
closeDetailDialog(){
this.detailVisible = false
},
onCancel(){
console.log(this.formObj)
this.contentObj.imageDialogVisible = false
// this.$emit('closeVideoDialog')
},
async getContentDetail(){
this.$apis.discover.getContentDetailApi({id: this.contentObj.id}).then(res => {
console.log(res)
if(res?.id){
for(const key in this.formObj){
this.formObj[key] = res[key]
}
}
})
},
onOk() {
console.log(this.formObj)
this.$refs.videoRef.$refs.formRef.validate(valid => {
if(valid) {
const params = JSON.parse(JSON.stringify(this.formObj))
if(!this.contentObj.id) delete params.id
if(this.contentObj.type==3){
delete params.isLink
}else{
delete params.proName
}
this.$apis.discover.addContentApi(params).then(res => {
if(res) {
this.$message.success('操作成功')
this.onCancel()
this.$parent.handleSearch();
}
})
}
})
},
}
}
</script>
<style lang="scss" scoped>
.main-video-slot{
display: flex;
/deep/ .upload-ctnr{
margin-right: 8px;
}
}
.radio-slot{
/deep/ .el-radio{
margin-right: 20px;
line-height: 25px;
.el-radio__label{
width: 100px;
display: inline-block;
}
}
}
.link-tip{
height: 17px;
line-height: 17px;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 12px;
color: #999999;
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<GLDialog mode="mid" :close-on-click-modal="false" :title="contentObj.type==2 ? '新增案例视频' : '新增操作指引'" :visible.sync="visible" @onOk="onOk" :before-close="onCancel" @onCancel="onCancel">
<glsx-combi-form class="glsx-combi-form" ref="videoRef" labelWidth="154px" defaultWidth="432px" :isInline="false" :formObj.sync="formObj" :formData="formData" :formRules="rules">
<div slot="moduleSlot" class="radio-slot">
<el-radio-group @change="menuRadioChange" v-model="formObj.menuId">
<el-radio v-for="item in menuList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group>
</div>
<div slot="zoneSlot" class="radio-slot">
<el-radio-group v-model="formObj.subMenuId">
<el-radio v-for="item in subMenuList" :key="item.id" :label="item.id">{{item.name}}</el-radio>
</el-radio-group>
</div>
<div slot="contZoneSlot" class="radio-slot">
<el-radio-group v-model="formObj.type">
<el-radio :label="formObj.type">{{contentType[contentObj.type]}}</el-radio>
</el-radio-group>
</div>
<div slot="businessSlot" class="global-menu">
<span class="module">{{contentObj.menuName}}</span>
<i class="el-icon-arrow-right arrow-right"></i>
<span class="module">{{contentObj.subMenuName}}</span>
<i class="el-icon-arrow-right arrow-right"></i>
<span class="module active">{{contentType[contentObj.type]}}</span>
</div>
<div slot="mainVideoSlot" class="main-video-slot">
<Upload :formObj="formObj" btnName="上传视频" attr="vedioUrl"></Upload>
<Upload tip="建议尺寸:最大5M,138*84px" :formObj="formObj" btnName="上传视频封面" attr="imageUrl"></Upload>
</div>
</glsx-combi-form>
</GLDialog>
</template>
<script>
import Upload from '@/components/Upload'
import glsxCombiForm from '@/components/glsx-combi-form'
export default {
name: 'AddVideo',
components: {
glsxCombiForm,
Upload
},
props: {
visible: {
type: Boolean,
default: false
},
contentObj: {
type: Object,
default: ()=>{
return {}
}
}
},
data(){
return {
contentType: {
1: '特色产品',
2: '案例视频',
3: '营销海报',
4: '操作指引'
},
detailVisible: false,
formObj: {
id: '',
menuId: '',
subMenuId: '',
type: '',
proName: '',
title: '',
vedioUrl: '',
imageUrl: '',
view: ''
},
formData:[
{
label: '业务模块',
name: 'module',
isHide: true,
addHtml: 'moduleSlot'
},
{
label: '业务专区',
name: 'zone',
isHide: true,
addHtml: 'zoneSlot'
},
{
label: '内容专区',
name: 'contZone',
isHide: true,
addHtml: 'contZoneSlot'
},
{
label: '业务模块',
name: 'business',
isHide: false,
addHtml: 'businessSlot'
},
{
label: '封面标题',
name: 'proName',
type: 'input'
},
{
label: '内容标题',
name: 'title',
type: 'input'
},
{
label: '主视频',
name: 'mainVideo',
addHtml: 'mainVideoSlot'
},
{
label: '观看人数',
name: 'view',
type: 'input'
},
],
rules: {
proName: [{ required: true, message: '请输入封面标题', trigger: 'change' }],
title: [{ required: true, message: '请输入内容标题', trigger: 'change' }],
view: [{ required: true, message: '请输入观看人数', trigger: 'change' }],
business: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
module: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
zone: [{required: true, validator: (rule, value, callback) => {
return callback()
}, trigger: 'change'}],
contZone: [{required: true, validator: (rule, value, callback) => {return callback() }, trigger: 'change'}],
mainVideo: [
{
required: true,
validator: (rule, value, callback) => {
if (!this.formObj.vedioUrl) {
return callback(new Error('请上传主视频'))
} else {
return callback()
}
},
trigger: 'change'
}
]
},
menuList: []
}
},
computed: {
subMenuList(){
const target = this.menuList.find(item => item.id == this.formObj.menuId)
return target?.childList || []
}
},
created() {
const {menuId, subMenuId , type} = this.contentObj
this.formObj = {...this.formObj, menuId, subMenuId , type}
if(this.contentObj.id) {
this.formData.forEach(item => {
const hideItemList = ['module', 'zone', 'contZone']
if(hideItemList.includes(item.name)){
item.isHide = false
}
if(item.name=='business') item.isHide = true
});
this.getMenuList()
}
},
methods: {
menuRadioChange(e){
const target = this.menuList.find(item => item.id == e)
if(target?.childList?.length) {
this.formObj.subMenuId = target?.childList[0]?.id
}
},
getMenuList() {
this.$apis.discover.getMenuListApi({}).then(res => {
this.getContentDetail()
if(res?.length){
this.menuList = res
}
})
},
closeDetailDialog(){
this.detailVisible = false
},
onCancel(){
console.log(this.formObj)
this.contentObj.videoDialogVisible = false
// this.$emit('closeVideoDialog')
},
async getContentDetail(){
this.$apis.discover.getContentDetailApi({id: this.contentObj.id}).then(res => {
console.log(res)
if(res?.id){
for(const key in this.formObj){
this.formObj[key] = res[key]
}
}
})
},
onOk() {
console.log(this.formObj)
this.$refs.videoRef.$refs.formRef.validate(valid => {
if(valid) {
const params = JSON.parse(JSON.stringify(this.formObj))
if(!this.contentObj.id) delete params.id
this.$apis.discover.addContentApi(params).then(res => {
if(res) {
this.$message.success('操作成功')
this.onCancel()
this.$parent.handleSearch();
}
})
}
})
},
}
}
</script>
<style lang="scss" scoped>
.main-video-slot{
display: flex;
/deep/ .upload-ctnr{
margin-right: 8px;
}
}
.radio-slot{
/deep/ .el-radio{
margin-right: 20px;
line-height: 25px;
.el-radio__label{
width: 100px;
display: inline-block;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="menu">
<div v-for="(item,index) in menuList" :key="index">
<div :class="['primary-level', {'menu-active': menuForm.id == item.id}]">
<span>
<i class="el-icon-caret-bottom icon-btn" v-if="item.expansion"></i>
<i class="el-icon-caret-right icon-btn" v-else></i>
{{item.name}}
</span>
<div class="son-operate-wrap" ref="menuOpRef" v-show="boxShow && menuForm.id == item.id">
<ul>
<li class="operate-item" v-for="oItem in primaryLevelOpList" :key="oItem.name" @click="addMenu(oItem)">{{ oItem.name }}</li>
</ul>
</div>
<span>
<img class="operate-btn" @click.stop="showOperateDialog(1, item)" :src="require('@/assets/draggable.png')" />
<!-- <i class="el-icon-edit-outline operate-btn"></i> -->
</span>
</div>
<div class="second-level">
<div :class="['level', {'menu-active': menuForm.id == ele.id}]" v-for="(ele,idx) in item.childList" :key="idx">
<span>{{ele.name}}</span>
<span>
<img class="operate-btn" @click.stop="showOperateDialog(2, ele)" :src="require('@/assets/draggable.png')" />
</span>
<div class="son-operate-wrap" ref="subMenuOpRef" v-show="boxShow && menuForm.id == ele.id">
<ul>
<li class="operate-item" v-for="oItem in secondLevelOpList" :key="oItem.name" @click="addMenu(oItem)">{{ oItem.name }}</li>
</ul>
</div>
</div>
</div>
</div>
<GLDialog :title="title" mode="small" :visible.sync="menuVisible" @onOk="commitMenu" :before-close="closeMenuDialog" @onCancel="closeMenuDialog">
<div class="menu-dialog-body">
<el-form ref="menuRef" label-width="154px" :rules="menuRules" :model="menuForm">
<el-form-item label="模块名称:" prop="name" class="m-t-20">
<el-input style="width: 284px;" :size="size" type="text" v-model="menuForm.name" placeholder="请输入" :maxlength="menuForm.level==1 && menuForm.type=='rename' ? 6 : 8" show-word-limit></el-input>
</el-form-item>
</el-form>
</div>
</GLDialog>
</div>
</template>
<script>
export default {
name: 'Menu',
props: {
name: {
type: String,
default: ''
}
},
computed: {
title() {
return this.menuForm.type == 'rename' ? '重命名' : this.menuForm.position == '1' ? '新增子级' : '新建菜单'
}
},
data() {
return {
menuVisible: false,
menuForm: {
id: '',
name: '',
position: '',
sceneCode: '',
type: '',
level: ''
},
menuRules: {
name: [
{
required: true,
validator: (rule, value, callback) => {
if (!value || (value && !value.trim())) {
return callback(new Error('请输入菜单名称'))
} else {
return callback()
}
},
trigger: 'change'
}
]
},
primaryLevelOpList: [
{
name: '新增子级',
type: 'add',
position: 1
},
{
name: '重命名',
type: 'rename'
}
],
secondLevelOpList:[
{
name: '下方新增同级',
type: 'add',
position: 3
},
{
name: '上方新增同级',
type: 'add',
position: 2
},
{
name: '重命名',
type: 'rename'
}
],
menuList: [],
curModuleInfo: {
menuName: '',
menuId: '',
subMenuName: '',
subMenuId: ''
},
boxShow: false
}
},
created(){
this.getMenuList()
},
mounted() {
document.addEventListener("click", this.eventListener);
},
beforeDestroy(){
document.removeEventListener("click", this.eventListener);
},
methods: {
eventListener(e){
if (!this.$refs?.menuOpRef?.[0]?.contains(e.target)) this.boxShow = false;
},
getMenuList() {
this.$apis.discover.getMenuListApi({}).then(res => {
if(res?.length){
this.menuList = res
const {id , name, childList} = res[0] || {}
this.curModuleInfo = {
menuName: name,
menuId: id,
subMenuName: childList[0]?.name,
subMenuId: childList[0]?.id
}
}
})
},
addMenu(item){
const { position, type } = item
this.menuForm = {...this.menuForm, position, type}
if(type=='add') this.menuForm.name = ''
this.menuVisible = true
},
commitMenu(){
this.$refs.menuRef.validate(valid => {
if(valid){
const { id, name, position , sceneCode , type } = this.menuForm
let params = {}
if(type=='add'){
params = { name, position, sceneCode }
if(position==1) params.parentMenuId = id
if(position==2 || position==3) params.menuId = id
}else{
params = { id, name }
}
const api = params.id ? 'updateMenuApi' : 'addMenuApi'
this.$apis.discover[api](params).then(res => {
console.log(res)
if(res){
this.menuVisible = false
this.$message.success(`${params.id ? '修改成功' : '新增成功'}`)
this.getMenuList()
}
})
}
})
},
showOperateDialog(level, item){
this.boxShow = true
const {id, sceneCode, name} = item
this.menuForm = {...this.menuForm, id, sceneCode, name, level}
}
}
}
</script>
<style lang="scss" scoped>
.menu{
padding: 18px 4px 18px 16px;
width: 250px;
.menu-dialog-body{
height: 150px;
display: flex;
align-items: center;
}
.son-operate-wrap{
position: absolute;
background-color: #fff;
top: 80%;
right: 4px;
box-shadow: 0 3px 6px -4px #0000001f, 0 6px 16px 0 #00000014, 0 9px 28px 8px #0000000d;
z-index: 2;
.operate-item{
height: 36px;
line-height: 36px;
padding: 0 20px;
font-size: 14px;
color: #666666;
list-style: none;
&:hover{
background: #F2F1FF;
}
}
}
.operate-btn{
height: 16px;
width: 16px;
vertical-align: middle;
color: #5850FF;
cursor: pointer;
&:first-child{
margin-right: 13px;
}
}
.menu-active{
background: #F2F1FF;
}
.primary-level{
height: 28px;
line-height: 28px;
color: #333333;
text-align: left;
display: flex;
justify-content: space-between;
font-size: 14px;
font-family: PingFangSC-Regular;
cursor: default;
position: relative;
&:hover{
background: #F2F1FF;
}
.son-operate-wrap{
right: 4px;
}
.icon-btn{
cursor: pointer;
}
}
.second-level{
margin-left: 32px;
.level{
height: 32px;
line-height: 32px;
font-size: 14px;
color: #333333;
cursor: default;
position: relative;
display: flex;
justify-content: space-between;
&:hover{
background: #F2F1FF;
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<GLDialog mode="mid" append-to-body :close-on-click-modal="false" title="创建封面" :visible.sync="visible" :before-close="onCancel" @onOk="onOk" @onCancel="onCancel">
<glsx-combi-form class="glsx-combi-form" ref="detailRef" labelWidth="154px" defaultWidth="432px" :isInline="false" :formObj.sync="detailFormObj" :formData="detailFormData" :formRules="detailRules">
<div slot="coverSlot">
<Upload tip="建议尺寸:最大5M,176*120px" :formObj="detailFormObj" btnName="上传封面" attr="url"></Upload>
</div>
</glsx-combi-form>
</GLDialog>
</template>
<script>
import Upload from '@/components/Upload'
import glsxCombiForm from '@/components/glsx-combi-form'
export default {
name: 'AddVideo',
components: {
glsxCombiForm,
Upload
},
props: {
visible: {
type: Boolean,
default: false
}
},
data(){
return {
detailFormObj: {
title: '',
url: ''
},
detailFormData: [
{
label: '封面标题',
name: 'title',
type: 'input'
},
{
label: '内容标题',
name: 'url',
addHtml: 'coverSlot'
}
],
detailRules: {
title: [{ required: true, message: '请输入产品名称', trigger: 'change' }],
url: [{ required: true, message: '请上传封面', trigger: 'change' }]
},
}
},
methods: {
onCancel(){
this.$emit('closeDialog')
},
onOk() {
this.$refs.detailRef.$refs.formRef.validate(valid => {
if(valid){
const { title, url} = this.detailFormObj
this.$emit('confirmDialog',{ title, url })
}
})
},
}
}
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file \ No newline at end of file
<!-- 秒杀活动 -->
<template>
<div class="ctnr">
<Menu ref="menuRef" class="menu"></Menu>
<div class="list">
<GLCombiForm class="search-wrap" ref="searchRef" labelWidth="154px" defaultWidth="432px" @handleOk="handleSearch" @handleRest="handleReset" :formObj="searchFormObj" :formData="searchFormData">
</GLCombiForm>
<div class="operate-wrap">
<span class="table-title">商品列表</span>
<div class="operate-btn">
<el-button :size="size" type="primary">新增<i class="el-icon-arrow-down arrow-icon"></i></el-button>
<div class="dropdown-wrap">
<ul>
<li class="dropdown-item" @click="addContent(item)" v-for="item in contentTypeList" :key="item.id">{{ item.name }}</li>
</ul>
</div>
</div>
</div>
<GLTable @setTableFinishFun="setTableFinishFun" ref="tableRef" :pageConf="pageConf" :searchForm="searchObj" :tableParams="tableParams" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn">
<div slot="coverImageSlot" slot-scope="scope">
<el-image
style="width: 100px; height: 100px"
:src="scope.scope.prodImg"
:preview-src-list="[scope.scope.prodImg]">
</el-image>
</div>
<div slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
</div>
<AddImage v-if="contentObj.imageDialogVisible" :contentObj="contentObj" :visible="contentObj.imageDialogVisible"></AddImage>
<AddVideo v-if="contentObj.videoDialogVisible" :contentObj="contentObj" :visible="contentObj.videoDialogVisible"></AddVideo>
</div>
</template>
<script>
const CONTENT_LIST = [
{
id: '1',
name: '特色产品'
},
{
id: '2',
name: '案例视频'
},
{
id: '3',
name: '营销海报'
},
{
id: '4',
name: '操作指引'
},
{
id: '5',
name: 'banner'
}
]
import Menu from './components/Menu'
import AddVideo from './components/AddVideo'
import AddImage from './components/AddImage'
export default {
name: 'discover',
components: {
Menu,
AddVideo,
AddImage
},
data() {
return {
contentObj: {
imageDialogVisible: false,
videoDialogVisible: false,
type: ''
},
contentTypeList: CONTENT_LIST.slice(0, 4),
operateList:[
{
name: '新增子集'
},
{
name: '重命名'
}
],
getListApi: this.$apis.discover.getListApi,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchFormObj: {
type: '5',
status: '',
subMenuId: '4'
},
searchObj: {},
searchFormData: [
{
label: '所属内容专区',
name: 'type',
type: 'select',
optionList: CONTENT_LIST,
optionId: 'id',
optionLabel: 'name',
isClear: true
},
{
label: '状态',
name: 'status',
type: 'select',
optionList: [
{
id: '',
name: '全部'
},
{
id: '1',
name: '已上架'
},
{
id: '2',
name: '已下架'
}
],
optionId: 'id',
optionLabel: 'name',
isClear: true
},
],
buttonList: [
{
type: 'el-button',
name: '编辑',
attrs: {
type: 'text',
fn: '编辑'
},
listeners: {
click: row => this.addContent(row.scope, 1)
}
},
{
type: 'el-button',
name: '上架',
attrs: {
type: 'text',
fn: '上架'
},
condition: row => {
return row.scope.type != 5 && row.scope.status != 1
},
listeners: {
click: row => this.updateStatus(row.scope.id, 1)
}
},
{
type: 'el-button',
name: '下架',
attrs: {
type: 'text',
fn: '下架'
},
condition: row => {
return row.scope.type != 5 && row.scope.status == 1
},
listeners: {
click: row => this.updateStatus(row.scope.id, 2)
}
}
],
tableParams: {
listName: 'list',
tableOption: {
width: 150
},
tableColumns: [
{
label: '所属内容专区',
formatter: (cell) => {
return CONTENT_LIST.find(item => item.id == cell.type).name
}
},
{
label: '封面图片',
prop: 'coverImage',
addHtml: 'coverImageSlot'
},
{
label: '内容封面标题',
prop: 'proName',
},
{
label: '状态',
prop: 'status',
formatter: (cell) => {
return (cell.status == 1 || cell.type == 5) ? '已上架' : '已下架'
}
},
]
},
}
},
created() {
},
mounted() {
},
methods:{
addContent(item, isEdit){
let type = isEdit ? item.type : item.id
if(type != 1){
this.contentObj = {
imageDialogVisible: type==3 || type==5,
videoDialogVisible: type==2 || type==4,
...this.$refs.menuRef.curModuleInfo,
type,
}
if(isEdit) this.contentObj.id = item.id
}else{
let params = {
...this.$refs.menuRef.curModuleInfo,
}
if(isEdit) params.id = item.id
const queryStr = encodeURIComponent(JSON.stringify(params))
this.$router.push({ path: `/discoverManager/addProd/`+queryStr})
}
},
updateStatus(id, status) {
if(status==2){
this.$confirm('请确认是否下架', '提示', {
confirmButtonText: '下架',
cancelButtonText: '否',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.toShelfProd(id, status)
}
}
})
}else{
this.toShelfProd(id, status)
}
},
toShelfProd(id, status){
this.$apis.discover.updateStatusApi({id, status}).then(res => {
if(res){
this.$message.success(`${status == 2 ? '下架成功' : '上架成功'}`)
this.handleSearch()
}
})
},
handleSearch(){
this.$refs.tableRef.refreshTable()
},
handleReset(){
this.searchFormObj = {
type: '',
status: '',
subMenuId: ''
},
this.handleSearch()
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchFormObj))
params.subMenuId = this.$refs.menuRef.curModuleInfo.subMenuId
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchObj = this.getParams()
resolve()
})
},
}
}
</script>
<style scoped lang="scss">
.ctnr{
display: flex;
.search-wrap{
/deep/ .el-form-item {
&, .search-item{
width: 312px;
}
}
}
.operate-btn{
position: relative;
&:hover{
.dropdown-wrap {
display: block;
}
}
.arrow-icon{
margin-left: 8px;
}
.dropdown-wrap{
display: none;
position: absolute;
background-color: #fff;
top: 100%;
width: 96px;
left: 0;
box-shadow: 0 3px 6px -4px #0000001f, 0 6px 16px 0 #00000014, 0 9px 28px 8px #0000000d;
z-index: 50;
.dropdown-item{
height: 36px;
line-height: 36px;
padding: 0 20px;
font-size: 14px;
color: #666666;
list-style: none;
cursor: default;
&:hover{
background: #F2F1FF;
color: #5850FF;
}
}
}
}
.list{
flex: 1;
background-color: #fff;
padding: 20px;
}
.menu{
background-color: #fff;
margin-right: 20px;
}
}
</style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!