Commit 4f674987 by 匡雅琴

营销素材调整

1 parent 756043d3
...@@ -54,13 +54,14 @@ const editMaterialGroup = params => { ...@@ -54,13 +54,14 @@ const editMaterialGroup = params => {
url: 'rop-scrm-marketing/router', url: 'rop-scrm-marketing/router',
method: 'post', method: 'post',
data: params, data: params,
sign: true sign: true,
returnAll: true
}) })
} }
//素材删除 //素材删除
const materialDelete = params => { const materialDelete = params => {
params.method = `${defaultPath}material.delete` params.method = `${defaultPath}delete`
return http({ return http({
url: 'rop-scrm-marketing/router', url: 'rop-scrm-marketing/router',
method: 'post', method: 'post',
...@@ -71,7 +72,7 @@ const materialDelete = params => { ...@@ -71,7 +72,7 @@ const materialDelete = params => {
//素材详情 //素材详情
const materialDetail = params => { const materialDetail = params => {
params.method = `${defaultPath}material.detail` params.method = `${defaultPath}detail`
return http({ return http({
url: 'rop-scrm-marketing/router', url: 'rop-scrm-marketing/router',
method: 'post', method: 'post',
...@@ -82,7 +83,7 @@ const materialDetail = params => { ...@@ -82,7 +83,7 @@ const materialDetail = params => {
//素材列表 //素材列表
const materialList = params => { const materialList = params => {
params.method = `${defaultPath}material.page` params.method = `${defaultPath}page`
return http({ return http({
url: 'rop-scrm-marketing/router', url: 'rop-scrm-marketing/router',
method: 'post', method: 'post',
...@@ -93,7 +94,7 @@ const materialList = params => { ...@@ -93,7 +94,7 @@ const materialList = params => {
//素材创建 //素材创建
const materialInsert = params => { const materialInsert = params => {
params.method = `${defaultPath}material.insert` params.method = `${defaultPath}insert`
return http({ return http({
url: 'rop-scrm-marketing/router', url: 'rop-scrm-marketing/router',
method: 'post', method: 'post',
...@@ -104,18 +105,7 @@ const materialInsert = params => { ...@@ -104,18 +105,7 @@ const materialInsert = params => {
//素材编辑 //素材编辑
const materialEdit = params => { const materialEdit = params => {
params.method = `${defaultPath}material.update` params.method = `${defaultPath}update`
return http({
url: 'rop-scrm-marketing/router',
method: 'post',
data: params,
sign: true
})
}
// 素材详情
const materialdetail = params => {
params.method = `${defaultPath}material.detail`
return http({ return http({
url: 'rop-scrm-marketing/router', url: 'rop-scrm-marketing/router',
method: 'post', method: 'post',
...@@ -178,7 +168,6 @@ export default { ...@@ -178,7 +168,6 @@ export default {
materialEdit, materialEdit,
materialInsert, materialInsert,
editMaterialGroup, editMaterialGroup,
materialdetail,
readDetailPage, readDetailPage,
dataOverview, dataOverview,
sendDetailPage, sendDetailPage,
......
...@@ -139,29 +139,34 @@ ...@@ -139,29 +139,34 @@
<el-input type="textarea" v-model="materialAddForm.desc" :size="size" maxlength="30" show-word-limit placeholder="请输入自定义描述"></el-input> <el-input type="textarea" v-model="materialAddForm.desc" :size="size" maxlength="30" show-word-limit placeholder="请输入自定义描述"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="封面:"> <el-form-item label="封面:">
<div class="img_div"> <div class="img-div">
<div class="putImg"> <div class="put-img">
<!-- <img :src="urlSrc" @click="deleteImg" class="imgCSS" /> --> <!-- <img :src="urlSrc" @click="deleteImg" class="img-css" /> -->
<div class="mask"> <div class="mask">
<h3> <h3>
<i class="el-icon-setting"></i> <img src="@/assets/material/view.png" alt="">
<i class="el-icon-delete"></i> <img src="@/assets/material/dele.png" alt="">
</h3> </h3>
</div> </div>
</div> </div>
<el-upload class="avatar-uploader" accept=".jpg, .jpeg, png" :action="uploadImgAction" :show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload"> <div class="avatar-uploader-desc">
<img v-if="imageUrl" :src="materialAddForm.imageUrl" class="avatar" />
<div v-else class="avatar-uploader-desc">
<i class="el-icon-plus avatar-uploader-desc-icon"></i> <i class="el-icon-plus avatar-uploader-desc-icon"></i>
<div class="avatar-uploader-desc-word">上传照片</div> <div class="avatar-uploader-desc-word">上传照片</div>
<input
type="file"
style="opacity: 0"
accept=".pdf"
@change="handleImgChange(e)"
/>
</div> </div>
</el-upload> <div @click="phoneVisible = !phoneVisible" class="view-phone">查看效果></div>
<span>查看效果></span>
</div> </div>
</el-form-item> </el-form-item>
</div> </div>
<div class="share-desc-right"> <div class="share-desc-right" v-show="phoneVisible">
<div class="share-desc-right-box">
<img class="share-desc-right-box-phone" src="@/assets/material/phone.png" alt="">
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -218,6 +223,8 @@ export default { ...@@ -218,6 +223,8 @@ export default {
editInfo: '', editInfo: '',
// 分享设置显示 // 分享设置显示
descVisible: false, descVisible: false,
// 手机显示
phoneVisible: false,
businessTypes: ['整车/新车', '保养', '维修', '车险', '二手车', '改装', '汽车金融', '零配件/精品', '通用(节假日等关怀素材)'], businessTypes: ['整车/新车', '保养', '维修', '车险', '二手车', '改装', '汽车金融', '零配件/精品', '通用(节假日等关怀素材)'],
materialAddFormRules: { materialAddFormRules: {
selectMaterialGroup: [{ required: true, message: '请选择素材组', trigger: 'change' }], selectMaterialGroup: [{ required: true, message: '请选择素材组', trigger: 'change' }],
...@@ -305,6 +312,28 @@ export default { ...@@ -305,6 +312,28 @@ export default {
}) })
} }
}, },
// 上传图片
handleImgChange(e) {
var file = e.srcElement.files[0]
var reader = new FileReader()
// 默认1MB
const limitSize = 1
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传PDF大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
console.log(res);
}
})
}
},
// 存草稿 // 存草稿
onSave() { onSave() {
var params = this.getParams() var params = this.getParams()
...@@ -478,19 +507,19 @@ export default { ...@@ -478,19 +507,19 @@ export default {
border-color: #5850ff; border-color: #5850ff;
color: #5850ff; color: #5850ff;
} }
.img_div { .put-img,
float: left !important; .avatar-uploader-desc,
&>:nth-child(-n+2) { .view-phone{
float: left;
margin-right: 8px; margin-right: 8px;
}
} }
.putImg { .put-img {
width: 104px; width: 104px;
height: 104px; height: 104px;
border-radius: 10px; border-radius: 10px;
display: inline-block; display: inline-block;
position: relative; position: relative;
.imgCSS { .img-css {
height: 100%; height: 100%;
width: 100%; width: 100%;
border-radius: 10px; border-radius: 10px;
...@@ -519,7 +548,7 @@ export default { ...@@ -519,7 +548,7 @@ export default {
.tag-show { .tag-show {
margin-right: 8px; margin-right: 8px;
} }
.putImg:hover .mask { .put-img:hover .mask {
opacity: 1; opacity: 1;
} }
.pdf-show { .pdf-show {
...@@ -535,35 +564,24 @@ export default { ...@@ -535,35 +564,24 @@ export default {
height: 100%; height: 100%;
} }
} }
.avatar-uploader, .avatar-uploader-desc {
.el-upload {
border: 1px dashed #d9d9d9;
height: 104px;
width: 104px; width: 104px;
border-radius: 6px; height: 104px;
cursor: pointer; border-radius: 4px;
position: relative;
display: inline-block;
overflow: hidden;
}
.avatar-uploader,
.el-upload:hover {
border: 1px dashed rgba(0, 0, 0, 0.15); border: 1px dashed rgba(0, 0, 0, 0.15);
} position: relative;
.avatar-uploader-desc {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
&-icon { &-icon {
font-size: 24px; width: 16px;
color: #8c939d; height: 16px;
position: absolute;
top: 28px;
left: 44px;
} }
&-word { &-word {
width: 78px; position: absolute;
height: 22px; top: 58px;
font-size: 14px; left: 24px;
color: #666666; color: #666666
} }
} }
.avatar { .avatar {
...@@ -573,5 +591,16 @@ export default { ...@@ -573,5 +591,16 @@ export default {
} }
.share-desc { .share-desc {
padding-bottom: 30px; padding-bottom: 30px;
display: flex;
justify-content: space-between;
&-right-box {
margin-right: 20px;
width: 290px;
height: 566px;
&-phone {
width: 290px;
height: 566px;
}
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<div> <div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="720px" :before-close="!dialogVisible"> <el-dialog :title="title" :visible.sync="dialogVisible" width="720px" :before-close="!dialogVisible">
<el-form ref="materialGroupAddForm" :model="materialGroupAddForm" label-width="110px" :rules="materialGroupAddRules"> <el-form ref="materialGroupAddForm" :model="materialGroupAddForm" label-width="110px" :rules="materialGroupAddRules">
<el-form-item label="分组名称:" prop="groupName"> <el-form-item label="分组名称:" prop="materialGroupName">
<el-input v-model="materialGroupAddForm.groupName" maxlength="8" show-word-limit :size="size" placeholder="客户跟进" style="width:567px"></el-input> <el-input v-model="materialGroupAddForm.materialGroupName" maxlength="8" show-word-limit :size="size" placeholder="客户跟进" style="width:567px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="业务类型:" prop="businessType"> <el-form-item label="业务类型:" prop="businessType">
<el-checkbox-group class="checkbox-group" v-model="materialGroupAddForm.businessType" @change="handleCheckChange"> <el-checkbox-group class="checkbox-group" v-model="materialGroupAddForm.businessType" @change="handleCheckChange">
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
groupCounter: [], groupCounter: [],
businessTypes: [], businessTypes: [],
materialGroupAddRules: { materialGroupAddRules: {
groupName: [ materialGroupName: [
{ required: true, message: '请输入分组名称', trigger: 'blur' }, { required: true, message: '请输入分组名称', trigger: 'blur' },
{ max: 16, message: '分组名称最长为8个字', trigger: 'blur' } { max: 16, message: '分组名称最长为8个字', trigger: 'blur' }
] ]
...@@ -51,16 +51,16 @@ export default { ...@@ -51,16 +51,16 @@ export default {
this.groupCounter = group this.groupCounter = group
if (addOrEdit == 2) { if (addOrEdit == 2) {
this.title = '编辑素材组' this.title = '编辑素材组'
// if (!value) { if (!value) {
this.materialGroupAddForm.materialGroupName = '新车素材组' this.materialGroupAddForm.materialGroupName = '新车素材组'
// return return
// } }
// var params = [] var params = []
// params.id = value.id params.id = value.id
// this.$apis.material.materialGroupDetail(params).then(res => { this.$apis.material.materialGroupDetail(params).then(res => {
// console.log(res); console.log(res);
// this.materialGroupAddForm = res this.materialGroupAddForm = res
// }) })
} }
// Object.assign(this.materialGroupAddForm, value) // Object.assign(this.materialGroupAddForm, value)
}, },
...@@ -85,7 +85,7 @@ export default { ...@@ -85,7 +85,7 @@ export default {
// 判断素材组名称是否重复 // 判断素材组名称是否重复
var groupName = [] var groupName = []
this.groupCounter.forEach(item => { this.groupCounter.forEach(item => {
groupName.push(item.groupName) groupName.push(item.materialGroupName)
}) })
var idx = groupName.indexOf(this.materialGroupAddForm.materialGroupName) var idx = groupName.indexOf(this.materialGroupAddForm.materialGroupName)
if (idx != -1) { if (idx != -1) {
...@@ -96,6 +96,7 @@ export default { ...@@ -96,6 +96,7 @@ export default {
return return
} }
// 判断是创建还是编辑 // 判断是创建还是编辑
// debugger
if (this.materialGroupAddForm.id) { if (this.materialGroupAddForm.id) {
this.eventBus.$emit('editMaterialGroup', this.materialGroupAddForm) this.eventBus.$emit('editMaterialGroup', this.materialGroupAddForm)
this.dialogVisible = false this.dialogVisible = false
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<li v-for="(item, index) in groupCounter" :key="index" @click="handleGroup(item)"> <li v-for="(item, index) in groupCounter" :key="index" @click="handleGroup(item)">
<img src="@/assets/material/file.png" alt=""> <img src="@/assets/material/file.png" alt="">
<div class="group-name">{{ item.materialGroupName }}</div> <div class="group-name">{{ item.materialGroupName }}</div>
<el-popover placement="right" trigger="click"> <el-popover placement="right" trigger="hover">
<div> <div>
<ul> <ul>
<li @click="handleStick(item.id)">置顶</li> <li @click="handleStick(item.id)">置顶</li>
...@@ -83,10 +83,10 @@ export default { ...@@ -83,10 +83,10 @@ export default {
// 点击素材组获取素材 // 点击素材组获取素材
handleGroup(item) { handleGroup(item) {
var params = {} var params = {}
params.id = item.id params.groupId = item.id
this.$apis.material.materialList(params).then(res => { params.pageNum = 1
console.log(res, '232424'); params.pageSize = 10
}) this.$emit('getList', params)
}, },
// 打开1-新增, 2-编辑 素材组弹框 // 打开1-新增, 2-编辑 素材组弹框
handleAddGroup(addOrEdit, value) { handleAddGroup(addOrEdit, value) {
...@@ -96,11 +96,12 @@ export default { ...@@ -96,11 +96,12 @@ export default {
// 素材组置顶 // 素材组置顶
handleStick(rowId) { handleStick(rowId) {
var date = new Date() var date = new Date()
var stickDate = dayjs(date).format('yyyy-MM-dd HH:mm:ss') var stickDate = dayjs(date).format('YYYY-MM-DD HH:mm:ss')
var params = {} var params = {}
params.id = rowId params.id = rowId
params.orderTime = stickDate params.orderTime = stickDate
this.secondConfirm('提示', '确定置顶该素材组吗?', 'material', 'editMaterialGroup', { params: params }) console.log(params);
this.secondConfirm('提示', '确定置顶该素材组吗?', 'material', 'editMaterialGroup', params)
}, },
// 素材组删除 // 素材组删除
handleDeleteGroup(rowId) { handleDeleteGroup(rowId) {
......
...@@ -24,22 +24,34 @@ ...@@ -24,22 +24,34 @@
<el-row :style="{height: boxHeight}"> <el-row :style="{height: boxHeight}">
<el-col :span="5"> <el-col :span="5">
<div class="left" :style="{height: boxHeight}"> <div class="left" :style="{height: boxHeight}">
<MaterialGroup @openAddDialog="addDialogShow" :eventBus="eventBus"></MaterialGroup> <MaterialGroup @openAddDialog="addDialogShow" :eventBus="eventBus" @getList="getList"></MaterialGroup>
</div> </div>
</el-col> </el-col>
<el-col :span="19"> <el-col :span="19">
<div class="right" :style="{height: boxHeight}"> <div class="right" :style="{height: boxHeight}">
<div class="groupTitle">新车素材组 (共{{ materialTableData.length }}条数据)</div> <div class="groupTitle">{{ materialTableData.groupName ? 'materialTableData.groupName' : '新车素材组' }} (共{{ materialTableData.length }}条数据)</div>
<GLTable ref="materialRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :tableData="materialTableData" :pageConf="pageConf" :tableTotal="tableTotal" @sortChange="sortChange" :isCustomHead="true" :customHeadShowList="customHeadShowList"> <GLTable ref="materialRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :tableData="materialTableData" :pageConf="pageConf" :tableTotal="tableTotal" @sortChange="sortChange" :isCustomHead="true" :customHeadShowList="customHeadShowList">
<!-- 素材内容 --> <!-- 素材内容 -->
<div slot="materialContentRpcResponse" slot-scope="scope"> <div slot="materialContentRpcResponse" slot-scope="scope">
<div v-for="item in scope.scope" :key="item"> <div v-for="item in scope" :key="item">
<!-- 素材为PDF --> <!-- 素材为PDF -->
<div v-if="item.materialType == 1"></div> <div v-if="item.materialType == 1"></div>
<!-- 素材为图文 --> <!-- 素材为图文 -->
<div v-else></div> <div v-else></div>
</div> </div>
</div> </div>
<!-- 状态 -->
<div slot="status" slot-scope="scope">
<span v-if="scope.scope.status == 0">启用</span>
<span v-if="scope.scope.status == -1">禁用</span>
<span v-if="scope.scope.status == 1">存草稿</span>
</div>
<!-- 类型 -->
<div slot="materialType" slot-scope="scope">
<span v-if="scope.scope.materialType == 1">pdf</span>
<span v-if="scope.scope.materialType == 2">自定义链接</span>
<span v-if="scope.scope.materialType == 3">图文</span>
</div>
<span slot="auth-button" slot-scope="scope"> <span slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">详情</el-button> <el-button type="text" @click="handleDetail(scope.scope)">详情</el-button>
<el-button type="text" @click="addMaterial(2, scope.scope)">编辑</el-button> <el-button type="text" @click="addMaterial(2, scope.scope)">编辑</el-button>
...@@ -48,7 +60,7 @@ ...@@ -48,7 +60,7 @@
<li @click="handleForbid(scope.scope)">禁用</li> <li @click="handleForbid(scope.scope)">禁用</li>
<li @click="handleDelete(scope.scope)">删除</li> <li @click="handleDelete(scope.scope)">删除</li>
</ul> </ul>
<el-button type="text" slot="reference">更多</el-button> <el-button type="text" slot="reference" class="btn-more">更多</el-button>
</el-popover> </el-popover>
</span> </span>
</GLTable> </GLTable>
...@@ -159,11 +171,13 @@ export default { ...@@ -159,11 +171,13 @@ export default {
}, },
{ {
label: '状态', label: '状态',
prop: 'status' prop: 'status',
addHtml: 'status'
}, },
{ {
label: '类型', label: '类型',
prop: 'materialType' prop: 'materialType',
addHtml: 'materialType'
}, },
{ {
label: '发送次数', label: '发送次数',
...@@ -308,7 +322,7 @@ export default { ...@@ -308,7 +322,7 @@ export default {
} }
] ]
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
tableTotal: 4 tableTotal: 4
} }
}, },
...@@ -363,10 +377,11 @@ export default { ...@@ -363,10 +377,11 @@ export default {
}, },
// 素材禁用 // 素材禁用
handleForbid(scope) { handleForbid(scope) {
console.log(scope);
var params = {} var params = {}
params.materialName = scope.materialName params.id = scope.id
params.materialUrl = scope.materialUrl
params.status = -1 params.status = -1
console.log(params);
this.secondConfirm('提示', '禁用素材,所有已经发送给客户的素材链接均会失效,是否继续禁用?', 'material', 'materialEdit', { params: params }) this.secondConfirm('提示', '禁用素材,所有已经发送给客户的素材链接均会失效,是否继续禁用?', 'material', 'materialEdit', { params: params })
}, },
// 素材删除 // 素材删除
...@@ -407,6 +422,13 @@ export default { ...@@ -407,6 +422,13 @@ export default {
this.materialTableData = this.materialTableData.sort((a, b) => a[fieldName] - b[fieldName]) this.materialTableData = this.materialTableData.sort((a, b) => a[fieldName] - b[fieldName])
} }
}, },
// 点击素材组获取素材组素材
getList(params) {
this.$apis.material.materialList(params).then(res => {
// console.log(res, '232424');
this.materialTableData = res.data
})
},
// 功能介绍弹框 // 功能介绍弹框
showIntroductionDialog() { showIntroductionDialog() {
this.introductionDialog = true this.introductionDialog = true
...@@ -482,4 +504,7 @@ export default { ...@@ -482,4 +504,7 @@ export default {
} }
} }
} }
.btn-more {
margin-left: 10px;
}
</style>> </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!