Commit 6b83832f by 胡悦

提交群发助手

1 parent fe0eee8d
......@@ -163,6 +163,24 @@ const remindUserGroup = params => {
sign: true
})
}
const getMerchant = params => {
params.method = 'scrm.api.coupon.list.merchant'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
})
}
const getCard = params => {
params.method = 'scrm.api.equity.card.class.list.with.page'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
customerList,
customerGroupList,
......@@ -179,5 +197,7 @@ export default {
groupDetailStatistic,
staffList,
customerDetailList,
groupDetailList
groupDetailList,
getMerchant,
getCard
}
export function debounce(func, wait= 200){
let timeout;
return function(event){
clearTimeout(timeout)
timeout = setTimeout(()=>{
func.call(this, event)
},wait)
}
}
export function dateFormat (dateTime, format = 'YYYY-MM-DD HH:mm') {
const date = new Date(dateTime)
const config = {
......
......@@ -177,7 +177,7 @@
@confirmDialog="handleConfirm"
@closeDialog="membersVisible = !membersVisible"
>
<SelectMembers :selectData="selectData" ref="membersForm"></SelectMembers>
<SelectMembers islord="false" :selectData="selectData" ref="membersForm"></SelectMembers>
</glsx-dialog>
</div>
<div
......@@ -219,6 +219,7 @@ export default {
}
}
const validatorAttachment = (rule, value, callback) => {
console.log(this.$refs.welcome.previewList)
const previewList = this.$refs.welcome.previewList
if (previewList.length != 0) {
this.basicForm.attachmentList = previewList
......@@ -332,13 +333,13 @@ export default {
this.$refs.selectLabel.init()
},
handleSubmit() {
console.log(this.basicForm)
console.log(this.basicForm, this.$refs.welcome.previewList)
this.$refs.basicForm.validate(valid => {
if (valid) {
console.log(valid)
this.$refs.groupForm.validate(v => {
if (v) {
if (this.groupNumber == 0) {
if (this.basicForm.selectType == 2 && this.groupNumber == 0) {
this.$message({
type: 'error',
message: '选择客户数量为0,不可创建'
......@@ -347,8 +348,15 @@ export default {
}
const params = this.getSiftMembers()
params.type = 1
params.attachmentList = this.basicForm.attachmentList
// params.attachmentList = this.basicForm.attachmentList
params.sendType = this.basicForm.sendType
const attachmentList = this.$common.utils.deepClone(this.$refs.welcome.previewList).map(item => {
if (item.attType == 1) {
item.attContent = item.attContent.replace('@昵称', '[@昵称]')
}
return item
})
params.attachmentList = attachmentList
// const params = {
// type: 1,
// attachmentList: this.basicForm.attachmentList,
......
......@@ -90,7 +90,7 @@
@confirmDialog="handleConfirm"
@closeDialog="membersVisible = !membersVisible"
>
<SelectMembers ref="membersForm"></SelectMembers>
<SelectMembers ref="membersForm" islord="true"></SelectMembers>
</glsx-dialog>
</div>
</template>
......
<template>
<div class="square-main">
<el-dialog title="选择活动" :visible.sync="dialogVisible" width="70%" :before-close="handleClose">
<div class="model-panel">
<div class="model-panel-tab">
<label>活动类型:</label>
<el-tabs v-model="activeName" @tab-click="handleClick" type="card">
<el-tab-pane label="券营销" name="1"></el-tab-pane>
<el-tab-pane label="权益卡" name="2"></el-tab-pane>
</el-tabs>
</div>
<div class="model-item-panel" v-if="modelList.length > 0" v-loading="loading">
<div
class="model-item"
:class="{ checked: selectItem == item }"
v-for="(item, index) in modelList"
:key="index"
@click="handleSelectItem(item)"
>
<div class="model-item-title" v-show="activeName == 2">{{ item.cardClassName }}</div>
<div class="model-item-title" v-show="activeName == 1">{{ item.couponName }}</div>
<div class="model-item-content" v-show="activeName == 1">数量:{{ item.residueAmount }}</div>
<div class="model-item-content" v-show="activeName == 2">价格:{{ item.price }}</div>
<div
class="model-item-content"
v-show="activeName == 2 && item.effectiveType == 2"
>有效期:{{ item.effectiveNum }}天</div>
<div
class="model-item-content"
v-show="activeName == 2 && item.effectiveType == 1"
>有效期:无限制</div>
<div
class="model-item-content"
v-show="activeName == 1 && item.effectiveType == 2"
>有效期:{{ item.effectiveStartTime }}~{{ item.effectiveEndTime }}</div>
<div
class="model-item-content"
v-show="activeName == 1 && item.effectiveType == 1"
>有效期:{{ item.effectiveDays }}天</div>
<div
class="model-item-content"
v-show="activeName == 1 && item.effectiveType == 3"
>有效期:无限制</div>
<div
class="model-item-content"
v-show="activeName == 1"
>类型:{{ item.discountType == 1 ? '满减劵' : item.discountType == 2 ? '折扣券' : item.discountType == 3 ? '代金券' : item.discountType == 4 ? '实物券' : item.discountType == 5 ? '购车代金券' : item.discountType == 6 ? '商品折扣券' : item.discountType == 7 ? '会员服务' : '' }}</div>
<div class="model-item-content" v-show="activeName == 2">类型:权益卡</div>
</div>
</div>
<div class="model-item-empty" v-else v-loading="loading">
<img src="@/assets/empty.png" />
<div class="empty-item">暂无数据</div>
</div>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNum"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="tableTotal"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible = false">取 消</el-button>
<el-button size="small" type="primary" @click="handleSelect">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'ActivityModel',
data() {
return {
dialogVisible: false,
loading: false,
activeName: '1',
modelList: [],
pageNum: 1,
pageSize: 10,
tableTotal: 0,
selectItem: {}
}
},
methods: {
handleSelectItem(item) {
this.selectItem = item
},
handleSelect() {
if (!this.selectItem.id) {
this.$message({
type: 'error',
message: '请选择活动'
})
return
}
this.dialogVisible = false
this.$emit('selectActivity', { marketingId: this.selectItem.id, marketingType: this.activeName == 1 ? 2 : 3, marketingName: this.activeName == 2 ? this.selectItem.cardClassName : this.selectItem.couponName })
},
handleSizeChange(val) {
this.pageSize = val
this.getModelList()
},
handleCurrentChange(val) {
this.pageNum = val
this.getModelList()
},
getModelList() {
this.modelList = []
this.loading = true
let market = ''
switch (this.activeName) {
case '1':
market = 'getMerchant'
break
case '2':
market = 'getCard'
break
}
let params = {
pageSize: this.pageSize,
pageNum: this.pageNum
}
this.$apis.customerTransform[market](params).then(res => {
this.modelList = res.list ? res.list : res.data
this.tableTotal = res.total
this.loading = false
})
},
init() {
this.dialogVisible = true
this.getModelList()
this.selectItem = {}
},
handleClick() {
this.getModelList()
}
}
}
</script>
<style lang="scss" scoped>
.model-panel {
.model-panel-tab {
display: flex;
align-items: center;
margin-bottom: 18px;
label {
font-size: 16px;
font-weight: 400;
color: #000000;
line-height: 24px;
}
/deep/ {
.el-checkbox:last-of-type {
margin-right: 8px;
}
.el-tabs__nav {
border: 0;
}
.el-tabs__header {
border: 0;
background-color: #f4f6fc;
margin: 0px;
}
.el-tabs__item {
border: none;
width: 180px;
height: 32px;
line-height: 32px;
margin: 2px;
text-align: center;
}
.el-tabs__item.is-active {
background-color: #fff;
border-radius: 4px;
}
}
}
.model-item-empty {
> img {
display: block;
margin: 50px auto 0px;
width: 60px;
height: auto;
}
.empty-item {
text-align: center;
font-size: 14px;
font-weight: 400;
color: #000000;
line-height: 22px;
margin-bottom: 30px;
}
}
.model-item-panel {
display: grid;
grid-template-columns: repeat(4, 25%);
grid-row-gap: 10px;
height: 40vh;
overflow: auto;
.model-item {
position: relative;
height: 128px;
background: #ffffff;
border-radius: 4px;
border: 2px solid #e6e6e6;
padding: 14px 24px;
box-sizing: border-box;
margin-right: 10px;
&:nth-child(4n) {
margin-right: 0px;
}
&.checked {
border: 2px solid #5850ff;
}
&-qrcode {
position: absolute;
right: 10px;
bottom: 10px;
width: 60px;
height: 60px;
border: 1px solid #979797;
}
&-title {
font-size: 18px;
font-weight: 600;
color: #333333;
line-height: 25px;
margin-bottom: 5px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
&-content {
font-size: 12px;
font-weight: 400;
color: #666666;
line-height: 17px;
margin-top: 6px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
}
}
}
</style>
\ No newline at end of file
......@@ -7,11 +7,19 @@
<template v-if="item.attType == 1">
<div class="preview-text text">{{ item.attContent }}</div>
</template>
<template v-else-if="item.attType == 4">
<div class="preview-text preview-link">
<template v-else-if="item.attType == 7">
<div class="preview-activity">
<img class="applet-logo" src="@/assets/guestCustom/applet-logo.png" alt />
<div class="activity-name">{{item.attContent.marketingName}}</div>
<img class="activity-logo" src="@/assets/guestCustom/activity-logo.png" alt />
<div class="activity-footer">
<img src="@/assets/guestCustom/applet-footer.png" alt />
</div>
</div>
<!-- <div class="preview-text preview-link">
{{ item.attContent.url }}
<img src="@/assets/guestCustom/preview-link.png" alt />
</div>
</div>-->
</template>
<template v-else-if="item.attType == 2">
<el-image style="width: 100px" :src="item.attContent" fit="contain"></el-image>
......@@ -139,6 +147,31 @@ export default {
margin-bottom: 5px;
}
}
.preview-activity {
width: 160px;
// height: 184px;
background-color: #fff;
border-radius: 4px;
border: 1px solid #dce1e5;
padding: 7px 7px 0;
.activity-name {
font-size: 12px;
color: #333;
margin: 7px 0 4px;
width: 160px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.applet-logo {
width: 95px;
height: 24px;
}
.activity-footer {
margin-top: 4px;
border-top: 1px solid #edeff3;
}
}
}
}
}
......
......@@ -37,7 +37,7 @@
<script>
export default {
name: 'selectEmp',
props: ['selectData'],
props: ['selectData', 'islord'],
data() {
return {
treeHeight: 0,
......@@ -69,7 +69,6 @@ export default {
]
},
tableEmpData: [],
group: {},
currentArr: [],
loading: true
}
......@@ -79,10 +78,14 @@ export default {
this.$emit('selectTable', val)
},
listDepartmentTree() {
this.$apis.customerTransform.listDepartmentTree({ merchantId: 10001001, addChildrensFlag: true }).then(res => {
const params = { merchantId: 10001001, addChildrensFlag: true }
if (this.islord) {
params.islord = this.islord
}
this.$apis.customerTransform.listDepartmentTree(params).then(res => {
this.listTree = res
this.loading = false
this.listTree[0].entmicroStaffResponses = this.getEmployee(this.listTree)
// this.listTree[0].entmicroStaffResponses = this.getEmployee(this.listTree)
console.log(this.listTree)
this.currentArr = this.$common.utils.deepClone(this.listTree[0].entmicroStaffResponses)
this.selectData.forEach(i => {
......@@ -145,6 +148,7 @@ export default {
// }
},
mounted() {
console.log('islord', this.islord)
let clientHeight = document.documentElement.clientHeight
this.treeHeight = clientHeight - 650
this.listDepartmentTree()
......
......@@ -27,7 +27,7 @@
<div class="select-sale-panel">
<select-emp
:selectData="selectData"
@group="handlGroup"
:islord="islord"
@selectTable="selectTable"
ref="selectEmpTabel"
></select-emp>
......@@ -42,7 +42,7 @@
import selectEmp from './selectEmp.vue'
export default {
name: 'SelectMembers',
props: ['selectData'],
props: ['selectData', 'islord'],
components: {
selectEmp
},
......
......@@ -3,15 +3,30 @@
<!-- <div class="required">入群欢迎语</div> -->
<div class="content">
<div class="content-bg">
<el-input
<!-- <div id="nick" contenteditable="false" class="nickname">
@昵称
<i class="el-icon-error"></i>
</div>-->
<!-- <div id="toolbar-container" style="display: none;"></div>
<div id="text-container" class="editor-container"></div>-->
<div
id="editor"
ref="editor"
@input="changeInput"
class="text-editor"
contenteditable="true"
autofocus
></div>
<!-- <el-input
type="textarea"
:rows="9"
maxlength="600"
show-word-limit
v-model="guestForm.name"
@input="textInput"
style="-webkit-user-modify: read-write-plaintext-only !important;"
placeholder="请输入内容"
></el-input>
></el-input>-->
<div v-for="itm in previewList" :key="itm.id">
<div class="welcome-file" v-if="itm.attType != 1">
<template v-if="itm.attType == 2">
......@@ -22,9 +37,9 @@
<img src="@/assets/guestCustom/icon-img.png" alt />
<span>{{ itm.attContent }}</span>
</template>
<template v-else-if="itm.attType == 4">
<img src="@/assets/guestCustom/icon-link.png" alt />
<span>{{ itm.attContent.url }}</span>
<template v-else-if="itm.attType == 7">
<img src="@/assets/guestCustom/icon-applet.png" alt />
<span>{{ itm.attContent.marketingName }}</span>
</template>
<template v-else-if="itm.attType == 5">
<img src="@/assets/guestCustom/icon-applet.png" alt />
......@@ -35,9 +50,9 @@
</div>
<div class="btn-group">
<div class="add-btn" v-for="item in btnList" :key="item.id">
<i class="el-icon-circle-plus-outline"></i>
<!-- <i class="el-icon-circle-plus-outline"></i> -->
<img :src="require(`@/assets/guestCustom/add-${item.type}.png`)" alt />
<span>{{ item.name }}</span>
<!-- <div id="video"></div> -->
<input
v-if="item.type == 'img'"
type="file"
......@@ -49,7 +64,7 @@
@change="e => handleImgChange(e, item)"
/>
<input
v-if="item.type == 'video'"
v-else-if="item.type == 'video'"
type="file"
style="opacity: 0"
:id="item.name + 'file'"
......@@ -58,11 +73,7 @@
:accept="item.accept || 'video/*'"
@change="e => handleVideoChange(e, item)"
/>
<el-link
v-if="item.type == 'popup'"
style="opacity: 0"
@click="switchDailog(item.funName)"
>{{ item.name }}</el-link>
<el-link v-else style="opacity: 0" @click="handleFun(item.funName)">{{ item.name }}</el-link>
</div>
</div>
</div>
......@@ -71,85 +82,7 @@
<span>客户每个月最多接收来自同一企业的管理员的 4 条群发消息,4条消息可在同一天发送,达到上限后,无法再接收管理员的群发消息。</span>
</div>
</div>
<!-- <div class="required">发送时间</div>
<div class="content">
<el-radio-group v-model="sendType">
<el-radio :label="1">立即发送</el-radio>
<el-radio :label="2">定时发送</el-radio>
</el-radio-group>
<div v-show="sendType == 2" class="date-picker">
<el-date-picker v-model="sendTime" size="small" type="date" placeholder="选择日期"></el-date-picker>
-
<el-time-picker v-model="sendDate" size="small" placeholder="选择时间"></el-time-picker>
</div>
</div>-->
<glsx-dialog
:title="dialogTitle"
:width="'712px'"
:isVisible="dialogVisible"
@confirmDialog="handleConfirm"
@closeDialog="dialogVisible = !dialogVisible"
>
<slot>
<el-form
v-if="dialogTitle == '添加网页消息'"
:model="linkForm"
:rules="linkRules"
ref="linkForm"
label-width="120px"
>
<el-form-item label="网页标题" prop="title">
<el-input v-model="linkForm.title" placeholder="请输入网页标题"></el-input>
</el-form-item>
<el-form-item label="添加网页链接" prop="url">
<el-input v-model="linkForm.url" placeholder="以http或https开头"></el-input>
</el-form-item>
</el-form>
<el-form
v-else-if="dialogTitle == '添加小程序'"
:model="appletForm"
:rules="appletRules"
ref="appletForm"
label-width="120px"
>
<el-form-item label="小程序标题" prop="title">
<el-input v-model="appletForm.title" placeholder="请输入小程序标题"></el-input>
</el-form-item>
<el-form-item label="小程序appID" prop="appid">
<el-input v-model="appletForm.appid" placeholder="请输入小程序appID"></el-input>
</el-form-item>
<el-form-item label="小程序路径" prop="page">
<el-input v-model="appletForm.page" placeholder="请输入小程序路径"></el-input>
<div class="form-tips">注意:小程序路径以html作为后缀</div>
</el-form-item>
<el-form-item label="小程序封面" prop="page">
<div class="upload">
<div v-show="!appletForm.picUrl" class="upload-bg">
<i class="el-icon-circle-plus"></i>
<div class="upload-text">上传封面</div>
</div>
<input
type="file"
style="opacity: 0"
ref="file"
class="form-upload img-w-h"
accept="image/png, image/jpeg, image/gif, image/jpg"
@change="handleImg"
/>
<el-image
v-show="appletForm.picUrl"
style="width: 140px"
:src="appletForm.picUrl"
fit="contain"
></el-image>
</div>
<div class="form-tips">建议图片大小在2M以内,建议尺寸:352*282px</div>
</el-form-item>
</el-form>
</slot>
</glsx-dialog>
<ActivityModel ref="activity" @selectActivity="selectActivity"></ActivityModel>
</div>
</template>
<script>
......@@ -159,66 +92,75 @@ const ATT_TYPE = {
VEDIO: 3,
URL: 4,
MINIPROGRAM: 5,
FILE: 6
FILE: 6,
ACTIVITY: 7
}
// import E from 'wangeditor'
import ActivityModel from './activityModel'
import { debounce } from '@/utils/index'
export default {
name: 'WelcomeWords',
components: {
ActivityModel
},
props: { eventBus: Object },
data() {
return {
btnList: [
// {
// id: 1,
// name: '表情',
// funcName: '',
// type: 'expression',
// limitSize: 10
// },
{
id: 1,
id: 2,
name: '图片',
funcName: '',
type: 'img',
limitSize: 10
},
{
id: 2,
name: '视频',
funcName: '',
type: 'video',
limitSize: 10
},
{
id: 3,
name: '链接',
type: 'popup',
funName: 'link'
},
// {
// id: 3,
// name: '昵称',
// type: 'nickname',
// funName: 'nickname'
// },
{
id: 4,
name: '小程序',
type: 'popup',
funName: 'applet'
name: '活动',
type: 'acivity',
funName: 'activity'
}
],
guestForm: {},
dialogTitle: '',
dialogVisible: false,
linkForm: {},
linkRules: {
title: [{ required: true, message: '请输入网页标题', trigger: 'blur' }],
url: [{ required: true, message: '请输入网页链接', trigger: 'blur' }]
},
appletForm: {},
appletRules: {
title: [{ required: true, message: '请输入网页标题', trigger: 'blur' }],
appid: [{ required: true, message: '请输入网页链接', trigger: 'blur' }],
page: [{ required: true, message: '请输入小程序路径', trigger: 'blur' }]
},
previewList: [],
sendType: '',
sendTime: '',
sendDate: ''
sendDate: '',
editor: {}
}
},
mounted() {
// const _this = this
// this.editor = new E('#toolbar-container', '#text-container')
// this.editor.config.zIndex = 100
// this.editor.config.height = 165
// this.editor.config.colors = ['#000000', '#f7f7f7']
// this.editor.config.focus = false
// this.editor.config.onchange = function(newHtml) {
// console.log('change 之后最新的 html', newHtml)
// console.log(_this.editor.txt.text())
// const val = _this.editor.txt.text()
// _this.textInput(val)
// }
// this.editor.config.onchangeTimeout = 500
// this.editor.create()
this.eventBus.$emit('update', this.previewList)
// obj.init('video')
},
methods: {
// 上传图片
handleImgChange(e, targetItem) {
var reader = new FileReader()
var file = e.srcElement.files[0]
......@@ -250,6 +192,7 @@ export default {
}
}
},
// 上传视频
handleVideoChange(e, targetItem) {
var file = e.srcElement.files[0]
var reader = new FileReader()
......@@ -275,77 +218,29 @@ export default {
})
}
},
handleImg(e) {
var reader = new FileReader()
var file = e.srcElement.files[0]
console.log(file)
// 默认1MB
const limitSize = 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
var image = new Image()
image.src = e.target.result
image.onload = () => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
console.log(res)
this.$set(this.appletForm, 'picUrl', res)
// this.appletForm.picUrl = res
}
})
}
}
},
switchDailog(funName) {
if (funName == 'link') {
this.dialogTitle = '添加网页消息'
} else if (funName == 'applet') {
this.dialogTitle = '添加小程序'
}
this.dialogVisible = !this.dialogVisible
},
handleConfirm() {
const { dialogTitle } = this
switch (dialogTitle) {
case '添加网页消息':
this.$refs.linkForm.validate(valid => {
if (valid) {
console.log(this.linkForm)
this.previewList.push({
attType: ATT_TYPE.URL,
attContent: this.linkForm
})
this.dialogVisible = !this.dialogVisible
} else {
console.log('error submit!!')
return false
}
})
break
case '添加小程序':
this.$refs.appletForm.validate(valid => {
if (valid) {
console.log(this.appletForm)
this.previewList.push({
attType: ATT_TYPE.MINIPROGRAM,
attContent: this.appletForm
})
this.dialogVisible = !this.dialogVisible
} else {
console.log('error submit!!')
return false
}
})
break
default:
console.log(dialogTitle)
// 添加昵称
handleFun(name) {
if (name == 'nickname') {
this.$refs.editor.focus()
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') {
this.$refs.activity.init()
}
},
close(index) {
......@@ -365,7 +260,58 @@ export default {
attType: ATT_TYPE.TEXT
})
}
}
},
selectActivity(val) {
console.log(val)
if (val) {
this.previewList.push({
attContent: val,
attType: ATT_TYPE.ACTIVITY
})
}
},
insertHtmlAtCaret(html) {
var sel, range, frag
if (window.getSelection) {
sel = window.getSelection()
if (sel.getRangeAt && sel.rangeCount) {
range = sel.getRangeAt(0)
range.deleteContents()
var el = document.createElement('span')
el.innerHTML = '<span contenteditable="false" class="nickname">@昵称<i class="el-icon-error"></i></span>'
// var el = document.createElement('div')
// el.innerHTML = html
frag = document.createDocumentFragment()
var node
var lastNode
while ((node = el.firstChild)) {
lastNode = frag.appendChild(node)
}
range.insertNode(frag)
if (lastNode) {
range = range.cloneRange()
range.setEndAfter(lastNode)
range.collapse(true)
sel.removeAllRanges()
sel.addRange(range)
}
}
}
},
changeInput: debounce(function() {
console.log(document.getElementById('editor').childNodes)
var allNodes = document.getElementById('editor').childNodes
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>
......@@ -385,6 +331,7 @@ export default {
display: flex;
align-items: center;
color: #999;
line-height: 20px;
padding: 10px;
margin-bottom: 10px;
border-left: 1px solid #dcdfe6;
......@@ -431,6 +378,10 @@ export default {
width: 100%;
cursor: pointer;
}
img {
width: 16px;
height: 16px;
}
.el-link {
position: absolute;
width: 100%;
......@@ -522,4 +473,44 @@ export default {
margin-right: 8px;
}
}
// 编辑器
.editor-container {
border: 1px solid #dcdfe6;
min-height: 165px;
/deep/ {
.w-e-text {
background-color: #f7f7f7;
}
}
}
.text-editor {
outline: 0;
width: 100%;
min-height: 200px;
max-height: 200px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
padding: 5px;
line-height: 20px;
font-size: 12px;
word-wrap: break-word;
overflow-x: hidden;
overflow-y: auto;
_overflow-y: visible;
}
/deep/.nickname {
display: inline;
// width: 64px;
// height: 20px;
border-radius: 2px;
background-color: #fff;
font-size: 14px;
color: #5850ff;
line-height: 20px;
padding: 2px;
margin: 0 5px;
i {
font-size: 10px;
}
}
</style>
......@@ -70,8 +70,8 @@ export default {
console.log(val)
const xData = val.map(i => i.dataDateStr)
const yData = val.map(i => i.amount)
this.option.xAxis.data = xData.reverse()
this.option.series[0].data = yData.reverse()
this.option.xAxis.data = xData
this.option.series[0].data = yData
this.option.series[0].count = val.map(i => i.count)
this.option && this.myChart.setOption(this.option)
}
......
......@@ -366,21 +366,24 @@ export default {
switch (name) {
case 'week':
startTime = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek)
endTime = new Date(nowYear, nowMonth, nowDay + 6 - nowDayOfWeek)
endTime = new Date()
// endTime = new Date(nowYear, nowMonth, nowDay + 6 - nowDayOfWeek)
this.$set(this.date, 0, startTime)
this.$set(this.date, 1, endTime)
this.dateChange(this.date)
break
case 'month':
startTime = new Date(nowYear, nowMonth, 1)
endTime = new Date(nowYear, nowMonth + 1, 0)
endTime = new Date()
// endTime = new Date(nowYear, nowMonth + 1, 0)
this.$set(this.date, 0, startTime)
this.$set(this.date, 1, endTime)
this.dateChange(this.date)
break
case 'year':
startTime = new Date(nowYear, 0, 1)
endTime = new Date(nowYear, 11, 31)
endTime = new Date()
// endTime = new Date(nowYear, 11, 31)
this.$set(this.date, 0, startTime)
this.$set(this.date, 1, endTime)
this.dateChange(this.date)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!