Commit 0d962da2 by 胡悦

提交群发

1 parent 75077e82
...@@ -156,7 +156,12 @@ ...@@ -156,7 +156,12 @@
<el-form :model="basicForm" :rules="basicRules" ref="groupForm" label-width="100px"> <el-form :model="basicForm" :rules="basicRules" ref="groupForm" label-width="100px">
<el-form-item prop="attachmentList"> <el-form-item prop="attachmentList">
<label slot="label" class="required">群发内容</label> <label slot="label" class="required">群发内容</label>
<WelcomeWords ref="welcome" :form="'customer'" :eventBus="eventBus"></WelcomeWords> <WelcomeWords
ref="welcome"
:form="'customer'"
:btnList="btnList"
:eventBus="eventBus"
></WelcomeWords>
</el-form-item> </el-form-item>
<el-form-item label="发送时间" prop="sendType"> <el-form-item label="发送时间" prop="sendType">
<el-radio-group v-model="basicForm.sendType"> <el-radio-group v-model="basicForm.sendType">
...@@ -272,6 +277,34 @@ export default { ...@@ -272,6 +277,34 @@ export default {
return { return {
addLoading: false, addLoading: false,
eventBus: new Vue(), eventBus: new Vue(),
btnList: [
{
id: 1,
name: '表情',
funcName: '',
type: 'expression',
limitSize: 10
},
{
id: 2,
name: '图片',
funcName: '',
type: 'img',
limitSize: 10
},
{
id: 3,
name: '昵称',
type: 'nickname',
funName: 'nickname'
},
{
id: 4,
name: '活动',
type: 'acivity',
funName: 'activity'
}
],
basicForm: { basicForm: {
selectType: 1, selectType: 1,
condition: { condition: {
...@@ -477,7 +510,7 @@ export default { ...@@ -477,7 +510,7 @@ export default {
return `[${s}]` return `[${s}]`
}) })
item.attContent = replaceImg item.attContent = replaceImg
item.attContent = item.attContent.replace('@昵称', '[@昵称]') item.attContent = item.attContent.replaceAll('@昵称', '[@昵称]')
} else if (item.attType == 7) { } else if (item.attType == 7) {
item.attContent = JSON.stringify(item.attContent) item.attContent = JSON.stringify(item.attContent)
} }
...@@ -501,33 +534,28 @@ export default { ...@@ -501,33 +534,28 @@ export default {
} }
console.log(params) console.log(params)
this.addLoading = true this.addLoading = true
this.$apis.customerTransform this.$apis.customerTransform.insert(params).then(res => {
.insert(params) console.log(res)
.then(res => { if (res.code == '-1') {
console.log(res) this.$message({
if (res.code == '-1') { type: 'error',
this.$message({ message: res.message
type: 'error', })
message: res.message this.handleCancel()
}) } else if (res.code == 0) {
this.handleCancel() this.$message({
} else if (res.code == 0) { type: 'success',
this.$message({ message: '操作成功!'
type: 'success', })
message: '操作成功!' this.handleCancel()
}) } else {
this.handleCancel() this.$message({
} else { type: 'error',
this.$message({ message: res.message
type: 'error', })
message: res.message }
}) this.addLoading = false
} })
this.addLoading = false
})
.catch(err => {
console.log(err)
})
} }
}) })
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
label-width="120px" label-width="120px"
> >
<el-form-item label="群聊名称" prop="massName"> <el-form-item label="群聊名称" prop="massName">
<el-input v-model="basicForm.massName" placeholder="群发名称仅内部可见,且不可重复" maxlength="10"></el-input> <el-input v-model="basicForm.massName" placeholder="群发名称仅内部可见" maxlength="10"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="userList"> <el-form-item prop="userList">
<label slot="label" class="required">选择群主</label> <label slot="label" class="required">选择群主</label>
...@@ -59,7 +59,12 @@ ...@@ -59,7 +59,12 @@
<el-form :model="basicForm" :rules="basicRules" ref="groupForm" label-width="120px"> <el-form :model="basicForm" :rules="basicRules" ref="groupForm" label-width="120px">
<el-form-item prop="attachmentList"> <el-form-item prop="attachmentList">
<label slot="label" class="required">群发内容</label> <label slot="label" class="required">群发内容</label>
<WelcomeWords ref="welcome" :form="'customerGroup'" :eventBus="eventBus"></WelcomeWords> <WelcomeWords
ref="welcome"
:form="'customerGroup'"
:btnList="btnList"
:eventBus="eventBus"
></WelcomeWords>
</el-form-item> </el-form-item>
<el-form-item label="发送时间" prop="sendType"> <el-form-item label="发送时间" prop="sendType">
<el-radio-group v-model="basicForm.sendType"> <el-radio-group v-model="basicForm.sendType">
...@@ -169,20 +174,42 @@ export default { ...@@ -169,20 +174,42 @@ export default {
} }
} }
} }
const nameVaild = (rule, value, callback) => { // const nameVaild = (rule, value, callback) => {
if (value) { // if (value) {
this.$apis.customerTransform.nameVaild({ templateName: value }).then(res => { // this.$apis.customerTransform.nameVaild({ templateName: value }).then(res => {
if (res) { // if (res) {
callback(new Error('群聊名称不可重复')) // callback(new Error('群聊名称不可重复'))
} else { // } else {
callback() // callback()
} // }
}) // })
} // }
} // }
return { return {
addLoading: false, addLoading: false,
eventBus: new Vue(), eventBus: new Vue(),
btnList: [
{
id: 1,
name: '表情',
funcName: '',
type: 'expression',
limitSize: 10
},
{
id: 2,
name: '图片',
funcName: '',
type: 'img',
limitSize: 10
},
{
id: 4,
name: '活动',
type: 'acivity',
funName: 'activity'
}
],
basicForm: {}, basicForm: {},
basicRules: { basicRules: {
userList: [ userList: [
...@@ -190,8 +217,8 @@ export default { ...@@ -190,8 +217,8 @@ export default {
{ validator: validatorUser, trigger: 'change' } { validator: validatorUser, trigger: 'change' }
], ],
massName: [ massName: [
{ required: true, message: '请输入群聊名称', trigger: 'blur' }, { required: true, message: '请输入群聊名称', trigger: 'blur' }
{ validator: nameVaild, trigger: 'blur' } // { validator: nameVaild, trigger: 'blur' }
], ],
attachmentList: [ attachmentList: [
// { required: true, message: '请输入入群欢迎语' }, // { required: true, message: '请输入入群欢迎语' },
...@@ -267,7 +294,120 @@ export default { ...@@ -267,7 +294,120 @@ export default {
const previewList = this.$common ? this.$common.utils.deepClone(this.$refs.welcome.previewList) : this.$refs.welcome.previewList const previewList = this.$common ? this.$common.utils.deepClone(this.$refs.welcome.previewList) : this.$refs.welcome.previewList
const attachmentList = previewList.map(item => { const attachmentList = previewList.map(item => {
if (item.attType == 1) { if (item.attType == 1) {
item.attContent = item.attContent.replace('@昵称', '[@昵称]') const list = [
'微笑',
'撇嘴',
'色',
'发呆',
'得意',
'流泪',
'害羞',
'闭嘴',
'睡',
'大哭',
'尴尬',
'发怒',
'调皮',
'呲牙',
'惊讶',
'难过',
'酷',
'冷汗',
'抓狂',
'吐',
'偷笑',
'可爱',
'白眼',
'傲慢',
'饥饿',
'困',
'惊恐',
'流汗',
'憨笑',
'大兵',
'奋斗',
'咒骂',
'疑问',
'嘘',
'晕',
'折磨',
'衰',
'骷髅',
'敲打',
'再见',
'擦汗',
'抠鼻',
'鼓掌',
'糗大了',
'坏笑',
'左哼哼',
'右哼哼',
'哈欠',
'鄙视',
'委屈',
'快哭了',
'阴险',
'亲亲',
'吓',
'可怜',
'菜刀',
'西瓜',
'啤酒',
'篮球',
'乒乓',
'咖啡',
'饭',
'猪头',
'玫瑰',
'凋谢',
'示爱',
'爱心',
'心碎',
'蛋糕',
'闪电',
'炸弹',
'刀',
'足球',
'瓢虫',
'便便',
'月亮',
'太阳',
'礼物',
'拥抱',
'强',
'弱',
'握手',
'胜利',
'抱拳',
'勾引',
'拳头',
'差劲',
'爱你',
'NO',
'OK',
'爱情',
'飞吻',
'跳跳',
'发抖',
'怄火',
'转圈',
'磕头',
'回头',
'跳绳',
'挥手',
'激动',
'街舞',
'献吻',
'左太极',
'右太极'
]
const cutImg = item.attContent.replaceAll('<img src="https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/', '')
console.log(cutImg)
const replaceImg = cutImg.replace(/(\d){1,2}.gif">/g, function(str) {
let s = list[str.split('.')[0]]
return `[${s}]`
})
item.attContent = replaceImg
} else if (item.attType == 7) { } else if (item.attType == 7) {
item.attContent = JSON.stringify(item.attContent) item.attContent = JSON.stringify(item.attContent)
} }
...@@ -284,25 +424,21 @@ export default { ...@@ -284,25 +424,21 @@ export default {
params.sendTimeStr = this.basicForm.sendTime + ' ' + this.basicForm.sendDate params.sendTimeStr = this.basicForm.sendTime + ' ' + this.basicForm.sendDate
} }
this.addLoading = true this.addLoading = true
this.$apis.customerTransform this.$apis.customerTransform.insert(params).then(res => {
.insert(params) if (res.code == 0) {
.then(res => { this.$message({
if (res) { type: 'success',
this.$message({ message: '操作成功!'
type: 'success', })
message: '操作成功!' this.handleCancel()
}) } else {
this.handleCancel()
}
this.addLoading = false
})
.catch(err => {
this.$message({ this.$message({
type: 'error', type: 'error',
message: err.message message: res.message
}) })
this.addLoading = false }
}) this.addLoading = false
})
}) })
} }
}) })
......
...@@ -221,6 +221,9 @@ export default { ...@@ -221,6 +221,9 @@ export default {
// this.basicInfo.sendTime = dayjs(this.basicInfo.sendTime).format('YYYY-MM-DD HH:mm:ss') // this.basicInfo.sendTime = dayjs(this.basicInfo.sendTime).format('YYYY-MM-DD HH:mm:ss')
const previewList = res.attachmentList.map(item => { const previewList = res.attachmentList.map(item => {
if (item.attType == 7 && item.attContent) item.attContent = JSON.parse(item.attContent) if (item.attType == 7 && item.attContent) item.attContent = JSON.parse(item.attContent)
if (item.attType == 1) {
item.attContent = item.attContent.replaceAll('[@昵称]', '@昵称')
}
return item return item
}) })
this.eventBus.$emit('update', previewList) this.eventBus.$emit('update', previewList)
......
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
watch: { watch: {
previewList(val) { previewList(val) {
console.log(val) console.log(val)
if (val[0].attType == 1) { if (val.length && val[0].attType == 1) {
const attContent = val[0].attContent const attContent = val[0].attContent
const htm = attContent.replace(/\[[\u4E00-\u9FA5]{1,3}]/gi, function(res) { const htm = attContent.replace(/\[[\u4E00-\u9FA5]{1,3}]/gi, function(res) {
let word = res.replace(/\[|\]/gi, '') let word = res.replace(/\[|\]/gi, '')
......
...@@ -116,39 +116,39 @@ export default { ...@@ -116,39 +116,39 @@ export default {
Emotion, Emotion,
wTextarea wTextarea
}, },
props: { eventBus: Object }, props: { eventBus: Object, btnList: Array },
data() { data() {
return { return {
loading: false, loading: false,
emotionStatus: false, emotionStatus: false,
btnList: [ // btnList: [
{ // {
id: 1, // id: 1,
name: '表情', // name: '表情',
funcName: '', // funcName: '',
type: 'expression', // type: 'expression',
limitSize: 10 // limitSize: 10
}, // },
{ // {
id: 2, // id: 2,
name: '图片', // name: '图片',
funcName: '', // funcName: '',
type: 'img', // type: 'img',
limitSize: 10 // limitSize: 10
}, // },
{ // {
id: 3, // id: 3,
name: '昵称', // name: '昵称',
type: 'nickname', // type: 'nickname',
funName: 'nickname' // funName: 'nickname'
}, // },
{ // {
id: 4, // id: 4,
name: '活动', // name: '活动',
type: 'acivity', // type: 'acivity',
funName: 'activity' // funName: 'activity'
} // }
], // ],
guestForm: {}, guestForm: {},
previewList: [], previewList: [],
sendType: '', sendType: '',
......
...@@ -53,8 +53,8 @@ ...@@ -53,8 +53,8 @@
:disabled="scope.scope.unsendUserNum == 0 || (scope.scope.unsendUserNum != 0 && scope.scope.isRemind == 1)" :disabled="scope.scope.unsendUserNum == 0 || (scope.scope.unsendUserNum != 0 && scope.scope.isRemind == 1)"
@click="btnClick('remind', 1, scope.scope)" @click="btnClick('remind', 1, scope.scope)"
>提醒发送</el-button> >提醒发送</el-button>
<!-- <GLButton type="text" fn="客户群发详情" @click="btnClick('detail', 1, scope.scope)">详情</GLButton> --> <GLButton type="text" fn="客户群发详情" @click="btnClick('detail', 1, scope.scope)">详情</GLButton>
<el-button type="text" @click="btnClick('detail', 1, scope.scope)">详情</el-button> <!-- <el-button type="text" @click="btnClick('detail', 1, scope.scope)">详情</el-button> -->
</span> </span>
</div> </div>
</GLTable> </GLTable>
...@@ -101,8 +101,8 @@ ...@@ -101,8 +101,8 @@
:disabled="scope.scope.unsendUserNum == 0 || (scope.scope.unsendUserNum != 0 && scope.scope.isRemind == 1)" :disabled="scope.scope.unsendUserNum == 0 || (scope.scope.unsendUserNum != 0 && scope.scope.isRemind == 1)"
@click="btnClick('remind', 2, scope.scope)" @click="btnClick('remind', 2, scope.scope)"
>提醒发送</el-button> >提醒发送</el-button>
<!-- <GLButton type="text" fn="客户群群发详情" @click="btnClick('detail', 2, scope.scope)">详情</GLButton> --> <GLButton type="text" fn="客户群群发详情" @click="btnClick('detail', 2, scope.scope)">详情</GLButton>
<el-button type="text" @click="btnClick('detail', 2, scope.scope)">详情</el-button> <!-- <el-button type="text" @click="btnClick('detail', 2, scope.scope)">详情</el-button> -->
</span> </span>
</div> </div>
</GLTable> </GLTable>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!