Commit a5b56df8 by 杨明

fixed

1 parent 961f73a7
...@@ -4352,6 +4352,12 @@ ...@@ -4352,6 +4352,12 @@
"integrity": "sha512-kaBmGWJlLW5bGEbm7/HWG9jt4oH+uecBIIfzFWfFkgqssPT2I6RDenGqo4wmKzm7seNu7DSCRZBXCuf7w8dtkQ==", "integrity": "sha512-kaBmGWJlLW5bGEbm7/HWG9jt4oH+uecBIIfzFWfFkgqssPT2I6RDenGqo4wmKzm7seNu7DSCRZBXCuf7w8dtkQ==",
"dev": true "dev": true
}, },
"element-theme-chalk": {
"version": "2.15.9",
"resolved": "https://registry.npmjs.org/element-theme-chalk/-/element-theme-chalk-2.15.9.tgz",
"integrity": "sha512-QrvAIyfIVMxakBzfnoamzSuVP4xs6UpaPmshuz7PogSzC31K0us46gqYPf/UjjP+mYC+i02LROg8UgxF814oig==",
"dev": true
},
"elliptic": { "elliptic": {
"version": "6.5.2", "version": "6.5.2",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
...@@ -12104,6 +12110,14 @@ ...@@ -12104,6 +12110,14 @@
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==", "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
"dev": true "dev": true
}, },
"vuedraggable": {
"version": "2.24.3",
"resolved": "https://registry.npmjs.org/vuedraggable/-/vuedraggable-2.24.3.tgz",
"integrity": "sha512-6/HDXi92GzB+Hcs9fC6PAAozK1RLt1ewPTLjK0anTYguXLAeySDmcnqE8IC0xa7shvSzRjQXq3/+dsZ7ETGF3g==",
"requires": {
"sortablejs": "1.10.2"
}
},
"watchpack": { "watchpack": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",
......
<template>
<div class="square-main" v-loading="loading">
<el-dialog title="客户列表" :visible.sync="dialogVisible" width="70%" :before-close="handleClose">
<el-form :inline="true" :model="tableSearchForm" class="emp-form">
<el-form-item size="small" label="客户名称">
<el-input v-model="tableSearchForm.customerName" placeholder="请输入客户名称"></el-input>
</el-form-item>
<el-form-item size="small" label="状态" v-if="!pStatus">
<el-select v-model="tableSearchForm.status" placeholder="请选择">
<el-option v-for="item in optionstatus" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item size="small" label="跟进员工" v-if="!staffIds">
<el-select v-model="staffId" placeholder="请选择">
<el-option v-for="item in staffName" :key="item.staffId" :label="item.staffName" :value="item.staffId"></el-option>
</el-select>
</el-form-item>
<el-form-item size="small" label="添加时间" v-if="timeStatus">
<el-date-picker :picker-options="pickerOptions" value-format="yyyy-MM-dd" v-model="createTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item>
<el-form-item size="small" style="float: right; margin-right: 0px">
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<!-- <GLCombiForm ref="formSearch" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm> -->
<GLTable v-loading="loading" ref="table" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams" @refreshTable="handleSearch" @selectionTable="selectionTable">
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">详情</el-button>
</div>
<template slot="status" slot-scope="scope">
<div class="status-form" v-if="scope.scope.status" style="color: #eb4e4e">删除好友</div>
<div class="status-form" v-else style="color: #00a854">正常</div>
</template>
<template slot="customerName" slot-scope="scope">
<div class="form-row">
<img :src="scope.scope.avatar" v-if="scope.scope.avatar" />
{{ scope.scope.customerName }}
<span style="color: #5850ff">{{ scope.scope.type == 1 ? '@微信' : '@企微' }}</span>
</div>
</template>
</GLTable>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleCancel" type="primary">关闭</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { utils } from 'glsx-common'
import util from '@/utils/util'
export default {
name: 'selectEmp',
data() {
return {
loading: false,
dialogVisible: false,
status: '',
createTime: [],
optionstatus: [
{
value: '',
label: '全部'
},
{
value: '0',
label: '正常'
},
{
value: '-1',
label: '删除好友'
}
],
tableSearchForm: {},
searchFormData: [
{
label: '客户名称',
name: 'codeNameAndRemark',
type: 'input',
placeholder: '请输入客户名称'
},
{
label: '状态',
name: 'imStatus',
type: 'select',
placeholder: '请选择',
optionId: 'value',
optionLabel: 'label',
optionList: [
{
value: '',
label: '全部'
},
{
value: '0',
label: '正常'
},
{
value: '-1',
label: '删除好友'
}
]
},
{
label: '跟进员工',
name: 'imStatus',
type: 'select',
placeholder: '请选择',
optionId: 'value',
optionLabel: 'label',
optionList: [
{
value: '',
label: '全部'
},
{
value: '0',
label: '正常'
},
{
value: '-1',
label: '删除好友'
}
]
},
{
label: '添加时间',
name: 'createTime',
type: 'datePicker',
placeholder: '',
isClear: true,
pickerOptions: {
disabledDate: time => {
return time.getTime() > Date.now()
}
}
}
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
tableParams: {
listName: 'data',
tableOption: false,
tableColumns: [
{
label: '客户名称',
prop: 'customerName',
addHtml: 'customerName',
align: 'left'
},
{
label: '客户性别',
prop: 'customerSex',
formatter: cellValue => {
return cellValue.customerSex == 1 ? '男' : '女'
},
minWidth: 100
},
{
label: '状态',
prop: 'status',
addHtml: 'status',
minWidth: 100
},
{
label: '跟进员工',
prop: 'followStaff',
minWidth: 100
},
{
label: '添加时间',
prop: 'addTime'
},
{
label: '操作',
prop: 'optionBtns',
minWidth: '80px',
addHtml: 'optionBtns'
}
]
},
layout: 'sizes, prev, pager, next, jumper, ->, total',
tableData: [],
staffName: [],
tableTotal: 0,
selectItem: [],
selectEmp: [],
pStatus: null,
staffIds: null,
staffId: null
}
},
methods: {
jumpUrl() {
this.$history.push('/home/followUp/index')
},
getFollower() {
var params = {
...JSON.parse(JSON.stringify(this.tableSearchForm)),
pageSize: this.$refs.table.page.pageSize,
pageNum: this.$refs.table.page.pageNum,
custState: this.selectRow.codeState,
staffIds: this.staffId ? [this.staffId] : null
}
if (this.createTime && this.createTime.length > 0) {
params.beginTime = this.createTime[0]
params.endTime = this.createTime[1]
}
if (this.pStatus) {
params.status = 0
}
if (this.staffIds) {
params.staffIds = this.staffIds
}
this.loading = true
this.$apis.channel.getCustomer(params).then(res => {
this.loading = false
this.tableData = res.data
this.tableTotal = res.count
})
},
getChannelCodeStaffList() {
var params = {
pageSize: 1000,
pageNum: 1,
codeState: this.selectRow.codeState
}
this.$apis.channel.getChannelCodeStaffList(params).then(res => {
this.staffName = [{ staffName: '全部', staffId: null }].concat(res.data)
})
},
init(item, value, day) {
this.createTime = []
this.pStatus = null
this.staffIds = null
this.timeStatus = true
if (value == 'day' && !day) {
this.createTime = [util.getDay(0), util.getDay(0)]
this.timeStatus = false
}
if (value == 'day' && day) {
if (day.indexOf('~') == -1) {
this.createTime = [day, day]
} else {
this.createTime = [day.split('~')[0], day.split('~')[1]]
}
this.timeStatus = false
}
if (value == 'status' && !day) {
this.pStatus = 'status'
}
if (value == 'status' && day) {
this.pStatus = 'status'
if (day.indexOf('~') == -1) {
this.createTime = [day, day]
} else {
this.createTime = [day.split('~')[0], day.split('~')[1]]
}
this.timeStatus = false
}
if (value == 'staffIds') {
this.staffIds = item.staffId
}
if (value == 'statusAndStaffIds') {
this.pStatus = 'status'
this.staffIds = item.staffId
}
this.selectRow = item
this.tableSearchForm = {}
this.dialogVisible = true
this.getChannelCodeStaffList()
this.$nextTick(() => {
this.$refs.table.page.pageNum = 1
this.getFollower()
})
},
handleSearch() {
this.getFollower()
},
selectionTable(val) {
this.selectItem = val
},
handleClose() {
this.handleCancel()
},
handleDetail(scope) {
this.$history.push('/custom/clientManage/clientDetail?id=' + scope.oneId)
},
handleCancel: utils.debounce(function() {
this.dialogVisible = false
}, 300)
}
}
</script>
<style lang="scss" scoped>
.dialog-jump {
color: #5850ff;
float: left;
line-height: 24px;
text-decoration: underline;
cursor: pointer;
}
.emp-form {
/deep/ {
.el-date-editor,
.el-input {
width: 215px;
}
}
}
.square-main {
/deep/ {
.el-table {
height: 35vh;
overflow-y: auto;
}
.el-form-item {
margin-right: 20px;
}
.el-table::before {
left: 0;
bottom: 0;
width: 100%;
height: 0px;
}
}
}
.form-row {
img {
width: 50px;
height: 50px;
vertical-align: middle;
}
}
</style>
<template>
<div>
<div id="channel-main" class="chart-line" ref="line" v-show="lineStatus"></div>
<div class="chart-line-empty" v-show="!lineStatus">
<img src="@/assets/img/empty.png" />
<div class="chart-empty-d">暂无数据</div>
</div>
</div>
</template>
<script>
import * as echarts from 'echarts'
export default {
name: 'line',
data() {
return {
lineStatus: true
}
},
props: {
colorList: {
type: Array
}
},
methods: {
init(chartList, codeName) {
if (chartList.length == 0) {
this.lineStatus = false
return
}
let time = chartList[0].trendItemList.map(item => {
return item.dayTime
})
let seriesList = chartList.map((item, index) => {
let newlyQyCount = []
item.trendItemList.forEach(i => {
newlyQyCount.push(i.newlyQyCount)
})
return {
name: codeName[index],
type: 'line',
data: newlyQyCount,
itemStyle: {
normal: {
color: this.colorList[index],
lineStyle: {
color: this.colorList[index]
}
}
}
}
})
echarts.init(document.getElementById('channel-main')).clear()
let chartDom = document.getElementById('channel-main')
let myChart = echarts.init(chartDom)
let option = {
legend: {
left: 'auto',
icon: 'stack',
itemHeight: 2,
itemWidth: 12,
color: this.colorList
},
tooltip: {
trigger: 'axis'
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
data: time
},
yAxis: {
type: 'value',
minInterval: 1
},
series: seriesList
}
myChart.setOption(option)
let dataList = []
seriesList.forEach(item => {
dataList = dataList.concat(item.data)
})
if (dataList.every(item => item == 0)) {
this.lineStatus = false
} else {
this.lineStatus = true
}
}
}
}
</script>
<style scoped lang="scss">
.chart-line {
height: 300px;
}
.chart-line-empty {
height: 300px;
text-align: center;
color: #666;
img {
margin-top: 100px;
width: 64px;
height: 32px;
margin-bottom: 12px;
}
}
</style>
<template>
<div class="square-main">
<GLDialog title="选择渠道" :visible.sync="dialogVisible" @onOk="handleSelect" @onCancel="handleCancel" mode="big">
<div class="square-tabel">
<div class="square-tabel-select">
<GLTable ref="table" :hasPage="false" :tableData="tableData" :tableTotal="tableTotal" :tableParams="tableParams" @refreshTable="handleSearch" @selectionTable="selectionTable"></GLTable>
</div>
<div class="square-tabel-selected">
<div class="selected-title">已选渠道</div>
<div class="selected-panel">
<div class="selected-item" v-for="(item, index) in selectedList" :key="index">
<div :title="item.codeName">
<span :style="{ background: colorList[index] }"></span>
{{ item.codeName }}
</div>
<img src="@/assets/img/channel/del.png" @click="delTag(item)" />
</div>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleCancel">取 消</el-button>
<el-button size="small" type="primary" @click="handleSelect">确 定</el-button>
</span>
</GLDialog>
</div>
</template>
<script>
import { utils } from 'glsx-common'
export default {
name: 'selectEmp',
data() {
return {
dialogVisible: false,
tableSearchForm: {},
tableParams: {
listName: 'data',
tableOption: false,
// 行数据的key
mutiSelectUniqueKey: 'id',
// 多选ref的名称
mutiSelectName: 'salelist',
tableColumns: [
{
label: '渠道名称',
prop: 'codeName'
},
{
label: '备注',
prop: 'codeRemark'
}
]
},
tableData: [],
tableTotal: 0,
selectItem: [],
selectCode: [],
selectedList: []
}
},
props: {
colorList: {
type: Array
}
},
methods: {
getFollower() {
var params = {
pageSize: 1000,
pageNum: 1
}
this.$apis.channel.listChannelCodeByPage(params).then(res => {
console.log(res)
this.tableData = res.data
this.tableTotal = res.count
this.tableData.forEach(item => {
this.selectCode.forEach((itm, index) => {
if (itm.codeState == item.codeState) {
this.$refs.table.$refs.salelistMutiTable.toggleRowSelection(item)
}
})
})
})
},
init(codeId) {
this.selectCode = JSON.parse(JSON.stringify(codeId))
this.selectedList = []
this.dialogVisible = true
this.$nextTick(() => {
this.getFollower()
})
},
handleSearch() {
this.getFollower()
},
selectionTable(val) {
this.selectedList = val
},
delTag(item) {
this.$refs.table.$refs.salelistMutiTable.toggleRowSelection(item)
},
handleCancel() {
this.dialogVisible = false
this.$refs.table.$refs.salelistMutiTable.clearSelection()
},
handleSelect: utils.debounce(function() {
if (this.selectedList.length == 0) {
this.$message.error('请选择渠道')
return
}
if (this.selectedList.length > 8) {
this.$message.error('最多选择8个渠道数据')
return
}
this.dialogVisible = false
this.$emit('selectTable', this.selectedList)
this.$refs.table.$refs.salelistMutiTable.clearSelection()
}, 300)
}
}
</script>
<style lang="scss" scoped>
.square-main {
.square-tabel {
display: flex;
&-select {
flex: 1;
}
&-selected {
width: 320px;
margin-left: 20px;
.selected-title {
background: #f4f6fc;
color: #333333;
line-height: 20px;
padding: 16px 20px;
font-weight: 600;
}
.selected-panel {
padding: 0px 20px;
.selected-item {
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 30px;
display: flex;
align-items: center;
justify-content: space-between;
div {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
span {
vertical-align: middle;
display: inline-block;
width: 12px;
height: 2px;
margin-right: 10px;
}
img {
width: 16px;
height: 16px;
cursor: pointer;
}
}
}
}
}
/deep/ {
.el-table {
height: 50vh;
overflow-y: auto;
}
.el-table::before {
left: 0;
bottom: 0;
width: 100%;
height: 0px;
}
}
}
</style>
<template>
<div class="ly-emotion">
<slot></slot>
</div>
</template>
<script>
import emoji from '@/utils/emo'
export default {
name: 'ly-emotion',
mounted() {
const name = this.$el.innerHTML
const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(name)) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
let imgHTML = `<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
this.$nextTick(() => {
this.$el.innerHTML = imgHTML
})
}
}
</script>
<style scoped>
.ly-emotion {
display: inline-block;
}
.ly-static-emotion {
width: 24px;
height: 24px;
display: inline-block;
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="square-main">
<el-dialog title="选择活动" :visible.sync="dialogVisible" width="1088px" :before-close="handleClose">
<div class="model-panel" v-loading="loading">
<div class="model-panel-tab">
<label>活动类型:</label>
<el-tabs v-model="activeName" @tab-click="handleClick" type="card">
<el-tab-pane label="权益卡试用" name="3"></el-tab-pane>
<el-tab-pane label="权益套餐" name="4"></el-tab-pane>
<el-tab-pane label="商城券" name="2"></el-tab-pane>
<el-tab-pane label="秒杀活动" name="5"></el-tab-pane>
<el-tab-pane label="无忧服务" name="6" v-if="openFlag"></el-tab-pane>
</el-tabs>
</div>
<div class="model-item-panel" v-if="modelList.length > 0">
<div class="model-item" :class="{ checked: selectItem == item }" v-for="(item, index) in modelList" :key="index" @click="handleSelectItem(item)">
<div class="model-item-title" :title="item.equityName" v-show="activeName == 3">{{ item.equityName }}</div>
<div class="model-item-title" :title="item.couponName" v-show="activeName == 2">{{ item.couponName }}</div>
<div class="model-item-title" :title="item.couponName" v-show="activeName == 6">{{ item.equityName }}</div>
<div class="model-item-title" :title="item.packageName" v-show="activeName == 4">{{ item.packageName }}</div>
<div class="model-item-title" :title="item.activityName" v-show="activeName == 5">{{ item.activityName }}</div>
<div class="model-item-content" v-show="activeName == 3">领取方式:免费领用</div>
<div class="model-item-content" v-show="activeName == 4">领取方式:付费购买</div>
<div class="model-item-content" v-show="activeName == 2 && item.effectiveType == 6">有效期:{{ item.effectiveDays }}天</div>
<div class="model-item-content" v-show="activeName == 2 && item.effectiveType == 3">有效期:无限制</div>
<div class="model-item-content" v-show="activeName == 2 && item.effectiveType == 2">有效期:{{ item.effectiveStartTime ? item.effectiveStartTime.split(' ')[0] : '' }}~{{ item.effectiveEndTime ? item.effectiveEndTime.split(' ')[0] : '' }}</div>
<div class="model-item-content" v-show="activeName == 6">获取方式:需先购买无忧服务套餐</div>
<div class="model-item-content" v-show="activeName == 6">获取限制:每个服务套餐限领一次</div>
<div class="model-item-content" v-show="activeName == 3"></div>
<div class="model-item-content model-item-contents" v-show="activeName == 3">
试用天数:
<span>{{ item.freeDay }}天</span>
</div>
<div class="model-item-content" v-show="activeName == 2">
使用途径:
{{ item.useChannel == 1 ? '线上商品' : '到店核销' }}
</div>
<div class="model-item-content model-item-weight" v-show="activeName == 6">
赠送天数:
<span>{{ item.effectiveType == 2 ? item.effectivedDay + '天' : '永久有效' }}</span>
</div>
<div class="model-item-content" v-show="activeName == 4 || activeName == 5"></div>
<div class="model-item-content model-item-contents" v-show="activeName == 4">
销售价格:
<span>{{ item.packagePrice }}元</span>
</div>
<div class="model-item-content" v-if="activeName == 5">
开始时间:
{{ item.startTime }}
</div>
<div class="model-item-content" v-if="activeName == 5">
结束时间:
{{ item.endTime }}
</div>
<div class="model-item-content model-item-contents" v-show="activeName == 2">
数量:
<span>{{ item.residueAmount }}</span>
</div>
</div>
</div>
<div class="model-item-empty" v-else v-loading="loading">
<img src="@/assets/img/empty.png" />
<div class="empty-item">暂无数据</div>
</div>
<el-pagination v-if="activeName != 3 && activeName != 6" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[12, 24, 36, 48]" :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" v-show="modelList.length">确 定</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && activeName == 2 && memberMenu">立即添加</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && activeName == 4 && couponMenu">立即添加</el-button>
<el-button size="small" type="primary" @click="handleOpen" v-show="modelList.length == 0 && activeName == 5 && activityMenu">立即添加</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import util from '@/utils/util'
export default {
name: 'ActivityModel',
data() {
return {
dialogVisible: false,
couponMenu: false,
loading: false,
activeName: '3',
modelList: [],
pageNum: 1,
pageSize: 12,
tableTotal: 0,
openFlag: 0,
selectItem: {
id: ''
}
}
},
methods: {
handleSelectItem(item) {
this.selectItem = item
if (item.equityClassId) {
this.selectItem.id = item.equityClassId
}
console.log(this.selectItem)
},
handleSelect() {
if (!this.selectItem.id) {
this.$message({
type: 'error',
message: '请选择活动'
})
return
}
this.dialogVisible = false
this.$emit('selectActivity', { marketingId: this.selectItem.id ? this.selectItem.id : this.selectItem.equityClassId, marketingType: this.activeName, marketingName: this.activeName == 3 ? this.selectItem.equityName : this.activeName == 4 ? this.selectItem.packageName : this.activeName == 5 ? this.selectItem.activityName : this.activeName == 2 ? this.selectItem.couponName : this.selectItem.equityName })
},
handleSizeChange(val) {
this.pageSize = val
this.getModelList()
},
handleCurrentChange(val) {
this.pageNum = val
this.getModelList()
},
handleOpen() {
let url
switch (this.activeName) {
case '2':
url = '/marketing/couponManage/index'
break
case '4':
url = '/marketing/memberCenter/setmealAddUpdate?%24title=%25E5%2588%259B%25E5%25BB%25BA%25E5%25A5%2597%25E9%25A4%2590'
break
case '5':
url = '/marketing/seckillActivity/editActivity/1'
break
}
util.openUrl(location.origin + url)
this.dialogVisible = false
},
getModelList() {
this.modelList = []
this.loading = true
let market = ''
switch (this.activeName) {
case '6':
market = 'merchant'
break
case '2':
market = 'getMerchant'
break
case '3':
market = 'getCard'
break
case '4':
market = 'getPackage'
break
case '5':
market = 'getActivity'
break
}
let params = {
pageSize: this.pageSize,
pageNum: this.pageNum
}
if (this.activeName == 3) {
params.tryAble = 1
params.merchantId = this.$globalState.session.merchantId
}
if (this.activeName == 2) {
params.discountTypes = [2, 3, 4]
params.directionalFlag = 1 // 1所有人可用2定向礼包专用3关联优惠券
params.validType = 'valid'
}
if (this.activeName == 5) {
params.currentPage = this.pageNum
params.activityStatus = 2
}
if (this.activeName == 6) {
params.merchantId = this.$globalState.session.merchantId
}
this.$apis.marketing[market](params)
.then(res => {
if (this.activeName == 3 || this.activeName == 6) {
this.modelList = res
} else {
this.modelList = res.list ? res.list : res.data
this.tableTotal = res.total
}
this.loading = false
})
.catch(() => {
this.loading = false
})
},
merchantOpen() {
let channel = null
if (location.host == 'scrm.cgacar.com') {
channel = 2
}
this.$apis.marketing.merchantOpen({ merchantId: this.$globalState.session.merchantId, channel }).then(res => {
this.openFlag = res.openFlag
})
},
init() {
this.merchantOpen()
this.couponMenu = false
this.activityMenu = false
this.memberMenu = false
const menu = JSON.parse(sessionStorage['SCRM_BASE_MENULIST'])
menu.forEach(item => {
if (item.name == 'marketing') {
if (!item.children) {
return
}
item.children.forEach(itm => {
console.log(itm.path)
if (itm.path == '/couponManage/index') {
this.couponMenu = true
}
if (itm.path == '/seckillActivity/index') {
this.activityMenu = true
}
if (itm.path == '^') {
this.memberMenu = true
}
})
}
})
this.dialogVisible = true
this.getModelList()
this.selectItem = {}
},
handleClick() {
this.getModelList()
}
}
}
</script>
<style lang="scss" scoped>
.square-main {
/deep/ {
.el-dialog__footer {
text-align: center;
}
}
}
.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;
font-weight: 600;
}
}
}
.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;
max-height: 38vh;
overflow: auto;
display: flex;
flex-wrap: wrap;
align-items: stretch;
flex-direction: row;
.model-item {
width: 240px;
margin-right: 24px;
margin-bottom: 24px;
padding: 12px 16px;
position: relative;
height: 128px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e6e6e6;
padding: 14px 24px;
box-sizing: border-box;
&:nth-child(4n) {
margin-right: 0px;
}
&.checked {
background: rgba(88, 80, 255, 0.1);
border: 1px 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: 16px;
height: 16px;
margin-top: 6px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
&.model-item-weight {
line-height: 20px;
height: 20px;
}
span {
color: #5850ff;
font-size: 20px;
}
}
&-contents {
line-height: 22px;
height: 22px;
}
}
}
}
</style>
<template>
<div>
<div class="emotion-box" :style="{ height: height + 'px' }">
<div class="emotion-box-line" v-for="(line, i) in list" :key="i">
<emotion class="emotion-item" v-for="(item, i) in line" :key="i" @click.native="clickHandler(item)">{{ item }}</emotion>
</div>
</div>
</div>
</template>
<script>
import emoji from '@/utils/emo'
import Emotion from './Emotion'
export default {
props: {
height: {
type: Number,
default: 200
}
},
data() {
return {
list: emoji
}
},
methods: {
clickHandler(i) {
let emotion = `${i}`
this.$emit('emotion', emotion)
}
},
components: {
Emotion
}
}
</script>
<style scoped lang="scss">
.emotion-box {
z-index: 2004;
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.15);
width: 300px;
box-sizing: border-box;
padding: 5px;
overflow: hidden;
overflow-y: auto;
}
.emotion-box-line {
display: flex;
}
.emotion-item {
flex: 1;
text-align: center;
cursor: pointer;
/deep/ {
img {
width: 24px;
-webkit-user-select: none;
cursor: default;
pointer-events: none;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<!-- 素材弹窗 -->
<template>
<glsx-dialog title="选择素材" :isVisible.sync="isMaterialVisible" width="1088px" @confirmDialog="handleMaterialConfirm" @closeDialog="handleMaterialClose" class="relateStore">
<GLCombiForm ref="showSearch" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="model-panel">
<div class="model-item-panel" v-if="modelList.length > 0" v-loading="loading">
<div class="model-item" :class="{ checked: selectItem.id == item.id }" v-for="(item, index) in modelList" :key="index" @click="handleSelectItem(item)">
<el-tooltip effect="dark" placement="top" :content="item.materialContentRpcResponse.materialName" :disabled="item.materialContentRpcResponse.materialName.length < 16">
<!-- <span class="hide-content">{{ item.materialContentRpcResponse.materialName }}</span> -->
<div class="model-item-title" :title="item.materialContentRpcResponse.materialName">{{ item.materialContentRpcResponse ? item.materialContentRpcResponse.materialName : '-' }}</div>
</el-tooltip>
<!-- <img :src="item.materialContentRpcResponse.materialUrl" /> -->
<!-- 素材内容 -->
<!-- <div slot="materialContentRpcResponse" slot-scope="scope" style="text-align: center"> -->
<!-- 素材为PDF -->
<span v-if="item.materialType == 1" class="material-content">
<!-- <el-tooltip effect="dark" placement="top" :content="item.materialContentRpcResponse.materialName" :disabled="item.materialContentRpcResponse.materialName.length < 16">
<span class="hide-content">{{ item.materialContentRpcResponse.materialName }}</span>
</el-tooltip> -->
<img class="img-pdf" src="@/assets/material/pdf.png" alt="" />
<p class="model-item-content">{{ item.materialContentRpcResponse.materialName }}.png</p>
</span>
<!-- 素材为自定义链接 -->
<!-- <span v-if="item.materialType == 2"></span> -->
<!-- 图文 -->
<span v-if="item.materialType == 3" class="material-content">
<!-- <el-tooltip effect="dark" placement="top" :content="item.materialContentRpcResponse.materialName" :disabled="item.materialContentRpcResponse.materialName.length < 16">
<span>{{ item.materialContentRpcResponse.materialName }}</span>
</el-tooltip> -->
<!-- <el-popover placement="top" trigger="click">
<div>
<img style="width: 72px; height: 72px;" v-if="item.materialContentRpcResponse.materialUrl" :src="item.materialContentRpcResponse.materialUrl" alt="" />
<img class="img-material" v-else src="@/assets/material/car.png" alt="" />
</div>
<span slot="reference">
<img v-if="item.materialContentRpcResponse.materialUrl" class="img-material" :src="item.materialContentRpcResponse.materialUrl" />
<img v-else class="img-material" src="@/assets/material/car.png" alt="" />
</span>
</el-popover> -->
<img v-if="item.materialContentRpcResponse.materialUrl" class="img-material" :src="item.materialContentRpcResponse.materialUrl" />
<img v-else class="img-material" src="@/assets/material/car.png" alt="" />
</span>
</div>
<!-- </div> -->
</div>
<div class="model-item-empty" v-else v-loading="loading">
<img src="@/assets/img/empty.png" />
<div class="empty-item">暂无数据</div>
</div>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[12, 24, 36, 48]" :page-size="pageSize" :total="tableTotal" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
</div>
</glsx-dialog>
</template>
<script>
import glsxDialog from '@/components/glsx-dialog'
export default {
name: 'materialModel',
data() {
return {
searchForm: {
groupId: '',
materialType: ''
},
searchFormData: [
{
label: '素材分组',
name: 'groupId',
type: 'select',
optionList: [],
optionId: 'id',
optionLabel: 'materialGroupName',
optionsName: 'groupList'
},
{
label: '素材类型',
name: 'materialType',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'materialTypeList'
}
],
// selectedData: [],
// selectingData: [],
// needTip: ['editProduct'],
modelList: [],
selectItem: {
id: ''
},
// 分页
pageNum: 1,
pageSize: 12,
tableTotal: 0,
baseData: {
groupList: [],
materialTypeList: [
{
confId: 1,
confName: 'PDF'
},
// {
// confId: 2,
// confName: '自定义链接'
// },
{
confId: 3,
confName: '图文'
}
]
}
}
},
props: {
isMaterialVisible: {
type: Boolean,
default: false
}
},
components: {
glsxDialog
},
created() {
this.getBaseData()
},
mounted() {
this.getModelList()
},
methods: {
getBaseData() {
this.$apis.sop.getGroupListApi({}).then(res => {
this.baseData.groupList = res
this.getOptionsList('searchFormData')
})
},
handleSelectItem(item) {
this.selectItem = item
},
getModelList() {
var params = {
...this.searchForm,
status: 0,
pageNum: this.pageNum,
pageSize: this.pageSize
}
this.$apis.sop.getMaterialListApi(params).then(res => {
this.modelList = res.data
this.tableTotal = res.count
let tableData = []
this.modelList.forEach(item => {
if (item.materialType != 3) {
item.materialContentRpcResponse.materialUrl = ''
}
if (item.materialType == 3) {
let html = decodeURIComponent(item.materialContentRpcResponse.materialUrl)
let imgHtml = html.match(/<img.*?(?:>|\/>)/g)
if (imgHtml) {
let imgSrc = imgHtml[0].match('<img[^<>]*? src="([^<>]*?)"')
item.materialContentRpcResponse.materialUrl = imgSrc[1]
} else {
item.materialContentRpcResponse.materialUrl = ''
}
}
tableData.push(item)
})
})
},
handleReset() {
this.searchForm = {
groupId: '',
materialType: ''
}
this.handleSearch()
},
handleSearch() {
this.pageNum = 1
this.getModelList()
},
handleSizeChange(val) {
this.pageSize = val
this.getModelList()
},
handleCurrentChange(val) {
this.pageNum = val
this.getModelList()
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
handleMaterialConfirm() {
this.$emit('handleMaterialConfirm', {
objectId: this.selectItem.id,
objectType: 10,
objectName: this.selectItem.materialContentRpcResponse.materialName,
additionalType: 1
})
},
handleMaterialClose() {
this.$emit('handleMaterialClose')
}
}
}
</script>
<style lang="scss" scoped>
.relateStore {
/deep/ {
.gl-operate {
margin-left: 10px;
}
}
}
.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;
font-weight: 600;
}
.el-pagination {
padding: 5px;
}
}
}
.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;
max-height: 38vh;
overflow: auto;
display: flex;
flex-wrap: wrap;
align-items: stretch;
flex-direction: row;
.model-item {
width: 100%;
// margin-right: 24px;
margin-bottom: 24px;
padding: 12px 16px;
position: relative;
text-align: center;
// height: 128px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e6e6e6;
padding: 14px 24px;
box-sizing: border-box;
&:nth-child(4n) {
margin-right: 0px;
}
&.checked {
background: rgba(88, 80, 255, 0.1);
border: 1px 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;
}
.img-pdf {
width: 40px;
height: 40px;
margin-top: 10px;
}
.img-material {
width: 72px;
height: 72px;
}
&-content {
font-size: 12px;
font-weight: 400;
color: #666666;
line-height: 16px;
height: 16px;
margin-top: 6px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
&.model-item-weight {
line-height: 20px;
height: 20px;
}
span {
color: #5850ff;
font-size: 20px;
}
}
&-contents {
line-height: 22px;
height: 22px;
}
}
}
}
</style>
<template>
<div class="img-bg">
<div class="preview-content">
<div class="preview-time">{{ currentTime }}</div>
<div class="preview-info" v-for="item in previewList" :key="item.id">
<img class="avatar" src="@/assets/img/guestCustom/logo.png" alt />
<template v-if="item.attType == 1">
<div class="preview-text text">{{ item.attContent }}</div>
</template>
<template v-else-if="item.attType == 7">
<div class="preview-activity">
<img class="applet-logo" src="@/assets/img/guestCustom/applet-logo.png" alt />
<div class="activity-name">{{item.attContent.marketingName}}</div>
<img class="activity-logo" src="@/assets/img/guestCustom/activity-logo.png" alt />
<div class="activity-footer">
<img src="@/assets/img/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>-->
</template>
<template v-else-if="item.attType == 2">
<el-image style="width: 100px" :src="item.attContent" fit="contain"></el-image>
</template>
<template v-else-if="item.attType == 3">
<!-- <el-image style="width: 100px" :src="item.attContent" fit="contain"></el-image> -->
<video style="width: 100px" :src="item.attContent"></video>
</template>
<template v-else-if="item.attType == 5">
<div class="preview-text text preview-applet">
<div class="preview-applet-title">
<img :src="item.attContent.picUrl" alt />
<span>{{ item.attContent.title }}</span>
</div>
{{ item.attContent.page }}
</div>
</template>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'Preview',
props: { eventBus: Object, list: Array },
data() {
return {
previewList: [],
currentTime: ''
}
},
created() {
this.$nextTick(() => {
console.log(1, this.list)
})
this.eventBus.$on('update', val => {
console.log(val)
this.previewList = val
})
},
mounted() {
const date = new Date()
let hours = date.getHours()
hours = hours < 10 ? `0${hours}` : hours
let minutes = date.getMinutes()
minutes = minutes < 10 ? `0${minutes}` : minutes
this.currentTime = `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日 ${hours}:${minutes}`
}
}
</script>
<style lang="scss" scope>
.img-bg {
position: relative;
width: 290px;
height: 566px;
background-image: url(../../../assets/img/guestCustom/iphone-bg.png);
background-size: 100%;
.preview-content {
position: absolute;
width: 250px;
height: 350px;
overflow-y: auto;
top: 115px;
left: 20px;
// background-color: cornflowerblue;
.preview-time {
font-size: 10px;
color: #999;
text-align: center;
margin-bottom: 15px;
}
.preview-info {
display: flex;
padding: 0 44px 20px 9px;
.avatar {
width: 26px;
height: 26px;
margin-right: 8px;
}
.preview-text {
position: relative;
max-width: 169px;
color: #333;
background-color: #fff;
border-radius: 4px;
word-wrap: break-word;
}
.text {
font-size: 16px;
padding: 8px 11px;
}
.preview-link {
display: inline-flex;
word-break: break-all;
font-size: 14px;
padding: 8px 8px 8px 11px;
img {
width: 34px;
height: 34px;
margin-left: 10px;
}
}
.preview-text::before {
content: '';
position: absolute;
left: -10px;
top: 20%;
border-width: 5px;
border-style: dashed solid dashed dashed;
border-color: transparent #fff transparent transparent;
// background-color: cornflowerblue;
}
.preview-applet {
img {
width: 20px;
height: 20px;
margin-right: 4px;
}
&-title {
display: flex;
align-self: center;
color: #999;
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;
}
}
}
}
}
</style>
<template>
<div class="w-textarea" ref="wTextarea">
<div contenteditable="true" class="w-textarea_input" ref="wTextareaContent" :id="contentId" @click="inputClick($event)" @focus="onFocus" @blur="onBlur" @keydown="textareaKeydown($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>
import emoji from '@/utils/emo'
export default {
name: 'wTextarea',
data() {
return {
// 记录currentText以计算长度
currentText: this.value,
// 为input区域生成随机id,当在页面上有多个组件时,用于监听光标的变化
contentId: `content${this.getGuid()}`,
// 输入的时候锁定,禁止更新innerHTML
isLocked: false,
isInsert: 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)
},
textareaKeydown(event) {
if (event.keyCode == 13) {
this.insertHtml('<br>')
let nn = document.createElement('br')
document.querySelector('.w-textarea_input').appendChild(nn)
return false
}
},
/*换行*/
insertHtml(html) {
var sel, range
if (window.getSelection) {
// IE9 或 非IE浏览器
sel = window.getSelection()
if (sel.getRangeAt && sel.rangeCount) {
range = sel.getRangeAt(0)
range.deleteContents()
// Range.createContextualFragment() would be useful here but is
// non-standard and not supported in all browsers (IE9, for one)
var el = document.createElement('div')
el.innerHTML = html
var frag = document.createDocumentFragment(),
node,
lastNode
while ((node = el.firstChild)) {
lastNode = frag.appendChild(node)
}
range.insertNode(frag)
// Preserve the selection
if (lastNode) {
range = range.cloneRange()
range.setStartAfter(lastNode)
range.collapse(true)
sel.removeAllRanges()
sel.addRange(range)
}
}
} else if (document.selection && document.selection.type != 'Control') {
// IE < 9
document.selection.createRange().pasteHTML(html)
}
this.currentText = document.querySelector('.w-textarea_input').innerHTML
this.$emit('updateText', this.currentText)
},
addTag(text) {
// 创建模版标签
let node = document.createElement(this.tag)
if (navigator.userAgent.indexOf('Firefox') > 0) {
node.setAttribute('contenteditable', 'false')
}
node.innerText = text
// 添加id便于删除
node.id = this.getGuid()
this.insertNode(node)
},
addNode() {
let target = this.$refs.wTextareaContent
this.updateData(target.innerHTML)
},
promiseAdd(item, num) {
return new Promise((resolve, reject) => {
setTimeout(() => {
document.querySelector('.w-textarea_input').innerHTML += item
document.querySelector('.w-textarea_input').focus()
resolve()
}, num * 100)
})
},
promiseAddNode(item, num) {
return new Promise((resolve, reject) => {
setTimeout(() => {
document.querySelector('.w-textarea_input').innerHTML += item
document.querySelector('.w-textarea_input').focus()
resolve()
}, num * 100)
})
},
addContent(attContent) {
attContent.forEach(async (item, index) => {
await this.promiseAdd(item, index)
this.addTag('@昵称')
// await this.promiseAddNode(item, index)
// this.addNode()
// t2(item)
})
// for (let i = 0; i < attContent.length; i++) {
// if (attContent[i] || (i == 0 && !attContent[i])) {
// document.querySelector('.w-textarea_input').innerHTML += attContent[i]
// document.querySelector('.w-textarea_input').focus()
// document.querySelector('.w-textarea_input').click()
// this.$nextTick(()=>{
// this.addTag('@昵称')
// })
// }
// // 代码格式
// // (function(a) {})(b)
// }
},
addLink(text, url) {
// 创建a标签
let node = document.createElement('a')
node.innerText = text
node.href = url
node.target = 'blank'
this.insertNode(node)
},
addImg(url) {
// 创建a标签
let node = document.createElement('img')
node.src = url
// node.setAttribute('ondragstart', 'return false;')
this.insertNode(node)
},
onFocus() {
this.isLocked = true
this.isInsert = true
},
onBlur() {
this.isLocked = false
},
insertNode(node) {
// 在内容中插入标签
// 删掉选中的内容(如有)
if (this.savedRange.startContainer) {
this.insertNodeFirst(node)
} else {
document.querySelector('.w-textarea_input').focus()
setTimeout(() => {
this.insertNodeFirst(node)
document.querySelector('.w-textarea_input').blur()
}, 100)
}
},
insertNodeFirst(node) {
this.savedRange.deleteContents()
// 插入链接
if (this.isInsert) {
this.savedRange.insertNode(node)
} else {
document.querySelector('.w-textarea_input').appendChild(node)
}
this.isInsert = false
// 更新双向绑定数据
let target = this.$refs.wTextareaContent
if (navigator.userAgent.indexOf('Firefox') > 0 || navigator.userAgent.indexOf('QQBrowser') > 0) {
this.updateData(target.innerHTML + '&nbsp;')
} else {
this.updateData(target.innerHTML)
}
let htm = target.innerHTML
const list = emoji.flat(Infinity)
const cutImg = htm
.replace(/<img src="https:\/\/img01.glsx.com.cn\/weapp\/resource\/saas\/scrm\/emoji\//g, '')
.replace(/<wise.+?(?:<\/wise>)/g, '@昵称')
.replace(/<br>/g, '\n')
const replaceImg = cutImg.replace(/(\d){3}.png">/g, function(str) {
let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]`
})
let Textnode = document.createElement('div')
Textnode.innerHTML = replaceImg
this.currentText = replaceImg.substring(0, 600)
console.log(this.currentText)
this.$emit('updateText', this.currentText)
},
placeCaretAtEnd(el) {
//传入光标要去的jq节点对象
el.focus()
if (typeof window.getSelection != 'undefined' && typeof document.createRange != 'undefined') {
var range = document.createRange()
range.selectNodeContents(el)
range.collapse(false)
var sel = window.getSelection()
sel.removeAllRanges()
sel.addRange(range)
} else if (typeof document.body.createTextRange != 'undefined') {
var textRange = document.body.createTextRange()
textRange.moveToElementText(el)
textRange.collapse(false)
textRange.select()
}
},
handleInput(target) {
// 即时更新数据
this.updateData(target.innerHTML)
let htm = target.innerHTML
console.log(htm)
const list = emoji.flat(Infinity)
const cutImg = htm
.replace(/<img src="https:\/\/img01.glsx.com.cn\/weapp\/resource\/saas\/scrm\/emoji\//g, '')
.replace(/<wise.+?(?:<\/wise>)/g, '@昵称')
.replace(/<br>/g, '\n')
const replaceImg = cutImg.replace(/(\d){3}.png">/g, function(str) {
let s = list[parseInt(str.split('.')[0]) - 1]
return `[${s}]`
})
let Textnode = document.createElement('div')
Textnode.innerHTML = replaceImg
this.currentText = replaceImg.substring(0, 600)
console.log(this.currentText)
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() {
return 1
// 生成随机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;
}
img {
width: 24px;
height: 24px;
-webkit-user-select: none;
cursor: default;
pointer-events: none;
}
.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;
overflow: hidden;
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>
<template>
<div class="welcome-box">
<!-- <div class="required">入群欢迎语</div> -->
<div class="content">
<div class="content-bg">
<!-- <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>-->
<wTextarea ref="textContent" v-model="textValue" @updateText="updateText"></wTextarea>
<!-- <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>-->
<div v-for="(itm, index) in previewList" :key="itm.id">
<div class="welcome-file" v-if="itm.attType != 1">
<template v-if="itm.attType == 2">
<i v-show="index == previewList.length - 1 && loading" class="el-icon-loading"></i>
<img v-show="!loading" src="@/assets/img/guestCustom/icon-img.png" alt />
<span :title="itm.attContent">{{ itm.attContent }}</span>
</template>
<template v-else-if="itm.attType == 3">
<img src="@/assets/img/guestCustom/icon-img.png" alt />
<span :title="itm.attContent">{{ itm.attContent }}</span>
</template>
<template v-else-if="itm.attType == 7">
<img src="@/assets/img/guestCustom/icon-applet.png" alt />
<span :title="itm.attContent.marketingName">{{ itm.attContent.marketingName }}</span>
</template>
<template v-else-if="itm.attType == 5">
<img src="@/assets/img/guestCustom/icon-applet.png" alt />
<span :title="itm.attContent.title">{{ itm.attContent.title }}</span>
</template>
<i class="el-icon-circle-close" @click="close(index)"></i>
</div>
</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> -->
<img :src="require(`@/assets/img/guestCustom/add-${item.type}.png`)" alt v-if="item.id == 1" @click="selectEmotion" />
<img :src="require(`@/assets/img/guestCustom/add-${item.type}.png`)" v-else alt />
<span v-if="item.id == 1" @click.stop="selectEmotion">{{ item.name }}</span>
<span v-else>{{ item.name }}</span>
<input v-if="item.type == 'img'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input upload-img" :accept="item.accept || 'image/png, image/jpeg, image/jpg'" @change="e => handleImgChange(e, item)" />
<input v-else-if="item.type == 'video'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'video/*'" @change="e => handleVideoChange(e, item)" />
<el-link v-else-if="item.type == 'nickname' || item.type == 'acivity' || item.type == 'material'" style="opacity: 0" @click="handleFun(item.funName)">{{ item.name }}</el-link>
</div>
</div>
</div>
<div v-show="emotionStatus" class="emotion-panel"><emotion class="emotion-panel-box" @emotion="handleEmotion" :height="376"></emotion></div>
<div class="tips-text">
<img src="@/assets/img/guestCustom/tips.png" class="tips-icon" alt />
<span @click="selectEmotion">如在企业微信管理后台已为所选员工设置了欢迎语,则此处设置的将不生效。</span>
</div>
</div>
<ActivityModel ref="activity" @selectActivity="selectActivity"></ActivityModel>
<!-- <material-model v-if="isMaterialVisible" :isMaterialVisible.sync="isMaterialVisible" @handleMaterialConfirm="handleMaterialConfirm" @handleMaterialClose="handleMaterialClose"></material-model> -->
</div>
</template>
<script>
const ATT_TYPE = {
TEXT: 1,
IMAGE: 2,
VEDIO: 3,
URL: 4,
MINIPROGRAM: 5,
FILE: 6,
ACTIVITY: 7
}
import emoji from '@/utils/emo'
import ActivityModel from './activityModel'
// import materialModel from './materialModel'
import Emotion from './emotionWords'
import wTextarea from './tag-textarea'
import { utils } from 'glsx-common'
export default {
name: 'WelcomeWords',
components: {
ActivityModel,
// materialModel,
Emotion,
wTextarea
},
props: { eventBus: Object },
data() {
return {
loading: false,
emotionStatus: false,
isMaterialVisible: 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: 5,
// name: '素材',
// type: 'material',
// funName: 'material'
// },
{
id: 4,
name: '活动',
type: 'acivity',
funName: 'activity'
}
],
guestForm: {},
previewList: [],
sendType: '',
sendTime: '',
sendDate: '',
editor: {},
textValue: ''
}
},
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)
},
methods: {
selectEmotion() {
this.emotionStatus = !this.emotionStatus
},
handleEmotion(i) {
this.emotionStatus = false
const list = emoji.flat(Infinity)
let index = list.indexOf(i) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
this.$refs.textContent.addImg(`https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png`)
},
updateText(val) {
this.textInput(val)
},
// 上传图片
handleImgChange(e, targetItem) {
var reader = new FileReader()
var file = e.srcElement.files[0]
console.log(file)
// 默认1MB
const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
this.loading = true
reader.readAsDataURL(file)
this.previewList.push({
attType: ATT_TYPE.IMAGE,
attContent: ''
})
reader.onload = e => {
var image = new Image()
image.src = e.target.result
image.onload = () => {
console.log(file, targetItem)
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
let len = this.previewList.length - 1
this.previewList[len].attContent = res
document.querySelector('.upload-img').value = ''
} else {
let len = this.previewList.length - 1
this.previewList.splice(len, 1)
}
this.loading = false
})
}
}
},
// 上传视频
handleVideoChange(e, targetItem) {
var file = e.srcElement.files[0]
var reader = new FileReader()
// 默认1MB
const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
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.previewList.push({
attType: ATT_TYPE.VEDIO,
attContent: res
})
}
})
}
},
// 素材
handleMaterialConfirm(val) {
console.log(val)
// additionalType 附加对象类型(1素材,2活动,3优惠券,4朋友券模板)
// objectType 对象类型(1朋友圈模板-单图文,2朋友圈模板-多图文,3朋友圈模板-文字+视频,4朋友圈模板-文字,5优惠券-商城券,6活动-权益卡使用,7活动-权益套餐,8活动-秒杀活动,10-素材)
this.editForm.object = JSON.parse(JSON.stringify(val))
this.editRule.eventContent[0].required = true
this.editForm.pushChannelType = ''
this.previewList = [
{
attContent: val,
additionalType: val.additionalType
}
]
this.handleMaterialClose()
},
handleMaterialClose() {
this.isMaterialVisible = !this.isMaterialVisible
},
handleFun(name) {
if (name == 'nickname') {
this.$refs.textContent.addTag('@昵称')
} else if (name == 'activity') {
this.$refs.activity.init()
} else if (name == 'material') {
this.handleMaterialClose()
}
},
close(index) {
this.previewList.splice(index, 1)
this.eventBus.$emit('update', this.previewList)
},
textInput(val) {
val = val.replace(/&nbsp;/g, '')
const hasText = this.previewList.some(item => item.attType == 1)
if (hasText) {
this.$set(this.previewList, 0, {
attContent: val,
attType: ATT_TYPE.TEXT
})
} else {
this.previewList.unshift({
attContent: val,
attType: ATT_TYPE.TEXT
})
}
},
selectActivity(val) {
let idx
const hasActivity = this.previewList.some((item, index) => {
if (item.attType == 7) {
idx = index
return item
}
})
if (val) {
if (hasActivity) {
this.$set(this.previewList, idx, {
attContent: val,
attType: ATT_TYPE.ACTIVITY
})
} else {
this.previewList.push({
attContent: val,
attType: ATT_TYPE.ACTIVITY
})
}
}
},
changeInput: utils.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)
}, 300),
updateList(val) {
console.log(val)
this.previewList = val
this.eventBus.$emit('update', this.previewList)
const obj = val.find(item => item.attType == 1)
let attContent = obj.attContent.replace(/\[@昵称\]/g, '<wise id="1" contenteditable="false">@昵称</wise>')
const htm = attContent.replace(/\[[\u4E00-\u9FA56]{1,4}]/gi, function(res) {
let word = res.replace(/\[|\]/gi, '')
const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(word)) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
return `<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
})
document.querySelector('.w-textarea_input').focus()
setTimeout(() => {
document.querySelector('.w-textarea_input').innerHTML = htm
}, 100)
}
}
}
</script>
<style lang="scss" scoped>
.welcome-box {
}
.emotion-panel {
position: relative;
height: 0px;
&-box {
position: absolute;
top: -415px;
}
}
.content-bg {
background-color: #f7f7f7;
}
.content {
display: inline-block;
vertical-align: text-top;
width: calc(100% - 103px);
margin-left: 12px;
.welcome-file {
display: flex;
align-items: center;
color: #999;
line-height: 20px;
padding: 10px;
margin-bottom: 10px;
border-left: 1px solid #dcdfe6;
border-right: 1px solid #dcdfe6;
img {
width: 20px;
height: 20px;
margin-right: 5px;
}
span {
display: inline-block;
margin-right: 20px;
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 14px;
}
i {
font-size: 16px;
cursor: pointer;
}
.el-icon-loading {
font-size: 24px;
}
&:last-child {
margin-bottom: 0;
}
}
.btn-group {
padding: 6px 0 6px 20px;
border: 1px solid #dcdfe6;
border-top: 0;
.add-btn {
display: inline-flex;
position: relative;
align-items: center;
padding-right: 25px;
font-size: 16px;
color: #666;
cursor: pointer;
span {
font-size: 14px;
margin-left: 5px;
cursor: pointer;
}
input {
position: absolute;
width: 100%;
cursor: pointer;
font-size: 0;
height: 40px;
}
img {
width: 16px;
height: 16px;
cursor: pointer;
}
.el-link {
position: absolute;
width: 100%;
}
}
}
.date-picker {
margin-top: 10px;
font-size: 14px;
color: #999;
}
}
.required {
display: inline-block;
line-height: 40px;
text-align: right;
width: 90px;
}
.required::before {
content: '*';
color: #f56c6c;
margin-right: 4 px;
}
.form-tips {
font-size: 12px;
color: #999;
}
.form-upload {
position: absolute;
top: 0;
width: 140px;
// width: 100%;
height: 100%;
cursor: pointer;
z-index: 1;
}
/deep/ {
.el-textarea__inner {
background-color: #f7f7f7;
border-radius: 0;
}
.el-textarea__inner:focus {
border-color: #dcdfe6;
}
.el-textarea .el-input__count {
background-color: #f7f7f7;
}
}
.upload {
position: relative;
}
.upload-bg {
position: relative;
width: 140px;
height: 140px;
background-color: #f7f7f7;
color: #999;
border: 1px dashed #dcdfe6;
i {
position: absolute;
top: 40px;
left: 50%;
transform: translateX(-50%);
font-size: 30px;
}
.upload-text {
position: absolute;
bottom: 40px;
left: 50%;
transform: translateX(-50%);
font-size: 12px;
}
}
.tips-text {
display: flex;
align-items: center;
justify-self: center;
color: #000;
font-size: 14px;
padding: 13px 16px;
margin-top: 10px;
background-color: rgba(230, 233, 255, 0.49);
border: 1px solid rgba(88, 80, 255, 0.49);
border-radius: 4px;
.tips-icon {
width: 14px;
height: 14px;
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>
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2022-08-30 10:21:19
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2022-08-30 10:32:08
* @FilePath: \scrm-micro-drainage\src\setup\qiankun.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import Vue from 'vue' import Vue from 'vue'
// import { message } from '@/plugins/element.js' // import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config' import { fetchConfig } from '@/config'
import ElementUI from 'element-ui' import ElementUI from 'element-ui'
import { GLTable, GLButton, GLFooter, GLCombiForm, GLDialog,GLTableButton } from 'glsx-components' //权限按钮 (根据权限动态创建) import { GLTable, GLButton, GLFooter, GLCombiForm, GLDialog, GLTableButton, GLTabs } from 'glsx-components' //权限按钮 (根据权限动态创建)
import GLEditor from 'glsx-components/src/packages/Editor' //权限按钮 (根据权限动态创建) import GLEditor from 'glsx-components/src/packages/Editor' //权限按钮 (根据权限动态创建)
import GLFull from '@/components/GLFull' import GLFull from '@/components/GLFull'
import { getRoutes } from '@/router' import { getRoutes } from '@/router'
...@@ -13,10 +21,12 @@ Vue.use(GLFooter) ...@@ -13,10 +21,12 @@ Vue.use(GLFooter)
Vue.use(GLCombiForm) Vue.use(GLCombiForm)
Vue.use(GLDialog) Vue.use(GLDialog)
Vue.use(GLTableButton) Vue.use(GLTableButton)
// Vue.use(GLFull) // Vue.use(GLFull)
// import GLTable from '@/components/glsx-table/index' // import GLTable from '@/components/glsx-table/index'
Vue.component('GLEditor', GLEditor) Vue.component('GLEditor', GLEditor)
Vue.component('GLFull', GLFull) Vue.component('GLFull', GLFull)
Vue.component('GLTabs', GLTabs)
// import 'glsx-components/src/theme/theme.scss' // import 'glsx-components/src/theme/theme.scss'
import 'glsx-components/dist/glsx-components.css' import 'glsx-components/dist/glsx-components.css'
import '@/assets/css/common.scss' import '@/assets/css/common.scss'
......
<template>
<div class="scrm-main">
<div class="channel-main-guidance scrm-box-f">
<div class="channel-main-guidance-item">
<div class="channel-main-guidance-item-head">
<img src="@/assets/img/channel/staff.png" />
<div class="channel-main-guidance-item-title">配置名片关联的员工</div>
</div>
<div class="channel-main-guidance-item-info">名片可关联一个或多个员工。配置多名员工时,客户扫码后仅会添加随机的某个员工。</div>
</div>
<div class="channel-arrow">
<img src="@/assets/img/channel/channel-arrow.png" />
</div>
<div class="channel-main-guidance-item">
<div class="channel-main-guidance-item-head">
<img src="@/assets/img/channel/equity.png" />
<div class="channel-main-guidance-item-title">配置客户领取的权益</div>
</div>
<div class="channel-main-guidance-item-info">客户添加员工为好友后,系统将通过欢迎语发送相关的权益礼包。
礼包内容可结合互联网权益、自店权益。由于企微官方限制,使用前请先确认已取消统一的欢迎语。</div>
</div>
<div class="channel-arrow">
<img src="@/assets/img/channel/channel-arrow.png" />
</div>
<div class="channel-main-guidance-item">
<div class="channel-main-guidance-item-head">
<img src="@/assets/img/channel/card.png" />
<div class="channel-main-guidance-item-title">生成智能员工名片</div>
</div>
<div class="channel-main-guidance-item-info">名片生成后长期有效,可结合门店业务需要,添加到门店活动易拉宝、员工卡座立牌、活动海报,实现灵活的集客。</div>
</div>
</div>
<div class="channel-main scrm-box-f">
<div class="chanel-form-title">基本信息</div>
<div class="chanel-form-box gl-form-page">
<el-form ref="codeForm" :model="addCodeForm" class="code-body-form" label-width="154px" :rules="codeRules">
<!-- <el-row> -->
<el-form-item label="渠道名称:" prop="codeName">
<el-input size="small" v-model.trim="addCodeForm.codeName" placeholder="请输入渠道名称" maxlength="30"></el-input>
</el-form-item>
<!-- </el-row>
<el-row> -->
<el-form-item label="备注:">
<el-input size="small" v-model.trim="addCodeForm.codeRemark" placeholder="请输入备注" maxlength="30"></el-input>
<div class="form-tips">设置备注,便于后续管理查找</div>
</el-form-item>
<!-- </el-row>
<el-row> -->
<el-form-item label="自动通过验证:">
<el-switch v-model="addCodeForm.autoAdd" active-color="#5850FF" inactive-color="#999999"></el-switch>
<span class="form-tips-btn">开启后,客户添加使用人员无需好友验证</span>
</el-form-item>
<!-- </el-row>
<el-row> -->
<el-form-item label="选择标签:">
<el-button size="small" @click="handleAddTag">
<i class="el-icon-plus"></i>
选择标签
</el-button>
<span class="form-tips-btn">
已选择
<span>{{ taggingLength }}</span>
个标签
</span>
<div class="form-tips">自动为通过该活码添加的客户打上所选标签</div>
<div class="el-input-tag input-tag-wrapper" v-show="taggingLength">
<template v-if="tagging && tagging.length > 0">
<template v-for="(item, index) in tagging">
<el-tag type="info" v-for="(tag, idx) in item.labelList" :key="idx" closable :disable-transitions="false" @close="removeTag(item, idx, index)">
{{ tag ? tag.name : '' }}
</el-tag>
</template>
</template>
</div>
</el-form-item>
<!-- </el-row>
<el-row> -->
<div class="el-form-item is-required">
<label for="codeName" class="el-form-item__label" style="width: 154px">选择专员:</label>
<div class="el-form-item__content" style="margin-left: 154px">
<el-button size="small" @click="handleAddEmp">
<i class="el-icon-plus"></i>
选择专员
</el-button>
<span class="form-tips-btn">
已选择
<span>{{ staffInfo.length }}</span>
人
</span>
<div class="form-tips">客户扫码后将添加所选专员为好友,选择多名专员则按ABAB的顺序添加客户</div>
<div class="el-input-tag input-tag-wrapper" v-show="staffInfo.length">
<el-tag effect="plain" type="info" v-for="(tag, idx) in staffInfo" :key="idx" closable :disable-transitions="false" @close="removeStaff(idx)">
<i class="el-icon-user-solid"></i>
{{ tag.staffName }}
</el-tag>
</div>
<div class="el-form-item__error" v-if="staffStatus">请选择专员</div>
</div>
</div>
<!-- </el-row> -->
</el-form>
</div>
</div>
<div class="channel-main-welcome scrm-box-f">
<div class="chanel-form-title">欢迎语</div>
<div class="welcome-panel">
<div class="welcome-switch">
<label>自动发送欢迎语</label>
<el-switch v-model="autoWelcome" active-color="#5850FF" inactive-color="#999999"></el-switch>
</div>
<div class="welcome-box" v-show="autoWelcome">
<!-- <welcome-words :eventBus="eventBus" ref="welcome"></welcome-words> -->
<GLEditor ref="welcome" :form="'customer'" :btnList="btnList" @previewWord="previewForm"></GLEditor>
</div>
</div>
</div>
<GLFooter>
<el-button type="primary" @click="handleSave">提交</el-button>
<el-button @click="goback">取消</el-button>
</GLFooter>
<GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisible = false" type="warning" content="当前有内容信息未保存,是否继续返回?" :visible.sync="dialogVisible" mode="small"></GLDialog>
<select-emp @selectTable="selectTable" ref="selectEmpForm"></select-emp>
<select-tag ref="selectTagForm" @tagSelected="tagSelected"></select-tag>
</div>
</template>
<script>
import { utils } from 'glsx-common'
import selectEmp from '@/components/selectEmp'
import selectTag from '@/components/selectTag'
import word from '@/mixins/word'
export default {
mixins: [word],
name: 'addCode',
components: { selectEmp, selectTag },
data() {
return {
dialogVisible: false,
addCodeForm: {
codeName: '',
codeRemark: '',
autoAdd: true
},
staffStatus: false,
staffInfo: [],
tagging: [],
taggingLength: 0,
codeId: null,
footerLeft: 0,
footerWidth: 0,
autoWelcome: true,
editStatus: false,
previewListStart: [],
codeRules: {
codeName: [{ required: true, message: '请输入渠道名称', trigger: 'blur' }]
}
}
},
watch: {
tagging: {
handler() {
this.taggingLength = 0
this.tagging.forEach(item => {
this.taggingLength += item.labelList.length
})
this.editStatus = true
},
deep: true
},
addCodeForm: {
handler() {
this.editStatus = true
},
deep: true
},
staffInfo: {
handler() {
this.editStatus = true
},
deep: true
}
},
methods: {
goback() {
this.previewListStart.forEach(item => {
this.$refs.welcome.previewList.forEach(itm => {
if (item.attType == itm.attType) {
if (typeof item.attContent != 'object' && item.attContent != itm.attContent) {
this.editStatus = true
}
if (typeof item.attContent == 'object' && item.attContent.marketingName != itm.attContent.marketingName) {
this.editStatus = true
}
}
})
})
if (this.editStatus || (this.$refs.welcome.previewList.length > 0 && !this.codeId)) {
this.dialogVisible = true
} else {
this.$router.push('/channel/index')
}
},
handleSure() {
this.$router.push('/channel/index')
},
removeTag(item, idx, index) {
item.labelList.splice(idx, 1)
if (item.labelList.length == 0) {
this.tagging.splice(index, 1)
}
},
removeStaff(index) {
this.staffInfo.splice(index, 1)
},
handleAddEmp() {
this.staffStatus = false
this.$refs.selectEmpForm.init(this.staffInfo)
},
handleAddTag() {
this.$refs.selectTagForm.init(this.tagging)
},
selectTable(item) {
this.staffInfo = item.map(item => {
return {
staffId: item.relationId,
staffName: item.staffName
}
})
},
tagSelected(item) {
this.tagging = item
},
handleSave: utils.debounce(function() {
if (this.staffInfo.length == 0) {
this.staffStatus = true
return
}
this.$refs['codeForm'].validate(valid => {
if (valid) {
let param = Object.assign({ id: this.codeId }, this.addCodeForm)
let tagging = this.tagging.map(item => {
let tagIds = item.labelList.map(tag => {
return tag.id
})
let name = item.labelList.map(tag => {
return tag.name
})
return {
groupId: item.labelGroup.id,
tagIds: tagIds.join(','),
name: name.join(','),
labelType: item.labelGroup.name
}
})
param.tagging = JSON.stringify(tagging)
param.autoWelcome = this.autoWelcome ? 1 : 0
param.codeSystem = 0
let staffId = []
this.staffInfo.forEach(item => {
staffId.push(item.staffId)
})
let channel
if (this.codeId) {
channel = 'updateChannelCode'
} else {
channel = 'saveChannelCode'
}
delete param.staffInfo
param.staffId = staffId.join(',')
param.autoAdd ? (param.autoAdd = 1) : (param.autoAdd = 0)
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.replaceAll('[@昵称]', '@昵称')
item.attContent = item.attContent.replaceAll('@昵称', '[@昵称]')
} else if (item.attType == 7) {
item.attContent = JSON.stringify(item.attContent)
}
return item
})
param.welcomeInfo = attachmentList
this.$apis.channel[channel](param).then(res => {
if (res) this.$router.push('/channel/index')
})
}
})
}, 300),
detailChannelCode(id, codeUuid) {
let param = {
id,
codeUuid
}
this.$apis.channel.detailChannelCode(param).then(res => {
this.addCodeForm = Object.assign({}, res)
this.addCodeForm.autoAdd = this.addCodeForm.autoAdd == 1 ? true : false
this.staffInfo = res.staffInfo
const tagging = eval(res.tagging)
const taggingList = tagging.map(item => {
let name = item.name.split(',')
let ids = item.tagIds.split(',')
console.log(ids)
let labelList = name.map((tag, index) => {
return { id: ids[index], name: tag }
})
return {
labelGroup: {
id: item.groupId,
name: item.labelType
},
labelList
}
})
this.tagging = taggingList
this.autoWelcome = res.autoWelcome ? true : false
if (res.welcomeInfo.length != 0) {
const previewList = res.welcomeInfo.map(item => {
if (item.attType == 7) item.attContent = JSON.parse(item.attContent)
return item
})
this.$refs.welcome.updateList(previewList)
}
this.$nextTick(() => {
this.editStatus = false
this.previewListStart = this.$common.utils.deepClone(this.$refs.welcome.previewList)
})
})
}
// resize() {
// this.footerLeft = document.querySelector('.base-container-right').offsetLeft
// this.footerWidth = document.documentElement.clientWidth - this.footerLeft
// }
},
// destroyed() {
// window.removeEventListener('resize', this.resize)
// },
mounted() {
const { id, codeUuid } = this.$route.params
if (id) {
this.codeId = id
this.detailChannelCode(id, codeUuid)
}
}
}
</script>
<style lang="scss" scoped>
.channel-main-welcome {
margin: 20px 0px 16px;
.welcome-panel {
margin: 10px;
padding: 0px 20px 20px;
.welcome-switch {
margin-bottom: 20px;
label {
margin-right: 10px;
font-size: 14px;
font-weight: 400;
color: #666666;
}
}
.welcome-box {
margin-left: 48px;
}
}
}
.footer-panel {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 0px;
height: 64px;
background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
}
.chanel-form-title {
padding: 20px;
font-size: 16px;
font-weight: 600;
color: #333333;
line-height: 16px;
border-bottom: 1px solid #d8d8d8;
}
.code-body-form {
padding: 20px;
width: 60%;
.form-tips {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 20px;
}
.form-tips-btn {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 20px;
margin-left: 10px;
> span {
color: #5850ff;
}
}
.input-tag-wrapper {
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #666;
display: inline-block;
outline: none;
padding: 5px 5px 0px 5px;
max-height: 68px;
overflow: auto;
flex-wrap: wrap;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 450px;
display: flex;
align-items: center;
margin-top: 6px;
font-size: 14px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
}
.el-tag {
margin-right: 4px;
height: 26px;
line-height: 24px;
margin-bottom: 5px;
}
}
.channel-main-guidance {
display: flex;
padding: 20px;
box-sizing: border-box;
align-items: center;
margin-bottom:20px;
.channel-main-guidance-item {
flex: 1;
height: 142px;
background: url('../../assets/img/channel/bg.png'),no-repeat;
padding: 16px 20px;
box-sizing: border-box;
&-head {
display: flex;
align-items: center;
margin-bottom: 8px;
img {
width: 22px;
height: 22px;
margin-right: 10px;
}
}
&-title {
font-size: 16px;
font-weight: 500;
color: #333333;
line-height: 22px;
}
&-info {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 20px;
}
}
.channel-arrow{
margin:0 16px;
width:20px;
height:15px;
img{
width:100%;
}
}
}
</style>
<template>
<div class="card-main">
2
</div>
</template>
<script>
export default {
name: 'accountList',
data() {
return {}
}
}
</script>
<style lang="scss" scoped></style>
<template>
<div>
<div class="form-header">
<GLButton type="primary" size="small" icon="el-icon-add" @click="handleAddCode" fn="新增活码">新建智能名片</GLButton>
</div>
<div class="form-panel scrm-box-f">
<GLCombiForm :rowNumber="1" ref="formSearch" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<GLTable v-loading="loading" ref="table" @refreshTable="handleSearch" :searchForm="tableSearchForm" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams">
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
</div>
<div slot="yesterdayNum" slot-scope="scope">
<div class="link-dialog" @click="handleEmpDetail(scope.scope, 'day')" v-if="scope.scope.yesterdayNum">{{ scope.scope.yesterdayNum }}</div>
<div v-else>0</div>
</div>
<div slot="totalNum" slot-scope="scope">
<div class="link-dialog" @click="handleEmpDetail(scope.scope)" v-if="scope.scope.totalNum">{{ scope.scope.totalNum }}</div>
<div v-else>0</div>
</div>
<div slot="staffInfo" slot-scope="scope">
<el-popover trigger="hover" placement="top" v-if="staffNameSplit(scope.scope.staffName).length > 3">
<GLFull
:labelWidth="110"
:label="item"
textType="user"
:identi="
`text_${Math.random()
.toString()
.replace('.', '')}`
"
v-for="(item, index) in staffNameSplit(scope.scope.staffName)"
:key="index"
></GLFull>
<div slot="reference" class="name-wrapper">
<div v-for="(item, index) in staffNameSplit(scope.scope.staffName)" :key="index" v-show="index < 4">
<template v-if="index == 3 && staffNameSplit(scope.scope.staffName).length > 3">
<div class="accountType-row">
<i class="el-icon-user-solid"></i>
<span>{{ '...(' + staffNameSplit(scope.scope.staffName).length + ')' }}</span>
</div>
</template>
<GLFull :labelWidth="110" :label="item" textType="user" v-if="index < 3"></GLFull>
</div>
</div>
</el-popover>
<GLFull
:labelWidth="110"
:label="item"
textType="user"
:identi="
`text_${Math.random()
.toString()
.replace('.', '')}`
"
v-for="(item, index) in staffNameSplit(scope.scope.staffName)"
:key="index"
v-else
></GLFull>
<!-- <div v-for="(item, index) in staffNameSplit(scope.scope.staffName)" :key="index" v-else>
<div class="accountType-row">
<i class="el-icon-user-solid"></i>
<GLTitle :content="item" textLength="4"></GLTitle>
</div>
</div> -->
</div>
<div slot="qrCode" slot-scope="scope">
<el-popover placement="bottom" width="400" trigger="click">
<img :src="scope.scope.qrCode" style="width: 360px; height: 360px" />
<img :src="scope.scope.qrCode" style="width: 80px; height: 80px" slot="reference" />
</el-popover>
<div class="download-link" @click="downloadIamge(scope.scope.qrCode)">下载二维码</div>
</div>
<div slot="tagging" slot-scope="scope" class="tag-panel">
<el-popover trigger="hover" placement="top" v-if="scope.scope.taggingList && scope.scope.taggingList.length > 3">
<!-- <div :title="item.name" class="accountType-row accountType-row-tag" v-for="(item, index) in scope.scope.taggingList" :key="index">
{{ item.name.length > 8 ? item.name.substring(0, 8) + '...' : item.name }}
</div> -->
<GLTitle :content="item.name" class="accountType-row accountType-row-tag" v-for="(item, index) in scope.scope.taggingList" :key="index"></GLTitle>
<div slot="reference" class="name-wrapper">
<div v-for="(item, index) in scope.scope.taggingList" :key="index" v-show="index < 4">
<div :title="item.name" class="accountType-row accountType-row-tag" v-if="index == 3 && scope.scope.taggingList.length > 3">{{ '...(' + scope.scope.taggingList.length + ')' }}</div>
<GLTitle :content="item.name" class="accountType-row accountType-row-tag" v-else></GLTitle>
</div>
</div>
</el-popover>
<template v-if="scope.scope.taggingList && scope.scope.taggingList.length <= 3 && scope.scope.taggingList.length > 0">
<div v-for="(item, index) in scope.scope.taggingList" :key="index">
<GLTitle :content="item.name" class="accountType-row accountType-row-tag"></GLTitle>
<!-- <div :title="item.name" class="accountType-row accountType-row-tag">{{ item.name.length > 8 ? item.name.substring(0, 8) + '...' : item.name }}</div> -->
</div>
</template>
<div v-if="!scope.scope.taggingList || (scope.scope.taggingList && scope.scope.taggingList.length == 0)">--</div>
</div>
<div slot="codeRemark" slot-scope="scope">
<div class="codeName">{{ scope.scope.codeName }}</div>
<div class="codeRemark" v-if="scope.scope.codeRemark">备注:{{ scope.scope.codeRemark }}</div>
</div>
</GLTable>
</div>
<GLDialog title="提示" @onOk="handleSure" @onCancel="dialogVisibleDel = false" type="error" content="是否删除?" :visible.sync="dialogVisibleDel" mode="small"></GLDialog>
<emp-detail ref="empDetailForm"></emp-detail>
</div>
</template>
<script>
import util from '@/utils/util'
import empDetail from '@/components/empDetail'
export default {
components: { empDetail },
name: 'cardList',
data() {
return {
dialogVisibleDel: false,
selectItem: '',
loading: false,
tableSearchForm: {
staffName: '',
codeNameAndRemark: ''
},
searchFormData: [
{
label: '渠道名称或备注',
name: 'codeNameAndRemark',
type: 'input',
placeholder: '请输入渠道名称或备注'
},
{
label: '关联专员',
name: 'staffName',
type: 'input',
placeholder: '请输入关联专员'
}
],
tableData: [],
// 表格按钮
tableButtonList: [
{
type: 'GLButton',
name: '修改',
attrs: {
type: 'text',
fn: '活码编辑'
},
listeners: {
click: this.handleEdit
}
},
{
type: 'el-button',
name: '删除',
attrs: {
type: 'text'
},
listeners: {
click: this.handleDelete
}
}
],
tableParams: {
listName: 'data',
tableOption: false,
tableColumns: [
{
label: '渠道名称',
prop: 'codeRemark',
minWidth: 200,
addHtml: 'codeRemark'
},
{
label: '今日新增客户数',
prop: 'yesterdayNum',
width: '130px',
addHtml: 'yesterdayNum'
},
{
label: '总新增客户数',
prop: 'totalNum',
width: '120px',
addHtml: 'totalNum'
},
{
label: '使用专员',
prop: 'staffInfo',
width: '130px',
addHtml: 'staffInfo',
align: 'left'
},
{
label: '活码',
prop: 'qrCode',
addHtml: 'qrCode',
width: '126px'
},
{
label: '标签',
prop: 'tagging',
addHtml: 'tagging',
width: '150px'
},
{
label: '创建时间',
prop: 'createdTime',
width: '180px'
},
{
label: '操作',
prop: 'optionBtns',
width: '170px',
addHtml: 'optionBtns',
fixed: 'right'
}
]
},
layout: 'sizes, prev, pager, next, jumper, ->, total',
tableTotal: 0,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }
}
},
methods: {
staffNameSplit(name) {
return name ? name.split(',') : ''
},
handleEdit(scope) {
this.$router.push('/businessCard/addCode/' + scope.id + '/' + scope.codeUuid)
},
handleSearch() {
this.listChannelCodeByPage()
},
handleReset() {
this.tableSearchForm = {}
this.listChannelCodeByPage()
},
handleAddCode() {
this.$router.push('/businessCard/addCode')
},
handleEmpDetail(scope, status) {
this.$refs.empDetailForm.init(scope, status)
},
downloadIamge(imgsrc) {
util.downloadIamge(imgsrc)
},
handleSwitchChange(scope) {
this.$confirm('是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.$apis.channel.deleteChannelCode({ id: scope.id }).then(res => {
if (res) {
this.$message({
type: 'success',
message: '删除成功!'
})
}
this.handleSearch()
})
})
.catch(() => {})
},
handleSure() {
const { id, codeUuid, configId } = this.selectItem
this.$apis.channel
.deleteChannelCode({
id,
codeUuid,
configId
})
.then(res => {
if (res) {
this.$message({
type: 'success',
message: '删除成功!'
})
}
this.handleSearch()
})
this.dialogVisibleDel = false
},
handleDelete(scope) {
this.dialogVisibleDel = true
this.selectItem = scope
},
listChannelCodeByPage() {
const params = {
...JSON.parse(JSON.stringify(this.tableSearchForm)),
pageSize: this.$refs.table.page.pageSize,
pageNum: this.$refs.table.page.pageNum
}
this.loading = true
this.$apis.channel.listChannelCodeByPage(params).then(res => {
this.loading = false
if (res) {
this.tableData = res.data
this.tableData.forEach(item => {
this.$set(item, 'taggingList', [])
const tagging = eval(item.tagging)
if (tagging && tagging.length > 0) {
tagging.forEach(itm => {
let name = itm.name.split(',')
name.forEach((tag, index) => {
item.taggingList.push({ name: tag })
})
})
}
})
this.tableTotal = res.count
}
})
}
},
mounted() {
this.listChannelCodeByPage()
}
}
</script>
<style>
.el-popover {
max-width: 800px;
}
</style>
<style lang="scss" scoped>
.popover-panel {
width: 1000px;
}
.form-header {
margin-bottom: 20px;
}
.form-panel {
padding: 20px;
/deep/ .el-popover {
max-width: 1000px;
}
}
.download-link {
cursor: pointer;
margin-top: 6px;
font-size: 14px;
font-weight: 400;
color: #666666;
line-height: 20px;
padding-left: 5px;
}
.codeRemark {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 20px;
}
.tag-panel {
.tag-item {
border-radius: 4px;
border: 1px solid #e8e8ea;
display: inline-block;
padding: 4px 6px;
margin-right: 3px;
margin-bottom: 3px;
}
}
.allTagsWrap {
position: relative;
display: -webkit-box;
// max-height: 56px;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
padding-bottom: -2px;
box-sizing: border-box;
// &:hover {
// -webkit-line-clamp: 9999;
// // .tag-box-wrap {
// // margin-bottom: 10px;
// // }
// }
.tag-box-wrap {
display: inline-block;
margin-right: 10px;
// margin-bottom: 2px;
padding: 0 10px;
box-sizing: border-box;
min-width: 76px;
max-width: 200px;
height: 26px;
line-height: 26px;
border-radius: 4px;
border: 1px solid #e8e8ea;
background: #fafbfe;
text-align: center;
font-size: 14px;
font-weight: 400;
color: #666666;
max-width: 245px;
cursor: pointer;
margin-bottom: 3px;
// &:first-child{
// margin-bottom: 4px;
// }
}
// .tag-box-wrap + .tag-box-wrap {
// margin-bottom: 4px;
// }
.expande-button-wrap {
position: absolute;
right: 0;
bottom: 0;
.expande-button {
color: #fafbfe;
cursor: pointer;
i {
height: 8px;
}
span {
height: 20px;
font-size: 14px;
font-weight: 400;
color: #fafbfe;
line-height: 20px;
}
}
}
}
.link-dialog {
text-decoration: underline;
cursor: pointer;
}
.accountType-row {
text-align: left;
position: relative;
font-size: 14px;
line-height: 14px;
padding-left: 15px;
border-radius: 4px;
border: 1px solid #e8e8ea;
padding: 6px;
display: inline-block;
margin-bottom: 5px;
margin-right: 5px;
&-tag {
display: inline-block;
border: 1px solid #e8e8ea;
background: #fafbfe;
text-align: center;
font-size: 14px;
font-weight: 400;
color: #666;
max-width: 150px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
i {
color: #75acff;
margin-right: 3px;
}
// &::before {
// content: '';
// position: absolute;
// width: 6px;
// height: 6px;
// background: #5850ff;
// border-radius: 8px;
// left: 0px;
// top: 7px;
// }
}
</style>
import Vue from 'vue'
const componentsFiles = require.context(`./`, true, /.vue$/)
componentsFiles.keys().forEach(path => {
const component = componentsFiles(path).default
console.log(component)
Vue.component(component.name, component)
})
<template>
<div class="card-main">
3
</div>
</template>
<script>
export default {
name: 'proxyList',
data() {
return {}
}
}
</script>
<style lang="scss" scoped></style>
<template>
<div class="channel-main scrm-box-f">
<div class="scrm-flex">
<el-radio-group v-model="timeRadio" size="mini" @change="handleTab">
<el-radio-button label="1">今天</el-radio-button>
<el-radio-button label="2">近1周</el-radio-button>
<el-radio-button label="3">近2周</el-radio-button>
<el-radio-button label="4">近1个月</el-radio-button>
</el-radio-group>
<el-form :inline="true" :model="tableSearchForm" class="follow-form-item" label-width="80px">
<el-form-item size="small" label="添加时间">
<el-date-picker :picker-options="pickerOptions" @change="handleTime" value-format="yyyy-MM-dd" v-model="createTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item>
<el-form-item size="small" label="渠道名称">
<el-input size="small" v-model="tableSearchForm.keyWord" placeholder="请输入渠道名称"></el-input>
</el-form-item>
<el-form-item size="small" style="float: right; margin-left: 40px">
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
</div>
<div class="channel-chart">
<div class="channel-chart-box">
<div class="channel-chart-title">新增客户走势</div>
<div class="channel-chart-container">
<linechart ref="channelLine" :colorList="colorList"></linechart>
</div>
</div>
<div class="channel-chart-desc">
<div class="chart-desc">
<div class="chart-desc-title">
<div class="chart-title-time">{{ timeRadio == 1 ? '今天' : timeRadio == 2 ? '近1周' : timeRadio == 3 ? '近2周' : timeRadio == 4 ? '近1个月' : startTime + '-' + endTime }}</div>
<div class="chart-title-num">各渠道新增客户数</div>
</div>
<div class="chart-desc-item" v-for="(item, index) in codeIds" :key="index">
<div class="chart-item-title" :title="item.codeName">
<span :style="{ background: colorList[index] }"></span>
{{ item.codeName }}
</div>
<div class="chart-item-num link-dialog" @click="handleEmpDetail(item)" v-if="item.totalNum">{{ item.totalNum }}</div>
<div class="chart-item-num" v-else>0</div>
</div>
</div>
<div>
<div class="chart-desc-add" @click="handleChannel">+选择查看渠道</div>
<div class="chart-desc-addNum">最多同时查看8个渠道数据</div>
</div>
</div>
</div>
<GLTable ref="table" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams" @refreshTable="handleSearch">
<div slot="newlyCount" slot-scope="scope">
<div class="link-dialog" @click="handleEmpDetail(scope.scope, 'day', scope.scope.timeFrame)" v-if="scope.scope.newlyCount">{{ scope.scope.newlyCount }}</div>
<div v-else>0</div>
</div>
<div slot="newlyKeepCount" slot-scope="scope">
<div class="link-dialog" @click="handleEmpDetail(scope.scope, 'status', scope.scope.timeFrame)" v-if="scope.scope.newlyKeepCount">{{ scope.scope.newlyKeepCount }}</div>
<div v-else>0</div>
</div>
</GLTable>
<select-channel :colorList="colorList" ref="channelForm" @selectTable="selectTable"></select-channel>
<emp-detail ref="empDetailForm"></emp-detail>
</div>
</template>
<script>
import utils from '@/utils/util'
import linechart from '@/components/linechart'
import selectChannel from '@/components/selectChannel'
import empDetail from '@/components/empDetail'
export default {
name: 'recordList',
components: {
linechart,
selectChannel,
empDetail
},
data() {
return {
timeRadio: 1,
trendType: 1,
pickerOptions: {
disabledDate: time => {
return time.getTime() > Date.now()
}
},
channel: [],
createTime: [],
tableSearchForm: {},
tableParams: {
listName: 'data',
tableOption: false,
tableColumns: [
{
label: '渠道名称',
prop: 'codeName'
},
{
label: '新增客户数',
prop: 'newlyCount',
addHtml: 'newlyCount'
},
{
label: '留存客户数',
prop: 'newlyKeepCount',
addHtml: 'newlyKeepCount'
},
{
label: '日期',
prop: 'timeFrame'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
layout: 'sizes, prev, pager, next, jumper, ->, total',
tableData: [],
tableTotal: 0,
startTime: '',
endTime: '',
selectItem: [],
codeIds: [],
colorList: ['#5850FF', '#2CCA74', '#EB4E4E', '#FF6D00', '#F8C900', '#2CCAC4', '#E74EEB', '#6F2828']
}
},
// watch: {
// createTime(value) {
// if (value) {
// this.startTime = value[0]
// this.endTime = value[1]
// this.timeRadio = null
// this.trendType = null
// } else {
// this.startTime = ''
// this.endTime = ''
// this.timeRadio = 1
// this.trendType = 1
// }
// this.getFollower()
// this.codeSearch()
// }
// },
methods: {
handleTime() {
const value = this.createTime
if (value && value.length > 0) {
this.startTime = value[0]
this.endTime = value[1]
this.timeRadio = null
this.trendType = null
} else {
this.startTime = ''
this.endTime = ''
this.timeRadio = 1
this.trendType = 1
}
this.getFollower()
this.codeSearch()
},
handleTab() {
this.createTime = []
this.trendType = this.timeRadio
this.createTime = ''
this.endTime = ''
this.codeSearch()
this.getFollower()
},
handleSearch() {
this.codeSearch()
},
handleEmpDetail(scope, value, day) {
this.$refs.empDetailForm.init(scope, value, day)
},
codeSearch() {
var params = {
...JSON.parse(JSON.stringify(this.tableSearchForm)),
pageSize: this.$refs.table.page.pageSize,
pageNum: this.$refs.table.page.pageNum,
startTime: this.startTime,
endTime: this.endTime,
trendType: this.trendType
}
this.$apis.overview.codeSearch(params).then(res => {
this.tableData = res.data
this.tableTotal = res.count
})
},
codeTrend() {
let codeIds = this.codeIds.map(item => {
return item.codeState
})
let codeName = this.codeIds.map(item => {
return item.codeName
})
const { trendType, startTime, endTime } = this
let params = {
codeIds,
trendType: trendType ? trendType : null,
startTime,
endTime
}
this.$apis.overview.codeTrend(params).then(res => {
this.$refs.channelLine.init(res, codeName)
})
},
selectTable(value) {
this.codeIds = value.map(item => {
return {
codeState: item.codeState,
codeName: item.codeName,
totalNum: item.totalNum
}
})
this.getFollower()
},
handleChannel() {
this.$refs.channelForm.init(this.codeIds)
},
getFollowerTotal() {
var params = {
pageSize: 1000,
pageNum: 1
}
this.$apis.channel.listChannelCodeByPage(params).then(res => {
console.log(res)
this.tableData = res.data
this.tableTotal = res.count
this.tableData.forEach(item => {
this.selectCode.forEach((itm, index) => {
if (itm.codeState == item.codeState) {
this.$refs.table.$refs.salelistMutiTable.toggleRowSelection(item)
}
})
})
})
},
getFollower() {
let codeState = this.codeIds.map(item => item.codeState)
var params = {
startTime: this.startTime,
endTime: this.endTime,
trendType: this.trendType,
pageSize: 8,
pageNum: 1,
codeState
}
this.$apis.channel.listChannelCodeByPage(params).then(res => {
this.channel = res.data
this.codeIds = this.channel.map(item => {
return {
codeState: item.codeState,
codeName: item.codeName,
totalNum: item.totalNum
}
})
this.codeTrend()
})
}
},
mounted() {
this.codeSearch()
this.getFollower()
}
}
</script>
<style lang="scss" scoped>
.channel-main {
padding: 20px;
/deep/ {
.el-radio-group {
margin-top: 3px;
}
}
}
.link-dialog {
text-decoration: underline;
cursor: pointer;
}
.channel-chart {
display: flex;
.channel-chart-desc {
width: 300px;
min-height: 310px;
padding: 10px;
display: flex;
flex-direction: column;
justify-content: space-between;
margin-bottom: 30px;
.chart-desc-title {
display: flex;
justify-content: space-between;
font-size: 14px;
font-weight: 600;
color: #333333;
line-height: 20px;
.chart-title-time {
color: #5850ff;
}
}
.chart-desc-item {
display: flex;
justify-content: space-between;
font-size: 12px;
font-weight: 400;
color: #666666;
line-height: 17px;
margin-top: 10px;
.chart-item-title {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
span {
vertical-align: middle;
display: inline-block;
width: 12px;
height: 2px;
margin-right: 10px;
}
}
}
.chart-desc-add {
font-size: 12px;
font-weight: 400;
color: #5850ff;
line-height: 17px;
text-align: center;
}
.chart-desc-addNum {
font-size: 12px;
font-weight: 400;
color: #666666;
line-height: 17px;
text-align: center;
}
}
&-box {
flex: 1;
.channel-chart-title {
font-size: 18px;
font-weight: 600;
color: #333333;
line-height: 25px;
}
.channel-chart-container {
margin-top: 20px;
}
}
}
</style>
<template>
<div class="channel-main">
<GLTabs v-model="activeName" :tabPaneList="tabPaneList" class="tabs-panel"></GLTabs>
<components :is="tabName"></components>
</div>
</template>
<script>
const tabPaneList = [
{
label: '智能名片',
name: '1'
},
{
label: '访问记录',
name: '2'
},
{
label: '账号申请',
name: '3'
},
{
label: '账号代理',
name: '4'
}
]
import './components'
export default {
name: 'businessCard',
data() {
return {
activeName: '1',
tabPaneList
}
},
computed: {
tabName() {
let sname
switch (this.activeName) {
case '1':
sname = 'cardList'
break
case '2':
sname = 'recordList'
break
case '3':
sname = 'accountList'
break
case '4':
sname = 'proxyList'
break
}
return sname
}
}
}
</script>
<style lang="scss" scoped>
.channel-main {
.tabs-panel {
margin-bottom: 10px;
}
}
</style>
...@@ -16,8 +16,7 @@ ...@@ -16,8 +16,7 @@
<img src="@/assets/img/channel/equity.png" /> <img src="@/assets/img/channel/equity.png" />
<div class="channel-main-guidance-item-title">配置客户领取的权益</div> <div class="channel-main-guidance-item-title">配置客户领取的权益</div>
</div> </div>
<div class="channel-main-guidance-item-info">客户添加员工为好友后,系统将通过欢迎语发送相关的权益礼包。 <div class="channel-main-guidance-item-info">客户添加员工为好友后,系统将通过欢迎语发送相关的权益礼包。 礼包内容可结合互联网权益、自店权益。由于企微官方限制,使用前请先确认已取消统一的欢迎语。</div>
礼包内容可结合互联网权益、自店权益。由于企微官方限制,使用前请先确认已取消统一的欢迎语。</div>
</div> </div>
<div class="channel-arrow"> <div class="channel-arrow">
<img src="@/assets/img/channel/channel-arrow.png" /> <img src="@/assets/img/channel/channel-arrow.png" />
...@@ -35,68 +34,68 @@ ...@@ -35,68 +34,68 @@
<div class="chanel-form-box gl-form-page"> <div class="chanel-form-box gl-form-page">
<el-form ref="codeForm" :model="addCodeForm" class="code-body-form" label-width="154px" :rules="codeRules"> <el-form ref="codeForm" :model="addCodeForm" class="code-body-form" label-width="154px" :rules="codeRules">
<!-- <el-row> --> <!-- <el-row> -->
<el-form-item label="渠道名称:" prop="codeName"> <el-form-item label="渠道名称:" prop="codeName">
<el-input size="small" v-model.trim="addCodeForm.codeName" placeholder="请输入渠道名称" maxlength="30"></el-input> <el-input size="small" v-model.trim="addCodeForm.codeName" placeholder="请输入渠道名称" maxlength="30"></el-input>
</el-form-item> </el-form-item>
<!-- </el-row> <!-- </el-row>
<el-row> --> <el-row> -->
<el-form-item label="备注:"> <el-form-item label="备注:">
<el-input size="small" v-model.trim="addCodeForm.codeRemark" placeholder="请输入备注" maxlength="30"></el-input> <el-input size="small" v-model.trim="addCodeForm.codeRemark" placeholder="请输入备注" maxlength="30"></el-input>
<div class="form-tips">设置备注,便于后续管理查找</div> <div class="form-tips">设置备注,便于后续管理查找</div>
</el-form-item> </el-form-item>
<!-- </el-row> <!-- </el-row>
<el-row> --> <el-row> -->
<el-form-item label="自动通过验证:"> <el-form-item label="自动通过验证:">
<el-switch v-model="addCodeForm.autoAdd" active-color="#5850FF" inactive-color="#999999"></el-switch> <el-switch v-model="addCodeForm.autoAdd" active-color="#5850FF" inactive-color="#999999"></el-switch>
<span class="form-tips-btn">开启后,客户添加使用人员无需好友验证</span> <span class="form-tips-btn">开启后,客户添加使用人员无需好友验证</span>
</el-form-item> </el-form-item>
<!-- </el-row> <!-- </el-row>
<el-row> --> <el-row> -->
<el-form-item label="选择标签:"> <el-form-item label="选择标签:">
<el-button size="small" @click="handleAddTag"> <el-button size="small" @click="handleAddTag">
<i class="el-icon-plus"></i>
选择标签
</el-button>
<span class="form-tips-btn">
已选择
<span>{{ taggingLength }}</span>
个标签
</span>
<div class="form-tips">自动为通过该活码添加的客户打上所选标签</div>
<div class="el-input-tag input-tag-wrapper" v-show="taggingLength">
<template v-if="tagging && tagging.length > 0">
<template v-for="(item, index) in tagging">
<el-tag type="info" v-for="(tag, idx) in item.labelList" :key="idx" closable :disable-transitions="false" @close="removeTag(item, idx, index)">
{{ tag ? tag.name : '' }}
</el-tag>
</template>
</template>
</div>
</el-form-item>
<!-- </el-row>
<el-row> -->
<div class="el-form-item is-required">
<label for="codeName" class="el-form-item__label" style="width: 154px">选择专员:</label>
<div class="el-form-item__content" style="margin-left: 154px">
<el-button size="small" @click="handleAddEmp">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
选择标签 选择专员
</el-button> </el-button>
<span class="form-tips-btn"> <span class="form-tips-btn">
已选择 已选择
<span>{{ taggingLength }}</span> <span>{{ staffInfo.length }}</span>
个标签 人
</span> </span>
<div class="form-tips">自动为通过该活码添加的客户打上所选标签</div> <div class="form-tips">客户扫码后将添加所选专员为好友,选择多名专员则按ABAB的顺序添加客户</div>
<div class="el-input-tag input-tag-wrapper" v-show="taggingLength"> <div class="el-input-tag input-tag-wrapper" v-show="staffInfo.length">
<template v-if="tagging && tagging.length > 0"> <el-tag effect="plain" type="info" v-for="(tag, idx) in staffInfo" :key="idx" closable :disable-transitions="false" @close="removeStaff(idx)">
<template v-for="(item, index) in tagging"> <i class="el-icon-user-solid"></i>
<el-tag type="info" v-for="(tag, idx) in item.labelList" :key="idx" closable :disable-transitions="false" @close="removeTag(item, idx, index)"> {{ tag.staffName }}
{{ tag ? tag.name : '' }} </el-tag>
</el-tag>
</template>
</template>
</div>
</el-form-item>
<!-- </el-row>
<el-row> -->
<div class="el-form-item is-required">
<label for="codeName" class="el-form-item__label" style="width: 154px">选择专员:</label>
<div class="el-form-item__content" style="margin-left: 154px">
<el-button size="small" @click="handleAddEmp">
<i class="el-icon-plus"></i>
选择专员
</el-button>
<span class="form-tips-btn">
已选择
<span>{{ staffInfo.length }}</span>
人
</span>
<div class="form-tips">客户扫码后将添加所选专员为好友,选择多名专员则按ABAB的顺序添加客户</div>
<div class="el-input-tag input-tag-wrapper" v-show="staffInfo.length">
<el-tag effect="plain" type="info" v-for="(tag, idx) in staffInfo" :key="idx" closable :disable-transitions="false" @close="removeStaff(idx)">
<i class="el-icon-user-solid"></i>
{{ tag.staffName }}
</el-tag>
</div>
<div class="el-form-item__error" v-if="staffStatus">请选择专员</div>
</div> </div>
<div class="el-form-item__error" v-if="staffStatus">请选择专员</div>
</div> </div>
</div>
<!-- </el-row> --> <!-- </el-row> -->
</el-form> </el-form>
</div> </div>
...@@ -109,7 +108,6 @@ ...@@ -109,7 +108,6 @@
<el-switch v-model="autoWelcome" active-color="#5850FF" inactive-color="#999999"></el-switch> <el-switch v-model="autoWelcome" active-color="#5850FF" inactive-color="#999999"></el-switch>
</div> </div>
<div class="welcome-box" v-show="autoWelcome"> <div class="welcome-box" v-show="autoWelcome">
<!-- <welcome-words :eventBus="eventBus" ref="welcome"></welcome-words> -->
<GLEditor ref="welcome" :form="'customer'" :btnList="btnList" @previewWord="previewForm"></GLEditor> <GLEditor ref="welcome" :form="'customer'" :btnList="btnList" @previewWord="previewForm"></GLEditor>
</div> </div>
</div> </div>
...@@ -439,11 +437,11 @@ export default { ...@@ -439,11 +437,11 @@ export default {
padding: 20px; padding: 20px;
box-sizing: border-box; box-sizing: border-box;
align-items: center; align-items: center;
margin-bottom:20px; margin-bottom: 20px;
.channel-main-guidance-item { .channel-main-guidance-item {
flex: 1; flex: 1;
height: 142px; height: 142px;
background: url('../../assets/img/channel/bg.png'),no-repeat; background: url('../../assets/img/channel/bg.png'), no-repeat;
padding: 16px 20px; padding: 16px 20px;
box-sizing: border-box; box-sizing: border-box;
&-head { &-head {
...@@ -469,12 +467,12 @@ export default { ...@@ -469,12 +467,12 @@ export default {
line-height: 20px; line-height: 20px;
} }
} }
.channel-arrow{ .channel-arrow {
margin:0 16px; margin: 0 16px;
width:20px; width: 20px;
height:15px; height: 15px;
img{ img {
width:100%; width: 100%;
} }
} }
} }
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
<script> <script>
import util from '@/utils/util' import util from '@/utils/util'
import empDetail from './empDetail.vue' import empDetail from '@/components/empDetail'
export default { export default {
components: { empDetail }, components: { empDetail },
name: 'channelList', name: 'channelList',
......
...@@ -64,9 +64,9 @@ ...@@ -64,9 +64,9 @@
<script> <script>
import utils from '@/utils/util' import utils from '@/utils/util'
import linechart from './linechart' import linechart from '@/components/linechart'
import selectChannel from './selectChannel' import selectChannel from '@/components/selectChannel'
import empDetail from './empDetail.vue' import empDetail from '@/components/empDetail'
export default { export default {
name: 'channelStatistics', name: 'channelStatistics',
components: { components: {
......
<template>
<div class="welcome-box">
<!-- <div class="required">入群欢迎语</div> -->
<div class="content">
<div class="content-bg">
<el-input type="textarea" :rows="9" maxlength="600" show-word-limit v-model="text" @input="textInput" placeholder="请输入内容"></el-input>
<div v-for="(itm, index) in previewList" :key="itm.id">
<div class="welcome-file" v-if="itm.attType != 1">
<template v-if="itm.attType == 2">
<img src="@/assets/img/guestCustom/icon-img.png" alt="" />
<span>{{ itm.attContent }}</span>
</template>
<template v-else-if="itm.attType == 3">
<img src="@/assets/img/guestCustom/icon-img.png" alt="" />
<span>{{ itm.attContent }}</span>
</template>
<template v-else-if="itm.attType == 4">
<img src="@/assets/img/guestCustom/icon-link.png" alt="" />
<span>{{ itm.attContent.url }}</span>
</template>
<template v-else-if="itm.attType == 5">
<img src="@/assets/img/guestCustom/icon-applet.png" alt="" />
<span>{{ itm.attContent.title }}</span>
</template>
<i class="el-icon-circle-close" @click="close(index)"></i>
</div>
</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>
<span>{{ item.name }}</span>
<!-- <div id="video"></div> -->
<input v-if="item.type == 'img'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'image/png, image/jpeg, image/jpg'" @change="e => handleImgChange(e, item)" />
<input v-if="item.type == 'video'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :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>
</div>
</div>
</div>
<div class="tips-text">
<img src="@/assets/img/guestCustom/tips.png" class="tips-icon" alt="" />
<span>如在企业微信管理后台已为所选员工设置了欢迎语,则此处设置的将不生效。</span>
</div>
</div>
<basic-dialog :title="dialogTitle" :width="'712px'" :isVisible="dialogVisible" @confirmDialog="handleConfirm" @closeDialog="closeDialog">
<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="picUrl">
<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>
</basic-dialog>
</div>
</template>
<script>
import basicDialog from '@/components/basic-dialog'
const ATT_TYPE = {
TEXT: 1,
IMAGE: 2,
VEDIO: 3,
URL: 4,
MINIPROGRAM: 5,
FILE: 6
}
export default {
name: 'WelcomeWords',
components: { basicDialog},
props: { eventBus: Object },
data() {
return {
btnList: [
{
id: 1,
name: '图片',
funcName: '',
type: 'img',
limitSize: 10
},
{
id: 2,
name: '视频',
funcName: '',
type: 'video',
limitSize: 10
},
{
id: 3,
name: '链接',
type: 'popup',
funName: 'link'
},
{
id: 4,
name: '小程序',
type: 'popup',
funName: 'applet'
}
],
guestForm: {},
text: '',
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: '请输入小程序appID', trigger: 'blur' }],
page: [{ required: true, message: '请输入小程序路径', trigger: 'blur' }],
picUrl: [{ required: true, message: '请上传封面路径', trigger: 'change' }]
},
previewList: []
}
},
mounted() {
console.log(this.previewList)
this.eventBus.$emit('update', this.previewList)
// this.updateList(this.previewList)
// obj.init('video')
},
methods: {
handleImgChange(e, targetItem) {
console.log(e, targetItem)
var reader = new FileReader()
var file = e.srcElement.files[0]
console.log(file)
// 默认1MB
const limitSize = targetItem.limitSize || 1
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 = () => {
console.log(file, targetItem)
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.previewList.push({
attType: ATT_TYPE.IMAGE,
attContent: res
})
}
})
}
}
},
handleVideoChange(e, targetItem) {
var file = e.srcElement.files[0]
var reader = new FileReader()
// 默认1MB
const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
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.previewList.push({
attType: ATT_TYPE.VEDIO,
attContent: res
})
}
})
}
},
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.$set(this.appletForm, 'picUrl', 'dfasdfasfa')
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
console.log(res)
this.$set(this.appletForm, 'picUrl', res)
}
})
}
}
},
switchDailog(funName) {
console.log(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.closeDialog('linkForm')
// this.dialogVisible = !this.dialogVisible
// this.linkForm = {}
// this.$refs.linkForm.clearValidate()
} else {
console.log('error submit!!')
return false
}
})
break
case '添加小程序':
console.log(this.appletForm)
this.$refs.appletForm.validate(valid => {
if (valid) {
console.log(this.appletForm)
this.previewList.push({
attType: ATT_TYPE.MINIPROGRAM,
attContent: this.appletForm
})
this.closeDialog('appletForm')
// this.dialogVisible = !this.dialogVisible
// this.appletForm = {}
// this.$refs.appletForm.clearValidate()
} else {
console.log('error submit!!')
return false
}
})
break
default:
console.log(dialogTitle)
}
},
close(index) {
console.log(index)
// this.previewList
this.previewList.splice(index, 1)
this.eventBus.$emit('update', this.previewList)
},
textInput(val) {
console.log(val)
const hasText = this.previewList.some(item => item.attType == 1)
console.log(hasText)
if (hasText) {
this.$set(this.previewList, 0, {
attContent: val,
attType: ATT_TYPE.TEXT
})
} else {
this.previewList.unshift({
attContent: val,
attType: ATT_TYPE.TEXT
})
}
console.log(this.previewList)
},
closeDialog() {
if (this.dialogVisible) {
if (this.$refs.linkForm) this.$refs.linkForm.clearValidate()
this.linkForm = {}
if (this.$refs.appletForm) this.$refs.appletForm.clearValidate()
this.appletForm = {}
}
this.dialogVisible = !this.dialogVisible
},
updateList(val) {
this.previewList = val
this.eventBus.$emit('update', this.previewList)
const obj = val.find(item => item.attType == 1)
if (obj) {
this.text = obj.attContent
} else {
this.text = ''
}
}
}
}
</script>
<style lang="scss" scoped>
.welcome-box {
// padding-top: 20px;
// margin-left: 87px;
}
.content {
display: inline-block;
vertical-align: text-top;
width: calc(100% - 103px);
// margin-left: 12px;
.content-bg {
background-color: #f7f7f7;
}
.welcome-file {
display: flex;
align-items: center;
color: #999;
padding: 10px;
margin-bottom: 10px;
border-left: 1px solid #dcdfe6;
border-right: 1px solid #dcdfe6;
img {
width: 20px;
height: 20px;
margin-right: 5px;
}
span {
display: inline-block;
margin-right: 20px;
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 14px;
}
i {
font-size: 16px;
}
&:last-child {
margin-bottom: 0;
}
}
.btn-group {
padding: 6px 0 6px 20px;
border: 1px solid #dcdfe6;
border-top: 0;
.add-btn {
display: inline-flex;
position: relative;
align-items: center;
padding-right: 25px;
font-size: 16px;
color: #666;
cursor: pointer;
span {
font-size: 14px;
margin-left: 5px;
}
input {
position: absolute;
width: 100%;
cursor: pointer;
}
.el-link {
position: absolute;
width: 100%;
}
}
}
}
.required {
display: inline-block;
line-height: 40px;
}
.required::before {
content: '*';
color: #f56c6c;
margin-right: 4 px;
}
.form-tips {
font-size: 12px;
color: #999;
}
.form-upload {
position: absolute;
top: 0;
width: 140px;
// width: 100%;
height: 100%;
cursor: pointer;
z-index: 1;
}
/deep/ {
.el-textarea__inner {
background-color: #f7f7f7;
border-radius: 0;
}
.el-textarea__inner:focus {
border-color: #dcdfe6;
}
.el-textarea .el-input__count {
background-color: #f7f7f7;
}
}
.upload {
position: relative;
}
.upload-bg {
position: relative;
width: 140px;
height: 140px;
background-color: #f7f7f7;
color: #999;
border: 1px dashed #dcdfe6;
i {
position: absolute;
top: 40px;
left: 50%;
transform: translateX(-50%);
font-size: 30px;
}
.upload-text {
position: absolute;
bottom: 40px;
left: 50%;
transform: translateX(-50%);
font-size: 12px;
}
}
.tips-text {
display: flex;
align-items: center;
justify-self: center;
color: #000;
font-size: 14px;
padding: 13px 16px;
margin-top: 10px;
background-color: rgba(230, 233, 255, 0.49);
border: 1px solid rgba(88, 80, 255, 0.49);
border-radius: 4px;
.tips-icon {
width: 14px;
height: 14px;
margin-right: 8px;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="channel-main"> <div class="channel-main">
<el-tabs v-model="activeName" @tab-click="handleClick"> <GLTabs v-model="activeName" :tabPaneList="tabPaneList" class="tabs-panel"></GLTabs>
<el-tab-pane label="渠道码列表" name="first"></el-tab-pane>
<el-tab-pane label="数据统计" name="second"></el-tab-pane>
</el-tabs>
<channel-list v-if="activeName == 'first'"></channel-list> <channel-list v-if="activeName == 'first'"></channel-list>
<channel-statistics v-if="activeName == 'second'"></channel-statistics> <channel-statistics v-if="activeName == 'second'"></channel-statistics>
</div> </div>
...@@ -20,7 +17,17 @@ export default { ...@@ -20,7 +17,17 @@ export default {
}, },
data() { data() {
return { return {
activeName: 'first' activeName: 'first',
tabPaneList: [
{
label: '渠道码列表',
name: 'first'
},
{
label: '数据统计',
name: 'second'
}
]
} }
}, },
methods: { methods: {
...@@ -62,10 +69,8 @@ export default { ...@@ -62,10 +69,8 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.channel-main { .channel-main {
/deep/ { .tabs-panel {
.el-tabs__nav-wrap::after { margin-bottom: 10px;
height: 0px;
}
} }
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!