Commit bce2cd21 by linkwechat8856@163.com

Merge branch 'master' into back_end_dev

# Conflicts:
#	linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeGroupMessageTemplateController.java
#	linkwe-mobile/src/components/StepList.vue
#	linkwe-mobile/src/utils/index.js
#	linkwe-mobile/src/views/communityOperating/SOP/panel.vue
#	linkwe-mobile/src/views/communityOperating/keywords/index.vue
#	linkwe-mobile/src/views/communityOperating/keywords/panel.vue
#	linkwe-mobile/src/views/communityOperating/oldCustomer/panel.vue
#	linkwe-mobile/src/views/portrait/index.vue
#	linkwe-quartz/src/main/java/com/linkwechat/quartz/task/PullGroupMessageTask.java
#	linkwe-ui/package.json
#	linkwe-ui/src/layout/components/Navbar.vue
#	linkwe-ui/src/views/communityOperating/groupSOP/aev.vue
#	linkwe-ui/src/views/communityOperating/groupSOP/list.vue
#	linkwe-ui/src/views/communityOperating/newCustomer/list.vue
#	linkwe-ui/src/views/conversation/content/employee.vue
#	linkwe-ui/src/views/customerManage/customer.vue
#	linkwe-ui/src/views/drainageCode/staff/detail.vue
#	linkwe-ui/src/views/drainageCode/staff/list.vue
#	linkwe-ui/src/views/index.vue
#	linkwe-ui/src/views/login.vue
#	linkwe-ui/src/views/material/components/MaPage.vue
#	linkwe-ui/src/views/material/poster.vue
2 parents 36220f05 2ad502a8
Showing 37 changed files with 7524 additions and 165 deletions
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
<p></p> <p></p>
<p align="center"> <p align="center">
<img alt="logo" src="https://images.gitee.com/uploads/images/2021/0107/210318_e1f66c96_1480777.png" width="120" style="margin-bottom: 0px;"> <img alt="logo" src="https://images.gitee.com/uploads/images/2021/1101/010135_60061e4a_1480777.png" style="margin-bottom: 0px;">
</p> </p>
<h2 align="center">LinkWeChat —— 让每个企业都是私域流量营销专家</h2>
<div align="center"> <div align="center">
[![star](https://gitee.com/LinkWeChat/link-wechat/badge/star.svg?theme=gvp)](https://gitee.com/LinkWeChat/link-wechat/stargazers) [![star](https://gitee.com/LinkWeChat/link-wechat/badge/star.svg?theme=gvp)](https://gitee.com/LinkWeChat/link-wechat/stargazers)
[![fork](https://gitee.com/LinkWeChat/link-wechat/badge/fork.svg?theme=gvp)](https://gitee.com/LinkWeChat/link-wechat/members) [![fork](https://gitee.com/LinkWeChat/link-wechat/badge/fork.svg?theme=gvp)](https://gitee.com/LinkWeChat/link-wechat/members)
![license](http://img.shields.io/badge/license-GPL%203.0-green) ![LinkWeChat](https://img.shields.io/badge/LinkWeChat-V1.5-brightgreen)
![license](http://img.shields.io/badge/license-GPL%203.0-orange)
</div> </div>
...@@ -19,36 +20,35 @@ ...@@ -19,36 +20,35 @@
<p></p> <p></p>
<p></p> <p></p>
![输入图片说明](https://images.gitee.com/uploads/images/2020/1231/233450_65d03349_1480777.png "LinkWeChat 企业微信私域流量营销专家-V1.0.4_00.png")
--- ---
**如果您觉得我们的开源项目很有帮助,请帮忙点击右上方的 :star: Star ,您的认可就是我们最大的动力,谢谢支持!:heart:** **<p align="center">如果您觉得我们的开源项目很有帮助,请帮忙点击右上方的 :star: Star ,您的认可就是我们最大的动力,谢谢支持!:heart:</p>**
--- ---
[LinkWeChat 官方帮助手册——语雀](https://www.yuque.com/linkwechat/help) [LinkWeChat 官方帮助手册——语雀](https://www.yuque.com/linkwechat/help)
### 平台简介 ### 产品简介
> LinkWeChat, Link to WeChat > LinkWeChat, Link to WeChat.
LinkWeChat 是一款基于人工智能的企业微信 SCRM 系统,为企业构建私域流量营销系统的综合解决方案,助力企业提高社交客户运营效率。 基于人工智能的企业微信 SCRM 系统——LinkWeChat基于企业微信开放能力,不仅集成了企微基础的客户管理和后台管理功能,而且通过引流获客、客情维系、社群运营等灵活高效的客户运营模块,让客户与企业之间建立强链接关系,同时进一步通过多元化的客户营销工具,帮助企业提高客户运营效率,强化营销能力,拓展盈利空间,是企业私域流量管理与营销的综合解决方案。
![输入图片说明](https://images.gitee.com/uploads/images/2020/1231/234154_394dea33_1480777.png "LinkWeChat 企业微信私域流量营销专家-V1.0.4_12.png") ![输入图片说明](https://images.gitee.com/uploads/images/2021/1101/012040_64b8b918_1480777.png "仟微助手企业微信SCRM智能营销系统-V1.5_13.png")
#### 应用场景
主要应用与泛零售、电商、金融等行业企业微信用户,提供多种工具、多渠道、多方式添加客户为企业微信好友,并通过营销互动与客户标签管理等建立强连接。
#### 功能特性 #### 功能特性
四大模块助力企业营销能力升级: 系统分为八大模块:
* **运营中心** :客户、客群、会话等全功能数据报表,数据一目了然;
* **引流获客** :活码、群活码、公海、客服等多渠道引流,实现精准获客;
* **客户中心** :助力企业搭建私域流量池,高效运营客户;
* **客情维系** :企业客户运营精细化,朋友圈、红包工具提高客户活跃度;
* **社群运营** :客群运营场景全覆盖,快速拉群;
* **全能营销** :提供多类型、多场景客户营销工具;
* **企业风控** :会话合规存档,敏感内容全局风控;
* **企业管理** :组织架构、自建应用全融合,实现“一个后台”;
* 客户管理:搭建私域流量池,高效运营客户
* 引流获客:多渠道引流,实现精准获客
* 会话存档:会话合规存档,提供多重服务保障
* 营销中心:多类型营销工具,实现场景化营销
![输入图片说明](https://images.gitee.com/uploads/images/2020/1231/232207_6a0f4a67_1480777.png "LinkWeChat 企业微信私域流量营销专家-V1.0.4_13.png") ![输入图片说明](https://images.gitee.com/uploads/images/2020/1231/232207_6a0f4a67_1480777.png "LinkWeChat 企业微信私域流量营销专家-V1.0.4_13.png")
......
...@@ -111,14 +111,17 @@ public class WeCustomerController extends BaseController ...@@ -111,14 +111,17 @@ public class WeCustomerController extends BaseController
/** /**
* 修改企业微信客户 * 修改企业微信客户(目前只更新生日)
*/ */
// @PreAuthorize("@ss.hasPermi('wecom:customer:edit')") // @PreAuthorize("@ss.hasPermi('wecom:customer:edit')")
@Log(title = "企业微信客户", businessType = BusinessType.UPDATE) @Log(title = "企业微信客户", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody WeCustomer weCustomer) public AjaxResult edit(@Validated @RequestBody WeCustomer weCustomer)
{ {
weCustomerService.saveOrUpdate(weCustomer); weCustomerService.update(weCustomer,new LambdaQueryWrapper<WeCustomer>()
.eq(WeCustomer::getExternalUserid,weCustomer.getExternalUserid())
.eq(WeCustomer::getFirstUserId,weCustomer.getFirstUserId()));
return AjaxResult.success(); return AjaxResult.success();
} }
......
...@@ -5,8 +5,6 @@ import com.linkwechat.common.core.controller.BaseController; ...@@ -5,8 +5,6 @@ import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeGroupMessageSendResult;
import com.linkwechat.wecom.domain.WeGroupMessageTask;
import com.linkwechat.wecom.domain.WeGroupMessageTemplate; import com.linkwechat.wecom.domain.WeGroupMessageTemplate;
import com.linkwechat.wecom.domain.query.WeAddGroupMessageQuery; import com.linkwechat.wecom.domain.query.WeAddGroupMessageQuery;
import com.linkwechat.wecom.domain.vo.WeGroupMessageDetailVo; import com.linkwechat.wecom.domain.vo.WeGroupMessageDetailVo;
...@@ -91,30 +89,4 @@ public class WeGroupMessageTemplateController extends BaseController { ...@@ -91,30 +89,4 @@ public class WeGroupMessageTemplateController extends BaseController {
iWeGroupMessageTemplateService.cancelByIds(Arrays.asList(ids)); iWeGroupMessageTemplateService.cancelByIds(Arrays.asList(ids));
return AjaxResult.success(); return AjaxResult.success();
} }
/**
* 群发成员发送任务列表
*/
//@PreAuthorize("@ss.hasPermi('linkwechat:template:remove')")
@ApiOperation(value = "群发成员发送任务列表", httpMethod = "GET")
@Log(title = "群发消息模板", businessType = BusinessType.SELECT)
@GetMapping("/task/list")
public TableDataInfo<WeGroupMessageTask> groupMsgTaskList(WeGroupMessageTask task) {
startPage();
List<WeGroupMessageTask> messageTaskList = iWeGroupMessageTemplateService.groupMsgTaskList(task);
return getDataTable(messageTaskList);
}
/**
* 群发成员发送任务列表
*/
//@PreAuthorize("@ss.hasPermi('linkwechat:template:remove')")
@ApiOperation(value = "群发成员发送任务列表", httpMethod = "GET")
@Log(title = "群发消息模板", businessType = BusinessType.SELECT)
@GetMapping("/send/result/list")
public TableDataInfo<WeGroupMessageSendResult> groupMsgSendResultList(WeGroupMessageSendResult sendResult) {
startPage();
List<WeGroupMessageSendResult> sendResultList = iWeGroupMessageTemplateService.groupMsgSendResultList(sendResult);
return getDataTable(sendResultList);
}
} }
/* package com.linkwechat.common.config;/*
package com.linkwechat.common.config; package com.linkwechat.common.config;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
......
...@@ -64,7 +64,7 @@ public class RSAUtil { ...@@ -64,7 +64,7 @@ public class RSAUtil {
*/ */
public static String decryptRSA(String str, PrivateKey privateKey) throws NoSuchPaddingException, public static String decryptRSA(String str, PrivateKey privateKey) throws NoSuchPaddingException,
NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, NoSuchProviderException { NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, NoSuchProviderException {
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); Security.addProvider(new BouncyCastleProvider());
Cipher rsa = Cipher.getInstance("RSA/ECB/PKCS1Padding", "BC"); Cipher rsa = Cipher.getInstance("RSA/ECB/PKCS1Padding", "BC");
rsa.init(Cipher.DECRYPT_MODE, privateKey); rsa.init(Cipher.DECRYPT_MODE, privateKey);
byte[] utf8 = rsa.doFinal(Base64.getDecoder().decode(str)); byte[] utf8 = rsa.doFinal(Base64.getDecoder().decode(str));
......
...@@ -2,5 +2,7 @@ ...@@ -2,5 +2,7 @@
ENV = 'development' ENV = 'development'
# 基础api(根据实际情况,自行配置,下为示例) # 基础api(根据实际情况,自行配置,下为示例)
VUE_APP_BASE_API = 'http://demo.linkwechat.cn' VUE_APP_BASE_API = 'http://demo.linkwechat.cn/api'
# 路由基础路径
VUE_APP_BASE_URL = '/'
\ No newline at end of file \ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
ENV = 'production' ENV = 'production'
# 基础api # 基础api
VUE_APP_BASE_API = 'http://demo.linkwechat.cn' VUE_APP_BASE_API = 'http://demo.linkwechat.cn/api'
# 路由基础路径 # 路由基础路径
VUE_APP_BASE_URL = '/' VUE_APP_BASE_URL = '/'
\ No newline at end of file \ No newline at end of file
<template>
<div>
<van-list v-model="loading" :finished="finished" finished-text="没有更多了" loading-text="上划加载更多">
<van-cell v-for="(item, index) in wList" :key="index">
<!-- 时间 -->
<p class="f12" style="position:relative; ">
{{ dateFormat(item[0].createTime, 'yyyy-MM-dd w') }}
<!-- {{item1.trajectoryType}} -->
</p>
<!-- <van-cell> -->
<van-steps
direction="vertical"
inactive-color="#2c8cf0"
:active="active"
v-for="(item1, index) in item"
:key="index"
>
<van-step class="msg">
<span class="f12 po"> {{ dateFormat(item[0].createTime, 'hh:mm') }}</span>
<span class="fs14">{{ chargeType(item1.trajectoryType) }}</span>
<span class="finish-box">
<span class="finish" v-if="item1.trajectoryType == 4 && item1.status != 3" @click="finDynamic(item1.id)"
>完成</span
>
<span class="deldynamic" @click="delDynamic(item1.id)">删除</span>
</span>
<p class="fs14 con ">{{ item1.content }}</p>
</van-step>
<!-- <van-step>
<span class="f12 po"> 12:40</span>
<span class="fs14">社交动态</span>
<span class="deldynamic">删除</span>
<p class="fs14 con ">编辑编辑</p>
</van-step> -->
</van-steps>
</van-cell>
<!-- <van-divider /> -->
</van-list>
</div>
</template>
<script>
import { removeTrajectory, handleWait } from '@/api/portrait'
import { dateFormat } from '@/utils'
export default {
props: ['stepList'],
inject: ['reload'],
data() {
return {
// 步骤条
active: -1,
// 轨迹外层按时间
wlist: [],
content: '',
type: 0,
wList: [],
finished: false,
loading: false,
dateFormat
}
},
watch: {
stepList(newVal, oldVal) {
// console.log(newVal, oldVal);
this.wList = []
let dayList = []
newVal.forEach((ele) => {
let date = this.dateFormat(ele.createTime, 'yyyyMMdd')
dayList.includes(date) || dayList.push(date)
})
dayList.sort((a, b) => b - a)
for (let i = 0; i < dayList.length; i++) {
let timeList = []
for (let j = 0; j < newVal.length; j++) {
// console.log(newVal[j].createTime);
if (dayList[i] == this.dateFormat(newVal[j].createTime, 'yyyyMMdd')) {
timeList.push(newVal[j])
}
}
this.wList.push(timeList)
}
this.loading = false
this.finished = true
// console.log(this.wlist);
// this.onLoad()
}
},
methods: {
onLoad() {
// // 异步更新数据
// // setTimeout 仅做示例,真实场景中一般为 ajax 请求
// setTimeout(() => {
// // debugger
// let total = this.wlist.length > 10 ? 10 : this.wlist.length
// for (let i = 0; i < total; i++) {
// this.wList.push(this.wlist[i])
// }
// console.log(this.wList)
// // 加载状态结束
// this.loading = false
// // 数据全部加载完成
// if (this.wList.length >= this.wlist.length) {
// this.finished = true
// }
// }, 1000)
},
// 根据数字判断类型
chargeType(num) {
if (num == 1) {
return (this.type = '信息动态')
} else if (num == 2) {
return (this.type = '社交动态')
} else if (num == 3) {
return (this.type = '活动规则')
} else if (num == 4) {
return (this.type = '待办动态')
}
},
// 删除轨迹
delDynamic(id) {
this.$dialog
.confirm({
title: '警告',
message: '确定要删除吗?'
})
.then(() => {
return removeTrajectory(id)
})
.then((data) => {
this.$toast.success('删除成功')
// 重新获取全部数据
this.$emit('reload')
})
.catch(() => {
// on cancel
})
},
// 点击完成
finDynamic(id) {
handleWait(id)
.then((data) => {
this.$emit('reload')
})
.catch((err) => {
console.log(err)
})
}
}
}
</script>
<style lang="less" scoped>
.f12 {
color: #9c9c9c;
font-size: 12px;
font-weight: 600;
}
/deep/.msg {
&::after {
border: none;
}
.po {
position: relative;
}
}
.fs14 {
color: #333;
font-size: 14px;
position: relative;
left: 20px;
}
.deldynamic {
float: right;
color: #9c9c9c;
font-size: 12px;
font-weight: 600;
}
.con {
left: 51px;
margin-top: 20px;
}
.finish-box {
float: right;
position: relative;
width: 80px;
}
.finish {
position: absolute;
color: #2c8cf0;
font-size: 12px;
font-weight: 600;
// right: 30px;
// top: 0px;
}
</style>
/**
* query请求路径参数转为对象
* @param {*} url
*/
export function param2Obj(url) {
url = url == null ? window.location.href : url
let search = decodeURIComponent(url).split('?')[1]
search = search && search.split('#')[0]
if (!search) {
return {}
}
return JSON.parse(
'{"' +
search
.replace(/"/g, '\\"')
.replace(/&/g, '","')
.replace(/=/g, '":"') +
'"}'
)
}
// 日期时间格式化
export function dateFormat(dateString, fmt = 'yyyy-MM-dd hh:mm:ss') {
if (!dateString) {
return
}
var date = new Date(dateString.replace(/-/g, '/'))
var o = {
'M+': date.getMonth() + 1, //月份
'd+': date.getDate(), //日
'h+': date.getHours(), //小时
'm+': date.getMinutes(), //分
's+': date.getSeconds(), //秒
'q+': Math.floor((date.getMonth() + 3) / 3), //季度
'S+': date.getMilliseconds(), //毫秒
'w+': '星期' + '日一二三四五六'.charAt(date.getDay()) //星期
}
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (var k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 || String(o[k]).length > 1 ? o[k] : '0' + o[k])
}
}
return fmt
}
<template>
<div>
<div class="task-wrapper">
<div class="header">
<span> 群SOP </span>
<div>{{ task.createTime }}</div>
</div>
<div class="group">
<van-cell class="group-tags" title="发送给客户群">
<template #default>
<template v-for="group of task.groupList.slice(0, 2)">
<van-tag :key="group.chatId" size="large"> {{ group.groupName }} </van-tag>
</template>
<template v-if="task.groupList.length > 2">
<van-tag size="large"> ... </van-tag>
</template>
</template>
</van-cell>
<van-cell title="发送时间" :value="sendRange"></van-cell>
</div>
<div class="content">
<div @touchstart.prevent="touchStart" @touchend="touchEnd">
{{ task.content }}
</div>
<div class="copy-wrapper" v-show="showCopy">
<van-button :class="'copy-btn_' + task.ruleId" :data-clipboard-text="task.content"> 复制 </van-button>
</div>
</div>
<div class="image-list">
<template v-for="material of task.materialList">
<!-- mediaType: 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报 6 海报字体 -->
<van-image
v-if="material.mediaType === 0"
width="80"
:key="material.id"
:src="material.materialUrl"
></van-image>
</template>
<template v-for="pic of task.picList">
<van-image width="80" :key="pic" :src="pic"></van-image>
</template>
</div>
<div>
<!-- <van-cell title="发送给" is-link value="张三、李四、王五等11人"></van-cell> -->
<van-cell title="已完成成员" is-link :value="showDone" @click="goState(1)"></van-cell>
<van-cell title="未完成成员" is-link :value="showTodo" @click="goState"></van-cell>
</div>
<div class="send-button" v-if="!state">
<van-button type="info" size="mini" @click="send()">发送</van-button>
</div>
</div>
<div class="bottom-line"></div>
</div>
</template>
<script>
import ClipboardJS from 'clipboard'
import { changeStatus } from '@/api/community'
export default {
name: 'SOPPanel',
props: {
task: {
type: Object,
required: true
},
// true: 已处理 false: 未处理
state: {
type: Boolean,
required: true
},
isAdmin: {
type: Boolean,
default: true
}
},
data() {
return {
showCopy: false, // 展示复制按钮
touchDelay: 750, // 触发显示按钮的长按时常
copyEvent: null,
touch: false
}
},
methods: {
goState(active) {
if (!this.isAdmin) return
this.$router.push({
name: 'taskState',
query: {
taskId: this.task.ruleId,
active: active === 1 ? 1 : 0,
taskType: 2
}
})
},
send() {
try {
const userId = this.$store.state && this.$store.state.userId
const taskId = this.task.ruleId
let _this = this
this.$toast.loading({
message: '正在发送...',
duration: 0,
forbidClick: true
})
// mes.link || delete mes.link
// mes.imgUrl || delete mes.imgUrl
wx.invoke(
'shareToExternalChat',
{
title: this.task.title,
desc: this.task.content,
link: (this.task.materialList && this.task.materialList[0] && this.task.materialList[0].materialUrl) || ' ', // 消息链接
imgUrl:
(this.task.materialList && this.task.materialList[0] && this.task.materialList[0].materialUrl) || ' ' // 封面
},
async function(res) {
if (res.err_msg == 'shareToExternalChat:ok') {
try {
await changeStatus(userId, taskId, 1)
} catch (error) {
_this.$toast.clear()
_this.$dialog({ message: '接口失败:' + JSON.stringify(error) })
return
}
// .then((res) => {
// }).catch(() => {
// this.$emit('refresh')
// })
_this.$toast.clear()
this.$emit('refresh')
} else {
if (res.err_code == 1) {
// 用户取消发送
} else {
_this.$dialog({ message: 'shareToExternalChat失败:' + JSON.stringify(res) })
}
}
_this.$toast.clear()
}
)
} catch (error) {
this.$dialog({ message: '代码错误:' + JSON.stringify(error.message) })
}
},
touchStart() {
clearTimeout(this.copyEvent)
this.copyEvent = setTimeout(() => {
this.touch = true
}, this.touchDelay)
},
touchEnd() {
clearTimeout(this.copyEvent)
if (this.touch) this.showCopy = true
this.touch = false
}
},
computed: {
sendRange() {
if (!this.task.startExeTime || !this.task.stopExeTime) return ''
return this.task.startExeTime + ' - ' + this.task.stopExeTime
},
todoMembers() {
if (!(this.task && this.task.scopeList && this.task.scopeList.length > 0)) return []
const members = []
for (let member of this.task.scopeList) {
if (!member.done) members.push(member)
}
return members
},
showTodo() {
if (this.todoMembers.length === 0) return '无'
const names = this.todoMembers.map((m) => m.name)
if (this.todoMembers.length <= 2) return names.join('、')
return names[0] + '、' + names[1] + '等' + this.todoMembers.length + '人'
},
doneMembers() {
if (!this.task || !this.task.scopeList || this.task.scopeList.length === 0) return []
const members = []
for (let member of this.task.scopeList) {
if (member.done) members.push(member)
}
return members
},
showDone() {
if (this.doneMembers.length === 0) return '无'
const names = this.doneMembers.map((m) => m.name)
if (this.doneMembers.length <= 2) return names.join('、')
return names[0] + '、' + names[1] + '等' + this.doneMembers.length + '人'
}
},
mounted() {
this.clipboard = new ClipboardJS('.copy-btn_' + this.task.ruleId)
this.clipboard.on('success', (e) => {
this.showCopy = false
})
this.clipboard.on('error', (e) => {
this.showCopy = false
})
}
}
</script>
<style lang="less" scoped>
.task-wrapper {
padding: 10px 8px;
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin: 5px 0 12px;
span {
font-size: 18px;
font-weight: bold;
}
}
.group {
.group-tags {
:nth-child(n + 2) {
margin-left: 5px;
}
.van-tag {
background-color: #f2f2f2;
color: black;
padding: 6px 10px;
}
}
}
.content {
padding: 15px;
background-color: #f2f2f2;
font-size: 16px;
line-height: 20px;
color: #999999;
// margin-bottom: 15px;
min-height: 30px;
position: relative;
.copy-wrapper {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, 0.4);
display: flex;
align-items: center;
justify-content: space-around;
}
}
.image-list {
.van-image {
padding: 10px 10px 0 0;
}
}
.van-cell {
padding: 10px 6px;
}
.send-button {
padding: 10px 5px 5px;
display: flex;
flex-direction: row-reverse;
.van-button {
padding: 0 12px;
margin-right: 12px;
border-radius: 4px;
font-size: 12px;
}
}
}
.bottom-line {
background-color: #f2f2f2;
height: 15px;
}
</style>
<template>
<div>
<div>
<van-search v-model="keyword" placeholder="搜索活码名或关键词" shape="round" @search="onSearch" @clear="clear">
</van-search>
</div>
<div class="history-wrapper">
<template v-for="k of history">
<van-tag :key="k" size="large" closeable @click="search(k)" @close="removeHistory(k)"> {{ k }} </van-tag>
</template>
</div>
<div class="bottom-line"></div>
<div>
<template v-if="!tasks || tasks.length === 0">
<van-empty description="暂无数据" />
</template>
<template v-else>
<template v-for="task of tasks">
<KeywordPanel :key="task.taskId" :task="task" :state="false"></KeywordPanel>
</template>
</template>
</div>
<van-overlay :show="loading" class-name="overlay">
<van-loading type="spinner"></van-loading>
</van-overlay>
</div>
</template>
<script>
import KeywordPanel from './panel'
import { getKeywordTasks } from '@/api/community'
export default {
components: { KeywordPanel },
data() {
return {
keyword: '',
storageKey: 'keywords',
history: [],
tasks: [],
loading: false,
focus: false
}
},
methods: {
getTasks() {
this.loading = true
getKeywordTasks(this.keyword)
.then((res) => {
if (res.code === 200) {
let timeStamp = (dateString) => (dateString ? +new Date(dateString.replace(/-/g, '/')) : 0)
this.tasks = res.rows.sort((a, b) => timeStamp(b.updateTime) - timeStamp(a.updateTime))
}
this.loading = false
})
.catch(() => {
this.loading = false
})
},
setHistory(keyword) {
if (!keyword) return
if (!this.history.includes(keyword)) {
this.history.push(keyword)
localStorage.setItem(this.storageKey, JSON.stringify(this.history))
}
},
removeHistory(keyword) {
if (this.history.includes(keyword)) {
this.history.splice(this.history.indexOf(keyword), 1)
localStorage.setItem(this.storageKey, JSON.stringify(this.history))
}
},
getHistory() {
this.history = JSON.parse(localStorage.getItem(this.storageKey)) || []
},
onSearch() {
this.setHistory(this.keyword)
this.getTasks()
},
search(keyword) {
this.keyword = keyword
this.getTasks()
},
clear() {
this.keyword = ''
this.getTasks()
}
},
computed: {
url() {
return window.location.href
}
},
created() {
this.getHistory()
this.getTasks()
}
}
</script>
<style lang="less" scoped>
.history-wrapper {
padding: 0 20px 20px;
.van-tag {
margin: 10px 10px 0 0;
}
}
.bottom-line {
background-color: #f2f2f2;
height: 15px;
}
.overlay {
display: flex;
align-items: center;
.van-loading {
margin: auto;
}
}
</style>
<template>
<div>
<div class="task-wrapper">
<div class="header">
<span> {{ task.taskName }} </span>
</div>
<div class="keywords">
<template v-for="keyword of keywords">
<van-tag size="medium" :key="keyword"> {{ keyword }} </van-tag>
</template>
</div>
<div class="guide" v-if="task.welcomeMsg">
<div @touchstart.prevent="touchStart" @touchend="touchEnd">
{{ task.welcomeMsg }}
</div>
<div class="copy-wrapper" v-show="showCopy">
<van-button :class="'copy-btn_' + task.taskId" :data-clipboard-text="task.welcomeMsg">
复制
</van-button>
</div>
</div>
<div class="content">
<div v-if="task.groupCodeInfo && task.groupCodeInfo.codeUrl">
<van-image width="50" :src="task.groupCodeInfo.codeUrl"></van-image>
</div>
<div class="group">
<span> {{ task.taskName }} </span>
</div>
</div>
<div class="bottom-area">
<span class="time"> {{ task.createTime }} </span>
<van-button type="info" size="mini" @click="send">发送</van-button>
</div>
</div>
<div class="bottom-line"></div>
</div>
</template>
<script>
import ClipboardJS from 'clipboard'
export default {
name: 'KeywordPanel',
props: {
task: {
type: Object,
required: true
}
},
data() {
return {
showCopy: false, // 展示复制按钮
touchDelay: 750, // 触发显示按钮的长按时常
copyEvent: null,
touch: false
}
},
methods: {
send() {
let _this = this
this.$toast.loading({
message: '正在发送...',
duration: 0,
forbidClick: true
})
try {
let news = {
link: this.groupCodeUrl,
title: this.task.taskName,
desc: this.task.welcomeMsg,
imgUrl: this.imgUrl
}
wx.invoke(
'sendChatMessage',
{
msgtype: 'news',
news
},
function(res) {
if (res.err_msg == 'sendChatMessage:ok') {
} else {
if (res.err_code == 1) {
// 用户取消发送
} else {
_this.$dialog({ message: 'sendChatMessage失败:' + JSON.stringify(res) })
}
}
_this.$toast.clear()
}
)
} catch (err) {
_this.$toast.clear()
_this.$dialog({ message: 'err' + JSON.stringify(err) })
}
},
touchStart() {
clearTimeout(this.copyEvent)
this.copyEvent = setTimeout(() => {
this.touch = true
}, this.touchDelay)
},
touchEnd() {
clearTimeout(this.copyEvent)
if (this.touch) this.showCopy = true
this.touch = false
}
},
computed: {
keywords() {
if (!this.task || !this.task.keywordList) return []
const keywords = this.task.keywordList.map((k) => k.keyword)
return keywords
},
groupCodeUrl() {
let groupCodeInfo = this.task.groupCodeInfo
if (window.location.hash[0] === '#') {
return (
window.location.origin + window.location.pathname + '#/groupCode?id=' + (groupCodeInfo && groupCodeInfo.id)
)
}
return window.location.origin + window.location.pathname + '#/groupCode?id=' + (groupCodeInfo && groupCodeInfo.id)
},
imgUrl() {
let groupCodeInfo = this.task.groupCodeInfo
return groupCodeInfo && groupCodeInfo.codeUrl ? groupCodeInfo.codeUrl : ''
}
},
mounted() {
this.clipboard = new ClipboardJS('.copy-btn_' + this.task.taskId)
this.clipboard.on('success', (e) => {
this.showCopy = false
})
this.clipboard.on('error', (e) => {
this.showCopy = false
})
}
}
</script>
<style lang="less" scoped>
.task-wrapper {
padding: 10px 8px;
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin: 5px 0 12px;
span {
font-size: 18px;
font-weight: bold;
}
}
.keywords {
margin-bottom: 15px;
.van-tag {
margin-right: 10px;
background-color: #f2f2f2;
color: rgba(0, 0, 0, 0.6);
}
}
.guide {
padding: 15px;
background-color: #f2f2f2;
font-size: 16px;
line-height: 20px;
color: #999999;
margin-bottom: 15px;
min-height: 30px;
position: relative;
.copy-wrapper {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, 0.4);
display: flex;
align-items: center;
justify-content: space-around;
}
}
.content {
padding: 10px;
background-color: #f2f2f2;
display: flex;
.group {
padding: 0 10px;
display: flex;
flex-direction: column;
justify-content: space-between;
.group-name {
color: #999999;
}
}
}
.van-cell {
padding: 10px 6px;
}
.bottom-area {
padding: 10px 5px 5px;
display: flex;
justify-content: space-between;
align-items: center;
.time {
color: rgba(0, 0, 0, 0.3);
}
.van-button {
padding: 0 12px;
margin-right: 12px;
border-radius: 4px;
font-size: 12px;
}
}
}
.bottom-line {
background-color: #f2f2f2;
height: 15px;
}
</style>
<template>
<div>
<div class="task-wrapper">
<div class="header">
<span> 老客标签建群 </span>
<div>{{ task.createTime }}</div>
</div>
<div class="guide" v-if="task.welcomeMsg">
<div @touchstart.prevent="touchStart" @touchend="touchEnd">
{{ task.welcomeMsg }}
</div>
<div class="copy-wrapper" v-show="showCopy">
<van-button :class="'copy-btn_' + task.taskId" :data-clipboard-text="task.welcomeMsg"> 复制 </van-button>
</div>
</div>
<div class="content">
<div>
<van-image width="50" :src="task.groupCodeInfo.codeUrl"></van-image>
</div>
<div class="group">
<span> {{ task.taskName }} </span>
<!-- <span class="group-name"> 测试群 </span> -->
</div>
</div>
<div>
<van-cell title="发送给" is-link :value="showMembers"></van-cell>
<van-cell title="已完成成员" is-link :value="showDone" @click="goState(1)"></van-cell>
<van-cell title="未完成成员" is-link :value="showTodo" @click="goState"></van-cell>
</div>
<div class="send-button" v-if="!state">
<van-button type="info" size="mini" @click="send">发送</van-button>
</div>
</div>
<div class="bottom-line"></div>
</div>
</template>
<script>
import ClipboardJS from 'clipboard'
import { changeStatus } from '@/api/community'
export default {
name: 'OldCustomerPanel',
props: {
task: {
type: Object,
required: true
},
// true: 已处理 false: 未处理
state: {
type: Boolean,
required: true
},
isAdmin: {
type: Boolean,
default: true
}
},
data() {
return {
showCopy: false, // 展示复制按钮
touchDelay: 750, // 触发显示按钮的长按时常
copyEvent: null,
touch: false
}
},
methods: {
goState(active) {
if (!this.isAdmin) return
this.$router.push({
name: 'taskState',
query: {
taskId: this.task.taskId,
active: active === 1 ? 1 : 0,
taskType: 1
}
})
},
send() {
const userId = this.$store.state.userId
const taskId = this.task.taskId
wx.invoke(
'shareToExternalContact',
{
title: this.task.taskName,
desc: this.task.welcomeMsg,
link: this.groupCodeUrl,
imgUrl: this.task.groupCodeInfo && this.task.groupCodeInfo.codeUrl
},
function(res) {
if (res.err_msg == 'shareToExternalContact:ok') {
changeStatus(userId, taskId, 0)
.then((res) => {
this.$emit('refresh')
})
.catch(() => {
this.$emit('refresh')
})
} else {
}
}
)
},
touchStart() {
clearTimeout(this.copyEvent)
this.copyEvent = setTimeout(() => {
this.touch = true
}, this.touchDelay)
},
touchEnd() {
clearTimeout(this.copyEvent)
if (this.touch) this.showCopy = true
this.touch = false
}
},
computed: {
todoMembers() {
if (!(this.task && this.task.scopeList && this.task.scopeList.length > 0)) return []
const members = []
for (let member of this.task.scopeList) {
if (!member.done) members.push(member)
}
return members
},
showTodo() {
if (this.todoMembers.length === 0) return '无'
const names = this.todoMembers.map((m) => m.name)
if (this.todoMembers.length <= 2) return names.join('、')
return names[0] + '、' + names[1] + '等' + this.todoMembers.length + '人'
},
doneMembers() {
if (!this.task || !this.task.scopeList || this.task.scopeList.length === 0) return []
const members = []
for (let member of this.task.scopeList) {
if (member.done) members.push(member)
}
return members
},
showDone() {
if (this.doneMembers.length === 0) return '无'
const names = this.doneMembers.map((m) => m.name)
if (this.doneMembers.length <= 2) return names.join('、')
return names[0] + '、' + names[1] + '等' + this.doneMembers.length + '人'
},
showMembers() {
if (!(this.task && this.task.scopeList && this.task.scopeList.length > 0)) return '无'
if (this.task.scopeList.length === 0) return '无'
const names = this.task.scopeList.map((m) => m.name)
if (this.task.scopeList.length <= 2) return names.join('、')
return names[0] + '、' + names[1] + '等' + this.task.scopeList.length + '人'
},
groupCodeUrl() {
let groupCodeInfo = this.task.groupCodeInfo
if (window.location.hash[0] === '#') {
return (
window.location.origin + window.location.pathname + '#/groupCode?id=' + (groupCodeInfo && groupCodeInfo.id)
)
}
return window.location.origin + window.location.pathname + 'groupCode?id=' + (groupCodeInfo && groupCodeInfo.id)
}
},
mounted() {
this.clipboard = new ClipboardJS('.copy-btn_' + this.task.taskId)
this.clipboard.on('success', (e) => {
this.showCopy = false
})
this.clipboard.on('error', (e) => {
this.showCopy = false
})
}
}
</script>
<style lang="less" scoped>
.task-wrapper {
padding: 10px 8px;
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin: 5px 0 12px;
span {
font-size: 18px;
font-weight: bold;
}
}
.guide {
padding: 15px;
background-color: #f2f2f2;
font-size: 16px;
line-height: 20px;
color: #999999;
margin-bottom: 15px;
min-height: 30px;
position: relative;
.copy-wrapper {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, 0.4);
display: flex;
align-items: center;
justify-content: space-around;
}
}
.content {
padding: 10px;
background-color: #f2f2f2;
display: flex;
.group {
padding: 0 10px;
display: flex;
flex-direction: column;
justify-content: space-between;
.group-name {
color: #999999;
}
}
}
.van-cell {
padding: 10px 6px;
}
.send-button {
padding: 10px 5px 5px;
display: flex;
flex-direction: row-reverse;
.van-button {
padding: 0 12px;
margin-right: 12px;
border-radius: 4px;
font-size: 12px;
}
}
}
.bottom-line {
background-color: #f2f2f2;
height: 15px;
}
</style>
<template>
<div>
<!-- 头部 -->
<!-- <div class="header">
<van-icon
name="cross"
color="#9c9c9c"
size="16"
@click="$router.back()"
/>
<span class="title"> 客户画像 </span>
</div>
<van-divider /> -->
<!-- 详细资料 -->
<div class="details">
<div class="detail">
<div class="left">
<div class="img"><img :src="form.avatar" alt="" /></div>
<div class="right">
<div>
<span
>{{
form.remark ? form.remark : (form.name || '') + (form.remarkCorpName ? '-' + form.remarkCorpName : '')
}}
&nbsp; &nbsp;</span
><span class="icon iconfont icon-man" v-if="form.gender == 1"></span>
<span class="icon iconfont icon-xingbie" v-else-if="form.gender == 2"></span>
<van-icon name="manager" color="#9c9c9c" v-else />
</div>
<div class="c9">
<span>昵称:</span><span>{{ form.name }}</span>
</div>
</div>
</div>
<div class="data" @click="goRoute('/customerDetail')">详细资料></div>
</div>
<div class="detail">
<div class="c9">手机号</div>
<div>{{ form.remarkMobiles }}</div>
</div>
<van-divider />
<div class="detail">
<div class="c9">年龄</div>
<div>{{ form.age }}</div>
</div>
<van-divider />
<div class="detail">
<div class="c9">生日</div>
<div>{{ form.birthday ? form.birthday.substring(0, 10) : '' }}</div>
</div>
<van-divider />
<div class="detail">
<div class="c9">邮箱</div>
<div>{{ form.email }}</div>
</div>
</div>
<div class="divider"></div>
<!-- 客户标签 -->
<div class="userlabel">
<div class="detail">
<div>客户标签</div>
<div class="data" is-link @click="labelEdit">编辑</div>
</div>
<div v-if="form.weTagGroupList" class="labelstyle mt10">
<template v-for="item in form.weTagGroupList">
<div class="label" v-for="(unit, unique) in item.weTags" :key="unique">
{{ unit.name }}
</div>
</template>
</div>
</div>
<div class="divider"></div>
<!-- 社交关系 -->
<div class="realationship">
<div class="detail">
<div>社交关系</div>
<div class="data" @click="goRoute('/community')">详情</div>
</div>
<div class="detail">
<div class="boxnumber">
<p>添加的员工</p>
<div class="number">{{ staff.length }}</div>
</div>
<div class="boxnumber">
<p>添加的群聊</p>
<div class="number">{{ groupChat.length }}</div>
</div>
<div class="boxnumber">
<p>共同的群聊</p>
<div class="number">{{ commonGroup.length }}</div>
</div>
</div>
</div>
<div class="divider"></div>
<!-- 客户轨迹 -->
<div class="addwaiting">
<div class="detail">
<div>客户轨迹</div>
<div class="data" is-link @click="usershow = true">添加待办></div>
</div>
<van-tabs v-model="query.trajectoryType" @change="changeInfo">
<van-tab :name="1" title="信息动态"></van-tab>
<van-tab :name="2" title="社交动态"></van-tab>
<van-tab :name="3" title="活动动态"></van-tab>
<van-tab :name="4" title="待办动态"></van-tab>
</van-tabs>
<!-- 步骤条 -->
<div class="ac">
<van-loading v-if="loadingStep" type="spinner" />
</div>
<StepList :stepList="list" @reload="changeInfo()"></StepList>
</div>
<!-- 点击客户标签里的编辑触发弹出框开始 -->
<van-action-sheet v-model="show">
<van-nav-bar title="客户标签管理" right-text="取消" @click-right="show = false" />
<div class="content">
<div v-for="(item, index) in alllabel" :key="index">
<div class="mb10 mt5">{{ item.gourpName }}:</div>
<div class="labelstyle">
<div
v-for="(unit, unique) in item.weTags"
:key="unique"
class="label"
:style="addTag.some((e) => e.tagId == unit.tagId) ? isActive : ''"
@click="userLabel(unit)"
>
{{ unit.name }}
</div>
</div>
</div>
</div>
<van-button type="info" class="saveinfo" round @click="saveInfo">保存</van-button>
</van-action-sheet>
<!-- 点击客户标签里的编辑触发弹出框结束 -->
<!-- 点击添加待办触发弹出框开始 -->
<van-action-sheet v-model="usershow">
<van-nav-bar title="客户待办" right-text="取消" @click-right="usershow = false" />
<!-- 表单 -->
<van-form @submit="onSubmit">
<!-- 待办内容 -->
<van-field
v-model="conagency"
name="待办内容"
label="待办内容"
placeholder="请输入待办内容"
type="textarea"
required
:rules="[{ required: true, message: '请输入待办内容' }]"
class="conagency"
/>
<!-- 待办日期 -->
<van-field
v-model="dateagency"
is-link
readonly
label="待办日期"
placeholder="请选择"
@click="dateshow = true"
required
:rules="[{ required: true, message: '请输入待办日期' }]"
/>
<van-calendar v-model="dateshow" @confirm="onConfirm" color="#1989fa" :min-date="minDate" :max-date="maxDate" />
<!-- 待办时间 -->
<van-field
v-model="timeagency"
is-link
readonly
label="待办时间"
placeholder="请选择"
@click="starttimeshow = true"
required
:rules="[{ required: true, message: '请输入待办时间' }]"
/>
<van-action-sheet v-model="starttimeshow">
<van-datetime-picker
v-model="startTime"
type="time"
title="请选择开始时间"
:min-hour="0"
:max-hour="23"
@cancel="timecancel"
@confirm="starttimeconfirm"
/>
</van-action-sheet>
<van-action-sheet v-model="endtimeshow">
<van-datetime-picker
v-model="endTime"
type="time"
title="请选择结束时间"
:min-hour="minHour"
:max-hour="23"
@cancel="timecancel"
@confirm="endtimeconfirm"
/>
</van-action-sheet>
<!-- 保存 -->
<div style="margin: 30px">
<van-button round block type="info" native-type="submit" @click="saveInfo2">保存</van-button>
</div>
</van-form>
</van-action-sheet>
<!-- 点击添加待办触发弹出框结束 -->
<!-- <div class="divider"></div> -->
</div>
</template>
<script>
import {
getCustomerInfo,
getAllTags,
updateWeCustomerPorTraitTag,
findAddaddEmployes,
findAddGroupNum,
findTrajectory,
addOrEditWaitHandle
} from '@/api/portrait'
// import { getUserInfo } from "@/api/common";
import StepList from '@/components/StepList.vue'
import { param2Obj } from '@/utils/index'
export default {
components: {
StepList
},
data() {
return {
// 客户标签弹出框
show: false,
// 客户待办的弹出框开始
usershow: false,
conagency: '', // 待办内容
// 待办日期
dateagency: '',
dateshow: false,
minDate: new Date(),
maxDate: new Date(2030, 12, 31),
// 待办时间
timeagency: '',
starttimeshow: false,
endtimeshow: false,
currentTime: '12:00',
startTime: '',
endTime: '',
// 客户待办的弹出框结束
actions: [{ name: '选项一' }, { name: '选项二' }, { name: '选项三' }],
// active:false,
// 客户轨迹
// 待办动态
todonewsshow: false,
// 接口开始
// externalUserid: 'IdwmiGuBCgAAoCBD1frD3hRplbsXoBLx6g', // 客户IdwmiGuBCgAAoCBD1frD3hRplbsXoBLx6g
externalUserid: 'wmiGuBCgAAgeijfvvpJ62cBfwrB-c4kw',
form: {
name: '', // 昵称
remarkMobiles: '', // 手机号
age: '', // 年龄
birthday: '', // 客户生日
email: '', // 邮箱
address: '', // 地址
qq: '', // qq
position: '', // 职业
remarkCorpName: '', // 公司
description: '', // 其他描述
weTagGroupList: [] // 客户标签合集
},
alllabel: [], // 标签组
// 点击测试组标签获取的变量
groupId: '',
name: '',
tagId: '',
addTag: [], // 添加的参数
isActive: 'background:#1989fa;color:#fff',
styleActive1: '',
styleActive2: '',
styleActive3: '',
styleActive4: '',
// activelabel:true
staff: [], // 添加的员工
groupChat: [], // 添加的群聊
commonGroup: [], // 共同的群聊
// 客户轨迹
query: {
page: 1,
trajectoryType: 1
},
loading: false,
finished: false,
list: [],
agentId: '' || '1000012', // 1000012,
loadingStep: false
}
},
watch: {
'$store.state.agentConfigStatus'(val) {
// val && this.init()
}
},
computed: {
userId() {
return this.$store.state.userId || 'FengJuZhuDeJieDao'
},
// activeLabel : () => {
// this.addTag.forEach((value) => {
// value.name == this.name
// })
// return this.activelabel
// }
minHour() {
let date = new Date()
return this.dateagency == this.getTime() ? date.getHours() : 0
}
},
created() {
// this.$toast.loading({
// message: 'loading...',
// duration: 0,
// forbidClick: true
// })
// // 获取agentId
// let query = param2Obj(window.location.search)
// let hash = param2Obj(window.location.hash)
// query = Object.assign(query, hash)
// this.agentId = query.agentId
// console.log(agentId)
this.findAddaddEmployes()
this.findAddGroupNum()
this.getCustomerInfo()
this.findTrajectory()
getAllTags()
.then(({ data }) => {
this.alllabel = data
})
.catch((err) => {
console.log(err)
})
},
methods: {
// 时间处理器
getTime(data) {
const date = new Date()
// console.log(timer.getFullYear());
var Y = date.getFullYear() + '-'
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() + ''
return Y + M + D
},
init() {
let _this = this
wx.invoke('getContext', {}, function(res) {
if (res.err_msg == 'getContext:ok') {
let entry = res.entry //返回进入H5页面的入口类型,目前有normal、contact_profile、single_chat_tools、group_chat_tools
if (!['single_chat_tools', 'group_chat_tools', 'contact_profile'].includes(entry)) {
// _this.$toast.clear()
_this.$toast('入口错误:' + entry)
return
}
wx.invoke('getCurExternalContact', {}, (res) => {
if (res.err_msg == 'getCurExternalContact:ok') {
_this.externalUserid = res.userId //返回当前外部联系人userId
// 获取客户信息
_this.findAddaddEmployes()
_this.findAddGroupNum()
_this.getCustomerInfo()
_this.findTrajectory()
getAllTags()
.then(({ data }) => {
_this.alllabel = data
})
.catch((err) => {
console.log(err)
})
} else {
//错误处理
_this.$dialog({ message: '进入失败:' + JSON.stringify(res) })
}
_this.$toast.clear()
})
} else {
//错误处理
_this.$toast.clear()
_this.$dialog({ message: '进入失败:' + JSON.stringify(res) })
}
})
},
// 客户待办点击保存事件
saveInfo2() {},
// 添加或编辑轨迹
addOrEditWaitHandle(form) {
addOrEditWaitHandle(form)
.then((data) => {
// 重新获取列表
this.findAddaddEmployes()
this.findTrajectory()
if (data.code == 200) {
this.$toast.success('保存成功')
this.usershow = false
}
})
.catch((err) => {
console.log(err)
})
},
// 获取轨迹信息
findTrajectory(page) {
this.loadingStep = true
let query = {
pageNum: page,
pageSize: 10,
userId: this.userId,
externalUserid: this.externalUserid
}
Object.assign(query, this.query)
findTrajectory(query)
.then((data) => {
// console.log(data.total);
this.list = data.rows
this.loadingStep = false
})
.catch((err) => {
console.log(err)
this.loadingStep = false
})
},
// 点击信息动态
changeInfo() {
this.findTrajectory()
},
// 添加代办
// 表单提交
onSubmit() {
let form = {
trajectoryType: 4,
userId: this.userId,
externalUserid: this.externalUserid,
content: this.conagency,
createDate: this.dateagency,
startTime: `${this.dateagency} ${this.startTime}:00`,
endTime: `${this.dateagency} ${this.endTime}:00`,
status: 1,
agentId: this.agentId
}
this.addOrEditWaitHandle(form)
// 表单重置
this.conagency = ''
this.dateagency = ''
this.startTime = ''
this.endTime = ''
},
// 待办日期
formatDate(dateagency) {
return `${dateagency.getFullYear()}-${dateagency.getMonth() + 1}-${dateagency.getDate()}`
},
onConfirm(dateagency) {
this.dateshow = false
this.dateagency = this.formatDate(dateagency)
},
// 待办时间
timecancel() {
this.starttimeshow = false
},
starttimeconfirm(value) {
this.startTime = value
this.starttimeshow = false
this.endtimeshow = true
},
endtimeconfirm(value) {
this.endTime = value
this.endtimeshow = false
let time = ''
if (this.startTime > this.endTime) {
time = this.startTime
this.startTime = this.endTime
this.endTime = time
}
// console.log(this.startTime, this.endTime);
this.endtimeshow = false
this.timeagency = this.formatTime()
},
formatTime() {
return `${this.startTime}-${this.endTime}`
},
// 待办动态
// 点击删除按钮
deltodoshow() {},
goRoute(path) {
this.$router.push({
path,
query: {
customerId: this.externalUserid
// type
}
})
},
// 第一层标签
userLabel(item) {
let index = this.addTag.findIndex((e) => {
return item.tagId == e.tagId
})
// 数组里不存在该对象,则添加
if (index == -1) {
this.addTag.push({
groupId: item.groupId,
name: item.name,
tagId: item.tagId
})
} else {
// 数组里存在该对象,则删除
this.addTag.splice(index, 1)
}
},
saveInfo() {
// 更新客户画像标签 [{ groupId: this.groupId, name: this.name, tagId: this.tagId }]
updateWeCustomerPorTraitTag({
externalUserid: this.externalUserid,
userId: this.userId,
addTag: this.addTag
})
.then((res) => {
// console.log(res);
if (res.code == 200) {
this.show = false
// 重新获取客户标签
this.getCustomerInfo()
this.$toast.success('保存成功')
}
// console.log(123);
})
.catch((err) => {
console.log(err)
})
},
// 点击编辑按钮
labelEdit() {
this.show = true
if (this.form.weTagGroupList) {
this.form.weTagGroupList.forEach((ele) => {
this.addTag.push(...ele.weTags)
})
}
// 获取用户当前的lable,将当前用户的lable与所有lable进行对比,相同的弹框内蓝色展示
// 弹框内的标签组选中时蓝色展示
// 弹框内的子标签与选中时蓝色展示,点击时
},
findAddaddEmployes() {
findAddaddEmployes(this.externalUserid)
.then(({ data }) => {
// console.log(data);
this.staff = data
})
.catch((err) => {
console.log(err)
})
},
findAddGroupNum() {
// this.$toast('userId:' + this.userId)
findAddGroupNum({
externalUserid: this.externalUserid,
userId: this.userId
})
.then(({ data }) => {
// console.log(data);
this.groupChat = data
// console.log(this.groupChat);
this.commonGroup = this.groupChat.filter((ele) => {
// debugger
return ele.groupMemberNum == 1
})
// console.log(this.commonGroup);
})
.catch((err) => {
console.log(err)
})
},
getCustomerInfo() {
// this.$toast('userId:' + this.userId)
getCustomerInfo({
externalUserid: this.externalUserid,
userId: this.userId
})
.then(({ data }) => {
// console.log(data);
this.form = data
// console.log(this.form);
})
.catch((err) => {
console.log(err)
})
}
}
}
</script>
<style lang="less" scoped>
.header {
margin: 20px 10px 10px;
vertical-align: center;
text-align: center;
}
.van-icon-cross {
position: absolute;
left: 10px;
}
.title {
text-align: center;
}
// 详细资料
.details,
.userlabel,
.realationship,
.addwaiting {
margin: 10px;
}
.detail {
display: flex;
justify-content: space-between;
align-items: center;
.c9 {
color: #9c9c9c;
}
}
.left {
display: flex;
margin-bottom: 20px;
.img {
width: 40px;
height: 40px;
background-color: #f2f2f2;
margin-right: 10px;
}
.right {
display: flex;
flex-direction: column;
justify-content: space-between;
}
}
.data {
font-size: 12px;
color: #2c8cf0;
}
.divider {
width: 100%;
height: 10px;
background-color: #f2f2f2;
}
.content {
max-height: 60vh;
position: relative;
margin: 16px 0 60px;
padding: 0 16px;
overflow: auto;
}
.van-action-sheet__header {
.van-icon-cross {
left: 85%;
font-size: 16px;
}
}
// 客户标签
.labelstyle {
display: flex;
flex-wrap: wrap;
align-items: center;
.label {
display: inline-block;
min-width: 45px;
font-size: 12px;
padding: 4px 5px 3px;
// background-color: #f2f2f2;
color: #2c8cf0;
border: 1px solid #2c8cf0;
text-align: center;
margin: 0 0 10px 10px;
line-height: 16px;
border-radius: 4px;
}
}
.branch {
position: relative;
}
.saveinfo {
position: absolute;
width: 90%;
height: 30px;
left: 50%;
bottom: 0;
transform: translate(-50%, -50%);
}
// 社交关系
.boxnumber {
height: 60px;
width: 100%;
margin: 20px;
p {
font-size: 12px;
}
.number {
text-align: center;
margin-top: 20px;
font-size: 24px;
font-weight: 700;
}
}
.boxnumber:first-child {
border-right: 1px solid #f2f2f2;
padding-right: 16px;
}
.addwaiting {
.labelstyle {
.label1 {
width: 80px;
margin-bottom: 20px;
border-radius: 40px;
}
}
}
// 客户轨迹
.f12 {
color: #9c9c9c;
font-size: 12px;
font-weight: 600;
}
.po {
position: relative;
}
.fs14 {
color: #333;
font-size: 14px;
position: relative;
left: 20px;
}
.con {
left: 51px;
margin-top: 20px;
}
/deep/.van-step__circle {
width: 8px;
height: 8px;
margin-left: 110px;
}
/deep/.van-step__line {
left: 39px;
}
.finish {
position: relative;
color: #2c8cf0;
font-size: 12px;
font-weight: 600;
right: -165px;
}
.deldynamic {
float: right;
color: #9c9c9c;
font-size: 12px;
font-weight: 600;
}
.van-step--vertical:not(:last-child)::after {
border-width: 1px;
}
/deep/.conagency {
line-height: 40px;
flex-direction: column;
.van-field__control {
// background-color: #f2f2f2;
background-color: #f6fbff;
padding: 0 10px;
}
}
.iconfont {
color: #2c8cf0;
}
.icon-xingbie {
color: pink;
}
.van-divider {
margin: 10px 0;
}
</style>
<template>
<div>
<!-- 头部 -->
<!-- <div class="header">
<van-icon
name="cross"
color="#9c9c9c"
size="16"
@click="$router.back()"
/>
<span class="title"> 客户画像 </span>
</div>
<van-divider /> -->
<!-- 详细资料 -->
<div class="details">
<div class="detail">
<div class="left">
<div class="img"><img :src="form.avatar" alt="" /></div>
<div class="right">
<div>
<span
>{{
form.remark ? form.remark : (form.name || '') + (form.remarkCorpName ? '-' + form.remarkCorpName : '')
}}
&nbsp; &nbsp;</span
><span class="icon iconfont icon-man" v-if="form.gender == 1"></span>
<span class="icon iconfont icon-xingbie" v-else-if="form.gender == 2"></span>
<van-icon name="manager" color="#9c9c9c" v-else />
</div>
<div class="c9">
<span>昵称:</span><span>{{ form.name }}</span>
</div>
</div>
</div>
<div class="data" @click="goRoute('/customerDetail')">详细资料></div>
</div>
<div class="detail">
<div class="c9">手机号</div>
<div>{{ form.remarkMobiles }}</div>
</div>
<van-divider />
<div class="detail">
<div class="c9">年龄</div>
<div>{{ form.age }}</div>
</div>
<van-divider />
<div class="detail">
<div class="c9">生日</div>
<div>{{ form.birthday ? form.birthday.substring(0, 10) : '' }}</div>
</div>
<van-divider />
<div class="detail">
<div class="c9">邮箱</div>
<div>{{ form.email }}</div>
</div>
</div>
<div class="divider"></div>
<!-- 客户标签 -->
<div class="userlabel">
<div class="detail">
<div>客户标签</div>
<div class="data" is-link @click="labelEdit">编辑</div>
</div>
<div v-if="form.weTagGroupList" class="labelstyle mt10">
<template v-for="item in form.weTagGroupList">
<div class="label" v-for="(unit, unique) in item.weTags" :key="unique">
{{ unit.name }}
</div>
</template>
</div>
</div>
<div class="divider"></div>
<!-- 社交关系 -->
<div class="realationship">
<div class="detail">
<div>社交关系</div>
<div class="data" @click="goRoute('/community')">详情</div>
</div>
<div class="detail">
<div class="boxnumber">
<p>添加的员工</p>
<div class="number">{{ staff.length }}</div>
</div>
<div class="boxnumber">
<p>添加的群聊</p>
<div class="number">{{ groupChat.length }}</div>
</div>
<div class="boxnumber">
<p>共同的群聊</p>
<div class="number">{{ commonGroup.length }}</div>
</div>
</div>
</div>
<div class="divider"></div>
<!-- 客户轨迹 -->
<div class="addwaiting">
<div class="detail">
<div>客户轨迹</div>
<div class="data" is-link @click="usershow = true">添加待办></div>
</div>
<van-tabs v-model="query.trajectoryType" @change="changeInfo">
<van-tab :name="1" title="信息动态"></van-tab>
<van-tab :name="2" title="社交动态"></van-tab>
<van-tab :name="3" title="活动动态"></van-tab>
<van-tab :name="4" title="待办动态"></van-tab>
</van-tabs>
<!-- 步骤条 -->
<div class="ac">
<van-loading v-if="loadingStep" type="spinner" />
</div>
<StepList :stepList="list" @reload="changeInfo()"></StepList>
</div>
<!-- 点击客户标签里的编辑触发弹出框开始 -->
<van-action-sheet v-model="show">
<van-nav-bar title="客户标签管理" right-text="取消" @click-right="show = false" />
<div class="content">
<div v-for="(item, index) in alllabel" :key="index">
<div class="mb10 mt5">{{ item.gourpName }}:</div>
<div class="labelstyle">
<div
v-for="(unit, unique) in item.weTags"
:key="unique"
class="label"
:style="addTag.some((e) => e.tagId == unit.tagId) ? isActive : ''"
@click="userLabel(unit)"
>
{{ unit.name }}
</div>
</div>
</div>
</div>
<van-button type="info" class="saveinfo" round @click="saveInfo">保存</van-button>
</van-action-sheet>
<!-- 点击客户标签里的编辑触发弹出框结束 -->
<!-- 点击添加待办触发弹出框开始 -->
<van-action-sheet v-model="usershow">
<van-nav-bar title="客户待办" right-text="取消" @click-right="usershow = false" />
<!-- 表单 -->
<van-form @submit="onSubmit">
<!-- 待办内容 -->
<van-field
v-model="conagency"
name="待办内容"
label="待办内容"
placeholder="请输入待办内容"
type="textarea"
required
:rules="[{ required: true, message: '请输入待办内容' }]"
class="conagency"
/>
<!-- 待办日期 -->
<van-field
v-model="dateagency"
is-link
readonly
label="待办日期"
placeholder="请选择"
@click="dateshow = true"
required
:rules="[{ required: true, message: '请输入待办日期' }]"
/>
<van-calendar v-model="dateshow" @confirm="onConfirm" color="#1989fa" :min-date="minDate" :max-date="maxDate" />
<!-- 待办时间 -->
<van-field
v-model="timeagency"
is-link
readonly
label="待办时间"
placeholder="请选择"
@click="starttimeshow = true"
required
:rules="[{ required: true, message: '请输入待办时间' }]"
/>
<van-action-sheet v-model="starttimeshow">
<van-datetime-picker
v-model="startTime"
type="time"
title="请选择开始时间"
:min-hour="0"
:max-hour="23"
@cancel="timecancel"
@confirm="starttimeconfirm"
/>
</van-action-sheet>
<van-action-sheet v-model="endtimeshow">
<van-datetime-picker
v-model="endTime"
type="time"
title="请选择结束时间"
:min-hour="minHour"
:max-hour="23"
@cancel="timecancel"
@confirm="endtimeconfirm"
/>
</van-action-sheet>
<!-- 保存 -->
<div style="margin: 30px">
<van-button round block type="info" native-type="submit" @click="saveInfo2">保存</van-button>
</div>
</van-form>
</van-action-sheet>
<!-- 点击添加待办触发弹出框结束 -->
<!-- <div class="divider"></div> -->
</div>
</template>
<script>
import {
getCustomerInfo,
getAllTags,
updateWeCustomerPorTraitTag,
findAddaddEmployes,
findAddGroupNum,
findTrajectory,
addOrEditWaitHandle
} from '@/api/portrait'
// import { getUserInfo } from "@/api/common";
import StepList from '@/components/StepList.vue'
import { param2Obj } from '@/utils/index'
export default {
components: {
StepList
},
data() {
return {
// 客户标签弹出框
show: false,
// 客户待办的弹出框开始
usershow: false,
conagency: '', // 待办内容
// 待办日期
dateagency: '',
dateshow: false,
minDate: new Date(),
maxDate: new Date(2030, 12, 31),
// 待办时间
timeagency: '',
starttimeshow: false,
endtimeshow: false,
currentTime: '12:00',
startTime: '',
endTime: '',
// 客户待办的弹出框结束
actions: [{ name: '选项一' }, { name: '选项二' }, { name: '选项三' }],
// active:false,
// 客户轨迹
// 待办动态
todonewsshow: false,
// 接口开始
externalUserid: '',
// externalUserid: 'wmiGuBCgAAoCBD1frD3hRplbsXoBLx6g', // 客户IdwmiGuBCgAAoCBD1frD3hRplbsXoBLx6g
// externalUserid: 'wmiGuBCgAA617zOzAIg-0sZG3Vok7BUA',
form: {
name: '', // 昵称
remarkMobiles: '', // 手机号
age: '', // 年龄
birthday: '', // 客户生日
email: '', // 邮箱
address: '', // 地址
qq: '', // qq
position: '', // 职业
remarkCorpName: '', // 公司
description: '', // 其他描述
weTagGroupList: [] // 客户标签合集
},
alllabel: [], // 标签组
// 点击测试组标签获取的变量
groupId: '',
name: '',
tagId: '',
addTag: [], // 添加的参数
isActive: 'background:#1989fa;color:#fff',
styleActive1: '',
styleActive2: '',
styleActive3: '',
styleActive4: '',
// activelabel:true
staff: [], // 添加的员工
groupChat: [], // 添加的群聊
commonGroup: [], // 共同的群聊
// 客户轨迹
query: {
page: 1,
trajectoryType: 1
},
loading: false,
finished: false,
list: [],
agentId: '', // 1000012,
loadingStep: false
}
},
watch: {
'$store.state.agentConfigStatus'(val) {
val && this.init()
}
},
computed: {
userId() {
return this.$store.state.userId
// || 'FengJuZhuDeJieDao'
},
// activeLabel : () => {
// this.addTag.forEach((value) => {
// value.name == this.name
// })
// return this.activelabel
// }
minHour() {
let date = new Date()
return this.dateagency == this.getTime() ? date.getHours() : 0
}
},
created() {
this.$toast.loading({
message: 'loading...',
duration: 0,
forbidClick: true
})
// 获取agentId
let query = param2Obj(window.location.search)
let hash = param2Obj(window.location.hash)
query = Object.assign(query, hash)
this.agentId = query.agentId
console.log(agentId)
// this.findAddaddEmployes()
// this.findAddGroupNum()
// this.getCustomerInfo()
// this.findTrajectory()
// getAllTags()
// .then(({ data }) => {
// this.alllabel = data
// })
// .catch((err) => {
// console.log(err)
// })
},
methods: {
// 时间处理器
getTime(data) {
const date = new Date()
// console.log(timer.getFullYear());
var Y = date.getFullYear() + '-'
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() + ''
return Y + M + D
},
init() {
let _this = this
wx.invoke('getContext', {}, function(res) {
if (res.err_msg == 'getContext:ok') {
let entry = res.entry //返回进入H5页面的入口类型,目前有normal、contact_profile、single_chat_tools、group_chat_tools
if (!['single_chat_tools', 'group_chat_tools', 'contact_profile'].includes(entry)) {
// _this.$toast.clear()
_this.$toast('入口错误:' + entry)
return
}
wx.invoke('getCurExternalContact', {}, (res) => {
if (res.err_msg == 'getCurExternalContact:ok') {
_this.externalUserid = res.userId //返回当前外部联系人userId
// 获取客户信息
_this.findAddaddEmployes()
_this.findAddGroupNum()
_this.getCustomerInfo()
_this.findTrajectory()
getAllTags()
.then(({ data }) => {
_this.alllabel = data
})
.catch((err) => {
console.log(err)
})
} else {
//错误处理
_this.$dialog({ message: '进入失败:' + JSON.stringify(res) })
}
_this.$toast.clear()
})
} else {
//错误处理
_this.$toast.clear()
_this.$dialog({ message: '进入失败:' + JSON.stringify(res) })
}
})
},
// 客户待办点击保存事件
saveInfo2() {},
// 添加或编辑轨迹
addOrEditWaitHandle(form) {
addOrEditWaitHandle(form)
.then((data) => {
// 重新获取列表
this.findAddaddEmployes()
this.findTrajectory()
if (data.code == 200) {
this.$toast.success('保存成功')
this.usershow = false
}
})
.catch((err) => {
console.log(err)
})
},
// 获取轨迹信息
findTrajectory(page) {
this.loadingStep = true
let query = {
pageNum: page,
pageSize: 10,
userId: this.userId,
externalUserid: this.externalUserid
}
Object.assign(query, this.query)
findTrajectory(query)
.then((data) => {
// console.log(data.total);
this.list = data.rows
this.loadingStep = false
})
.catch((err) => {
console.log(err)
this.loadingStep = false
})
},
// 点击信息动态
changeInfo() {
this.findTrajectory()
},
// 添加代办
// 表单提交
onSubmit() {
let form = {
trajectoryType: 4,
userId: this.userId,
externalUserid: this.externalUserid,
content: this.conagency,
createDate: this.dateagency,
startTime: `${this.dateagency} ${this.startTime}:00`,
endTime: `${this.dateagency} ${this.endTime}:00`,
status: 1,
agentId: this.agentId
}
this.addOrEditWaitHandle(form)
// 表单重置
this.conagency = ''
this.dateagency = ''
this.startTime = ''
this.endTime = ''
},
// 待办日期
formatDate(dateagency) {
return `${dateagency.getFullYear()}-${dateagency.getMonth() + 1}-${dateagency.getDate()}`
},
onConfirm(dateagency) {
this.dateshow = false
this.dateagency = this.formatDate(dateagency)
},
// 待办时间
timecancel() {
this.starttimeshow = false
},
starttimeconfirm(value) {
this.startTime = value
this.starttimeshow = false
this.endtimeshow = true
},
endtimeconfirm(value) {
this.endTime = value
this.endtimeshow = false
let time = ''
if (this.startTime > this.endTime) {
time = this.startTime
this.startTime = this.endTime
this.endTime = time
}
// console.log(this.startTime, this.endTime);
this.endtimeshow = false
this.timeagency = this.formatTime()
},
formatTime() {
return `${this.startTime}-${this.endTime}`
},
// 待办动态
// 点击删除按钮
deltodoshow() {},
goRoute(path) {
this.$router.push({
path,
query: {
customerId: this.externalUserid
// type
}
})
},
// 第一层标签
userLabel(item) {
let index = this.addTag.findIndex((e) => {
return item.tagId == e.tagId
})
// 数组里不存在该对象,则添加
if (index == -1) {
this.addTag.push({
groupId: item.groupId,
name: item.name,
tagId: item.tagId
})
} else {
// 数组里存在该对象,则删除
this.addTag.splice(index, 1)
}
},
saveInfo() {
// 更新客户画像标签 [{ groupId: this.groupId, name: this.name, tagId: this.tagId }]
updateWeCustomerPorTraitTag({
externalUserid: this.externalUserid,
userId: this.userId,
addTag: this.addTag
})
.then((res) => {
// console.log(res);
if (res.code == 200) {
this.show = false
// 重新获取客户标签
this.getCustomerInfo()
this.$toast.success('保存成功')
}
// console.log(123);
})
.catch((err) => {
console.log(err)
})
},
// 点击编辑按钮
labelEdit() {
this.show = true
if (this.form.weTagGroupList) {
this.form.weTagGroupList.forEach((ele) => {
this.addTag.push(...ele.weTags)
})
}
// 获取用户当前的lable,将当前用户的lable与所有lable进行对比,相同的弹框内蓝色展示
// 弹框内的标签组选中时蓝色展示
// 弹框内的子标签与选中时蓝色展示,点击时
},
findAddaddEmployes() {
findAddaddEmployes(this.externalUserid)
.then(({ data }) => {
// console.log(data);
this.staff = data
})
.catch((err) => {
console.log(err)
})
},
findAddGroupNum() {
// this.$toast('userId:' + this.userId)
findAddGroupNum({
externalUserid: this.externalUserid,
userId: this.userId
})
.then(({ data }) => {
// console.log(data);
this.groupChat = data
// console.log(this.groupChat);
this.commonGroup = this.groupChat.filter((ele) => {
// debugger
return ele.groupMemberNum == 1
})
// console.log(this.commonGroup);
})
.catch((err) => {
console.log(err)
})
},
getCustomerInfo() {
// this.$toast('userId:' + this.userId)
getCustomerInfo({
externalUserid: this.externalUserid,
userId: this.userId
})
.then(({ data }) => {
// console.log(data);
this.form = data
// console.log(this.form);
})
.catch((err) => {
console.log(err)
})
}
}
}
</script>
<style lang="less" scoped>
.header {
margin: 20px 10px 10px;
vertical-align: center;
text-align: center;
}
.van-icon-cross {
position: absolute;
left: 10px;
}
.title {
text-align: center;
}
// 详细资料
.details,
.userlabel,
.realationship,
.addwaiting {
margin: 10px;
}
.detail {
display: flex;
justify-content: space-between;
align-items: center;
.c9 {
color: #9c9c9c;
}
}
.left {
display: flex;
margin-bottom: 20px;
.img {
width: 40px;
height: 40px;
background-color: #f2f2f2;
margin-right: 10px;
}
.right {
display: flex;
flex-direction: column;
justify-content: space-between;
}
}
.data {
font-size: 12px;
color: #2c8cf0;
}
.divider {
width: 100%;
height: 10px;
background-color: #f2f2f2;
}
.content {
max-height: 60vh;
position: relative;
margin: 16px 0 60px;
padding: 0 16px;
overflow: auto;
}
.van-action-sheet__header {
.van-icon-cross {
left: 85%;
font-size: 16px;
}
}
// 客户标签
.labelstyle {
display: flex;
flex-wrap: wrap;
align-items: center;
.label {
display: inline-block;
min-width: 45px;
font-size: 12px;
padding: 4px 5px 3px;
// background-color: #f2f2f2;
color: #2c8cf0;
border: 1px solid #2c8cf0;
text-align: center;
margin: 0 0 10px 10px;
line-height: 16px;
border-radius: 4px;
}
}
.branch {
position: relative;
}
.saveinfo {
position: absolute;
width: 90%;
height: 30px;
left: 50%;
bottom: 0;
transform: translate(-50%, -50%);
}
// 社交关系
.boxnumber {
height: 60px;
width: 100%;
margin: 20px;
p {
font-size: 12px;
}
.number {
text-align: center;
margin-top: 20px;
font-size: 24px;
font-weight: 700;
}
}
.boxnumber:first-child {
border-right: 1px solid #f2f2f2;
padding-right: 16px;
}
.addwaiting {
.labelstyle {
.label1 {
width: 80px;
margin-bottom: 20px;
border-radius: 40px;
}
}
}
// 客户轨迹
.f12 {
color: #9c9c9c;
font-size: 12px;
font-weight: 600;
}
.po {
position: relative;
}
.fs14 {
color: #333;
font-size: 14px;
position: relative;
left: 20px;
}
.con {
left: 51px;
margin-top: 20px;
}
/deep/.van-step__circle {
width: 8px;
height: 8px;
margin-left: 110px;
}
/deep/.van-step__line {
left: 39px;
}
.finish {
position: relative;
color: #2c8cf0;
font-size: 12px;
font-weight: 600;
right: -165px;
}
.deldynamic {
float: right;
color: #9c9c9c;
font-size: 12px;
font-weight: 600;
}
.van-step--vertical:not(:last-child)::after {
border-width: 1px;
}
/deep/.conagency {
line-height: 40px;
flex-direction: column;
.van-field__control {
// background-color: #f2f2f2;
background-color: #f6fbff;
padding: 0 10px;
}
}
.iconfont {
color: #2c8cf0;
}
.icon-xingbie {
color: pink;
}
.van-divider {
margin: 10px 0;
}
</style>
package com.linkwechat.quartz.task; package com.linkwechat.quartz.task;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.enums.MessageType; import com.linkwechat.common.enums.MessageType;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.domain.*; import com.linkwechat.wecom.domain.WeGroupMessageAttachments;
import com.linkwechat.wecom.domain.dto.WeMediaDto; import com.linkwechat.wecom.domain.WeGroupMessageList;
import com.linkwechat.wecom.domain.WeGroupMessageSendResult;
import com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto; import com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto;
import com.linkwechat.wecom.domain.query.WeAddMsgTemplateQuery; import com.linkwechat.wecom.domain.query.WeAddMsgTemplateQuery;
import com.linkwechat.wecom.service.*; import com.linkwechat.wecom.service.IWeGroupMessageAttachmentsService;
import com.linkwechat.wecom.service.IWeGroupMessageListService;
import com.linkwechat.wecom.service.IWeGroupMessageSendResultService;
import com.linkwechat.wecom.service.IWeGroupMessageTaskService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -30,22 +36,16 @@ import java.util.Optional; ...@@ -30,22 +36,16 @@ import java.util.Optional;
public class PullGroupMessageTask { public class PullGroupMessageTask {
@Autowired @Autowired
private IWeGroupMessageTemplateService groupMessageTemplateService;
@Autowired
private IWeGroupMessageListService groupMessageListService; private IWeGroupMessageListService groupMessageListService;
@Autowired @Autowired
private IWeGroupMessageAttachmentsService attachmentsService; private IWeGroupMessageAttachmentsService attachmentsService;
@Autowired @Autowired
private IWeGroupMessageTaskService groupMessageTaskService;
@Autowired
private IWeGroupMessageSendResultService sendResultService; private IWeGroupMessageSendResultService sendResultService;
@Autowired @Autowired
private IWeMaterialService weMaterialService; private IWeGroupMessageTaskService iWeGroupMessageTaskService;
/** /**
* 同步开始时间 * 同步开始时间
...@@ -72,33 +72,33 @@ public class PullGroupMessageTask { ...@@ -72,33 +72,33 @@ public class PullGroupMessageTask {
} else if (ObjectUtil.equal("3", type)) { } else if (ObjectUtil.equal("3", type)) {
startTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -30)).getTime() / 1000; startTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -30)).getTime() / 1000;
endTime = DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1)).getTime() / 1000; endTime = DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1)).getTime() / 1000;
pullGroupMsgList(); ThreadUtil.execAsync(this::pullSingleMsgList);
return; return;
} else if (ObjectUtil.equal("4", type)) { } else if (ObjectUtil.equal("4", type)) {
startTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -30)).getTime() / 1000; startTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -30)).getTime() / 1000;
endTime = DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1)).getTime() / 1000; endTime = DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1)).getTime() / 1000;
pullGroupMsgList(); ThreadUtil.execAsync(this::pullGroupMsgList);
return; return;
} else if (ObjectUtil.equal("5", type)) { } else if (ObjectUtil.equal("5", type)) {
startTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1)).getTime() / 1000; startTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1)).getTime() / 1000;
endTime = DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1)).getTime() / 1000; endTime = DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1)).getTime() / 1000;
pullSingleMsgList(); ThreadUtil.execAsync(this::pullSingleMsgList);
return; return;
} else if (ObjectUtil.equal("6", type)) { } else if (ObjectUtil.equal("6", type)) {
startTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1)).getTime() / 1000; startTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1)).getTime() / 1000;
endTime = DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1)).getTime() / 1000; endTime = DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1)).getTime() / 1000;
pullGroupMsgList(); ThreadUtil.execAsync(this::pullGroupMsgList);
return; return;
} }
pullGroupMsgList(); ThreadUtil.execAsync(this::pullSingleMsgList);
pullSingleMsgList(); ThreadUtil.execAsync(this::pullGroupMsgList);
} }
//拉取发送给客户的群发消息 //拉取发送给客户的群发消息
private void pullSingleMsgList() { private void pullSingleMsgList() {
WeGroupMsgListDto singleMsgList = groupMessageListService.getGroupMsgList("single", startTime, endTime, null); WeGroupMsgListDto singleMsgList = groupMessageListService.getGroupMsgList("single", startTime, endTime, null);
List<WeGroupMessageList> weGroupMessageLists = saveGroupMsg(singleMsgList, "single"); saveGroupMsg(singleMsgList);
pullGroupMsgSendResult(weGroupMessageLists); pullGroupMsgSendResult(singleMsgList);
} }
...@@ -106,24 +106,17 @@ public class PullGroupMessageTask { ...@@ -106,24 +106,17 @@ public class PullGroupMessageTask {
private void pullGroupMsgList() { private void pullGroupMsgList() {
//拉取发送给客户的群发消息 //拉取发送给客户的群发消息
WeGroupMsgListDto groupMsgList = groupMessageListService.getGroupMsgList("group", startTime, endTime, null); WeGroupMsgListDto groupMsgList = groupMessageListService.getGroupMsgList("group", startTime, endTime, null);
List<WeGroupMessageList> weGroupMessageLists = saveGroupMsg(groupMsgList, "group"); saveGroupMsg(groupMsgList);
pullGroupMsgSendResult(weGroupMessageLists); pullGroupMsgSendResult(groupMsgList);
} }
/** //保存消息入库
* 保存消息入库 private void saveGroupMsg(WeGroupMsgListDto groupMsgList) {
*
* @param groupMsgList
* @param chatType
*/
private List<WeGroupMessageList> saveGroupMsg(WeGroupMsgListDto groupMsgList, String chatType) {
List<WeGroupMessageAttachments> attachmentList = new ArrayList<>();
List<WeGroupMessageList> saveGroupMessageList = new ArrayList<>();
Optional.ofNullable(groupMsgList).map(WeGroupMsgListDto::getGroupMsgList) Optional.ofNullable(groupMsgList).map(WeGroupMsgListDto::getGroupMsgList)
.orElseGet(ArrayList::new).forEach(weGroupMsg -> { .orElseGet(ArrayList::new).forEach(weGroupMsg -> {
WeGroupMessageList weGroupMessageList = new WeGroupMessageList(); WeGroupMessageList weGroupMessageList = new WeGroupMessageList();
weGroupMessageList.setMsgId(weGroupMsg.getMsgId()); weGroupMessageList.setMsgId(weGroupMsg.getMsgId());
weGroupMessageList.setChatType(chatType); weGroupMessageList.setChatType("single");
weGroupMessageList.setCreateType(weGroupMsg.getCreateType()); weGroupMessageList.setCreateType(weGroupMsg.getCreateType());
weGroupMessageList.setSendTime(new Date(weGroupMsg.getCreateTime() * 1000)); weGroupMessageList.setSendTime(new Date(weGroupMsg.getCreateTime() * 1000));
weGroupMessageList.setUserId(weGroupMsg.getCreator()); weGroupMessageList.setUserId(weGroupMsg.getCreator());
...@@ -131,54 +124,29 @@ public class PullGroupMessageTask { ...@@ -131,54 +124,29 @@ public class PullGroupMessageTask {
.eq(WeGroupMessageList::getMsgId, weGroupMsg.getMsgId()).last("limit 1")); .eq(WeGroupMessageList::getMsgId, weGroupMsg.getMsgId()).last("limit 1"));
if (weGroupMessage != null) { if (weGroupMessage != null) {
weGroupMessageList.setId(weGroupMessage.getId()); weGroupMessageList.setId(weGroupMessage.getId());
saveGroupMessageList.add(weGroupMessageList); groupMessageListService.updateById(weGroupMessageList);
} else {
List<WeGroupMessageAttachments> attachmentTempList = new ArrayList<>();
WeGroupMessageTemplate weGroupMessageTemplate = new WeGroupMessageTemplate();
if (ObjectUtil.equal("single", chatType)) {
weGroupMessageTemplate.setChatType(1);
} else { } else {
weGroupMessageTemplate.setChatType(2); if (groupMessageListService.save(weGroupMessageList)) {
} List<WeGroupMessageAttachments> attachmentList = new ArrayList<>();
weGroupMessageTemplate.setSendTime(weGroupMessageList.getSendTime());
weGroupMessageTemplate.setStatus(1);
weGroupMessageTemplate.setIsTask(0);
String content = Optional.ofNullable(weGroupMsg.getText()).map(WeAddMsgTemplateQuery.Text::getContent).orElse(""); String content = Optional.ofNullable(weGroupMsg.getText()).map(WeAddMsgTemplateQuery.Text::getContent).orElse("");
if (StringUtils.isNotEmpty(content)) { if (StringUtils.isNotEmpty(content)) {
weGroupMessageTemplate.setContent(content);
WeGroupMessageAttachments attachment = new WeGroupMessageAttachments(); WeGroupMessageAttachments attachment = new WeGroupMessageAttachments();
attachment.setMsgId(weGroupMsg.getMsgId());
attachment.setMsgType("text"); attachment.setMsgType("text");
attachment.setContent(content); attachment.setContent(content);
attachmentTempList.add(attachment); attachmentList.add(attachment);
} }
List<JSONObject> attachments = weGroupMsg.getAttachments(); List<JSONObject> attachments = weGroupMsg.getAttachments();
Optional.ofNullable(attachments).orElseGet(ArrayList::new).forEach(attachment -> { Optional.ofNullable(attachments).orElseGet(ArrayList::new).forEach(attachment -> {
String msgtype = attachment.getString("msgtype"); String msgtype = attachment.getString("msgtype");
JSONObject msgObject = attachment.getJSONObject(msgtype); JSONObject msgObject = attachment.getJSONObject(msgtype);
WeGroupMessageAttachments messageAttachment = new WeGroupMessageAttachments(); WeGroupMessageAttachments messageAttachment = new WeGroupMessageAttachments();
messageAttachment.setMsgId(weGroupMsg.getMsgId());
messageAttachment.setMsgType(msgtype); messageAttachment.setMsgType(msgtype);
String mediaId = msgObject.getString("media_id") == null ? msgObject.getString("pic_media_id")
: msgObject.getString("media_id"); MessageType messageType = MessageType.valueOf(msgtype);
WeMediaDto weMediaDto = null;
if (StringUtils.isNotEmpty(mediaId)) {
try {
weMediaDto = weMaterialService.getMediaToResponse(mediaId);
} catch (Exception e) {
log.info("获取素材信息失败.........." + e.getMessage());
}
}
MessageType messageType = MessageType.messageTypeOf(msgtype);
switch (messageType) { switch (messageType) {
case IMAGE: case IMAGE:
//messageAttachment.setMediaId(msgObject.getString("media_id")); messageAttachment.setMediaId(msgObject.getString("media_id"));
messageAttachment.setMediaId(mediaId);
messageAttachment.setPicUrl(msgObject.getString("pic_url")); messageAttachment.setPicUrl(msgObject.getString("pic_url"));
if (weMediaDto != null) {
messageAttachment.setPicUrl(weMediaDto.getUrl());
}
break; break;
case LINK: case LINK:
messageAttachment.setTitle(msgObject.getString("title")); messageAttachment.setTitle(msgObject.getString("title"));
...@@ -188,61 +156,36 @@ public class PullGroupMessageTask { ...@@ -188,61 +156,36 @@ public class PullGroupMessageTask {
break; break;
case MINIPROGRAM: case MINIPROGRAM:
messageAttachment.setTitle(msgObject.getString("title")); messageAttachment.setTitle(msgObject.getString("title"));
//messageAttachment.setMediaId(msgObject.getString("pic_media_id")); messageAttachment.setMediaId(msgObject.getString("pic_media_id"));
messageAttachment.setMediaId(mediaId);
messageAttachment.setAppId(msgObject.getString("appid")); messageAttachment.setAppId(msgObject.getString("appid"));
messageAttachment.setLinkUrl(msgObject.getString("page")); messageAttachment.setLinkUrl(msgObject.getString("page"));
if (weMediaDto != null) {
messageAttachment.setPicUrl(weMediaDto.getUrl());
}
break; break;
case VIDEO: case VIDEO:
case FILE: case FILE:
//messageAttachment.setMediaId(msgObject.getString("media_id")); messageAttachment.setMediaId(msgObject.getString("media_id"));
messageAttachment.setMediaId(mediaId);
if (weMediaDto != null) {
messageAttachment.setFileUrl(weMediaDto.getUrl());
}
break; break;
default: default:
break; break;
} }
attachmentTempList.add(messageAttachment); attachmentList.add(messageAttachment);
}); });
if (groupMessageTemplateService.save(weGroupMessageTemplate)) { attachmentsService.saveBatch(attachmentList);
weGroupMessageList.setMsgTemplateId(weGroupMessageTemplate.getId());
saveGroupMessageList.add(weGroupMessageList);
attachmentTempList.forEach(item -> item.setMsgTemplateId(weGroupMessageTemplate.getId()));
attachmentList.addAll(attachmentTempList);
} }
} }
}); });
groupMessageListService.saveOrUpdateBatch(saveGroupMessageList);
attachmentsService.saveBatch(attachmentList);
return saveGroupMessageList;
} }
/** /**
* 企业群发成员执行结果 * 企业群发成员执行结果
* *
* @param weGroupMessageLists * @param groupMsgList
*/ */
public void pullGroupMsgSendResult(List<WeGroupMessageList> weGroupMessageLists) { public void pullGroupMsgSendResult(WeGroupMsgListDto groupMsgList) {
List<WeGroupMessageTask> taskList = new ArrayList<>(); List<WeGroupMessageSendResult> list = new ArrayList<>();
List<WeGroupMessageSendResult> sendResultlist = new ArrayList<>(); Optional.ofNullable(groupMsgList).map(WeGroupMsgListDto::getGroupMsgList)
Optional.ofNullable(weGroupMessageLists).orElseGet(ArrayList::new).forEach(weGroupMsg -> { .orElseGet(ArrayList::new).forEach(weGroupMsg -> {
WeGroupMsgListDto groupMsgTask = groupMessageTaskService.getGroupMsgTask(weGroupMsg.getMsgId(), null); WeGroupMsgListDto groupMsgTask = iWeGroupMessageTaskService.getGroupMsgTask(weGroupMsg.getMsgId(), null);
Optional.ofNullable(groupMsgTask).map(WeGroupMsgListDto::getTaskList).orElseGet(ArrayList::new).forEach(msgTask -> { Optional.ofNullable(groupMsgTask).map(WeGroupMsgListDto::getTaskList).orElseGet(ArrayList::new).forEach(msgTask -> {
WeGroupMessageTask messageTask = new WeGroupMessageTask();
messageTask.setMsgId(weGroupMsg.getMsgId());
messageTask.setUserId(msgTask.getUserId());
if (msgTask.getSendTime() != null) {
messageTask.setSendTime(new Date(msgTask.getSendTime() * 1000));
}
messageTask.setStatus(msgTask.getStatus());
messageTask.setMsgTemplateId(weGroupMsg.getMsgTemplateId());
taskList.add(messageTask);
WeGroupMsgListDto groupMsgSendResult = sendResultService.getGroupMsgSendResult(weGroupMsg.getMsgId(), msgTask.getUserId(), null); WeGroupMsgListDto groupMsgSendResult = sendResultService.getGroupMsgSendResult(weGroupMsg.getMsgId(), msgTask.getUserId(), null);
Optional.ofNullable(groupMsgSendResult).map(WeGroupMsgListDto::getSendList).orElseGet(ArrayList::new).forEach(sendResult -> { Optional.ofNullable(groupMsgSendResult).map(WeGroupMsgListDto::getSendList).orElseGet(ArrayList::new).forEach(sendResult -> {
WeGroupMessageSendResult messageSendResult = new WeGroupMessageSendResult(); WeGroupMessageSendResult messageSendResult = new WeGroupMessageSendResult();
...@@ -250,16 +193,22 @@ public class PullGroupMessageTask { ...@@ -250,16 +193,22 @@ public class PullGroupMessageTask {
messageSendResult.setUserId(msgTask.getUserId()); messageSendResult.setUserId(msgTask.getUserId());
messageSendResult.setChatId(sendResult.getChatId()); messageSendResult.setChatId(sendResult.getChatId());
messageSendResult.setExternalUserid(sendResult.getExternalUserId()); messageSendResult.setExternalUserid(sendResult.getExternalUserId());
if (sendResult.getSendTime() != null) {
messageSendResult.setSendTime(new Date(sendResult.getSendTime() * 1000)); messageSendResult.setSendTime(new Date(sendResult.getSendTime() * 1000));
}
messageSendResult.setStatus(sendResult.getStatus()); messageSendResult.setStatus(sendResult.getStatus());
messageSendResult.setMsgTemplateId(weGroupMsg.getMsgTemplateId()); list.add(messageSendResult);
sendResultlist.add(messageSendResult);
}); });
}); });
}); });
groupMessageTaskService.addOrUpdateBatchByCondition(taskList); if (CollectionUtil.isNotEmpty(list)) {
sendResultService.addOrUpdateBatchByCondition(sendResultlist); list.forEach(item -> {
if (!sendResultService.update(item, new LambdaQueryWrapper<WeGroupMessageSendResult>()
.eq(WeGroupMessageSendResult::getMsgId, item.getMsgId())
.eq(WeGroupMessageSendResult::getExternalUserid, item.getExternalUserid())
.eq(WeGroupMessageSendResult::getUserId, item.getUserId())
.eq(WeGroupMessageSendResult::getChatId, item.getChatId()))) {
sendResultService.save(item);
}
});
}
} }
} }
...@@ -4,3 +4,5 @@ ENV = 'development' ...@@ -4,3 +4,5 @@ ENV = 'development'
# 基础api(根据实际情况,自行配置,下为示例) # 基础api(根据实际情况,自行配置,下为示例)
VUE_APP_BASE_API = 'http://demo.linkwechat.cn/api' VUE_APP_BASE_API = 'http://demo.linkwechat.cn/api'
# 路由基础路径
VUE_APP_BASE_URL = '/'
\ No newline at end of file \ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
ENV = 'production' ENV = 'production'
# 基础api # 基础api
VUE_APP_BASE_API = 'http://demo.linkwechat.cn' VUE_APP_BASE_API = 'http://demo.linkwechat.cn/api'
# 路由基础路径 # 路由基础路径
VUE_APP_BASE_URL = '/' VUE_APP_BASE_URL = '/'
\ No newline at end of file \ No newline at end of file
{
"name": "linkwechat",
"version": "0.1.0",
"description": "LinkWeChat",
"license": "GPL-3.0",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"build:test": "vue-cli-service build --mode test",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src",
"test:unit": "jest --clearCache && vue-cli-service test:unit",
"test:ci": "npm run lint && npm run test:unit",
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
"new": "plop"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,vue}": [
"eslint --fix",
"git add"
]
},
"keywords": [
"vue",
"admin",
"dashboard",
"element-ui",
"boilerplate",
"admin-wechat",
"management-system"
],
"repository": {
"type": "git",
"url": "https://gitee.com/LinkWeChat/link-wechat.git"
},
"dependencies": {
"@liripeng/vue-audio-player": "^1.2.8",
"@riophae/vue-treeselect": "0.4.0",
"awesome-qr": "^2.0.1-rc.0",
"axios": "0.18.1",
"clipboard": "2.0.4",
"core-js": "3.6.5",
"echarts": "4.2.1",
"element-resize-detector": "^1.2.2",
"element-ui": "^2.15.2",
"fabric": "^4.6.0",
"file-saver": "2.0.1",
"fuse.js": "3.4.4",
"js-beautify": "1.10.2",
"js-cookie": "2.2.0",
"jsencrypt": "3.0.0-rc.1",
"moment": "^2.29.1",
"normalize.css": "^8.0.1",
"nprogress": "0.2.0",
"path-to-regexp": "2.4.0",
"promise.prototype.finally": "^3.1.2",
"screenfull": "4.2.0",
"sortablejs": "1.8.4",
"uuid": "^8.3.2",
"video.js": "^7.11.4",
"videojs-contrib-hls": "^5.15.0",
"vue": "2.6.10",
"vue-amap": "^0.5.10",
"vue-count-to": "1.0.13",
"vue-cropper": "0.4.9",
"vue-quill-editor": "3.0.6",
"vue-router": "3.0.2",
"vue-splitpane": "1.0.4",
"vue-ueditor-wrap": "^2.4.4",
"vue-video-player": "^5.0.2",
"vuedraggable": "2.20.0",
"vuex": "3.1.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "4.4.4",
"@vue/cli-plugin-eslint": "4.4.4",
"@vue/cli-plugin-unit-jest": "4.4.4",
"@vue/cli-service": "4.4.4",
"@vue/test-utils": "1.0.0-beta.29",
"autoprefixer": "9.5.1",
"babel-eslint": "10.1.0",
"babel-jest": "23.6.0",
"babel-plugin-dynamic-import-node": "2.3.3",
"chalk": "2.4.2",
"chokidar": "2.1.5",
"connect": "3.6.6",
"eslint": "6.7.2",
"eslint-plugin-vue": "6.2.2",
"html-webpack-plugin": "3.2.0",
"husky": "1.3.1",
"lint-staged": "8.1.5",
"mockjs": "1.0.1-beta3",
"node-sass": "4.14.1",
"plop": "2.3.0",
"runjs": "4.3.2",
"sass-loader": "8.0.2",
"sass-resources-loader": "^2.1.0",
"script-ext-html-webpack-plugin": "2.1.3",
"script-loader": "0.7.2",
"serve-static": "1.13.2",
"svg-sprite-loader": "4.1.3",
"svgo": "1.2.0",
"vue-template-compiler": "2.6.10"
},
"engines": {
"node": ">=8.9",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
<template>
<div class="navbar main-size">
<logo />
<el-scrollbar class="nav-scrollbar">
<template v-for="(route, index) in permission_routes">
<div
v-if="!route.hidden"
:class="['nav', $route.path.startsWith(route.path) && 'active']"
:key="route.path + index"
@click="goLink(route.path)"
>
{{ route.meta && route.meta.title }}
</div>
</template>
</el-scrollbar>
<div class="right-menu">
<template v-if="device !== 'mobile'">
<!-- <search id="header-search" class="right-menu-item" /> -->
<el-tooltip content="源码地址" effect="dark" placement="bottom">
<div class="right-menu-item hover-effect">
<svg-icon icon-class="github" @click="goto(0)" />
</div>
</el-tooltip>
<el-tooltip content="文档地址" effect="dark" placement="bottom">
<div class="right-menu-item hover-effect">
<i class="el-icon-reading document" @click="goto(1)"></i>
<!-- <svg-icon icon-class="question" @click="goto(1)" /> -->
</div>
</el-tooltip>
<screenfull id="screenfull" class="right-menu-item hover-effect" />
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
仟微
<!-- <img :src="avatar" class="user-avatar"> -->
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
<router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item>
</router-link>
<el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
</template>
<script>
import { isExternal } from '@/utils/validate'
import { mapGetters } from 'vuex'
import Logo from './Logo'
import Search from '@/components/HeaderSearch'
import screenfull from '@/components/Screenfull'
export default {
components: {
Logo,
Search,
screenfull
},
computed: {
...mapGetters(['avatar', 'device', 'permission_routes']),
setting: {
get() {
return this.$store.state.settings.showSettings
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val
})
}
}
},
mounted() {
// console.log(this.permission_routes)
},
methods: {
async logout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = process.env.VUE_APP_BASE_URL
})
})
},
goto(type) {
window.open(type ? 'https://www.yuque.com/linkwechat/help/dsatfs' : 'https://gitee.com/LinkWeChat/link-wechat')
},
goLink(path) {
if (!isExternal(path)) {
this.$router.push({ path })
} else {
window.open(path, '_blank')
}
}
}
}
</script>
<style lang="scss" scoped>
.navbar {
display: flex;
align-items: center;
width: 100%;
height: 100%;
overflow: hidden;
position: relative;
color: #fff;
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.errLog-container {
display: inline-block;
vertical-align: top;
}
.right-menu {
position: absolute;
right: 0;
&:focus {
outline: none;
}
.right-menu-item {
display: inline-block;
padding: 0 8px;
font-size: 18px;
// color: #5a5e66;
vertical-align: middle;
&.hover-effect {
cursor: pointer;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
.document {
font-size: 20px;
}
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
position: relative;
color: #fff;
.user-avatar {
cursor: pointer;
width: 40px;
height: 40px;
border-radius: 10px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 5px;
font-size: 12px;
}
}
}
}
}
.nav-scrollbar {
width: calc(100% - 450px);
/deep/.el-scrollbar__view {
white-space: nowrap;
line-height: 58px;
}
.nav {
display: inline-block;
margin: 0 20px;
flex: none;
position: relative;
cursor: pointer;
&.active::after {
content: '';
display: inline-block;
position: absolute;
bottom: 2px;
width: 42px;
height: 2px;
left: 50%;
transform: translateX(-50%);
border-radius: 6px;
background: #fff;
}
}
}
</style>
<template>
<div class="wrap" v-loading="loading">
<el-form :model="form" ref="form" :rules="rules" label-width="100px">
<el-form-item label="规则名称" prop="ruleName">
<el-input v-model="form.ruleName" maxlength="30" show-word-limit placeholder="请输入" clearable />
</el-form-item>
<el-form-item label="执行群聊" prop="chatIdList">
<el-tag size="medium" v-for="(group, index) in customerGroups" :key="index">{{ group.groupName }}</el-tag>
<el-button
type="primary"
plain
class="ml10"
icon="el-icon-plus"
size="mini"
@click="dialogVisibleSelectCustomerGroup = true"
>{{ customerGroups.length ? '修改' : '添加' }}</el-button
>
</el-form-item>
<el-form-item label="内容名称" prop="title">
<el-input
v-model="form.title"
maxlength="220"
show-word-limit
:autosize="{ minRows: 5, maxRows: 20 }"
placeholder="请输入"
clearable
/>
</el-form-item>
<el-form-item label="执行时间" required>
<el-date-picker
v-model="dateRange"
value-format="yyyy-MM-dd"
type="daterange"
:picker-options="pickerOptions"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
align="right"
></el-date-picker>
</el-form-item>
<el-form-item label="消息内容" prop="content">
<div class="content-left">
<el-button class="create" @click="goRoute">新建素材</el-button>
<el-tabs v-model="activeName">
<el-tab-pane name="0">
<span slot="label"> <i class="el-icon-date"></i> 文本 </span>
<el-input
v-model="form.content"
type="textarea"
maxlength="220"
show-word-limit
:autosize="{ minRows: 10, maxRows: 50 }"
placeholder="请输入"
class="mb8"
></el-input>
<div v-for="text in textMaterialList" :key="text.id" class="text-wrapper">
<div class="content overflow-ellipsis">
{{ text.content }}
</div>
<el-button icon="el-icon-close" class="remove-btn" size="mini" @click="removeTextMaterial(text)">
</el-button>
</div>
</el-tab-pane>
<el-tab-pane name="1">
<span slot="label"> <i class="el-icon-date"></i> 图片 </span>
<div v-for="image in imageMaterialList" :key="image.id" class="image-wrapper">
<el-image :src="image.materialUrl" fit="fit"> </el-image>
<el-button icon="el-icon-close" class="remove-btn" size="mini" @click="removeImageMaterial(image)">
</el-button>
</div>
<!-- <div v-for="url in form.picList" :key="url" class="image-wrapper">
<el-image :src="url" fit="fit"> </el-image>
<el-button icon="el-icon-close" class="remove-btn" size="mini" @click="removeImage(url)"> </el-button>
</div>
<upload :fileUrl.sync="uploadImageUrl" class="image-uploader">
<i class="el-icon-plus uploader-icon"></i>
</upload> -->
</el-tab-pane>
<el-button type="primary" class="mt20" @click="dialogVisibleSelectMaterial = true">从素材库选择</el-button>
</el-tabs>
</div>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="submit">保存</el-button>
<el-button @click="$router.back()">取消</el-button>
</el-form-item>
</el-form>
<div class="preview-wrap">
<!-- 预览 -->
<div class="tip">欢迎语样式</div>
<PhoneDialog :message="form.content || '请输入加群引导语'" :imageList="imageList" :messageList="messageList">
<template #image="{ image }">
<el-image style="border-radius: 6px; width: 100px;" :src="image" fit="fit"> </el-image>
</template>
<template #text="{ text }">
{{ text }}
</template>
</PhoneDialog>
</div>
<!-- 选择素材弹窗 -->
<SelectMaterial
v-if="activeName === '0'"
:key="0"
:visible.sync="dialogVisibleSelectMaterial"
type="0"
:showArr="[0]"
@success="submitSelectMaterial"
>
</SelectMaterial>
<SelectMaterial
v-else
:key="1"
:visible.sync="dialogVisibleSelectMaterial"
type="1"
:showArr="[1]"
@success="submitSelectMaterial"
>
</SelectMaterial>
<!-- 选择客户群聊 -->
<SelectCustomerGroup
:visible.sync="dialogVisibleSelectCustomerGroup"
@success="submitSelectCustomerGroup"
:multiSelect="true"
>
</SelectCustomerGroup>
</div>
</template>
<script>
import { getDetail, add, update } from '@/api/communityOperating/groupSOP'
import PhoneDialog from '@/components/PhoneDialog'
import SelectMaterial from '@/components/SelectMaterial'
import SelectCustomerGroup from '@/components/SelectCustomerGroup'
export default {
components: { PhoneDialog, SelectMaterial, SelectCustomerGroup },
data() {
const checkContent = (rule, value, callback) => {
if (!this.form.content && this.form.picList.length === 0 && this.form.materialIdList.length === 0) {
callback(new Error('该项为必填项'))
} else {
callback()
}
}
return {
ruleId: '',
dialogVisibleSelectMaterial: false,
dialogVisibleSelectCustomerGroup: false,
loading: false, // 遮罩层
// 表单参数
form: {
ruleName: '', // 规则名称
chatIdList: [], // 群聊ID
title: '', // 内容标题
content: '', // 内容
materialIdList: [], // 素材ID
startExeTime: '', // 开始执行时间
stopExeTime: '', // 结束执行时间
picList: [] // 手动上传图片
},
dateRange: [],
activeName: '',
customerGroups: [],
pickerOptions: {
disabledDate(time) {
// return time.getTime() < Date.now()
return time.getTime() < new Date(new Date(new Date().toLocaleDateString()).getTime())
}
},
uploadImageUrl: '',
imageMaterialList: [],
textMaterialList: [],
rules: Object.freeze({
ruleName: [{ required: true, message: '该项为必填项', trigger: 'blur' }],
title: [{ required: true, message: '该项为必填项', trigger: 'blur' }],
chatIdList: [{ required: true, message: '该项为必填项', trigger: 'change' }],
startExeTime: [{ type: 'array', required: true, message: '该项为必填项', trigger: 'change' }],
content: [
// { required: true, message: '该项为必填项', trigger: 'change' },
{ required: true, validator: checkContent, trigger: 'change' }
]
})
}
},
watch: {
// 日期选择器数据同步至查询参数
dateRange(dateRange) {
if (!dateRange || dateRange.length !== 2) {
this.form.startExeTime = ''
this.form.stopExeTime = ''
} else {
;[this.form.startExeTime, this.form.stopExeTime] = dateRange
// this.$nextTick(() => this.$refs.form.validateField('startExeTime'))
}
},
customerGroups(groups) {
this.form.chatIdList = groups.map((g) => g.chatId)
this.$refs.form.validateField('chatIdList')
},
uploadImageUrl(url) {
if (url) this.form.picList.push(url)
this.$refs.form.validateField('content')
}
},
computed: {
imageMaterialUrls() {
const urls = this.imageMaterialList.map((m) => m.materialUrl)
return urls
},
messageList() {
const texts = this.textMaterialList.map((t) => t.content)
return texts
},
imageList() {
const list = this.form.picList.concat(this.imageMaterialUrls)
return list
}
},
created() {
this.ruleId = this.$route.query.id
this.ruleId && this.getDetail(this.ruleId)
},
methods: {
/** 获取详情 */
getDetail(id) {
this.loading = true
getDetail(id).then(({ data }) => {
this.dateRange = [data.startExeTime || '', data.stopExeTime || '']
this.customerGroups = data.groupList || []
this.form.ruleName = data.ruleName || ''
this.form.title = data.title || ''
this.form.content = data.content || ''
this.form.picList = data.picList || []
this.form.materialIdList = []
const materialList = data.materialList || []
for (let material of materialList) {
if (material.materialUrl) {
this.imageMaterialList.push(material)
} else {
this.textMaterialList.push(material)
}
this.form.materialIdList.push(material.id)
}
this.loading = false
})
},
// 选择素材确认按钮
submitSelectMaterial(text, image, file) {
text &&
text.id &&
!this.form.materialIdList.includes(text.id) &&
this.form.materialIdList.push(text.id) &&
this.textMaterialList.push(text)
image &&
image.id &&
!this.form.materialIdList.includes(image.id) &&
this.form.materialIdList.push(image.id) &&
this.imageMaterialList.push(image)
this.$refs.form.validateField('content')
},
// 选择客户群聊确认
submitSelectCustomerGroup(groups) {
this.customerGroups = groups
},
submit() {
this.$refs.form.validate((valid) => {
if (valid) {
if (!this.dateRange.length) {
this.msgError('执行时间不能为空')
return
}
// if (!this.dateRange.length) {
// this.msgError('执行时间不能为空')
// return
// }
this.loading = true
if (this.ruleId) {
update(this.ruleId, this.form)
.then(({ data }) => {
this.msgSuccess('操作成功')
this.loading = false
this.$router.back()
})
.catch(() => {
this.loading = false
})
} else {
add(this.form)
.then(({ data }) => {
this.msgSuccess('操作成功')
this.loading = false
this.$router.back()
})
.catch(() => {
this.loading = false
})
}
}
})
},
goRoute() {
let contentType = ['text', 'image', 'file']
window.open('#/customerMaintain/material/' + contentType[this.activeName])
},
removeImage(url) {
this.form.picList.splice(this.form.picList.indexOf(url), 1)
},
removeImageMaterial(image) {
this.imageMaterialList.splice(this.imageMaterialList.indexOf(image), 1)
this.form.materialIdList.splice(this.form.materialIdList.indexOf(image.id), 1)
},
removeTextMaterial(text) {
this.textMaterialList.splice(this.textMaterialList.indexOf(text), 1)
this.form.materialIdList.splice(this.form.materialIdList.indexOf(text.id), 1)
}
}
}
</script>
<style lang="scss" scoped>
.wrap {
display: flex;
margin-top: 24px;
.el-form {
margin-right: 10%;
}
}
.preview-wrap {
line-height: 26px;
}
.tip {
color: #999;
}
.welcome-input {
display: table;
width: 80%;
margin: 0 auto 20px;
}
/deep/ .image-uploader {
.uploader-icon {
width: 80px;
height: 80px;
line-height: 80px;
}
.upload-img {
width: 80px;
height: 80px;
}
}
.uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
border-radius: 6px;
border: 1px dashed #d9d9d9;
}
.image-wrapper {
width: 100px;
position: relative;
display: inline-block;
.remove-btn {
top: 2px;
}
}
.text-wrapper {
width: 100px;
position: relative;
.content {
background-color: #e8f4ff;
border-color: #d1e9ff;
padding: 0 10px;
font-size: 12px;
border-radius: 4px;
color: #1890ff;
}
.remove-btn {
top: 5px;
}
}
.text-wrapper,
.image-wrapper {
margin: 5px;
.remove-btn {
position: absolute;
right: 2px;
padding: 5px;
border: none;
background: transparent;
}
}
.overflow-ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.phone-dialog-image {
border-radius: 6px;
width: 100px;
}
</style>
<script>
import { getList, remove } from '@/api/communityOperating/groupSOP'
export default {
data() {
return {
query: {
pageNum: 1,
pageSize: 10,
ruleName: '', // 规则名称
createBy: '', // 创建人
beginTime: '', // 创建开始时间
endTime: '' // 创建结束时间
},
dateRange: [], // 添加日期
total: 0, // 群SOP数据总量
list: [], // 群SOP数据
multiSelect: [], // 多选数据
loading: false
}
},
watch: {
// 日期选择器数据同步至查询参数
dateRange(dateRange) {
if (!dateRange || dateRange.length !== 2) {
this.query.beginTime = ''
this.query.endTime = ''
} else {
;[this.query.beginTime, this.query.endTime] = dateRange
}
}
},
created() {
this.getList()
this.$store.dispatch(
'app/setBusininessDesc',
`
<div>管理员在创建群 SOP 规则后,员工通过推送的消息通知,在规定时间内给规定群聊发送规定内容。</div>
`
)
},
methods: {
// 获取群SOP数据
getList(page) {
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
})
.catch(() => {
this.loading = false
})
},
// 新增/编辑群SOP
goRoute(id) {
this.$router.push({
path: 'groupSOPAev',
query: { id: id }
})
},
// 重置查询参数
resetQuery() {
this.dateRange = []
this.$refs['queryForm'].resetFields()
this.$$nextTick(() => {
this.getList(1)
})
},
// 批量删除
handleBulkRemove() {
this.$confirm('确认删除当前数据?删除操作无法撤销,请谨慎操作。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
const ids = this.multiSelect.map((r) => r.ruleId)
remove(ids + '').then((res) => {
if (res.code === 200) {
this.getList()
} else {
}
})
})
.catch(() => {})
},
// 删除
handleRemove(id) {
this.$confirm('确认删除当前数据?删除操作无法撤销,请谨慎操作。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
remove(id + '').then((res) => {
if (res.code === 200) {
this.getList()
} else {
}
})
})
.catch(() => {})
},
// 处理多选
handleSelectionChange(val) {
this.multiSelect = val
},
// 获取显示用实际群聊
getDisplayGroups(row) {
if (row.groupList) {
const groups = row.groupList.map((g) => g.groupName)
return groups.join(',')
}
}
}
}
</script>
<template>
<div>
<div class="top-search">
<el-form inline label-position="right" :model="query" label-width="100px" ref="queryForm">
<el-form-item label="规则名称" prop="ruleName">
<el-input v-model="query.ruleName" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="创建人" prop="createBy">
<el-input v-model="query.createBy" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="dateRange"
value-format="yyyy-MM-dd"
type="daterange"
:picker-options="pickerOptions"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
align="right"
></el-date-picker>
</el-form-item>
<el-form-item label=" ">
<el-button v-hasPermi="['customerManage:customer:query']" type="primary" @click="getList(1)">查询</el-button>
<el-button v-hasPermi="['customerManage:customer:query']" type="success" @click="resetQuery()"
>重置</el-button
>
</el-form-item>
</el-form>
</div>
<div class="mid-action">
<div>
<el-button type="primary" @click="goRoute()">新建规则</el-button>
</div>
<div>
<el-button
v-hasPermi="['customerManage:customer:export']"
:disabled="multiSelect.length === 0"
@click="handleBulkRemove"
type="cyan"
>批量删除</el-button
>
</div>
</div>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column label="规则名称" align="center" prop="ruleName" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="执行群聊" align="center" width="120">
<template #default="{ row }">
<el-popover placement="bottom" width="200" trigger="hover" :content="getDisplayGroups(row)">
<div slot="reference" class="table-desc overflow-ellipsis">
{{ getDisplayGroups(row) }}
</div>
</el-popover>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy"></el-table-column>
<el-table-column label="创建人" align="center" prop="createBy"></el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime"></el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-hasPermi="['enterpriseWechat:view']"
size="mini"
type="text"
icon="el-icon-view"
@click="handleRemove(scope.row.ruleId)"
>删除</el-button
>
<el-button
v-hasPermi="['enterpriseWechat:edit']"
size="mini"
type="text"
icon="el-icon-edit"
@click="goRoute(scope.row.ruleId)"
>编辑</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getList()"
/>
</div>
</template>
<style scoped lang="scss">
.overflow-ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.table-desc {
max-width: 120px;
}
</style>
<script>
import { getList, remove, download, downloadBatch } from '@/api/communityOperating/newCustomer'
export default {
components: {},
props: {},
data() {
return {
query: {
pageNum: 1,
pageSize: 10,
emplCodeName: '', // 活码名称
createBy: '', // 创建人
beginTime: '', // 开始日期
endTime: '' // 结束日期
},
dateRange: [], // 添加日期
total: 0, // 数据总量
form: {},
list: [],
dialogVisible: false,
disabled: false,
loading: false,
status: ['正常', '停用'],
pushType: {
0: '发给客户',
1: '发给客户群'
},
queryUser: [], // 搜索框选择的添加人
ids: []
}
},
computed: {},
watch: {
// 日期选择器数据同步至查询参数
dateRange(dateRange) {
if (!dateRange || dateRange.length !== 2) {
this.query.beginTime = ''
this.query.endTime = ''
} else {
;[this.query.beginTime, this.query.endTime] = dateRange
}
}
},
created() {
this.getList()
this.$store.dispatch(
'app/setBusininessDesc',
`
<div>指在客户通过员工活码加为好友后,员工自动推送入群引导语和群活码,客户可通过群活码扫码入群。</div>
`
)
},
mounted() {
// new clipboard(".copy-btn");
},
methods: {
// 获取新客数据
getList(page) {
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
})
.catch(() => {
this.loading = false
})
},
// 新建/编辑新客数据
goRoute(id) {
this.$router.push({
path: 'newCustomerAev',
query: { id }
})
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id)
},
/** 删除按钮操作 */
remove(id) {
const ids = id || this.ids
this.$confirm('是否确认删除?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(function() {
return remove(ids)
})
.then(() => {
this.getList()
this.msgSuccess('删除成功')
})
.catch(function() {})
},
// 下载
download(data) {
let name = data.codeName + '.png'
download(data.id).then((res) => {
if (res != null) {
let blob = new Blob([res], { type: 'application/zip' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = name // 重命名文件
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
},
// 批量下载
downloadBatch() {
this.$confirm('是否确认下载所有活码图片吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
return downloadBatch(this.ids + '')
// window.open(downloadBatch(this.ids))
})
.then((res) => {
if (res != null) {
let blob = new Blob([res], { type: 'application/zip' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = '批量员工活码.zip' // 重命名文件
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
.catch(function() {})
},
// 重置查询参数
resetQuery() {
this.dateRange = []
this.$refs['queryForm'].resetFields()
this.$nextTick(() => {
this.getList(1)
})
}
}
}
</script>
<template>
<div>
<el-form ref="queryForm" :inline="true" :model="query" label-width="100px" class="top-search" size="small">
<el-form-item label="活码名称" prop="emplCodeName">
<el-input v-model="query.emplCodeName" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="创建人" prop="createBy">
<el-input v-model="query.createBy" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="dateRange"
value-format="yyyy-MM-dd"
type="daterange"
:picker-options="pickerOptions"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
align="right"
></el-date-picker>
</el-form-item>
<el-form-item label=" ">
<el-button v-hasPermi="['customerManage:customer:query']" type="primary" @click="getList(1)">查询</el-button>
<el-button v-hasPermi="['customerManage:customer:query']" type="success" @click="resetQuery()">重置</el-button>
</el-form-item>
</el-form>
<div class="mid-action">
<div>
<el-button type="primary" @click="goRoute()">新建自动拉群</el-button>
</div>
<div>
<el-button type="primary" :disabled="!ids.length" @click="downloadBatch()">批量下载</el-button>
<el-button v-hasPermi="['customerManage:customer:export']" :disabled="!ids.length" type="cyan" @click="remove()"
>批量删除</el-button
>
</div>
</div>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column prop="codeName" label="活码名称" align="center"></el-table-column>
<el-table-column prop="emplList" label="使用员工" align="center" width="130">
<template #default="{ row }">
<el-popover placement="bottom" trigger="hover">
<el-image slot="reference" :src="row.emplCodeUrl" class="code-image--small"></el-image>
<el-image :src="row.emplCodeUrl" class="code-image"></el-image>
</el-popover>
</template>
<!-- <template slot-scope="{ row }">
<el-image v-if="row.emplCodeUrl" :src="row.emplCodeUrl" class="code-image">
</el-image>
</template> -->
</el-table-column>
<el-table-column prop="emplList" label="使用员工" align="center" :show-overflow-tooltip="true">
<template slot-scope="{ row }">
<el-tag size="medium" type="info" v-for="(item, index) in row.emplList" :key="index">{{
item.businessName
}}</el-tag>
</template>
</el-table-column>
<el-table-column label="客户标签" align="center" width="160" :show-overflow-tooltip="true">
<template slot-scope="{ row }">
<el-tag size="medium" type="info" v-for="(item, index) in row.tagList" :key="index">{{
item.tagName
}}</el-tag>
</template>
</el-table-column>
<el-table-column label="实际群聊" align="center" :show-overflow-tooltip="true">
<template slot-scope="{ row }">
<el-tag size="medium" v-for="(item, index) in (row.actualGroupName || '').split(',')" :key="index">{{
item
}}</el-tag>
</template>
</el-table-column>
<el-table-column label="添加好友数" align="center" prop="cusNumber"></el-table-column>
<el-table-column label="创建人" align="center" prop="createBy"></el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="160"></el-table-column>
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<template slot-scope="{ row }">
<el-button v-hasPermi="['enterpriseWechat:edit']" type="text" @click="goRoute(row.id)">编辑</el-button>
<el-button v-hasPermi="['enterpriseWechat:view']" type="text" @click="download(row)">下载</el-button>
<el-button v-hasPermi="['enterpriseWechat:edit']" type="text" @click="remove(row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getList()"
/>
</div>
</template>
<style scoped lang="scss">
.code-image {
width: 200px;
height: 200px;
}
.code-image--small {
width: 50px;
height: 50px;
}
</style>
<template>
<div class="employ">
<el-row type="flex">
<el-col :span="6" class="borderR">
<!-- <div class="hd_box">
<div class="name">成员({{employAmount}})</div>
<div class="paddingT10">
<el-input placeholder="请输入内容" prefix-icon="el-icon-search" v-model="employName">
</el-input>
</div>
</div> -->
<div class="ct_box ct_boxFirst" style="height: calc(100vh - 197px)">
<el-tree
ref="tree"
class="filter-tree"
:props="defaultProps"
:filter-node-method="filterNode"
highlight-current
node-key="id"
@node-click="handleNodeClick"
:default-expanded-keys="defaultExpandedKeys"
:load="loadNode"
lazy
>
<!--
:data="treeData"
:default-expand-all="true"
:expand-on-click-node="false" -->
</el-tree>
</div>
</el-col>
<el-col :span="6" class="borderR">
<template v-if="talkName">
<div class="name pd15">{{ talkName }}</div>
<el-tabs v-model="activeName" @tab-click="tabClick(true)">
<el-tab-pane label="内部联系人" name="0">
<userList v-if="activeName == 0" :personList="personList" :loading="loading" @chatFn="chatFn"> </userList>
</el-tab-pane>
<el-tab-pane label="外部联系人" name="1">
<userList v-if="activeName == 1" :personList="personList" :loading="loading" @chatFn="chatFn"> </userList>
</el-tab-pane>
<el-tab-pane label="群聊" name="2">
<grouplist
class="ct_box"
v-if="activeName == 2"
:personList="personList"
:loading="loading"
@groupFn="groupFn"
>
</grouplist>
</el-tab-pane>
</el-tabs>
</template>
<el-empty v-else :image-size="100" description="请选择员工"></el-empty>
</el-col>
<el-col :span="12">
<chatListClass v-show="queryChat.receiveName" :queryChat="queryChat"></chatListClass>
<el-empty v-if="!queryChat.receiveName" description="请选择联系人" :image-size="100"></el-empty>
</el-col>
</el-row>
</div>
</template>
<script>
import chatListClass from './component/chatListClass.vue'
import userList from './component/userList.vue'
import grouplist from './component/groupList.vue'
import * as apiOrg from '@/api/organization'
import api from '@/api/conversation/content.js'
export default {
components: {
grouplist,
userList,
chatListClass
},
data() {
return {
employAmount: 1,
fromId: '',
// employName: '',
talkName: '',
// treeData: [],
defaultExpandedKeys: [],
defaultProps: {
label: 'name',
children: 'children',
isLeaf: 'isLeaf'
},
activeName: '0',
chat: {},
personList: [],
loading: false,
queryChat: {}
}
},
watch: {
// employName(val) {
// this.$refs.tree.filter(val)
// }
},
mounted() {
// this.getTree()
//this.getAmount()
},
methods: {
chatFn(data) {
this.queryChat = {
fromId: this.fromId,
receiveName: data.name,
toList: data.receiver
}
},
groupFn(data) {
this.queryChat = {
// fromId: this.fromId,
receiveName: data.name,
roomId: data.receiver
}
},
// getTree() {
// apiOrg.getTree().then(({ data }) => {
// let treeData = (this.treeData = this.handleTree(data))
// this.handleNodeClick(this.treeData[0], true)
// })
// },
tabClick(flag) {
this.personList = []
if (!this.fromId) {
return
}
if (flag) {
this.loading = true
}
if (this.activeName == 0) {
api
.getInternalChatList(this.fromId)
.then(({ data }) => {
this.loading = false
this.personList = data
})
.catch((err) => {
this.loading = false
})
} else if (this.activeName == 1) {
api
.getExternalChatList(this.fromId)
.then(({ data }) => {
this.loading = false
this.personList = data
})
.catch((err) => {
this.loading = false
})
} else {
api
.getGroupChatList(this.fromId)
.then(({ data }) => {
this.loading = false
this.personList = data
})
.catch((err) => {
this.loading = false
})
}
},
filterNode(value, data) {
console.log(value, data)
if (!value) return true
return data.name.indexOf(value) !== -1
},
loadNode(node, resolve) {
if (node.level == 0) {
apiOrg.getTree().then(({ data }) => {
let treeData = this.handleTree(data)
// this.handleNodeClick(this.treeData[0], true)
treeData[0] && (this.defaultExpandedKeys = [treeData[0].id])
resolve(treeData)
})
} else {
if (node.data.userId) {
resolve([])
} else {
let querys = {
pageNum: '1',
pageSize: '999',
isActivate: '',
department: node.data.id
}
apiOrg.getList(querys).then(({ rows }) => {
// if (!data.children) {
// this.$set(data, 'children', [])
// }
// data.children.push(...rows)
let arr = node.data.children ? node.data.children.concat(rows || []) : rows || []
arr.forEach((element) => {
element.isLeaf = !!element.userId
})
resolve(arr)
})
}
}
},
handleNodeClick(data, add) {
if (!data.userId) {
} else {
this.talkName = data.name
this.fromId = data.userId
this.tabClick()
this.queryChat = {
fromId: data.userId
}
}
}
}
}
</script>
<style lang="scss" scoped>
/deep/.el-tabs__nav-scroll {
padding-left: 15px;
}
.borderR {
border-right: 2px solid #ccc;
}
/deep/ .el-tabs__header {
margin: 0;
}
.employ {
background: #f6f6f9;
.el-tabs {
background: #fff;
}
.name {
font-size: 18px;
min-height: 20px;
}
.ct_box {
background: white;
height: calc(100vh - 286px);
padding: 0 10px;
overflow-y: auto;
border-bottom: 1px solid #efefef;
color: #999;
text-align: center;
::-webkit-scrollbar {
display: none;
}
}
}
</style>
<script>
import * as api from '@/api/customer'
import { getList as getListTag } from '@/api/customer/tag'
import { getList as getListOrganization } from '@/api/organization'
import AddTag from '@/components/AddTag'
import SelectUser from '@/components/SelectUser'
import SelectTag from '@/components/SelectTag'
export default {
name: 'Customer',
components: { AddTag, SelectUser, SelectTag },
props: {},
data() {
return {
query: {
pageNum: 1,
pageSize: 10,
name: '', // "客户名称",
userIds: '', // "添加人id",
tagIds: '', // "标签id,多个标签,id使用逗号隔开",
beginTime: '', // "开始时间",
endTime: '' // "结束时间"
},
queryTag: [], // 搜索框选择的标签
queryUser: [], // 搜索框选择的添加人
dateRange: [], // 添加日期
loading: false,
isMoreFilter: false,
total: 0,
// 添加标签表单
form: {
gourpName: '',
weTags: []
},
list: [], // 客户列表
listOrganization: [], // 组织架构列表
multipleSelection: [], // 多选数组
dialogVisible: false, // 选择标签弹窗显隐
dialogVisibleSelectUser: false, // 选择添加人弹窗显隐
dialogVisibleAddTag: false, // 添加标签弹窗显隐
selectedGroup: '', // 选择的标签分组
selectedTag: [], // 选择的标签
removeTag: [], // 可移除的标签
tagDialogType: {
title: '', // 选择标签弹窗标题
type: '' // 弹窗类型
}
}
},
watch: {},
computed: {},
created() {
this.getList()
this.getListTag()
this.getListOrganization()
this.$store.dispatch(
'app/setBusininessDesc',
`
<div>用于查看当前企业所有的客户列表及详细信息,支持对客户进行打标签。</div>
`
)
},
mounted() {},
methods: {
getList(page) {
// console.log(this.dateRange);
if (this.dateRange) {
this.query.beginTime = this.dateRange[0]
this.query.endTime = this.dateRange[1]
} else {
this.query.beginTime = ''
this.query.endTime = ''
}
page && (this.query.pageNum = page)
this.loading = true
api
.getListNew(this.query)
.then(({ rows, total }) => {
rows.forEach((element) => {
if (element.tagIds && element.tagNames) {
element.tagIds = element.tagIds.split(',')
element.tagNames = element.tagNames.split(',')
rows.tags = []
element.tagIds.forEach((unit, index) => {
rows.tags.push({
tagId: unit,
tagId: element.tagNames[index]
})
})
}
})
this.list = rows
this.total = +total
this.loading = false
this.multipleSelection = []
})
.catch(() => {
this.loading = false
})
},
getListTag(refresh) {
getListTag().then(({ rows }) => {
this.listTagOneArray = []
rows.forEach((element) => {
element.weTags.forEach((d) => {
this.listTagOneArray.push(d)
})
})
if (refresh) {
this.$refs.selectTag.getList()
this.form = {
gourpName: '',
weTags: []
}
}
})
},
getListOrganization() {
getListOrganization().then(({ rows }) => {
this.listOrganization = Object.freeze(rows)
})
},
showTagDialog() {
this.selectedTag = this.queryTag
this.tagDialogType = {
title: '选择标签',
type: 'query'
}
this.dialogVisible = true
// this.$refs.selectTag.$forceUpdate()
},
makeTag(type) {
if (!this.multipleSelection.length) {
this.msgInfo('请选择一位客户')
return
}
if (this.multipleSelection.length > 1) {
this.msgInfo('同时只能选择一位客户')
return
}
this.selectedTag = []
let hasErrorTag = []
let repeat = []
this.multipleSelection.forEach((element) => {
element.tags &&
element.tags.split(',').forEach((unit) => {
// 判断是否有重复标签
let isRepeat = this.selectedTag.some((d) => {
return d.tagId === unit.tagId
})
// 去重
if (isRepeat) {
repeat.push(unit.tagName)
return
}
let filter = this.listTagOneArray.find((d) => {
return d.tagId === unit.tagId
})
// 如果没有匹配到,则说明该便签处于异常状态,可能已被删除或破坏
if (!filter) {
hasErrorTag.push(unit.tagName)
isError = true
return
}
this.selectedTag.push(filter)
})
})
if (hasErrorTag.length > 0) {
this.msgError('已有标签[' + hasErrorTag + ']不在标签库中,或存在异常')
return
}
if (type === 'remove' && this.selectedTag.length === 0) {
this.msgError('该客户没有标签,不可进行移除')
return
}
this.tagDialogType = {
title: (type === 'add' ? '增加标签' : '移出标签') + (repeat.length ? '(重复的标签已去重显示)' : ''),
type: type
}
this.dialogVisible = true
// this.$refs.selectTag.$forceUpdate()
},
sync() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
api
.sync()
.then(() => {
loading.close()
this.msgSuccess('后台开始同步数据,请稍后关注进度')
})
.catch((fail) => {
loading.close()
console.log(fail)
})
},
/** 导出按钮操作 */
exportCustomer() {
const queryParams = this.query
this.$confirm('是否确认导出所有客户数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(function() {
return api.exportCustomer(queryParams)
})
.then((response) => {
this.download(response.msg)
})
.catch(function() {})
},
selectedUser(list) {
this.queryUser = list
this.query.userIds = list.map((d) => d.userId) + ''
},
submitSelectTag(selected) {
if (this.tagDialogType.type === 'query') {
this.query.tagIds = selected.map((d) => d.tagId) + ''
// debugger;
this.queryTag = selected
this.dialogVisible = false
} else {
let data = {
externalUserid: this.multipleSelection[0].externalUserid,
addTag: selected,
userId: this.multipleSelection[0].firstUserId
}
let apiType = {
add: 'makeLabel',
remove: 'removeLabel'
}
api[apiType[this.tagDialogType.type]](data).then(() => {
this.msgSuccess('操作成功')
this.dialogVisible = false
this.getList()
})
}
},
resetForm(formName) {
this.dateRange = []
this.queryTag = []
this.queryUser = []
this.$refs['queryForm'].resetFields()
this.getList(1)
},
// 多选框选中数据
handleSelectionChange(selection) {
this.multipleSelection = selection
},
// 用于多选变单选
handleSelection(selection, row) {
this.$nextTick(() => {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(row, true)
})
},
goRoute(row) {
this.$router.push({
path: 'customerDetail',
query: { id: row.externalUserid }
})
}
}
}
</script>
<template>
<div>
<el-form ref="queryForm" :inline="true" :model="query" label-width="100px" class="top-search" size="small">
<el-form-item label="客户名称" prop="name">
<el-input v-model="query.name" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="添加人">
<div class="tag-input" @click="dialogVisibleSelectUser = true">
<span class="tag-place" v-if="!queryUser.length">请选择</span>
<template v-else>
<el-tag type="info" v-for="(unit, unique) in queryUser" :key="unique">{{ unit.name }}</el-tag>
</template>
</div>
</el-form-item>
<el-form-item label="添加日期">
<el-date-picker
v-model="dateRange"
value-format="yyyy-MM-dd"
type="daterange"
:picker-options="pickerOptions"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
align="right"
></el-date-picker>
</el-form-item>
<el-form-item label="标签">
<div class="tag-input" @click="showTagDialog">
<span class="tag-place" v-if="!queryTag.length">请选择</span>
<template v-else>
<el-tag type="info" v-for="(unit, unique) in queryTag" :key="unique">{{ unit.name }}</el-tag>
</template>
</div>
</el-form-item>
<el-form-item label=" ">
<el-button v-hasPermi="['customerManage:customer:query']" type="primary" @click="getList(1)">查询</el-button>
<el-button v-hasPermi="['customerManage:customer:query']" type="success" @click="resetForm()">重置</el-button>
<el-button v-hasPermi="['customerManage:customer:export']" type="info" @click="exportCustomer"
>导出列表</el-button
>
</el-form-item>
</el-form>
<div class="mid-action">
<div>
<!-- 共
<span class="num">{{ total }}</span> 位客户,实际客户
<span class="num">{{ total }}</span> 位。 -->
<el-button v-hasPermi="['customerManage:customer:sync']" v-preventReClick type="primary" @click="sync"
>同步客户</el-button
>
<el-button v-hasPermi="['customerManage:customer:checkRepeat']" type="primary">查看重复客户</el-button>
<!-- <div>
最近同步:2021-05-17 15:05:43
</div> -->
</div>
<div>
<el-button
v-hasPermi="['customerManage/customer:makeTag']"
type="primary"
@click="makeTag('add')"
:disabled="multipleSelection.length !== 1"
>打标签</el-button
>
<el-button
v-hasPermi="['customerManage:customer:removeTag']"
type="primary"
@click="makeTag('remove')"
:disabled="multipleSelection.length !== 1"
>移除标签</el-button
>
</div>
</div>
<el-table
ref="table"
:data="list"
tooltip-effect="dark"
highlight-current-row
@select="handleSelection"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" align="center" width="55"></el-table-column>
<el-table-column label="客户" prop="name" align="center">
<template slot-scope="{ row }">
<div class="cp" @click="goRoute(row)">
{{ row.customerName }}
<!-- <span :style="{ color: row.type === 1 ? '#4bde03' : '#f9a90b' }">{{
{ 1: '@微信', 2: '@企业微信' }[row.type]
}}</span>
<i :class="['el-icon-s-custom', { 1: 'man', 2: 'woman' }[row.gender]]"></i> -->
</div>
</template>
</el-table-column>
<!-- <el-table-column prop="corpName" label="公司名称" align="center"></el-table-column> -->
<el-table-column prop="firstUserId" label="添加人(首位)" align="center">
<!-- <template slot-scope="{ row }">{{
row.weFlowerCustomerRels[0] ? row.weFlowerCustomerRels[0].userName : ''
}}</template> -->
</el-table-column>
<el-table-column prop="firstAddTime" label="添加时间" align="center">
<!-- <template slot-scope="{ row }">{{
row.weFlowerCustomerRels[0] ? row.weFlowerCustomerRels[0].createTime : ''
}}</template> -->
</el-table-column>
<el-table-column prop="tagNames" label="标签" align="center">
<div v-if="row.tagNames" slot-scope="{ row }">
<el-tag type="info" v-for="(unit, unique) in row.tagNames" :key="unique">{{ unit }}</el-tag>
<!-- <div v-for="(item, index) in row.weFlowerCustomerRels" :key="index">
<el-tag type="info" v-for="(unit, unique) in item.weFlowerCustomerTagRels" :key="unique">{{
unit.tagName
}}</el-tag>
</div> -->
</div>
<span v-else>无标签</span>
</el-table-column>
<el-table-column label="操作" width="100">
<template slot-scope="{ row }">
<el-button v-hasPermi="['customerManage:customer:view']" @click="goRoute(row)" type="text" size="small"
>查看</el-button
>
<!-- <el-button type="text" size="small">编辑</el-button> -->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getList()"
/>
<!-- 选择标签弹窗 -->
<SelectTag
ref="selectTag"
:visible.sync="dialogVisible"
:title="tagDialogType.title"
:selected="selectedTag"
:type="tagDialogType.type"
@success="submitSelectTag"
>
<div class="mt20" v-show="tagDialogType.type === 'add'">
<el-button type="primary" @click="dialogVisibleAddTag = true">添加标签</el-button>
</div>
</SelectTag>
<!-- 选择添加人弹窗 -->
<SelectUser :visible.sync="dialogVisibleSelectUser" title="选择添加人" @success="selectedUser"></SelectUser>
<!-- 添加标签弹窗 -->
<AddTag :visible.sync="dialogVisibleAddTag" :form="form" @success="getListTag(true)" />
</div>
</template>
<style lang="scss" scoped>
.el-icon-s-custom {
font-size: 16px;
margin-left: 4px;
color: #999;
&.man {
color: #13a2e8;
}
&.woman {
color: #f753b2;
}
}
.bfc-d + .bfc-d .el-checkbox:first-child {
margin-left: 10px;
}
</style>
<script>
import { getDetail, getUserAddCustomerStat, download } from '@/api/drainageCode/staff'
import ClipboardJS from 'clipboard'
import echarts from 'echarts'
export default {
name: 'CodeDetail',
data() {
return {
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 总条数
total: 0,
// 表格数据
list: [],
// 日期范围
dateRange: [],
// 表单参数
form: {},
// 查询参数
query: {
userId: undefined,
addWay: undefined,
beginTime: undefined,
endTime: undefined
},
type: { 1: '单人', 2: '多人', 3: '批量单人' },
timeRange: 7
}
},
created() {
let id = this.$route.query.id
id && this.getDetail(id)
// this.getList()
},
mounted() {
this.clipboard = new ClipboardJS('.copy-btn')
this.clipboard.on('success', (e) => {
this.$notify({
title: '成功',
message: '链接已复制到剪切板,可粘贴。',
type: 'success'
})
})
this.clipboard.on('error', (e) => {
this.$message.error('链接复制失败')
})
},
destroyed() {
this.clipboard.destroy()
},
methods: {
/** 获取详情 */
getDetail(id) {
this.loading = true
getDetail(id).then(({ data }) => {
this.form = data
this.loading = false
this.query.userId = data.weEmpleCodeUseScops[0].businessId
this.query.addWay = 1
this.setTime(7)
this.getList()
})
},
/** */
getList() {
this.query.beginTime = this.dateRange[0]
this.query.endTime = this.dateRange[1]
getUserAddCustomerStat(this.query).then(({ data }) => {
this.total = data.total
this.loading = false
let option = {
xAxis: {
type: 'category',
data: data.dateList
},
yAxis: {
type: 'value'
},
series: [
{
data: data.statList,
type: 'line'
}
]
}
var myChart = echarts.init(this.$refs.chart)
myChart.setOption(option)
this.$nextTick(() => {})
})
},
setTime(days) {
this.timeRange = days
let date = new Date()
date.setDate(date.getDate() - days)
this.dateRange = [this.getTime(date), this.getTime()]
this.getList()
},
getHandledValue(num) {
return num < 10 ? '0' + num : num
},
getTime(datePar) {
const d = datePar ? new Date(datePar) : new Date()
const year = d.getFullYear()
const month = this.getHandledValue(d.getMonth() + 1)
const date = this.getHandledValue(d.getDate())
return year + '-' + month + '-' + date
},
download() {
let userName = this.form.weEmpleCodeUseScops
.map((item) => {
return item.businessName
})
.join(',')
let name = userName + '-' + this.form.activityScene + '.png'
download(this.form.id).then((res) => {
if (res != null) {
let blob = new Blob([res], { type: 'application/zip' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = name // 重命名文件
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
}
}
}
</script>
<template>
<div v-loading="loading">
<div class="title">员工活码信息</div>
<div class="flex top">
<div class="ac">
<el-image
:src="form.qrCode"
fit="fit"
:preview-src-list="[form.qrCode]"
style="width: 150px; height: 150px"
></el-image>
<div>
<el-button type="text" @click="download()">下载二维码</el-button>
<el-button type="text" class="copy-btn" :data-clipboard-text="form.qrCode">复制链接</el-button>
</div>
</div>
<el-form ref="form" label-width="100px">
<el-form-item label="使用成员:">
<el-tag size="small" v-for="(item, index) in form.weEmpleCodeUseScops" :key="index">{{
item.businessName
}}</el-tag>
</el-form-item>
<el-form-item label="活动场景:">{{ form.activityScene }}</el-form-item>
<el-form-item label="类型:">{{ type[form.codeType] }}</el-form-item>
<el-form-item label="设置:">{{
`客户添加时${form.isJoinConfirmFriends === 1 ? '无' : ''}需经过确认自动成为好友`
}}</el-form-item>
<el-form-item label="创建人:">{{ form.createBy }}</el-form-item>
<el-form-item label="创建时间:">{{ form.createTime }}</el-form-item>
</el-form>
<el-form ref="form" label-width="100px">
<el-form-item label="扫码标签:"
><el-tag size="small" v-for="(item, index) in form.weEmpleCodeTags" :key="index">{{
item.tagName
}}</el-tag></el-form-item
>
<el-form-item label="欢迎语:">{{ form.welcomeMsg }}</el-form-item>
</el-form>
</div>
<el-divider></el-divider>
<div class="title">扫码人数</div>
<div class="mb15">累计总人数:{{ total }}</div>
<div>
<el-button-group>
<el-button size="small" type="primary" :plain="timeRange != 7" @click="setTime(7)">近7日</el-button>
<el-button size="small" type="primary" :plain="timeRange != 30" @click="setTime(30)">近30日</el-button>
</el-button-group>
<el-date-picker
v-model="dateRange"
size="small"
class="ml20"
style="width: 260px"
value-format="yyyy-MM-dd"
type="daterange"
:clearable="false"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="getList"
></el-date-picker>
</div>
<div class="chart" ref="chart" style="width: 90%;height:400px;"></div>
</div>
</template>
<style lang="scss" scoped>
.top {
align-items: flex-start;
}
.title {
font-size: 16px;
font-weight: 600;
margin: 0 0 20px;
}
</style>
<script>
import { getList, remove, batchAdd, downloadBatch, download } from '@/api/drainageCode/staff'
import SelectUser from '@/components/SelectUser'
import ClipboardJS from 'clipboard'
export default {
name: 'CodeStaff',
components: { SelectUser },
data() {
return {
// 查询参数
query: {
pageNum: 1,
pageSize: 10,
useUserName: undefined,
mobile: undefined,
scenario: undefined,
createBy: undefined,
beginTime: undefined,
endTime: undefined
},
// 日期范围
dateRange: [],
dialogVisible: false,
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 总条数
total: 0,
// 表格数据
list: [],
// 表单参数
form: {
codeType: 3,
qrcode: '',
isJoinConfirmFriends: 0,
weEmpleCodeTags: [],
weEmpleCodeUseScops: []
}
}
},
created() {
this.getList()
this.$store.dispatch(
'app/setBusininessDesc',
`
<div>支持单人、批量单人及多人方式新建员工活码,客户可以通过扫描员工活码添加员工为好友,并支持自动给客户打标签和发送欢迎语。</div>
`
)
},
mounted() {
this.clipboard = new ClipboardJS('.copy-btn')
this.clipboard.on('success', (e) => {
this.$notify({
title: '成功',
message: '链接已复制到剪切板,可粘贴。',
type: 'success'
})
})
this.clipboard.on('error', (e) => {
this.$message.error('链接复制失败')
})
},
destroyed() {
this.clipboard.destroy()
},
methods: {
getList(page) {
// console.log(this.dateRange);
if (this.dateRange) {
this.query.beginTime = this.dateRange[0]
this.query.endTime = this.dateRange[1]
} else {
this.query.beginTime = ''
this.query.endTime = ''
}
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
this.ids = []
})
.catch(() => {
this.loading = false
})
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = []
this.$refs['queryForm'].resetFields()
this.getList(1)
},
goRoute(path, id) {
this.$router.push({ path: path, query: { id } })
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id)
},
/** 删除按钮操作 */
remove(id) {
const ids = id || this.ids
this.$confirm('是否确认删除?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(function() {
return remove(ids)
})
.then(() => {
this.getList()
this.msgSuccess('删除成功')
})
.catch(function() {})
},
// 选择人员变化事件
selectedUser(users) {
this.form.weEmpleCodeUseScops = users.map((d) => {
return {
businessId: d.id || d.userId,
businessName: d.name,
businessIdType: d.userId ? 2 : 1
}
})
batchAdd(this.form).then(({ data }) => {
this.msgSuccess('操作成功')
this.getList(1)
})
},
download(id, userName, scenario) {
let name = userName + '-' + scenario + '.png'
download(id).then((res) => {
if (res != null) {
let blob = new Blob([res], { type: 'application/zip' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = name // 重命名文件
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
},
/** 下载 */
downloadBatch(qrCode) {
this.$confirm('是否确认下载所有图片吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
return downloadBatch(this.ids + '')
// window.open(downloadBatch(this.ids))
})
.then((res) => {
if (res != null) {
let blob = new Blob([res], { type: 'application/zip' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = '批量员工活码.zip' // 重命名文件
link.click()
URL.revokeObjectURL(url) // 释放内存
}
})
.catch(function() {})
}
}
}
</script>
<template>
<div>
<el-form :model="query" ref="queryForm" :inline="true" label-width="100px" class="top-search">
<el-form-item label="使用员工" prop="useUserName">
<el-input v-model="query.useUserName" placeholder="请输入" clearable @keyup.enter.native="getList(1)" />
</el-form-item>
<!-- <el-form-item label="姓名">
<el-input
v-model="query.operName"
placeholder="请输入"
clearable
@keyup.enter.native="getList(1)"
/>
</el-form-item> -->
<el-form-item label="手机号" prop="mobile">
<el-input v-model="query.mobile" placeholder="请输入" clearable @keyup.enter.native="getList(1)" />
</el-form-item>
<el-form-item label="活动场景" prop="scenario">
<el-input v-model="query.scenario" placeholder="请输入" clearable @keyup.enter.native="getList(1)" />
</el-form-item>
<el-form-item label="创建人" prop="createBy">
<el-input v-model="query.createBy" placeholder="请输入" clearable @keyup.enter.native="getList(1)" />
</el-form-item>
<el-form-item label="创建日期">
<el-date-picker
v-model="dateRange"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item label=" ">
<el-button v-hasPermi="['wecom:code:list']" type="cyan" @click="getList(1)">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
<!-- <el-button @click="resetQuery">导出</el-button> -->
</el-form-item>
</el-form>
<div class="mid-action">
<!-- <div class="total">
己选
<span class="num">{{ total }}</span> 条,当前已经配置
<span class="num">{{ total }}</span> 个 最多配置
<span class="num">{{ total }}</span> 个
</div> -->
<div>
<el-button v-hasPermi="['wecom:code:add']" type="primary" size="mini" @click="goRoute('staffAdd')"
>新建员工活码</el-button
>
<!-- <el-button
v-hasPermi="['wecom:code:batchAdd']"
type="primary"
size="mini"
@click="dialogVisible = true"
>批量新建</el-button
> -->
<el-button v-hasPermi="['wecom:code:remove']" type="primary" size="mini" @click="remove()">删除</el-button>
<el-button v-hasPermi="['wecom:code:downloadBatch']" type="primary" size="mini" @click="downloadBatch()"
>批量下载</el-button
>
</div>
</div>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange" max-height="600">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="样式" align="center" prop="qrCode">
<template slot-scope="{ row }">
<el-image
:src="row.qrCode"
fit="fit"
:preview-src-list="[row.qrCode]"
style="width: 100px; height: 100px"
></el-image>
</template>
</el-table-column>
<!-- <el-table-column label="使用员工" align="center" prop="useUserName" /> -->
<el-table-column label="姓名" align="center" prop="useUserName" show-overflow-tooltip />
<el-table-column label="手机号" align="center" prop="mobile" show-overflow-tooltip />
<el-table-column label="活动场景" align="center" prop="scenario" show-overflow-tooltip />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="{ row }">
<el-button
type="text"
@click="download(row.id, row.useUserName, row.scenario)"
v-hasPermi="['wecom:code:download']"
>下载</el-button
>
<el-button
type="text"
class="copy-btn"
:data-clipboard-text="row.qrCode"
v-hasPermi="['monitor:operlog:query']"
>复制链接</el-button
>
<el-button type="text" @click="goRoute('staffDetail', row.id)" v-hasPermi="['drainageCode:staff:detail']"
>查看详情</el-button
>
<el-button type="text" @click="goRoute('staffAdd', row.id)" v-hasPermi="['wecom:code:edit']">编辑</el-button>
<el-button type="text" @click="remove(row.id)" v-hasPermi="['wecom:code:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getList()"
/>
<!-- 批量新建弹窗 -->
<SelectUser :visible.sync="dialogVisible" title="组织架构" @success="selectedUser"></SelectUser>
</div>
</template>
<style lang="scss" scoped></style>
<template>
<div class="index">
<div class="index_l whitebg">
<!-- <div class="box titlebox">
<p>{{ parseTime(nowTime) }}</p>
</div> -->
<div class="tables">
<div style="text-align:left">
<el-row type="flex" class="row-bg" justify="space-between">
<el-col :span="24" class="title_name">数据总览</el-col>
</el-row>
<el-row type="flex" class="row-bg" justify="space-between" style="margin-top:35px; text-align: center;">
<el-col :span="6" class="col_style">企业成员总数</el-col>
<el-col :span="6" class="col_style">客户总人数</el-col>
<el-col :span="6" class="col_style">客户群总数</el-col>
<el-col :span="6" class="col_style">群成员总数</el-col>
</el-row>
<el-row
type="flex"
class="row-bg"
justify="space-between"
style="margin-top:10px;font-size:35px;font-weight:bold;color:#0079DE; text-align: center;"
>
<el-col :span="6">{{ table.customerCount }}</el-col>
<el-col :span="6">{{ table.groupMemberCount }}</el-col>
<el-col :span="6">{{ table.groupCount }}</el-col>
<el-col :span="6">{{ table.userCount }}</el-col>
</el-row>
</div>
</div>
<div class="dataall" style="margin-top:10px">
<div style="text-align:left">
<el-row type="flex" class="row-bg" justify="space-between">
<el-col :span="10" class="title_name"
>实时数据 <span class=" fontgay">更新于{{ uptime }}</span></el-col
>
<el-col :span="10" style="text-align:right">
<el-radio-group v-model="timeType" style="margin-top: 20px;" @change="timeTypeCheck">
<el-radio-button label="today">今日</el-radio-button>
<el-radio-button label="week">本周</el-radio-button>
<el-radio-button label="month">本月</el-radio-button>
<el-radio-button label="reset"><i class="el-icon-refresh"> </i></el-radio-button>
</el-radio-group>
</el-col>
</el-row>
<el-row type="flex" class="row-bg" justify="space-between" style="margin-top:30px; text-align: center;">
<el-col :span="6">发起申请数</el-col>
<el-col :span="6">新增客户数</el-col>
<el-col :span="6">群新增人数</el-col>
<el-col :span="6">流失客户数</el-col>
</el-row>
<el-row
type="flex"
class="row-bg"
justify="space-between"
style="margin-top:10px;font-size:35px;font-weight:bold;color: #0079DE; text-align: center;"
>
<el-col :span="6">{{ erchatsTable.newApplyCnt }}</el-col>
<el-col :span="6">{{ erchatsTable.newContactCnt }}</el-col>
<el-col :span="6">{{ erchatsTable.newMemberCnt ? erchatsTable.newMemberCnt : 0 }}</el-col>
<el-col :span="6">{{ erchatsTable.negativeFeedbackCnt }}</el-col>
</el-row>
<el-row type="flex" class="row-bg" justify="space-between" style="margin-top:10px; text-align: center;">
<el-col
:span="6"
:class="{
greenicon: Number(erchatsTable.newApplyCntDiff) >= 1,
redicon: Number(erchatsTable.newApplyCntDiff) < 0
}"
>较{{ time }}
<span>{{ erchatsTable.newApplyCntDiff }}</span>
</el-col>
<el-col
:span="6"
:class="{
greenicon: Number(erchatsTable.newContactCntDiff) >= 1,
redicon: Number(erchatsTable.newContactCntDiff) < 0
}"
>较{{ time }}
<span>{{ erchatsTable.newContactCntDiff }}</span>
</el-col>
<el-col
:span="6"
:class="{
greenicon: Number(erchatsTable.newMemberCntDiff) >= 1,
redicon: Number(erchatsTable.newMemberCntDiff) < 0
}"
>较{{ time }}
<span>{{ erchatsTable.newMemberCntDiff ? erchatsTable.newMemberCntDiff : 0 }}</span>
</el-col>
<el-col
:span="6"
:class="{
greenicon: Number(erchatsTable.negativeFeedbackCntDiff) >= 1,
redicon: Number(erchatsTable.negativeFeedbackCntDiff) < 0
}"
>较{{ time }}
<span>{{ erchatsTable.negativeFeedbackCntDiff }}</span>
</el-col>
</el-row>
</div>
</div>
<div class="erchatsdiv" style="margin-top:10px">
<el-row :gutter="20">
<el-col :span="12" class="erchats">
<el-row type="flex" class="row-bg" justify="space-between">
<div id="fatherbox">
<div id="main" ref="views"></div>
</div>
</el-row>
</el-col>
<el-col :span="12" class="erchats">
<el-row type="flex" class="row-bg" justify="space-between">
<div id="fatherbox">
<div id="main2" ref="views"></div>
</div>
</el-row>
</el-col>
<el-col :span="12" class="erchats">
<el-row type="flex" class="row-bg" justify="space-between">
<div id="fatherbox">
<div id="main3" ref="views"></div>
</div>
</el-row>
</el-col>
<el-col :span="12" class="erchats">
<el-row type="flex" class="row-bg" justify="space-between">
<div id="fatherbox">
<div id="main4" ref="views"></div>
</div>
</el-row>
</el-col>
</el-row>
</div>
<!-- -->
</div>
<div class="index_r whitebg">
<div class="qy_R">
<div class="inedx_r_top_t">
<p class="p1">{{ $store.state.user.companyName }},欢迎登陆本系统</p>
<p class="p2">登录时间:{{ parseTime(new Date()) }}</p>
<p class="p1 p3 margint20">LinkWechat 企业微信SCRM</p>
<p class="p2 p4">版本信息:开源 <span class="fr">可用期限:永久</span></p>
<el-row :gutter="20" type="flex" class="row-bg" justify="center" style="text-align:center">
<el-col :span="10" class="flexspan">
<img src="../assets/index/bzwd.png" />
<a href="https://www.yuque.com/linkwechat/help"> 帮助手册</a>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="10" class="flexspan" @click.native="msgInfo('《使用手册》正在加急上线中,敬请关注…')"
><img src="../assets/index/kfsc.png" /> 开发文档</el-col
>
</el-row>
</div>
<div class="inedx_r_top_bottom">
<span class="inedx_r_top_bottomp1"><img src="../assets/index/gxrz.png" /> 更新日志</span>
<span class="fr" style="color:#0079DE" @click="msgInfo('《更新日志》正在加急上线中,敬请关注…')">更多</span>
<ul>
<li v-for="(index, i) in 3" :key="i" @click="msgInfo('暂无内容')">
即将上线,敬请期待 <span class="fr">03-26</span>
</li>
</ul>
</div>
<div class="inedx_r_top_bottom">
<span class="inedx_r_top_bottomp1"><img src="../assets/index/qyxy.png" /> 私域学院</span>
<span class="fr" style="color:#0079DE">更多</span>
<ul>
<li v-for="(index, i) in 3" :key="i" @click="msgInfo('暂无内容')">
即将上线,敬请期待 <span class="fr">03-26</span>
</li>
</ul>
</div>
<div class="inedx_r_top_bottom" style="text-align:center">
<p style="text-align:left">
<span class="inedx_r_top_bottomp1"> <img src="../assets/index/kfq.png" /> 官方交流</span>
</p>
<img :src="bossImg" class="img" />
</div>
<div class="inedx_r_top_bottom" style="text-align:center">
<p style="text-align:left">
<span class="inedx_r_top_bottomp1"> <img src="../assets/index/khq.png" /> 联系客服</span>
</p>
<img :src="bossImg" class="img" />
</div>
</div>
</div>
<div class="car">
<el-row type="flex" class="row-bg" justify="space-between">
<el-col
:span="24"
style="font-size: 24px; line-height:80px
"
>功能直通车
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="4" v-for="(index, i) in car" :key="i">
<div class="grid-content" @click="$router.push(index.url)">
<span class="fl"> <img :src="index.img" alt="" /> </span><span class="fl craname">{{ index.name }}</span>
</div>
</el-col>
</el-row>
</div>
</div>
</template>
<script>
import { content } from '@/api/conversation/content.js'
import echarts from 'echarts'
export default {
name: 'Index',
components: {},
data() {
return {
nowTime: new Date(),
bossImg: require('@/assets/index/boss.png'),
car: [
{
name: '客户管理',
url: '/customerManage/customer',
img: require('@/assets/index/kehgl.png')
},
{
name: '内容存档',
url: '/conversation/content',
img: require('@/assets/index/neircd.png')
},
{
name: '任务宝',
url: '/appTool/task',
img: require('@/assets/index/renwb.png')
},
{
name: '消息群发',
url: '/groupMessage/add',
img: require('@/assets/index/xiaoxqf.png')
},
{
name: '员工活码',
url: '/drainageCode/staff',
img: require('@/assets/index/yuanghm.png')
},
{
name: '字典管理',
url: '/system/dict',
img: require('@/assets/index/zidgl.png')
}
],
table: {},
erchatsTable: {},
xAxis: ['1', '2', '3', '4', '5'],
allData: {},
time: '昨天',
uptime: '',
timeType: 'today',
charts: '',
opinionData: {
opinionData1: [],
opinionData2: [],
opinionData3: [],
opinionData4: []
},
charts: null
}
},
methods: {
timeTypeCheck(type) {
switch (type) {
case 'today':
case 'week':
case 'month':
let json = {
today: '昨天',
week: '上周',
month: '上月'
}
this.time = json[type]
this.erchatsTable = this.allData[type]
this.serErchat()
break
default:
this.time = '昨天'
this.timeType = 'today'
break
}
},
tableInfo() {
content.indexTable().then((res) => {
this.table = res.data
})
},
erchatInfo() {
content.indexEchart().then((res) => {
this.allData = res.data
this.uptime = res.data.updateTime
this.erchatsTable = this.allData.today
this.serErchat()
})
},
serErchat() {
let data = {
arr1: [],
arr2: [],
arr3: [],
arr4: [],
time: []
}
this.erchatsTable.dataList.forEach((a) => {
data.arr1.push(a.newApplyCnt)
data.time.push(a.xtime)
data.arr3.push(a.newMemberCnt)
data.arr2.push(a.newContactCnt)
data.arr4.push(a.negativeFeedbackCnt)
})
this.xAxis = data.time
this.drawLine('main', ['发起申请数'], data.arr1, '#088AEE')
this.drawLine('main2', ['新增客户数'], data.arr2, '#E74E59')
this.drawLine('main3', ['群新增人数'], data.arr3, '#14BF48')
this.drawLine('main4', ['流失客户数'], data.arr4, '#FA7216')
},
drawLine(id, arrData, data, color) {
let obj = document.getElementById(id)
obj.style.width = '100%'
obj.style.height = '380px'
this.charts = echarts.init(obj)
window.onresize = function() {
charts.resize()
// test
}
this.charts.setOption({
color: [color],
tooltip: {
trigger: 'axis'
},
legend: {
data: arrData
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
data: this.xAxis,
axisLine: {
lineStyle: {
color: '#ccc'
}
}
},
yAxis: {
type: 'value',
axisLine: {
lineStyle: {
color: '#ccc'
}
}
},
series: [
{
name: arrData,
type: 'line',
stack: '总量',
smooth: true,
data: data,
itemStyle: {
normal: {
lineStyle: {
color: color
}
}
},
textStyle: {
color: '#fff' // 主标题文字的颜色。
}
}
]
})
}
},
//调用
mounted() {
this.erchatInfo()
this.tableInfo()
}
}
</script>
<style lang="scss" scoped>
.index {
margin: 0;
padding: 0.5% 1%;
width: 100%;
background: #f1f1f1;
// overflow: hidden;
.title_name {
font-size: 24px;
font-weight: bold;
color: #000000;
padding-top: 15px;
}
.col_style {
font-size: 18px;
font-weight: 500;
color: #666;
}
.fontgay {
text-indent: 4em;
color: #999;
font-size: 14px;
font-weight: 200;
}
#fatherbox {
width: 100%;
height: 380px;
overflow-y: scroll;
}
#main {
width: 100%;
height: 380px;
}
.fr {
float: right;
}
.redicon {
color: #ff0000;
}
.greenicon {
color: green;
}
.tables {
width: 100%;
height: 200px;
background: #fff;
border-radius: 5px;
padding: 15px;
font-size: 16px;
}
.whitebg {
min-height: 1000px;
float: left;
border-radius: 5px;
}
.index_l {
width: 75%;
}
.circle {
width: 80px;
height: 80px;
background: #999;
border-radius: 50%;
margin: 0 auto;
img {
border-radius: 50%;
width: 80px;
height: 80px;
}
}
.index_r {
width: 23%;
margin-left: 2%;
.qy_R {
background: #fff;
min-height: 1267px;
border-radius: 5px;
.inedx_r_top_t {
border-radius: 5px;
height: 270px;
background-size: 100% 100%;
background: url('../assets/index/yd.png') no-repeat;
background-size: cover;
padding: 20px 10px 10px 10px;
color: #fff;
.flexspan {
height: 40px;
line-height: 40px;
background: #fff;
color: #0079de;
border-radius: 4px;
margin-top: 30px;
}
.margint20 {
margin-top: 31px;
}
p {
padding-top: 9px;
}
.p1 {
font-size: 16px;
font-weight: 500;
color: #ffffff;
}
.p2 {
font-size: 14px;
font-weight: 400;
color: #d3e8ff;
}
.p3 {
font-size: 18px;
}
.p4 {
color: #ffffff;
padding-top: 10px;
}
}
.img {
margin: 30px;
width: 175px;
height: 175px;
}
.inedx_r_top_bottom {
padding: 10px 30px;
margin-top: 29px;
.inedx_r_top_bottomp1 {
font-size: 16px;
color: #333333;
}
ul {
margin-top: 20px;
}
ul li {
font-size: 14px;
line-height: 35px;
font-weight: 500;
color: #666;
span {
color: #999999;
}
}
}
}
}
.box {
width: 100%;
}
.titlebox {
height: 80px;
padding: 10px 0;
background: #f1f1f1;
p {
line-height: 30px;
margin: 0;
padding: 0;
}
}
.adminname {
font-size: 20px;
font-weight: bold;
}
.dataall {
width: 100%;
height: 238px;
background: #fff;
border-radius: 5px;
padding: 20px;
font-size: 16px;
}
.erchatsdiv {
width: 100%;
height: auto;
overflow: hidden;
border-radius: 5px;
font-size: 16px;
/deep/ .el-col-12 {
width: 49%;
}
.erchats {
margin: 0 5px;
height: 400px;
border-radius: 4px;
margin-bottom: 10px;
background: #fff;
}
}
.car {
height: 200px;
margin-top: 40px;
width: 100%;
overflow: hidden;
line-height: 70px;
.grid-content {
overflow: hidden;
height: 70px;
background: #fff;
border-radius: 5px;
padding: 10px 30px;
.craname {
height: 50px;
line-height: 50px;
font-size: 16px;
display: block;
text-indent: 1em;
}
img {
width: 30px;
height: 30px;
}
}
}
}
</style>
<template>
<div class="login">
<div class="login-wrap">
<img class="login-bg1" src="@/assets/image/login_bg1.png" alt="" />
<img class="login-bg2" src="@/assets/image/login_bg2.png" alt="" />
<img class="login-bg3" src="@/assets/image/login_bg3.png" alt="" />
<div class="login-form-wrap">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">LinkWeChat</h3>
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
type="password"
auto-complete="off"
placeholder="密码"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="code">
<el-input
v-model="loginForm.code"
auto-complete="off"
placeholder="验证码"
style="width: 63%"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img" />
</div>
</el-form-item>
<el-checkbox class="fr" v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
<el-checkbox v-model="isDemonstrationLogin" @change="changeDemonAccount" style="margin:0px 0px 25px 0px;"
>演示账号登录</el-checkbox
>
<el-form-item style="width:100%;">
<el-button
:loading="loading"
size="medium"
type="primary"
style="width:100%;"
@click.native.prevent="handleLogin"
>
<span v-if="!loading">登 录</span>
<span v-else>登 录 中...</span>
</el-button>
</el-form-item>
<el-form-item class="ac" v-if="authLink">
<a :href="authLink">
<img
src="//wwcdn.weixin.qq.com/node/wwopen/wwopenmng/style/images/independent/brand/300x40_white$4dab5411.png"
srcset="
//wwcdn.weixin.qq.com/node/wwopen/wwopenmng/style/images/independent/brand/300x40_white_2x$6a1f5234.png 2x
"
alt="企业微信登录"
/>
</a>
</el-form-item>
</el-form>
</div>
</div>
<!-- 底部 -->
<div class="el-login-footer">
<span>Copyright © 2018-2021 LinkWeChat All Rights Reserved.</span>
</div>
<!-- <el-dialog
title="开源软件评选"
:visible.sync="dialogVisible"
width="400px"
class="c"
>
<div>
<p>2020年度最佳人气项目开源软件评选。</p>
<p>
请为
<strong style="color: #FF0036;" class="cp" @click="goVote"
>LinkWeChat</strong
>
投票,谢谢支持。
</p>
<div class="ac">
<img src="@/assets/image/vote-code.png" alt />
<p style="color: #FF0036;">☛☛微信扫码投票☚☚</p>
</div>
</div>
<div slot="footer">
<el-button @click="goVote">朕要支持</el-button>
<el-button type="primary" @click="dialogVisible = false"
>残忍拒绝</el-button
>
</div>
</el-dialog> -->
</div>
</template>
<script>
import axios from 'axios'
import { getCodeImg, findWxQrLoginInfo } from '@/api/login'
import Cookies from 'js-cookie'
import { encrypt, decrypt } from '@/utils/jsencrypt'
export default {
name: 'Login',
data() {
return {
codeUrl: '',
cookiePassword: '',
loginForm: {
username: '',
password: '',
rememberMe: false,
code: '',
uuid: ''
},
loginRules: {
username: [{ required: true, trigger: 'blur', message: '用户名不能为空' }],
password: [{ required: true, trigger: 'blur', message: '密码不能为空' }],
code: [{ required: true, trigger: 'change', message: '验证码不能为空' }]
},
loading: false,
redirect: undefined,
authLink: '',
dialogVisible: true,
isDemonstrationLogin: false
}
},
watch: {
$route: {
handler: function(route) {
this.redirect = route.query && route.query.redirect
},
immediate: true
}
},
created() {
// data.wxQrLoginRedirectUri http://192.168.0.101/#/authCallback
findWxQrLoginInfo().then(({ data }) => {
let authParams = {
appid: data.corpId, // * 服务商的CorpID
redirect_uri: encodeURIComponent(data.wxQrLoginRedirectUri), // * 授权登录之后目的跳转网址,需要做urlencode处理。所在域名需要与授权完成回调域名一致
state: '', // ? 用于企业或服务商自行校验session,防止跨域攻击
usertype: 'admin' // ? 支持登录的类型。admin代表管理员登录(使用微信扫码),member代表成员登录(使用企业微信扫码),默认为admin
}
this.authLink = `https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?appid=${authParams.appid}&redirect_uri=${authParams.redirect_uri}&state=${authParams.state}&usertype=${authParams.usertype}`
})
this.getCode()
this.getCookie()
},
methods: {
getCode() {
getCodeImg().then((res) => {
this.codeUrl = 'data:image/gif;base64,' + res.img
this.loginForm.uuid = res.uuid
})
},
getCookie() {
const username = Cookies.get('username')
const password = Cookies.get('password')
const rememberMe = Cookies.get('rememberMe')
this.loginForm = {
username: username === undefined ? this.loginForm.username : username,
password: password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
}
},
handleLogin() {
this.$refs.loginForm.validate((valid) => {
if (valid) {
this.loading = true
if (this.loginForm.rememberMe) {
Cookies.set('username', this.loginForm.username, { expires: 30 })
Cookies.set('password', encrypt(this.loginForm.password), {
expires: 30
})
Cookies.set('rememberMe', this.loginForm.rememberMe, {
expires: 30
})
} else {
Cookies.remove('username')
Cookies.remove('password')
Cookies.remove('rememberMe')
}
this.$store
.dispatch('Login', this.loginForm)
.then(() => {
this.$router.push({ path: this.redirect || '/' })
})
.catch(() => {
this.loading = false
this.getCode()
})
}
})
},
goVote() {
window.open('https://www.oschina.net/p/linkwechat')
},
changeDemonAccount(val) {
this.loginForm.username = val ? 'Wecome' : ''
this.loginForm.password = val ? '123456' : ''
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.login {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
// background-image: url('../assets/image/login-background.png');
background-size: cover;
}
.title {
margin: 0px auto 30px auto;
text-align: center;
color: #027dfe;
}
.login-form {
border-radius: 6px;
background: #ffffff;
width: 400px;
padding: 25px 25px 5px 25px;
position: relative;
top: 120px;
.el-input {
height: 38px;
input {
height: 38px;
}
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 2px;
}
}
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
.login-code {
width: 33%;
height: 38px;
float: right;
img {
cursor: pointer;
vertical-align: middle;
}
}
.el-login-footer {
height: 40px;
line-height: 40px;
position: fixed;
bottom: 0;
width: 100%;
text-align: center;
// color: #fff;
font-family: Arial;
font-size: 12px;
letter-spacing: 1px;
z-index: 90;
}
.login-code-img {
height: 38px;
}
.login /deep/.el-dialog {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin-top: 0vh !important;
}
.el-dialog__body {
padding: 0px 20px;
}
[class*='login-bg'] {
position: absolute;
z-index: -1;
}
.login-form-wrap {
position: relative;
background: #fff;
height: 609px;
top: 50px;
left: 100px;
}
.login-wrap {
position: relative;
width: 1180px;
height: 720px;
}
.login-bg1 {
top: 0;
left: 0;
}
.login-bg2 {
top: 50px;
left: 370px;
z-index: 10;
}
.login-bg3 {
top: 220px;
right: 25px;
z-index: 20;
}
</style>
<script>
import {
getTree,
getList,
getTreeDetail,
updateTree,
addTree,
removeTree,
getDetail,
add,
update,
remove,
moveGroup
} from '@/api/material'
// import {
// getList
// } from '@/api/material/poster'
export default {
name: 'MaPage',
components: {},
props: {
// "0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报 6 海报字体",
type: {
type: String,
default: '0'
},
// 选中的素材ids
selected: {
type: [Array, String],
default: ''
}
},
data() {
return {
loading: true, // 遮罩层
// 查询条件
query: {
pageNum: 1,
pageSize: 10,
categoryId: '',
search: '',
mediaType: '0'
},
list: [], // 列表
total: 0, // 总条数
treeData: [{}], // 树
// 树props
treeProps: {
children: 'children',
label: 'name'
},
treeForm: {}, // 树表格
treeDialogVisible: false, // 树表格对话框显隐
group: '', // 选择的分组
groupDialogVisible: false, // 移动分组对话框
// 分组props
groupProps: {
// expandTrigger: 'hover',
checkStrictly: true,
children: 'children',
label: 'name',
value: 'id',
emitPath: false
},
typeTitle: ['图片', '语音', '视频', '文件', '文本', '海报', '海报字体'],
form: {}, // 素材表单
dialogVisible: false, // 素材表格对话框显隐
// 表单校验
rules: Object.freeze({
categoryId: [{ required: true, message: '不能为空', trigger: 'change' }],
content: [{ required: true, message: '不能为空', trigger: 'blur' }],
materialUrl: [{ required: true, message: '不能为空', trigger: 'change' }],
materialName: [{ required: true, message: '不能为空', trigger: 'blur' }],
digest: [{ required: true, message: '不能为空', trigger: 'blur' }],
coverUrl: [{ required: true, message: '不能为空', trigger: 'blur' }]
})
}
},
watch: {},
computed: {},
created() {
this.query.mediaType = this.type
this.getTree()
this.getList()
},
mounted() {},
methods: {
// 获取类目树
getTree() {
getTree(this.type).then(({ data }) => {
this.treeData = [
{
id: '',
name: '全部',
parentId: '0',
hasParent: false,
hasChildren: true,
children: data || []
}
]
})
},
// 获取素材列表
getList(page) {
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
this.$emit('listChange', this.list)
})
.catch(() => {
this.loading = false
})
},
// 筛选节点
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
// 节点单击事件
handleNodeClick(data) {
this.query.categoryId = data.id
this.getList(1)
},
// 类目树节点添加/编辑 0: 添加, 1:编辑
treeEdit(data, type) {
this.treeForm = Object.assign({}, type ? data : { parentId: data.id || '0', mediaType: this.type })
this.treeDialogVisible = true
},
// 类目树节点提交
treeSubmit() {
;(this.treeForm.id ? updateTree : addTree)(this.treeForm)
.then(() => {
this.msgSuccess('操作成功')
this.treeDialogVisible = false
this.getTree()
})
.catch(() => {
this.treeDialogVisible = false
})
},
// 类目树节点删除
treeRemove(id) {
this.$confirm('是否确认删除吗?', '警告', {
type: 'warning'
})
.then(function() {
return removeTree(id)
})
.then(() => {
this.getTree()
this.msgSuccess('删除成功')
})
},
// 素材添加/编辑
edit(data, type) {
switch (type) {
case 5:
this.$parent.edit()
break
default:
this.form = Object.assign({}, data || { categoryId: this.query.categoryId })
this.dialogVisible = true
this.$nextTick(() => {
this.$refs['form'].clearValidate()
})
break
}
// type || !data ? (this.disabled = false) : (this.disabled = true)
},
// 素材提交
submit() {
// this.$refs['form'].validateField
this.$refs['form'].validate((valid) => {
if (valid) {
let form = JSON.parse(JSON.stringify(this.form))
;(form.id ? update : add)(form)
.then(() => {
this.msgSuccess('操作成功')
this.dialogVisible = false
this.getList()
this.$refs['form'].resetFields()
})
.catch(() => {
this.dialogVisible = false
})
}
})
},
// 素材删除
remove(id) {
const Ids = id || this.selected + ''
this.$confirm('是否确认删除吗?', '警告', {
type: 'warning'
})
.then(function() {
return remove(Ids)
})
.then(() => {
this.getList()
this.msgSuccess('删除成功')
})
},
// 移动分组
moveGroup() {
moveGroup(this.group, this.selected + '').then(() => {
this.getList()
this.msgSuccess('操作成功')
this.groupDialogVisible = false
})
},
// 下载
download(data) {
window.open(data.materialUrl)
}
}
}
</script>
<template>
<div class="page">
<el-row type="flex" justify="space-between">
<el-col :span="6">
<div>
<el-button v-hasPermi="['wechat:category:add']" slot="reference" type="primary" @click="treeEdit({}, 0)"
>添加分类</el-button
>
</div>
<div class="mt20">
<!-- :filter-node-method="filterNode" -->
<el-tree
ref="tree"
class="left-tree"
:data="treeData"
:props="treeProps"
:expand-on-click-node="false"
highlight-current
default-expand-all
@node-click="handleNodeClick"
>
<div class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<span class="fr" v-if="data.id">
<i
v-hasPermi="['wechat:category:edit']"
class="el-icon-edit-outline"
title="编辑"
@click.stop="treeEdit(data, 1)"
></i>
<i
v-hasPermi="['wechat:category:edit']"
class="el-icon-circle-plus-outline"
title="添加子分类"
@click.stop="treeEdit(data, 0)"
></i>
<i
v-hasPermi="['wechat:category:remove']"
class="el-icon-delete"
title="删除"
@click.stop="treeRemove(data.id)"
></i>
</span>
</div>
</el-tree>
</div>
</el-col>
<el-col :span="17">
<!-- <el-checkbox
:indeterminate="isIndeterminate"
v-model="checkAll"
@change="handleCheckAllChange"
>全选</el-checkbox
> -->
<div>
<el-input
v-model="query.search"
placeholder="请输入素材"
clearable
prefix-icon="el-icon-search"
style="width: 300px;"
/>
<el-button class="ml10" @click="getList(1)" v-hasPermi="['wecom:material:list']">搜索</el-button>
<el-button v-hasPermi="['wechat:material:remove']" @click="remove()" :disabled="selected.length === 0"
>删除</el-button
>
<el-popover placement="top" width="260" v-model="groupDialogVisible">
<div>选择分组</div>
<div style="position: relative; margin: 10px 0;">
<el-cascader v-model="group" :options="treeData[0].children" :props="groupProps"></el-cascader>
</div>
<div style="text-align: right;">
<el-button size="mini" @click="groupDialogVisible = false">取消</el-button>
<el-button type="primary" size="mini" @click="moveGroup">确定</el-button>
</div>
<el-button
v-hasPermi="['wechat:material:resetCategory']"
slot="reference"
class="ml10"
:disabled="selected.length === 0"
>移动分组</el-button
>
</el-popover>
<div class="fr">
<el-button v-hasPermi="['wechat:material:add']" type="primary" @click="edit(1, ~~type)"
>添加{{ typeTitle[type] }}</el-button
>
</div>
</div>
<div v-loading="loading" class="mt20">
<slot v-bind:list="list"></slot>
</div>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getList()"
/>
</el-col>
</el-row>
<!-- 分类树添加/编辑弹窗 -->
<el-dialog :title="(treeForm.id ? '修改' : '添加') + '分类'" :visible.sync="treeDialogVisible" width="400px">
<el-form ref="treeForm" :model="treeForm">
<el-form-item>
<el-input
v-model="treeForm.name"
maxlength="20"
show-word-limit
placeholder="分类名称"
@keyup.enter.native="treeSubmit"
></el-input>
</el-form-item>
<!-- <el-form-item label="所属分类" v-if="treeForm.pName">
<el-input disabled v-model="treeForm.pName"></el-input>
</el-form-item> -->
</el-form>
<div slot="footer">
<el-button @click="treeDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="treeSubmit">确 定</el-button>
</div>
</el-dialog>
<!-- 添加或修改素材对话框 -->
<el-dialog
:title="(form.id ? '修改' : '添加') + typeTitle[type]"
:visible.sync="dialogVisible"
width="600px"
append-to-body
>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="分类" prop="categoryId">
<el-cascader v-model="form.categoryId" :options="treeData[0].children" :props="groupProps"></el-cascader>
</el-form-item>
<el-form-item label="文本内容" prop="content" v-if="type === '4'">
<el-input
v-model="form.content"
type="textarea"
:autosize="{ minRows: 2, maxRows: 50 }"
placeholder="请输入内容"
></el-input>
</el-form-item>
<template v-else-if="type === '0'">
<el-form-item label="文案" prop="content">
<el-input
v-model="form.content"
type="textarea"
:autosize="{ minRows: 2, maxRows: 50 }"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="图片" prop="materialUrl">
<upload :fileUrl.sync="form.materialUrl" :fileName.sync="form.materialName" :type="type">
<div slot="tip">
支持JPG,PNG格式,图片大小不超过2M,建议上传宽高1:1的图片
</div>
</upload>
</el-form-item>
<el-form-item label="名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入"></el-input>
</el-form-item>
</template>
<template v-else-if="type === '1'">
<el-form-item label="语音" prop="materialUrl">
<upload :fileUrl.sync="form.materialUrl" :fileName.sync="form.materialName" :type="type">
<div slot="tip">
只能上传amr格式的语音文件。单个文件大小不超过2M,时长不超过1分钟
</div>
</upload>
</el-form-item>
<el-form-item label="名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入"></el-input>
</el-form-item>
</template>
<template v-else-if="type === '2'">
<el-form-item label="视频" prop="materialUrl">
<upload :fileUrl.sync="form.materialUrl" :fileName.sync="form.materialName" :type="type">
<div slot="tip">
不超过10M, 文件格式: mp4
</div>
</upload>
</el-form-item>
<el-form-item label="名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="封面">
<upload :fileUrl.sync="form.coverUrl" type="0">
<div slot="tip">
建议尺寸:1068*455
</div>
</upload>
</el-form-item>
<el-form-item label="摘要">
<el-input
v-model="form.digest"
type="textarea"
placeholder="非必填,限120字,如不填会自动抓取正文前54个字"
></el-input>
</el-form-item>
</template>
<template v-else-if="type === '3'">
<el-form-item label="文件" prop="materialUrl">
<upload :fileUrl.sync="form.materialUrl" :fileName.sync="form.materialName" :type="type">
<div slot="tip">
单个文件大小不超过20M
</div>
</upload>
</el-form-item>
<el-form-item label="名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入"></el-input>
</el-form-item>
</template>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit">确 定</el-button>
<el-button @click="dialogVisible = false">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<style lang="scss" scoped>
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
}
</style>
<script>
import { getPosterInfo, addPoster, updatePoster, removePoster } from '@/api/material/poster.js'
import MaPage from '@/views/material/components/MaPage'
import SelectMaterial from '@/components/SelectMaterial'
import { fabric } from 'fabric'
import qrCodeImage from '@/assets/poster/img/qrCodeImage.png'
export default {
name: 'Poster',
components: {
MaPage,
SelectMaterial
},
data() {
return {
imgList: {},
posterSubassemblyList: [],
dialogVisibleSelectMaterial: false,
dialog: {
preview: false, // 预览弹出显示隐藏
edit: false // 编辑弹出显示隐藏
},
materialSelected: '', // 图片url
rangeErrorMsg: '',
form: {
title: '', // 海报名称
categoryId: '', // 所属分类
type: '1', // 海报类型
// content: '', // 内容
// count: '', // 虚拟次数
// sort: '', // 海报排序
// jump: [], // 跳转页面
delFlag: 0, // 是否启用
mediaId: '' // 图片id
},
rules: {
title: {
required: true,
message: '请输入海报名称',
trigger: 'blur'
},
categoryId: {
required: true,
message: '请选择分类'
},
type: {
required: true,
message: '请选择海报类型'
},
delFlag: {
required: true,
message: '请选择是否启用'
}
},
srcList: [],
ids: [], // 选中数组
previewImg: '', // 预览图片地址
activeObject: {},
fontColor: ''
}
},
watch: {
fontColor(hex) {
this.setAttr('fill', hex)
}
},
created() {},
mounted() {},
methods: {
listChange(data) {
this.srcList = data.map((item) => item.materialUrl)
},
preview(url) {
this.previewImg = url || ''
this.dialog.preview = true
},
async edit(item) {
try {
if (item) {
// 编辑
const res = await getPosterInfo(item.id)
const data = res.data || {}
// console.log('getPosterInfo', data)
this.form = {
id: data.id,
title: data.title,
categoryId: data.categoryId,
type: data.type,
delFlag: data.delFlag,
posterJSON: JSON.parse(data.otherField)
}
this.posterSubassemblyList = data.posterSubassemblyList || []
this.materialSelected = data.backgroundImgPath
} else {
// 新增,清除编辑的数据
this.form = {}
this.posterSubassemblyList = []
}
this.dialog.edit = true
this.initPoster()
} catch (error) {
console.log(error)
}
},
// 初始化海报画布
initPoster() {
this.$nextTick(() => {
let canvas = (this.canvas = new fabric.Canvas('canvas'))
if (this.form.posterJSON) {
// 加载画布信息
this.setPosterBackgroundImage()
canvas.loadFromJSON(this.form.posterJSON, () => {
canvas.renderAll()
})
} else {
this.setPosterBackgroundImage()
}
// 删除某个图层
var deleteBtn = document.getElementById('deleteBtn')
function addDeleteBtn(x, y) {
deleteBtn.style.display = 'none'
deleteBtn.style.left = x - 10 + 'px'
deleteBtn.style.top = y - 30 + 'px'
deleteBtn.style.display = 'block'
}
canvas.on('selection:created', function(e) {
addDeleteBtn(e.target.lineCoords.tr.x, e.target.lineCoords.tr.y)
})
canvas.on('selection:updated', function(e) {
addDeleteBtn(e.target.lineCoords.tr.x, e.target.lineCoords.tr.y)
})
//通用事件另外写法
canvas.on({
'mouse:down': function(e) {
if (e.target != undefined) {
var ob = canvas.getActiveObject()
if (ob) {
var i = e.transform.corner
if (i == 'tr') {
this.del()
}
ob.set({
transparentCorners: false,
cornerColor: 'white',
cornerStrokeColor: 'blue',
borderColor: 'blue',
cornerSize: 12,
// rotatingPointOffset: 15,
padding: 10,
cornerStyle: 'circle',
borderDashArray: [3, 3],
snapAngle: 45, //在45度时自动保持到45的倍数
snapThreshold: 5,
centeredRotation: true
})
}
}
}
})
//是否拖动
// let panning = false
// canvas.on('mouse:down', (e) => {
// this.activeObject = canvas.getActiveObject()
// if (!this.activeObject) {
// deleteBtn.style.display = 'none'
// }
// //按住alt键可拖动画布
// if (e.e.altKey) {
// panning = true
// canvas.selection = false
// }
// })
// //鼠标抬起
// canvas.on('mouse:up', function(e) {
// panning = false
// canvas.selection = true
// })
// //鼠标移动
// canvas.on('mouse:move', function(e) {
// if (panning && e && e.e) {
// let delta = new fabric.Point(e.e.movementX, e.e.movementY)
// canvas.relativePan(delta)
// console.log(e)
// }
// })
canvas.on('object:modified', function(e) {
addDeleteBtn(e.target.lineCoords.tr.x, e.target.lineCoords.tr.y)
})
canvas.on('object:scaling', function(e) {
deleteBtn.style.display = 'none'
})
canvas.on('object:moving', function(e) {
deleteBtn.style.display = 'none'
})
canvas.on('object:rotating', function(e) {
deleteBtn.style.display = 'none'
})
canvas.on('mouse:wheel', function(e) {
deleteBtn.style.display = 'none'
})
// alt键缩放
document.getElementById('canvas-wrap').addEventListener('wheel', (e) => {
// e.stopPropagation()
if (e.altKey) {
e.preventDefault()
console.log(e)
let zoom = (e.deltaY > 0 ? 0.1 : -0.1) + canvas.getZoom()
zoom = Math.max(0.1, zoom) //最小为原来的1/10
zoom = Math.min(5, zoom) //最大是原来的5倍
let zoomPoint = new fabric.Point(e.offsetX, e.offsetY)
canvas.zoomToPoint(zoomPoint, zoom)
}
})
deleteBtn.addEventListener('click', () => {
let activeObject = canvas.getActiveObject()
if (activeObject) {
this.$confirm('是否确认删除吗?', '警告', {
type: 'warning'
}).then(() => {
canvas.remove(activeObject)
this.activeObject = null
deleteBtn.style.display = 'none'
})
}
})
})
},
// 设置海报背景
setPosterBackgroundImage() {
if (!this.materialSelected) {
return
}
let canvas = this.canvas
new fabric.Image.fromURL(this.materialSelected, (img) => {
// img.set({
// // 通过scale来设置图片大小,这里设置和画布一样大
// // scaleX: canvas.width / img.width,
// // scaleY: canvas.height / img.height
// })
canvas.setWidth(img.width)
canvas.setHeight(img.height)
canvas.setBackgroundImage(img, canvas.renderAll.bind(canvas))
canvas.renderAll()
})
},
// 设置文本对齐方式
setAttr(attr, type) {
this.activeObject.set(attr, type)
this.canvas.requestRenderAll()
// this.activeObject.set({
// textAlign: type
// })
},
addObj(type, obj) {
let options = {
left: 100,
top: 100,
borderDashArray: [3, 3],
customType: { text: 1, image: 2, qrcode: 3 }[type] // 自定义类型 1 固定文本 2 固定图片 3 二维码图片
}
switch (type) {
case 'text':
let text = new fabric.IText('请输入', options)
this.canvas.add(text).setActiveObject(text)
break
case 'imageShow':
this.dialogVisibleSelectMaterial = true
this.isBackgroundImage = false
break
case 'image':
case 'qrcode':
new fabric.Image.fromURL(type == 'image' ? obj : qrCodeImage, (img) => {
img.set(options)
img.scale(this.canvas.width / img.width / 2)
// img.scaleToWidth(200)
this.canvas.add(img).setActiveObject(img)
})
break
default:
break
}
this.activeObject = this.canvas.getActiveObject()
},
beforeCloseDialog() {
this.$refs.form.resetFields()
this.form.id = undefined
this.form.posterJSON = undefined
this.dialog.edit = false
},
remove(id) {
this.$confirm('是否确认删除吗?', '警告', {
type: 'warning'
})
.then(function() {
return removePoster(id)
})
.then(() => {
this.$refs.page.getList(1)
this.msgSuccess('删除成功')
})
},
submitSelectMaterial(text, image, file) {
if (this.isBackgroundImage) {
this.form.mediaId = image.id
this.materialSelected = image.materialUrl
this.setPosterBackgroundImage()
this.dialogVisibleSelectMaterial = false
} else {
this.addObj('image', image.materialUrl)
}
},
//
save(isBack) {
if (this.materialSelected === '') {
this.rangeErrorMsg = '请选择背景图片'
return
} else {
this.rangeErrorMsg = ''
}
this.$refs.form.validate((valid) => {
if (valid) {
let laoding = this.$loading()
const form = this.form
form.posterJSON = this.canvas.toJSON(['customType'])
let list = form.posterJSON.objects
form.otherField = JSON.stringify(form.posterJSON)
delete form.posterJSON
let posterSubList = []
let vo = null
let i = 0
let len = list.length
while (i < len) {
vo = list[i]
let isText = vo.type == 'i-text'
let align = (vo.textAlign && (vo.textAlign === 'left' ? 1 : vo.textAlign === 'center' ? 2 : 3)) || 1
let posData = {
id: null, // 修改的时候后端默认没增删,沟通后让先传null
content: vo.text || '', // 文本内容
delFlag: 0, // 1 启动 0 删除 暂时写死
fontColor: vo.fill || '#000000',
fontId: null, // TODO 后端让传NULL isText ? i : null, // 字体ID 与imgPath互斥
fontSize: parseInt(vo.fontSize),
fontTextAlign: align, // 1 2 3 left center right
left: parseInt(vo.left), // - (isText ? 0 : vo.width >> 1), // 显示偏移了
top: parseInt(vo.top), // - (isText ? 0 : vo.height >> 1),
width: parseInt(vo.width + (isText ? vo.fontSize / 2 : 0)),
height: parseInt(vo.height),
imgPath: vo.src || '',
posterId: null,
type: vo.customType, // 1 固定文本 2 固定图片 3 二维码图片
// alpha: vo.opacity, // 后端暂时不支持
fontStyle: vo.italic && vo.bold ? 3 : vo.italic ? 2 : vo.bold ? 1 : 0, // 0 通常 1 粗体 2 斜体 3 粗 + 斜
rotate: vo.angle,
order: i, // 层级
// categoryId: 0, // 分类ID (不需要传了)
verticalType: 2 // 居中方式后端让写死2
}
posterSubList.push(posData)
i++
}
;(form.id ? updatePoster : addPoster)(
Object.assign(
{
// backgroundImgPath: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg',
backgroundImgPath: this.materialSelected,
posterSubassemblyList: posterSubList
},
form
)
)
.then((res) => {
laoding.close()
this.msgSuccess(res.msg)
if (isBack) {
this.$refs.page.getList(1)
this.beforeCloseDialog()
}
})
.catch(() => {
laoding.close()
})
}
})
}
}
}
</script>
<template>
<div>
<MaPage ref="page" type="5" @listChange="listChange" :selected="ids" v-slot="{ list }">
<el-row :gutter="20">
<el-col :span="6" style="margin-bottom: 24px; min-width: 220px" v-for="(item, index) in list" :key="index">
<el-card shadow="hover" body-style="padding: 0px;">
<div class="img-wrap">
<el-image class="poster-img" :src="item.materialUrl" fit="contain"></el-image>
<div class="actions">
<el-tag class="actions-btn" type="success" size="mini" effect="dark" @click="preview(item.materialUrl)"
>预览</el-tag
>
<el-tag class="actions-btn" type="success" size="mini" effect="dark" @click="edit(item)">编辑</el-tag>
<el-tag class="actions-btn" type="success" size="mini" effect="dark" @click="remove(item.id)"
>删除</el-tag
>
</div>
</div>
<div style="padding: 14px">
<el-checkbox v-model="ids" :label="item.id">{{ item.materialName }}</el-checkbox>
</div>
</el-card>
</el-col>
</el-row>
<el-dialog title="海报预览" width="50%" :visible.sync="dialog.preview">
<img class="preview-img" :src="previewImg" />
</el-dialog>
<el-dialog
title="海报编辑"
width="80%"
v-if="dialog.edit"
:visible.sync="dialog.edit"
:before-close="beforeCloseDialog"
:close-on-click-modal="false"
>
<div class="poster-edit-dialog fxbw">
<div style="width: 30%;">
<el-form ref="form" :rules="rules" :model="form" label-width="120px">
<el-form-item label="海报名称" prop="title">
<el-input v-model="form.title" maxlength="10" show-word-limit></el-input>
</el-form-item>
<el-form-item label="所属分类" prop="categoryId">
<el-cascader
v-if="$refs.page"
v-model="form.categoryId"
:options="$refs.page.treeData[0].children"
:props="$refs.page.groupProps"
style="width: 100%;"
></el-cascader>
<!-- <el-select
v-model="form.categoryId"
placeholder="请选择分类"
>
<el-option label="海报一" value="1"></el-option>
<el-option label="海报二" value="2"></el-option>
</el-select> -->
</el-form-item>
<!-- <el-form-item label="所属二级分类">
<el-select
v-model="form.classifySecond"
placeholder="请选择分类"
>
<el-option label="海报一" value="poster1"></el-option>
<el-option label="海报二" value="poster2"></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="海报类型" prop="type">
<el-radio-group v-model="form.type">
<el-radio label="1">通用海报</el-radio>
<!-- <el-radio label="1">名片海报</el-radio>
<el-radio label="2">专属海报</el-radio> -->
<!-- <el-radio label="4">案例海报</el-radio>
<el-radio label="5">产品海报</el-radio> -->
</el-radio-group>
</el-form-item>
<!-- <el-form-item
:label="`${form.type === '4' ? '案例' : '产品'}内容`"
v-if="form.type === '4' || form.type === '5'"
>
<el-input v-model="form.content"></el-input>
</el-form-item> -->
<!-- <el-form-item label="虚拟次数">
<el-input v-model="form.count" type="number"></el-input>
</el-form-item>
<el-form-item label="海报排序">
<el-input v-model="form.sort" type="number"></el-input>
</el-form-item>
<el-form-item label="跳转页面" v-if="form.type === '3'">
<el-checkbox-group v-model="form.jump">
<el-checkbox label="首页" value="1"></el-checkbox>
<el-checkbox label="名片" value="2"></el-checkbox>
</el-checkbox-group>
</el-form-item> -->
<el-form-item label="是否启用" prop="delFlag">
<el-radio-group v-model="form.delFlag">
<el-radio :label="1">是</el-radio>
<el-radio :label="0">否</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="背景图片" :required="true" :error="rangeErrorMsg">
<div v-if="materialSelected !== ''">
<el-image
style="width: 100px; height: 100px; cursor: pointer;border-radius: 6px;"
:src="materialSelected"
fit="fit"
>
</el-image>
</div>
<el-button
icon="el-icon-plus"
size="mini"
@click="isBackgroundImage = dialogVisibleSelectMaterial = true"
>选择图片</el-button
>
</el-form-item>
<el-form-item label="">
<el-button type="success" @click="save()">保存</el-button>
<el-button type="success" @click="save(1)">保存并关闭</el-button>
</el-form-item>
</el-form>
</div>
<div style="">
<div id="canvas-wrap">
<i class="el-icon-error" id="deleteBtn"></i>
<canvas id="canvas" width="300" height="500" style="border: 1px solid #ddd;"> </canvas>
</div>
<div id="tbody-containerui-image-editor-controls">
<ul class="menu">
<li class="menu-item" id="btn-text" @click="addObj('text')">添加自定义文本</li>
<li class="menu-item" id="btn-image" @click="addObj('imageShow')">添加图片</li>
<li class="menu-item" id="btn-qrCode" @click="addObj('qrcode')">添加二维码</li>
<!-- <li class="menu-item" id="btn-nickName">添加客户昵称</li> -->
</ul>
<div class="sub-menu-container">
<ul class="menu" v-show="activeObject && activeObject.type == 'i-text'">
<li class="menu-item">
<!-- <div>
<button class="btn-text-style" data-style-type="b">Bold</button>
<button class="btn-text-style" data-style-type="i">Italic</button>
<button class="btn-text-style" data-style-type="u">Underline</button>
</div> -->
<!-- <div> -->
<div>
<button class="btn-text-style" @click="setAttr('textAlign', 'left')">左对齐</button>
<button class="btn-text-style" @click="setAttr('textAlign', 'center')">居中</button>
<button class="btn-text-style" @click="setAttr('textAlign', 'right')">右对齐</button>
</div>
</li>
<li class="menu-item">
<el-color-picker v-model="fontColor" color-format="hex"></el-color-picker>
</li>
</ul>
</div>
</div>
</div>
</div>
</el-dialog>
</MaPage>
<!-- 选择素材弹窗 -->
<SelectMaterial :visible.sync="dialogVisibleSelectMaterial" type="1" :showArr="[1]" @success="submitSelectMaterial">
</SelectMaterial>
</div>
</template>
<style lang="scss" scoped>
.el-icon-error {
position: absolute;
top: 0px;
left: 0px;
cursor: pointer;
z-index: 9;
font-size: 24px;
color: #fff;
display: none;
}
.img-wrap {
position: relative;
height: 0;
padding: 70% 0 0 0;
border-bottom: 1px solid #e6ebf5;
&:hover .actions {
opacity: 1;
}
}
.actions {
position: absolute;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-end;
width: 100%;
height: 100%;
left: 0;
top: 0;
padding: 10px;
opacity: 0;
transition: opacity 0.3s;
.actions-btn {
display: inline-block;
cursor: pointer;
margin: 10px 0 0 0;
// & + .actions-btn {
// margin: 10px;
// }
}
}
.poster-img {
position: absolute;
width: 100%;
height: 100%;
top: 0;
}
.preview-img {
width: 100%;
}
#canvas-wrap {
margin-right: 20px;
display: inline-block;
position: relative;
vertical-align: top;
overflow: auto;
max-width: 500px;
max-height: 700px;
}
#tbody-containerui-image-editor-controls {
display: inline-block;
position: relative;
}
.border {
border: 1px solid black;
}
.menu {
padding: 0;
margin-bottom: 5px;
text-align: center;
color: #544b61;
font-weight: 400;
list-style-type: none;
user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
}
.menu-item {
padding: 10px;
display: inline-block;
cursor: pointer;
vertical-align: middle;
}
.menu-item a {
text-decoration: none;
}
.menu-item.no-pointer {
cursor: default;
}
.menu-item.active,
.menu-item:hover {
background-color: #f3f3f3;
}
.menu-item.disabled {
cursor: default;
color: #bfbebe;
}
.sub-menu-container {
font-size: 14px;
margin-bottom: 1em;
}
.btn-text-style {
padding: 5px;
margin: 3px 1px;
border: 1px dashed #bfbebe;
outline: 0;
background-color: #eee;
cursor: pointer;
}
</style>
package com.linkwechat.wecom.domain; import lombok.Data; @Datapublic class CorpBasicPageData { private Long customerCount; private Long groupMemberCount; private Long groupCount; private Long userCount;}
\ No newline at end of file \ No newline at end of file
package com.linkwechat.wecom.mapper; import com.linkwechat.wecom.domain.CorpBasicPageData; public interface WePageMapper { CorpBasicPageData getCcorpBasicData();}
\ No newline at end of file \ No newline at end of file
...@@ -29,14 +29,14 @@ public interface IWeCustomerService extends IService<WeCustomer> ...@@ -29,14 +29,14 @@ public interface IWeCustomerService extends IService<WeCustomer>
*/ */
public WeCustomer selectWeCustomerById(String externalUserId); public WeCustomer selectWeCustomerById(String externalUserId);
/** // /**
* 新增/修改企业微信客户 // * 新增/修改企业微信客户
* // *
* @param weCustomer 企业微信客户 // * @param weCustomer 企业微信客户
* @return 修改结果 // * @return 修改结果
*/ // */
@Override // @Override
public boolean saveOrUpdate(WeCustomer weCustomer); // public boolean saveOrUpdate(WeCustomer weCustomer);
/** /**
* 查询企业微信客户列表 * 查询企业微信客户列表
......
package com.linkwechat.wecom.service; import com.linkwechat.wecom.domain.CorpBasicPageData; public interface IWePageService { CorpBasicPageData getCcorpBasicData();}
\ No newline at end of file \ No newline at end of file
package com.linkwechat.wecom.service.impl; import com.linkwechat.wecom.domain.CorpBasicPageData;import com.linkwechat.wecom.mapper.WePageMapper;import com.linkwechat.wecom.service.IWePageService;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service; @Servicepublic class WePageServiceImpl implements IWePageService { @Autowired WePageMapper wePageMapper; @Override public CorpBasicPageData getCcorpBasicData() { return wePageMapper.getCcorpBasicData(); }}
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.linkwechat.wecom.mapper.WePageMapper"> <select id="getCcorpBasicData" resultType="com.linkwechat.wecom.domain.CorpBasicPageData"> SELECT (SELECT COUNT(*) FROM we_user WHERE is_activate !=6) as customerCount, (SELECT COUNT(*) FROM we_customer WHERE del_flag=0) as groupMemberCount, (SELECT COUNT(*) FROM we_group WHERE del_flag=0) as groupCount, (SELECT count(*) FROM we_group_member where del_flag=0) as userCount </select> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!