Commit 4aae65ad by 王志慧

活码上传需求开发

1 parent 9ab0c7c0
<template>
<div class="view-panel">
<img :src="dialogSrc" width="100%" v-if="dialogType == 'img'" />
<video width="100%" autoplay controls :src="dialogSrc" v-else></video>
</div>
</template>
<script>
export default {
name: 'view',
data() {
return {
dialogVisibleImg: true
}
},
props: {
dialogType: String,
dialogSrc: String
},
methods: {
test() {
console.log('点击了按钮')
this.$messenger.send({ message: { from: 11, message: '11111' } })
}
}
}
</script>
\ No newline at end of file \ No newline at end of file
...@@ -11,5 +11,7 @@ import Vue from 'vue' ...@@ -11,5 +11,7 @@ import Vue from 'vue'
// 导入权限按钮 // 导入权限按钮
import _button from '@/components/glsx-button/index' import _button from '@/components/glsx-button/index'
import glsxTable from '@/components/glsx-table/index.vue' import glsxTable from '@/components/glsx-table/index.vue'
import glsxPreview from '@/components/preview/index.vue'
Vue.component('glsx-button', _button) Vue.component('glsx-button', _button)
Vue.component('glsx-preview', glsxPreview)
// Vue.component('glsx-table', glsxTable) // Vue.component('glsx-table', glsxTable)
\ No newline at end of file \ No newline at end of file
<template>
<div class="activity-img-box">
<template v-if="imageUrlArr && imageUrlArr.length > 0">
<div v-for="(item, index) in imageUrlArr" :key="index">
<div class="pic-box" :style="{ width: picOptions.width, height: picOptions.height }">
<img class="photo-activity" :src="item" alt="" />
<div class="mask" :style="{ width: picOptions.width, height: picOptions.height }">
<!-- <div class="pic-pane-close" @click="handleEnlarge(item)">
<img src="@/assets/img/home/view.png" alt="" />
</div> -->
<template v-if="picOptions.isClose">
<div class="pic-pane-close" @click="close('img', index)">
<img src="@/assets/img/home/dele.png" alt="" />
</div>
</template>
</div>
</div>
</div>
</template>
<template v-if="(imageUrlArr && imageUrlArr.length < 9 && limit > 1) || (imageUrlArr&&imageUrlArr.length == 0 && limit == 1)">
<div class="upload-img">
<i class="el-icon-plus avatar-uploader-desc-icon"></i>
<div class="avatar-uploader-desc-word">上传照片</div>
<input type="file" ref="uploadImg" class="upload-img" style="opacity: 0" accept=".jpg, .jpeg, .png" @change="e => handleImgChange(e)" />
</div>
</template>
<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 {
props: {
picOptions: {
type: Object,
default: () => {
return {
width: '104px',
height: '104px',
isClose: true
}
}
},
imageUrlArr: {
type: Array,
default: () => []
},
limit: {
type: String,
default: '1'
},
index: {
type: Number,
default: -1
}
},
data() {
return {
dialogVisibleImg: false
}
},
methods: {
// 上传图片
handleImgChange(e) {
this.$notify({
title: '提示',
message: '图片上传中,请稍后'
})
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.imageUrlArr.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.pictureUpload({ file: fileUrl, compress: this.picOptions.compress || 0 }).then(res => {
if (res) {
this.$notify({
title: '提示',
message: '图片上传成功',
type: 'success'
})
this.imageUrlArr.push(res)
this.$emit('change', { arr: this.imageUrlArr, key: this.picOptions.key, index: this.index })
}
e.target.value = ''
this.$refs.uploadImg.value = ''
})
}
},
// 预览图文
handleEnlarge(src, type) {
this.dialogVisibleImg = true
this.dialogSrc = src
this.dialogType = type ? type : 'img'
},
// 删除图片/视频
close(type, index) {
switch (type) {
case 'radio':
this.videoUrl = ''
this.videoImage = ''
break
case 'img':
this.imageUrlArr.splice(index, 1)
this.$emit('change', { arr: this.imageUrlArr, key: this.picOptions.key, id: 1, index: this.index })
break
default:
this.videoUrl = ''
}
}
}
}
</script>
<style scoped lang="scss">
.activity-img-box {
display: flex;
flex-wrap: wrap;
max-width: 600px;
.pic-box {
position: relative;
width: 104px;
height: 104px;
border-radius: 4px;
margin-right: 8px;
margin-bottom: 5px;
&:hover .mask {
opacity: 1;
}
.pic {
position: absolute;
object-fit: fill;
}
.photo-activity {
position: absolute;
width: 100%;
height: 100%;
}
.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: 104px;
height: 104px;
z-index: 999;
.pic-pane-close {
width: 14px;
height: 14px;
cursor: pointer;
margin-right: 8px;
img{
width:100%;
display: block;
}
}
}
}
.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: 104px;
height: 104px;
}
}
.avatar-uploader-desc-word {
font-weight: 400;
font-size: 28rpx;
color: #666666;
}
.image-dialog {
/deep/ {
.el-dialog__header {
border-bottom: 0px;
padding: 0px;
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -460,7 +460,7 @@ export default { ...@@ -460,7 +460,7 @@ export default {
} }
}, },
handleConfig() { handleConfig() {
const { followStaffName, followStaff } = this const { followStaffName, followStaff ,qrCode} = this
let staff = [] let staff = []
if (followStaffName) { if (followStaffName) {
const name = followStaffName.split(',') const name = followStaffName.split(',')
...@@ -473,7 +473,7 @@ export default { ...@@ -473,7 +473,7 @@ export default {
}) })
} }
this.$refs.configForm.init(this.dracScrmWelcomeConfigDTOS, staff) this.$refs.configForm.init(this.dracScrmWelcomeConfigDTOS, staff,qrCode)
}, },
changeBackground() { changeBackground() {
this.$refs.cardForm.init(this.backgroundId) this.$refs.cardForm.init(this.backgroundId)
...@@ -544,7 +544,7 @@ export default { ...@@ -544,7 +544,7 @@ export default {
//详情 //详情
async getConfigDetail() { async getConfigDetail() {
this.loading = true this.loading = true
const { merchantName, merchantAddress, id, backgroundId, followStaffName, configId, followStaff, dracScrmWelcomeConfigDTOS, businessUuid, miniprogramCode } = await this.$apis.helpCard.getConfigDetail({}) const { merchantName, merchantAddress, id, backgroundId, followStaffName, configId, followStaff, dracScrmWelcomeConfigDTOS, businessUuid, miniprogramCode,qrCode } = await this.$apis.helpCard.getConfigDetail({})
this.merchantName = merchantName ? merchantName : '' this.merchantName = merchantName ? merchantName : ''
this.merchantAddress = merchantAddress ? merchantAddress : '' this.merchantAddress = merchantAddress ? merchantAddress : ''
this.backgroundId = backgroundId this.backgroundId = backgroundId
...@@ -555,6 +555,7 @@ export default { ...@@ -555,6 +555,7 @@ export default {
this.followStaffName = followStaffName ? followStaffName : '' this.followStaffName = followStaffName ? followStaffName : ''
this.followStaff = followStaff ? followStaff : '' this.followStaff = followStaff ? followStaff : ''
this.dracScrmWelcomeConfigDTOS = dracScrmWelcomeConfigDTOS ? dracScrmWelcomeConfigDTOS : [] this.dracScrmWelcomeConfigDTOS = dracScrmWelcomeConfigDTOS ? dracScrmWelcomeConfigDTOS : []
this.qrCode = qrCode
this.listContact() this.listContact()
}, },
validFirst() { validFirst() {
......
<template> <template>
<div class="activity-main"> <div class="activity-main">
<el-drawer class="activity-drawer" size="50%" title="跟进员配置" :visible.sync="drawer" :before-close="handleClose" :append-to-body="true"> <el-drawer class="activity-drawer" size="70%" title="跟进员配置" :visible.sync="drawer" :before-close="handleClose" :append-to-body="true">
<div class="market-container"> <div class="gl-form-page gl-form-min">
<div v-if="title || $slots.title"> <el-form label-width="154px" :model="form" size="small" :rules="rule">
<slot name="title">{{ title }}</slot> <el-form-item label="配置方式:" prop="configuration">
</div> <el-radio-group v-model="form.configuration" @change="changeConfig">
<div class="config-item"> <el-radio :label="1">直接配置</el-radio>
<div class="market-title"> <el-radio :label="2">活码上传</el-radio>
<label>*</label> </el-radio-group>
跟进专员: </el-form-item>
</el-form>
</div>
<div class="optional-wrap" v-show="form.configuration == 1">
<div class="market-container">
<div v-if="title || $slots.title">
<slot name="title">{{ title }}</slot>
</div> </div>
<div class="market-content"> <div class="config-item">
<el-button size="small" @click="handleAddEmp"> <div class="market-title">
<i class="el-icon-plus"></i> <label>*</label>
选择专员 跟进专员:
</el-button> </div>
<div class="el-input-tag input-tag-wrapper" v-show="staffInfo.length"> <div class="market-content">
<GLFull :label="tag.staffName" :identi="`${tag.staffId}`" labelWidth="110" textType="user" :haveClose="true" v-for="(tag, idx) in staffInfo" :key="idx" @handleRemove="removeStaff(idx)"></GLFull> <el-button size="small" @click="handleAddEmp">
<i class="el-icon-plus"></i>
选择专员
</el-button>
<div class="el-input-tag input-tag-wrapper" v-show="staffInfo.length">
<GLFull :label="tag.staffName" :identi="`${tag.staffId}`" labelWidth="110" textType="user" :haveClose="true" v-for="(tag, idx) in staffInfo" :key="idx" @handleRemove="removeStaff(idx)"></GLFull>
</div>
</div> </div>
</div> </div>
</div> <div class="config-item">
<div class="config-item"> <div class="market-title">
<div class="market-title"> <label>*</label>
<label>*</label> 配置欢迎语:
配置欢迎语: </div>
</div> <div class="market-content" v-if="drawer">
<div class="market-content" v-if="drawer"> <GLEditor ref="welcome" :btnList="btnList" @previewWord="previewForm"></GLEditor>
<GLEditor ref="welcome" :btnList="btnList" @previewWord="previewForm"></GLEditor> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="preview-wrap" v-show="form.configuration == 2">
<preview :picOptions="picOptions" :imageUrlArr="form.qrCodeArr" @change="changeqrCode"></preview>
<div class="preview-text" @click="handleView">预览</div>
<div class="el-form-item__error" v-if="qrCodeFlag">请上传图片</div>
<div class="text-tip">建议大小:不超过1M</div>
</div>
<div class="drawer-btn"> <div class="drawer-btn">
<el-button @click="drawer = false" size="small"> <el-button @click="drawer = false" size="small">取消</el-button>
取消
</el-button>
<el-button type="primary" @click="handleSaveConfig" size="small">提交</el-button> <el-button type="primary" @click="handleSaveConfig" size="small">提交</el-button>
</div> </div>
</el-drawer> </el-drawer>
<select-emp @selectTable="selectTable" ref="selectEmpForm"></select-emp> <select-emp @selectTable="selectTable" ref="selectEmpForm"></select-emp>
<el-dialog class="image-dialog" :visible.sync="dialogVisibleImg" width="30%">
<big-view ref="viewForm" v-if="dialogVisibleImg" :dialogSrc="dialogSrc" :dialogType="dialogType"></big-view>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import selectEmp from '@/components/selectEmp/emp.vue' import selectEmp from '@/components/selectEmp/emp.vue'
import preview from '@/components/preview/index.vue'
import bigView from '@/components/big-view/index.vue'
export default { export default {
name: 'marketConfig', name: 'marketConfig',
components: { components: {
selectEmp selectEmp,
preview,
bigView
}, },
props: { props: {
title: { title: {
...@@ -60,7 +83,10 @@ export default { ...@@ -60,7 +83,10 @@ export default {
}, },
data() { data() {
return { return {
dialogVisibleImg: false,
qrCodeFlag: false,
drawer: false, drawer: false,
dialogType: '',
staffInfo: [], staffInfo: [],
welcomeStatus: false, welcomeStatus: false,
btnList: [ btnList: [
...@@ -178,10 +204,48 @@ export default { ...@@ -178,10 +204,48 @@ export default {
templateSaveApi: this.$apis.welcomeword.templateSave, templateSaveApi: this.$apis.welcomeword.templateSave,
templateDetailApi: this.$apis.welcomeword.templateDetail templateDetailApi: this.$apis.welcomeword.templateDetail
} }
] ],
rule: {
configuration: [{ required: true, message: '请选择配置方式', trigger: 'change' }]
},
form: {
configuration: 1,
qrCode: '',
qrCodeArr: []
},
picOptions: {
width: '104px',
height: '104px',
key: 'qrCode',
isClose: true
}
} }
}, },
methods: { methods: {
//视频预览
handleView(index) {
this.dialogType = 'img'
this.dialogVisibleImg = true
this.dialogSrc = this.form.qrCode
},
//清空数据
changeConfig() {
if (this.form.configuration == 1) {
this.form.qrCode = ''
this.form.qrCodeArr = []
this.qrCodeFlag = false
} else {
const preview = [{ attContent: '', attNum: 1, mediaId: '', attType: 1 }]
this.$nextTick(() => {
this.$refs.welcome.updateList(preview)
})
this.staffInfo = []
}
},
changeqrCode(val) {
this[val.key + 'Flag'] = false
this.form[val.key] = val.arr[0]
},
handleAddEmp() { handleAddEmp() {
this.staffStatus = false this.staffStatus = false
this.$refs.selectEmpForm.init(this.staffInfo) this.$refs.selectEmpForm.init(this.staffInfo)
...@@ -197,42 +261,68 @@ export default { ...@@ -197,42 +261,68 @@ export default {
} }
}) })
}, },
init(previewList, staff) { init(previewList, staff, qrCode) {
const preview = this.$common.utils.deepClone(previewList)
this.drawer = true this.drawer = true
this.$nextTick(() => { if (qrCode) {
preview.map(item => { this.form.configuration = 2
if (item.attType == 7) { this.staffInfo = staff
item.attContent = JSON.parse(item.attContent) this.form.qrCode = qrCode
} this.form.qrCodeArr = [qrCode]
} else {
this.form.configuration = 1
const preview = this.$common.utils.deepClone(previewList)
this.$nextTick(() => {
preview.map(item => {
if (item.attType == 7) {
item.attContent = JSON.parse(item.attContent)
}
})
this.$refs.welcome.updateList(preview)
}) })
this.$refs.welcome.updateList(preview) }
})
this.staffInfo = staff
}, },
handleSaveConfig() { handleSaveConfig() {
const param = {} let param = {}
let staffId = [] if (this.form.configuration == 1) {
this.staffInfo.forEach(item => { let staffId = []
staffId.push(item.staffId) this.staffInfo.forEach(item => {
}) staffId.push(item.staffId)
if (staffId.length == 0) { })
this.$message.error('请选择跟进专员') if (staffId.length == 0) {
return this.$message.error('请选择跟进专员')
} return
param.followStaff = staffId.join(',')
const previewList = this.$common ? this.$common.utils.deepClone(this.$refs.welcome.previewList) : this.$refs.welcome.previewList
if (previewList.length == 0) {
this.$message.error('请填写欢迎语')
return
}
const attachmentList = previewList.map(item => {
if (item.attType == 7) {
item.attContent = JSON.stringify(item.attContent)
} }
return item param.followStaff = staffId.join(',')
}) const previewList = this.$common ? this.$common.utils.deepClone(this.$refs.welcome.previewList) : this.$refs.welcome.previewList
param.welcomeInfo = attachmentList if (previewList.length == 0) {
this.$message.error('请填写欢迎语')
return
}
const attachmentList = previewList.map(item => {
if (item.attType == 7) {
item.attContent = JSON.stringify(item.attContent)
}
return item
})
param.welcomeInfo = attachmentList
param.qrCode = ''
} else {
if (this.form.qrCode == '') {
this.$message.error('请上传活码')
return
}
param.welcomeInfo = [
{
attContent: '',
attNum: 1,
mediaId: '',
attType: 1
}
]
param.followStaff = ''
param.qrCode = this.form.qrCode
}
this.$emit('handleConfigChecked', param) this.$emit('handleConfigChecked', param)
this.drawer = false this.drawer = false
} }
...@@ -306,10 +396,40 @@ export default { ...@@ -306,10 +396,40 @@ export default {
padding-right: 20px; padding-right: 20px;
height: 64px; height: 64px;
border-top: 1px solid #e6e6e6; border-top: 1px solid #e6e6e6;
position: absolute;
width: 100%;
bottom: 0px;
}
.optional-wrap {
background: #f9f9f9;
padding: 20px;
margin-left: 154px;
margin-right: 20px;
margin: 10px 20px 20px 174px;
}
.text-tip {
font-weight: 400;
font-size: 14px;
color: #999999;
margin-bottom: 35px;
margin-top: 8px;
}
.preview-wrap {
margin: 10px 0 200px 174px;
position: relative;
.preview-text {
font-weight: 400;
font-size: 14px;
color: #5850ff;
position: absolute;
top: 90px;
left: 118px;
white-space: nowrap;
cursor: pointer;
}
.el-form-item__error {
margin-top: 5px;
}
} }
</style> </style>
<style>
/* .activity-drawer {
z-index: 3000 !important;
} */
</style>
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
</div> </div>
</div> </div>
<div class="use-operation" @click="$router.push('/home/helpCard')" v-if="verifyOpenStatus">立即使用</div> <div class="use-operation" @click="$router.push('/home/helpCard')" v-if="verifyOpenStatus">立即使用</div>
<div class="use-operation" v-else>尚未该订阅服务</div> <!-- <div class="use-operation" v-else>尚未该订阅服务</div> -->
</div> </div>
</div> </div>
</div> </div>
...@@ -85,11 +85,11 @@ export default { ...@@ -85,11 +85,11 @@ export default {
data() { data() {
return { return {
activeName: 'first', activeName: 'first',
verifyOpenStatus: false verifyOpenStatus: true
} }
}, },
mounted() { mounted() {
this.verifyOpen() // this.verifyOpen()
}, },
methods: { methods: {
verifyOpen() { verifyOpen() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!