Commit 0d962da2 by 胡悦

提交群发

1 parent 75077e82
......@@ -156,7 +156,12 @@
<el-form :model="basicForm" :rules="basicRules" ref="groupForm" label-width="100px">
<el-form-item prop="attachmentList">
<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 label="发送时间" prop="sendType">
<el-radio-group v-model="basicForm.sendType">
......@@ -272,6 +277,34 @@ export default {
return {
addLoading: false,
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: {
selectType: 1,
condition: {
......@@ -477,7 +510,7 @@ export default {
return `[${s}]`
})
item.attContent = replaceImg
item.attContent = item.attContent.replace('@昵称', '[@昵称]')
item.attContent = item.attContent.replaceAll('@昵称', '[@昵称]')
} else if (item.attType == 7) {
item.attContent = JSON.stringify(item.attContent)
}
......@@ -501,33 +534,28 @@ export default {
}
console.log(params)
this.addLoading = true
this.$apis.customerTransform
.insert(params)
.then(res => {
console.log(res)
if (res.code == '-1') {
this.$message({
type: 'error',
message: res.message
})
this.handleCancel()
} else if (res.code == 0) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.handleCancel()
} else {
this.$message({
type: 'error',
message: res.message
})
}
this.addLoading = false
})
.catch(err => {
console.log(err)
})
this.$apis.customerTransform.insert(params).then(res => {
console.log(res)
if (res.code == '-1') {
this.$message({
type: 'error',
message: res.message
})
this.handleCancel()
} else if (res.code == 0) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.handleCancel()
} else {
this.$message({
type: 'error',
message: res.message
})
}
this.addLoading = false
})
}
})
}
......
......@@ -14,7 +14,7 @@
label-width="120px"
>
<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 prop="userList">
<label slot="label" class="required">选择群主</label>
......@@ -59,7 +59,12 @@
<el-form :model="basicForm" :rules="basicRules" ref="groupForm" label-width="120px">
<el-form-item prop="attachmentList">
<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 label="发送时间" prop="sendType">
<el-radio-group v-model="basicForm.sendType">
......@@ -169,20 +174,42 @@ export default {
}
}
}
const nameVaild = (rule, value, callback) => {
if (value) {
this.$apis.customerTransform.nameVaild({ templateName: value }).then(res => {
if (res) {
callback(new Error('群聊名称不可重复'))
} else {
callback()
}
})
}
}
// const nameVaild = (rule, value, callback) => {
// if (value) {
// this.$apis.customerTransform.nameVaild({ templateName: value }).then(res => {
// if (res) {
// callback(new Error('群聊名称不可重复'))
// } else {
// callback()
// }
// })
// }
// }
return {
addLoading: false,
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: {},
basicRules: {
userList: [
......@@ -190,8 +217,8 @@ export default {
{ validator: validatorUser, trigger: 'change' }
],
massName: [
{ required: true, message: '请输入群聊名称', trigger: 'blur' },
{ validator: nameVaild, trigger: 'blur' }
{ required: true, message: '请输入群聊名称', trigger: 'blur' }
// { validator: nameVaild, trigger: 'blur' }
],
attachmentList: [
// { required: true, message: '请输入入群欢迎语' },
......@@ -267,7 +294,120 @@ export default {
const previewList = this.$common ? this.$common.utils.deepClone(this.$refs.welcome.previewList) : this.$refs.welcome.previewList
const attachmentList = previewList.map(item => {
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) {
item.attContent = JSON.stringify(item.attContent)
}
......@@ -284,25 +424,21 @@ export default {
params.sendTimeStr = this.basicForm.sendTime + ' ' + this.basicForm.sendDate
}
this.addLoading = true
this.$apis.customerTransform
.insert(params)
.then(res => {
if (res) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.handleCancel()
}
this.addLoading = false
})
.catch(err => {
this.$apis.customerTransform.insert(params).then(res => {
if (res.code == 0) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.handleCancel()
} else {
this.$message({
type: 'error',
message: err.message
message: res.message
})
this.addLoading = false
})
}
this.addLoading = false
})
})
}
})
......
......@@ -221,6 +221,9 @@ export default {
// this.basicInfo.sendTime = dayjs(this.basicInfo.sendTime).format('YYYY-MM-DD HH:mm:ss')
const previewList = res.attachmentList.map(item => {
if (item.attType == 7 && item.attContent) item.attContent = JSON.parse(item.attContent)
if (item.attType == 1) {
item.attContent = item.attContent.replaceAll('[@昵称]', '@昵称')
}
return item
})
this.eventBus.$emit('update', previewList)
......
......@@ -55,7 +55,7 @@ export default {
watch: {
previewList(val) {
console.log(val)
if (val[0].attType == 1) {
if (val.length && val[0].attType == 1) {
const attContent = val[0].attContent
const htm = attContent.replace(/\[[\u4E00-\u9FA5]{1,3}]/gi, function(res) {
let word = res.replace(/\[|\]/gi, '')
......
......@@ -116,39 +116,39 @@ export default {
Emotion,
wTextarea
},
props: { eventBus: Object },
props: { eventBus: Object, btnList: Array },
data() {
return {
loading: false,
emotionStatus: false,
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'
}
],
// 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'
// }
// ],
guestForm: {},
previewList: [],
sendType: '',
......
......@@ -53,8 +53,8 @@
:disabled="scope.scope.unsendUserNum == 0 || (scope.scope.unsendUserNum != 0 && scope.scope.isRemind == 1)"
@click="btnClick('remind', 1, scope.scope)"
>提醒发送</el-button>
<!-- <GLButton type="text" fn="客户群发详情" @click="btnClick('detail', 1, scope.scope)">详情</GLButton> -->
<el-button type="text" @click="btnClick('detail', 1, scope.scope)">详情</el-button>
<GLButton type="text" fn="客户群发详情" @click="btnClick('detail', 1, scope.scope)">详情</GLButton>
<!-- <el-button type="text" @click="btnClick('detail', 1, scope.scope)">详情</el-button> -->
</span>
</div>
</GLTable>
......@@ -101,8 +101,8 @@
:disabled="scope.scope.unsendUserNum == 0 || (scope.scope.unsendUserNum != 0 && scope.scope.isRemind == 1)"
@click="btnClick('remind', 2, scope.scope)"
>提醒发送</el-button>
<!-- <GLButton type="text" fn="客户群群发详情" @click="btnClick('detail', 2, scope.scope)">详情</GLButton> -->
<el-button type="text" @click="btnClick('detail', 2, scope.scope)">详情</el-button>
<GLButton type="text" fn="客户群群发详情" @click="btnClick('detail', 2, scope.scope)">详情</GLButton>
<!-- <el-button type="text" @click="btnClick('detail', 2, scope.scope)">详情</el-button> -->
</span>
</div>
</GLTable>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!