Commit f92da390 by 李长胜

Merge branch 'v1.0.1' of http://192.168.3.233:8090/saas/scrm-micro-marketing into v1.0.1

2 parents 69f62c37 f7c597c1
...@@ -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,9 +534,7 @@ export default { ...@@ -501,9 +534,7 @@ 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)
.then(res => {
console.log(res) console.log(res)
if (res.code == '-1') { if (res.code == '-1') {
this.$message({ this.$message({
...@@ -525,9 +556,6 @@ export default { ...@@ -525,9 +556,6 @@ export default {
} }
this.addLoading = false this.addLoading = false
}) })
.catch(err => {
console.log(err)
})
} }
}) })
} }
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
ref="basicForm" ref="basicForm"
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,23 +424,19 @@ export default { ...@@ -284,23 +424,19 @@ 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 => {
if (res) {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '操作成功!' message: '操作成功!'
}) })
this.handleCancel() this.handleCancel()
} } else {
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, '')
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
ref="wTextareaContent" ref="wTextareaContent"
:id="contentId" :id="contentId"
@click="inputClick($event)" @click="inputClick($event)"
@focus="isLocked = true" @focus="onFocus"
@blur="isLocked = false" @blur="onBlur"
@keydown.delete="handleDelete($event)" @keydown.delete="handleDelete($event)"
@input="handleInput($event.target)" @input="handleInput($event.target)"
></div> ></div>
...@@ -41,6 +41,7 @@ export default { ...@@ -41,6 +41,7 @@ export default {
contentId: `content${this.getGuid()}`, contentId: `content${this.getGuid()}`,
// 输入的时候锁定,禁止更新innerHTML // 输入的时候锁定,禁止更新innerHTML
isLocked: false, isLocked: false,
isInsert: false,
// 记录当前选中tag的ID // 记录当前选中tag的ID
currentTagId: null, currentTagId: null,
// 当前光标位置 // 当前光标位置
...@@ -189,12 +190,34 @@ export default { ...@@ -189,12 +190,34 @@ export default {
node.src = url node.src = url
this.insertNode(node) this.insertNode(node)
}, },
onFocus() {
this.isLocked = true
this.isInsert = true
},
onBlur() {
this.isLocked = false
},
insertNode(node) { insertNode(node) {
// 在内容中插入标签 // 在内容中插入标签
// 删掉选中的内容(如有) // 删掉选中的内容(如有)
if (this.savedRange.startContainer) {
this.insertNodeFirst(node)
} else {
document.querySelector('.w-textarea_input').focus()
setTimeout(() => {
this.insertNodeFirst(node)
}, 100)
}
},
insertNodeFirst(node) {
this.savedRange.deleteContents() this.savedRange.deleteContents()
// 插入链接 // 插入链接
if (this.isInsert) {
this.savedRange.insertNode(node) this.savedRange.insertNode(node)
} else {
document.querySelector('.w-textarea_input').appendChild(node)
}
this.isInsert = false
// 更新双向绑定数据 // 更新双向绑定数据
let target = this.$refs.wTextareaContent let target = this.$refs.wTextareaContent
if (navigator.userAgent.indexOf('Firefox') > 0 || navigator.userAgent.indexOf('QQBrowser') > 0) { if (navigator.userAgent.indexOf('Firefox') > 0 || navigator.userAgent.indexOf('QQBrowser') > 0) {
...@@ -458,7 +481,6 @@ export default { ...@@ -458,7 +481,6 @@ export default {
let Textnode = document.createElement('div') let Textnode = document.createElement('div')
Textnode.innerHTML = replaceImg Textnode.innerHTML = replaceImg
this.currentText = Textnode.innerText this.currentText = Textnode.innerText
console.log(this.currentText, 11111111)
this.$emit('updateText', this.currentText) this.$emit('updateText', this.currentText)
}, },
handleDelete(e) { handleDelete(e) {
......
...@@ -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!