Commit f3abc981 by cwq0219
2 parents 654e0679 02e4c766
...@@ -124,7 +124,7 @@ const orderStatusList = [ ...@@ -124,7 +124,7 @@ const orderStatusList = [
}, },
{ {
confId: 6, confId: 6,
confName: '已经退款' confName: '已退款'
}, },
] ]
const serviceStatusList = [{ const serviceStatusList = [{
......
...@@ -24,7 +24,7 @@ export async function start() { ...@@ -24,7 +24,7 @@ export async function start() {
// .forEach(item => { // .forEach(item => {
// urlParams[item.split('=')[0]] = item.split('=')[1] // urlParams[item.split('=')[0]] = item.split('=')[1]
// }) // })
var token = Object.keys(urlParams).includes('sessionId') ? urlParams.sessionId : 'mini-983e626d-4250-42b0-be9c-a9845552ae20-rop' var token = Object.keys(urlParams).includes('sessionId') ? urlParams.sessionId : 'mini-53e870b5-80d5-483e-8277-cdc4dec0ad80-rop'
Vue.prototype.$http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: token } }) Vue.prototype.$http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: token } })
Vue.use(GLButton, { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] }) Vue.use(GLButton, { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
render('/', routes) render('/', routes)
......
...@@ -352,9 +352,10 @@ export default { ...@@ -352,9 +352,10 @@ export default {
params.sendType = this.basicForm.sendType params.sendType = this.basicForm.sendType
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 => {
// const attachmentList = this.$common.utils.deepClone(this.$refs.welcome.previewList).map(item => {
if (item.attType == 1) { if (item.attType == 1) {
item.attContent = item.attContent.replace('@昵称', '[@昵称]') item.attContent = item.attContent.replace('@昵称', '[@昵称]')
} else if (item.attType == 7) {
item.attContent = JSON.stringify(item.attContent)
} }
return item return item
}) })
......
...@@ -225,10 +225,20 @@ export default { ...@@ -225,10 +225,20 @@ export default {
this.$refs.groupForm.validate(v => { this.$refs.groupForm.validate(v => {
const params = { const params = {
type: 2, type: 2,
attachmentList: this.basicForm.attachmentList, // attachmentList: this.basicForm.attachmentList,
sendType: this.basicForm.sendType, sendType: this.basicForm.sendType,
massName: this.basicForm.massName massName: this.basicForm.massName
} }
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('@昵称', '[@昵称]')
} else if (item.attType == 7) {
item.attContent = JSON.stringify(item.attContent)
}
return item
})
params.attachmentList = attachmentList
params.userList = this.basicForm.userList.map(item => { params.userList = this.basicForm.userList.map(item => {
return { return {
staffId: item.staffId, staffId: item.staffId,
......
...@@ -117,7 +117,11 @@ export default { ...@@ -117,7 +117,11 @@ export default {
this.$apis.customerTransform.customerDetail({ id }).then(res => { this.$apis.customerTransform.customerDetail({ id }).then(res => {
console.log(res) console.log(res)
this.basicInfo = res this.basicInfo = res
this.eventBus.$emit('update', this.basicInfo.attachmentList) const previewList = res.attachmentList.map(item => {
if (item.attType == 7) item.attContent = JSON.parse(item.attContent)
return item
})
this.eventBus.$emit('update', previewList)
}) })
}, },
getStatistic() { getStatistic() {
......
<template>
<div class="w-textarea" ref="wTextarea">
<div
class="w-textarea_input"
ref="wTextareaContent"
:id="contentId"
@click="inputClick($event)"
@focus="isLocked = true"
@blur="isLocked = false"
@keydown.delete="handleDelete($event)"
@input="handleInput($event.target)"
></div>
<!-- <div class="w-textarea_tools" v-if="tools.length > 0 || maxlength">
<button
class="w-textarea_tools__item"
v-for="item in tools"
:key="item.type"
@click="openTagDialog(item.type)"
>{{item.text}}</button>
<span
:class="['w-textarea_tools__text',
count.num < 0 ? '__danger' : '']"
v-if="maxlength"
>{{count.text}}</span>
</div>-->
<!-- <div class="w-textarea_dialog">
<slot></slot>
</div>-->
</div>
</template>
<script>
export default {
name: 'wTextarea',
data() {
return {
// 记录currentText以计算长度
currentText: this.value,
// 为input区域生成随机id,当在页面上有多个组件时,用于监听光标的变化
contentId: `content${this.getGuid()}`,
// 输入的时候锁定,禁止更新innerHTML
isLocked: false,
// 记录当前选中tag的ID
currentTagId: null,
// 当前光标位置
savedRange: {}
}
},
props: {
value: {
type: String,
default: ''
},
tag: {
// 自定义模版标签的标签名
type: String,
// 默认使用wise作为标签名,并添加了默认样式
// 当使用其他标签名的时候,需要另写标签样式
default: 'wise'
},
tools: {
// 自定义扩展功能:超链接'link',模版标签'tag'
type: Array,
default() {
return [
{ type: 'link', text: '添加超链接' },
{ type: 'tag', text: '添加模版标签' }
]
}
},
maxlength: {
// 最大输入长度
type: [String, Number],
default: ''
}
},
computed: {
count() {
// 字符长度记数
let num = this.maxlength - this.currentText.length
let text = num < 0 ? `已超出${Math.abs(num)}个字符` : `还可以输入${num}个字符`
return { num, text }
}
},
mounted() {
// 初始化数据
this.currentText && (this.$refs.wTextareaContent.innerHTML = this.currentText)
// 创建模版标签的style
this.createStyle()
// 每次光标变化的时候,保存 range
document.addEventListener('selectionchange', this.selectHandler)
},
beforeDestroy() {
// 卸载事件
document.removeEventListener('selectionchange', this.selectHandler)
},
methods: {
updateData(text) {
this.$emit('input', text)
},
createStyle() {
// 为自定义的模版标签添加样式,使之不可编辑
let style = document.createElement('style')
style.innerHTML = `.w-textarea ${this.tag} {
cursor: default;
-webkit-user-modify: read-only !important;
}`
this.$refs.wTextarea.appendChild(style)
},
closeModal() {
this.form.text = ''
this.showModal = false
},
openTagDialog(type) {
// if (addLink)
// 将事件抛给父组件处理
// 处理后需要调用 addTag() 或者 addLink() 将内容传回来
this.$emit('add', type)
},
addTag(text) {
// 创建模版标签
let node = document.createElement(this.tag)
node.innerText = text
// 添加id便于删除
node.id = this.getGuid()
this.insertNode(node)
},
addLink(text, url) {
// 创建a标签
let node = document.createElement('a')
node.innerText = text
node.href = url
node.target = 'blank'
this.insertNode(node)
},
insertNode(node) {
// 在内容中插入标签
// 删掉选中的内容(如有)
this.savedRange.deleteContents()
// 插入链接
this.savedRange.insertNode(node)
// 更新双向绑定数据
let target = this.$refs.wTextareaContent
this.updateData(target.innerHTML)
this.currentText = target.innerText
this.$emit('updateText', this.currentText)
},
handleInput(target) {
// 即时更新数据
this.updateData(target.innerHTML)
this.currentText = target.innerText
this.$emit('updateText', this.currentText)
},
handleDelete(e) {
// 监听“删除”事件
if (this.currentTagId) {
// 若已选中模版标签,直接删除dom节点
let t = document.getElementById(this.currentTagId)
this.$refs.wTextareaContent.removeChild(t)
this.currentTagId = null
// 阻止浏览器默认的删除事件,并手动更新数据
e.preventDefault()
this.handleInput(e.target)
}
},
inputClick(e) {
console.log(this.tag.toUpperCase(), e.target.nodeName, e)
// 监听点击事件
this.isLocked = true
const TAG_NAME = e.target.nodeName
if (TAG_NAME === this.tag.toUpperCase()) {
// 点击模版标签时,记录id
this.currentTagId = e.target.id
e.target.className = 'active'
} else if (this.currentTagId) {
// 清空active样式
let target = document.getElementById(this.currentTagId)
target.className = ''
this.currentTagId = null
} else {
this.currentTagId = null
}
},
getGuid() {
// 生成随机ID
return `r${new Date().getTime()}d${Math.ceil(Math.random() * 1000)}`
},
selectHandler() {
// 监听选定文本的变动
let sel = window.getSelection()
let range = sel.rangeCount > 0 ? sel.getRangeAt(0) : null
if (range && range.commonAncestorContainer.ownerDocument.activeElement.id === this.contentId) {
this.savedRange = range
}
}
},
watch: {
value(val) {
// 非锁定状态下,实时更新innerHTML
if (!this.isLocked) {
this.$refs.wTextareaContent.innerHTML = val
}
}
}
}
</script>
<style lang="scss">
// 给标签默认样式,不可scoped
.w-textarea {
wise {
border-radius: 2px;
background-color: #fff;
font-size: 14px;
color: #5850ff;
line-height: 20px;
padding: 2px;
margin: 0 5px;
color: #26a2ff;
// padding: 0 1px;
white-space: nowrap;
cursor: default;
-webkit-user-modify: read-only !important;
}
.active {
background: #dcdfe6;
}
}
</style>
<style lang="scss" scoped>
$borderColor: #dcdfe6;
$bgColor: #f5f7fa;
$textColor: #666;
.w-textarea {
width: 100%;
box-sizing: border-box;
// border-radius: 4px;
border: 1px solid $borderColor;
min-height: 200px;
// margin-bottom: 15px;
overflow: hidden;
position: relative;
&_input {
width: 100%;
min-height: 100px;
box-sizing: border-box;
padding: 10px;
line-height: 1.5;
word-break: break-word;
// 允许编辑,禁止富文本
-webkit-user-modify: read-write-plaintext-only !important;
&:focus {
outline: none;
}
}
&_tools {
padding: 0 10px;
height: 40px;
line-height: 40px;
border-top: 1px solid $borderColor;
background-color: $bgColor;
color: $textColor;
font-size: 12px;
&__item {
display: inline-block;
line-height: 1;
padding: 5px 8px;
margin-right: 8px;
color: $textColor;
cursor: pointer;
border: 1px solid $borderColor;
border-radius: 4px;
background: #fff;
transition: all 0.3s;
&:hover {
background: $bgColor;
opacity: 0.7;
}
&:focus {
outline: none;
}
}
&__text {
display: inline-block;
line-height: 40px;
padding: 0 8px;
float: right;
color: $textColor;
cursor: default;
transition: all 0.3s;
&:hover {
opacity: 1;
}
&.__danger {
color: red;
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -9,14 +9,15 @@ ...@@ -9,14 +9,15 @@
</div>--> </div>-->
<!-- <div id="toolbar-container" style="display: none;"></div> <!-- <div id="toolbar-container" style="display: none;"></div>
<div id="text-container" class="editor-container"></div>--> <div id="text-container" class="editor-container"></div>-->
<div <!-- <div
id="editor" id="editor"
ref="editor" ref="editor"
@input="changeInput" @input="changeInput"
class="text-editor" class="text-editor"
contenteditable="true" contenteditable="true"
autofocus autofocus
></div> ></div>-->
<wTextarea ref="textContent" @updateText="updateText"></wTextarea>
<!-- <el-input <!-- <el-input
type="textarea" type="textarea"
:rows="9" :rows="9"
...@@ -97,11 +98,13 @@ const ATT_TYPE = { ...@@ -97,11 +98,13 @@ const ATT_TYPE = {
} }
// import E from 'wangeditor' // import E from 'wangeditor'
import ActivityModel from './activityModel' import ActivityModel from './activityModel'
import wTextarea from './tag-textarea'
import { debounce } from '@/utils/index' import { debounce } from '@/utils/index'
export default { export default {
name: 'WelcomeWords', name: 'WelcomeWords',
components: { components: {
ActivityModel ActivityModel,
wTextarea
}, },
props: { eventBus: Object }, props: { eventBus: Object },
data() { data() {
...@@ -221,24 +224,7 @@ export default { ...@@ -221,24 +224,7 @@ export default {
// 添加昵称 // 添加昵称
handleFun(name) { handleFun(name) {
if (name == 'nickname') { if (name == 'nickname') {
this.$refs.editor.focus() this.$refs.textContent.addTag('@昵称')
this.insertHtmlAtCaret('@昵称')
this.changeInput()
// var range = window.getSelection().getRangeAt(0)
// console.log(range)
// range.selectNodeContents(range.endContainer.childNodes[range.startOffset - 2])
// var el = document.createElement('span')
// el.setAttribute('contenteditable', false)
// el.setAttribute('class', 'nickname')
// el.innerHTML = '@昵称<i class="el-icon-error"></i>'
// el.innerHTML = '<span id="nick" contenteditable="false" class="nickname">@昵称<i class="el-icon-error"></i></span>'
// var node = document.getElementById('nick')
// var targetNode = document.getElementById('editor')
// targetNode.appendChild(el)
// var EL = document.createElement('div')
// EL.setAttribute('contenteditable', true)
// targetNode.appendChild(EL)
// this.editor.txt.append('<span class="nickname">@昵称<i class="el-icon-error"></i><span>')
} else if (name == 'activity') { } else if (name == 'activity') {
this.$refs.activity.init() this.$refs.activity.init()
} }
...@@ -263,12 +249,26 @@ export default { ...@@ -263,12 +249,26 @@ export default {
}, },
selectActivity(val) { selectActivity(val) {
console.log(val) console.log(val)
let idx
const hasActivity = this.previewList.some((item, index) => {
if (item.attType == 7) {
idx = index
return item
}
})
if (val) { if (val) {
if (hasActivity) {
this.$set(this.previewList, idx, {
attContent: val,
attType: ATT_TYPE.ACTIVITY
})
} else {
this.previewList.push({ this.previewList.push({
attContent: val, attContent: val,
attType: ATT_TYPE.ACTIVITY attType: ATT_TYPE.ACTIVITY
}) })
} }
}
}, },
insertHtmlAtCaret(html) { insertHtmlAtCaret(html) {
var sel, range, frag var sel, range, frag
...@@ -298,20 +298,10 @@ export default { ...@@ -298,20 +298,10 @@ export default {
} }
} }
}, },
changeInput: debounce(function() { updateText(val) {
console.log(document.getElementById('editor').childNodes) console.log(val)
var allNodes = document.getElementById('editor').childNodes this.textInput(val)
var str = ''
allNodes.forEach(item => {
if (item.className == 'nickname') {
str += item.innerText
} else if (item.data) {
str += item.data
} }
})
console.log(str)
this.textInput(str)
})
} }
} }
</script> </script>
......
...@@ -19,7 +19,11 @@ ...@@ -19,7 +19,11 @@
<div class="detail-total">共 {{ employeelist.length || 0 }} 人</div> <div class="detail-total">共 {{ employeelist.length || 0 }} 人</div>
<div v-if="employeelist.length != 0" class="info-list"> <div v-if="employeelist.length != 0" class="info-list">
<div class="info-item" v-for="(item, index) in employeelist" :key="item.id"> <div class="info-item" v-for="(item, index) in employeelist" :key="item.id">
<img class="info-avatar" :src="item.avatar" alt /> <img
class="info-avatar"
:src="item.avatar ? item.avatar : require('@/assets/guestCustom/default-avatar.png')"
alt
/>
<div class="info-content"> <div class="info-content">
<div class="info-text"> <div class="info-text">
<div class="info-name"> <div class="info-name">
...@@ -62,7 +66,11 @@ ...@@ -62,7 +66,11 @@
<div class="detail-total">共 {{ customerlist.length || 0 }} 人</div> <div class="detail-total">共 {{ customerlist.length || 0 }} 人</div>
<div v-if="customerlist.length != 0" class="info-list"> <div v-if="customerlist.length != 0" class="info-list">
<div class="info-item" v-for="item in customerlist" :key="item.id"> <div class="info-item" v-for="item in customerlist" :key="item.id">
<img class="info-avatar" :src="item.avatar" alt /> <img
class="info-avatar"
:src="item.avatar ? item.avatar : require('@/assets/guestCustom/default-avatar.png')"
alt
/>
<div class="info-content info-custom"> <div class="info-content info-custom">
<div class="info-text"> <div class="info-text">
<div class="info-name"> <div class="info-name">
......
...@@ -348,11 +348,12 @@ export default { ...@@ -348,11 +348,12 @@ export default {
this.equityStatistical() this.equityStatistical()
this.merchantStatistical() this.merchantStatistical()
}, },
dateChange(val) { dateChange(val, pointUnit = 1) {
console.log(val) console.log(val)
const params = { const params = {
dataStartDateStr: dayjs(val[0]).format('YYYY-MM-DD'), dataStartDateStr: dayjs(val[0]).format('YYYY-MM-DD'),
dataEndDateStr: dayjs(val[1]).format('YYYY-MM-DD') dataEndDateStr: dayjs(val[1]).format('YYYY-MM-DD'),
pointUnit
} }
this.timePeriodStatistics(params) this.timePeriodStatistics(params)
}, },
...@@ -386,7 +387,7 @@ export default { ...@@ -386,7 +387,7 @@ export default {
// endTime = new Date(nowYear, 11, 31) // endTime = new Date(nowYear, 11, 31)
this.$set(this.date, 0, startTime) this.$set(this.date, 0, startTime)
this.$set(this.date, 1, endTime) this.$set(this.date, 1, endTime)
this.dateChange(this.date) this.dateChange(this.date, 2)
break break
} }
}, },
......
...@@ -96,8 +96,8 @@ export default { ...@@ -96,8 +96,8 @@ export default {
}, },
{ {
label: '说明', label: '说明',
prop: 'notes' prop: 'notes',
// line: 1 line: 4
}, },
{ {
label: '状态', label: '状态',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!