打标签bug修复

1 parent f673b7e1
Showing 56 changed files with 0 additions and 4868 deletions
# link-wechat-mobile
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"]
};
This diff could not be displayed because it is too large.
{
"name": "link-wechat-mobile",
"version": "0.1.0",
"description": "LinkWeChat mobile",
"license": "GPL-3.0",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.21.1",
"clipboard": "^2.0.8",
"core-js": "^3.6.5",
"normalize.css": "^8.0.1",
"vant": "^2.12.2",
"vconsole": "^3.9.1",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuex": "^3.4.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^6.2.2",
"html-webpack-plugin": "^4.5.1",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"prettier": "^1.19.1",
"script-ext-html-webpack-plugin": "^2.1.5",
"style-resources-loader": "^1.3.2",
"vue-cli-plugin-style-resources-loader": "~0.1.4",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended",
"@vue/prettier"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
No preview for this file type
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
\ No newline at end of file \ No newline at end of file
<script>
import { getUserInfo } from '@/api/common'
import { getAgentTicket, getAppTicket } from '@/api/common'
import { param2Obj } from '@/utils/index'
export default {
name: 'App',
provide() {
return {
reload: this.reload
}
},
data() {
return {
corpId: '',
agentId: '',
isRouterAlive: true
}
},
async created() {
// http://106.13.201.219/?code=xxx&state=linkwechat#/route
// console.log('routerbeforeCreate', this.$route);
// this.$dialog({ message: 'url' + JSON.stringify(window.location) })
let query = param2Obj(window.location.search)
let hash = param2Obj(window.location.hash)
query = Object.assign(query, hash)
let code = query.code
this.corpId = query.corpId
this.agentId = query.agentId
// this.$toast('agentId:' + this.agentId)
this.$router.onReady(() => {
const noAuth = this.$router.app.$route.meta ? this.$router.app.$route.meta.noAuth : false
if (!code && !noAuth) {
this.$toast('未获得授权')
}
})
if (!code) {
// this.$toast('未获得授权')
return
}
let { data } = await getUserInfo(code, this.agentId)
this.$store.state.userId = data.userId
// this.$toast('userId:' + this.$store.state.userId)
},
watch: {
// 通过config接口注入权限验证配置
// 所有需要使用JS-SDK的页面必须先注入配置信息,否则将无法调用(同一个url仅需调用一次,对于变化url的SPA(single-page application)的web app可在每次url变化时进行调用)
$route(route) {
// this.wxConfig()
const noAuth = route.meta ? route.meta.noAuth : false
!noAuth && this.wxConfig()
}
},
methods: {
reload() {
this.isRouterAlive = false
this.$nextTick(() => {
this.isRouterAlive = true
})
},
async wxConfig() {
this.$store.state.agentConfigStatus = false
try {
let { data } = await getAgentTicket(window.location.href.split('#')[0], this.agentId)
let { timestamp, nonceStr, signature } = data
wx.agentConfig({
beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
debug: true,
corpid: this.corpId, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: this.agentId, // 必填,企业微信的应用id (e.g. 1000247)
timestamp, // 必填,生成签名的时间戳
nonceStr, // 必填,生成签名的随机串
signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList: [
'sendChatMessage',
'getContext',
'getCurExternalContact',
'openEnterpriseChat',
'shareToExternalContact',
'shareToExternalChat'
], //必填
success: (res) => {
// 回调
// this.$toast('agentId成功:')
this.$store.state.agentConfigStatus = true
},
fail: (res) => {
console.log('agent config 失败: ', res)
this.$toast('agentId失败:' + JSON.stringify(res))
if (res.errMsg.indexOf('function not exist') > -1) {
alert('版本过低请升级')
}
}
})
} catch (error) {}
}
// 丢弃
// _wxConfig() {
// // 获取企业的jsapi_ticket
// getAppTicket(window.location.href).then(({ data }) => {
// let { timestamp, nonceStr, signature } = data
// wx.config({
// beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
// debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
// corpId: this.corpId, // 必填,企业微信的corpID
// timestamp, // 必填,生成签名的时间戳
// nonceStr, // 必填,生成签名的随机串
// signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
// jsApiList: ['getContext', 'sendChatMessage'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
// })
// wx.ready(() => {
// // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
// getAgentTicket(window.location.href).then(({ data }) => {
// let { timestamp, nonceStr, signature } = data
// wx.agentConfig({
// corpid: this.corpId, // 必填,企业微信的corpid,必须与当前登录的企业一致
// agentid: this.agentId, // 必填,企业微信的应用id (e.g. 1000247)
// timestamp, // 必填,生成签名的时间戳
// nonceStr, // 必填,生成签名的随机串
// signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
// jsApiList: ['sendChatMessage'], //必填
// success: (res) => {
// // 回调
// },
// fail: (res) => {
// if (res.errMsg.indexOf('function not exist') > -1) {
// alert('版本过低请升级')
// }
// },
// })
// })
// })
// wx.error(function(res) {
// console.error(res)
// // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
// })
// })
// },
}
}
</script>
<template>
<div id="app">
<router-view class="page" v-if="isRouterAlive" />
</div>
</template>
<style lang="less">
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #2c3e50;
}
</style>
import request from '@/utils/request'
const wecom = window.CONFIG.services.wecom
const service = wecom + '/chat'
const serviceMaterial = wecom + '/material'
/**
* 侧边栏列表
* @param {*} params
*/
export function getTypeList() {
return request({
url: service + '/side/h5List',
})
}
/**
* 素材列表
* @param {*} sideId
*/
export function getMaterialList(params) {
return request({
url: service + '/item/list',
params,
})
}
/**
* 收藏列表(h5我的)
* @param {*} userId
*/
export function getCollectionList(params) {
return request({
url: service + '/collection/list',
params,
})
}
/**
* 添加收藏
* @param {*} data
* {
materialId:素材id
userId:用户id
}
*/
export function addCollection(data) {
return request({
url: service + '/collection/addCollection',
method: 'post',
// headers: {
// 'Content-Type': 'application/x-www-form-urlencoded',
// },
data,
})
}
/**
* 取消收藏
* @param {*} data
* {
materialId:素材id
userId:用户id
}
*/
export function cancleCollection(data) {
return request({
url: service + '/collection/cancleCollection',
method: 'post',
data,
})
}
/**
* 获取企业微信素材media_id
* @param {*} params
* url [string] 是 素材路径
type [string] 是 素材类型
name [string] 是 文件名称
*/
export function getMaterialMediaId(params) {
return request({
url: serviceMaterial + '/temporaryMaterialMediaId',
params,
})
}
import request from '@/utils/request'
import config from '@/config'
const service = config.services.wecom
/**
* 获取应用的jsapi_ticket
* @param {*} url 页面url
*/
export function getAgentTicket(url, agentId) {
return request({
url: service + '/ticket/getAgentTicket',
params: {
url,
agentId,
},
})
}
/**
* 获取企业的jsapi_ticket
* @param {*} url 页面url
*/
export function getAppTicket(url) {
return request({
url: service + '/ticket/getAppTicket',
params: {
url,
},
})
}
/**
* 获取登录用户id
* @param {*} url 页面url
*/
export function getUserInfo(code, agentId) {
return request({
url: service + '/user/getUserInfo',
params: {
code,
agentId,
},
})
}
\ No newline at end of file \ No newline at end of file
import request from '@/utils/request'
const wecom = window.CONFIG.services.wecom
const service = wecom + '/community/h5'
/**
* 获取用户相关的所有任务
* @param {*} userId 用户ID
* @param {*} taskType 0: 全部 1: 老客标签建群 2: 群SOP
* @returns
*/
export function getTasks (userId, taskType) {
return request({
url: service + '/' + userId,
params: {
type: taskType
}
})
}
/**
* 获取任务相关员工及完成情况
* @param {*} taskId 任务ID
* @param {*} taskType 1: 老客标签建群 2: 群SOP
* @returns
*/
export function getState (taskId, taskType) {
return request({
url: service + '/scope/' + taskId,
params: {
type: taskType
}
})
}
/**
* 更新任务状态
* @param {*} userId 用户ID
* @param {*} taskId 任务ID
* @param {*} taskType 0: 老客标签建群 1: 群SOP
* @returns
*/
export function changeStatus (userId, taskId, taskType) {
return request({
url: service + '/changeStatus',
params: {
emplId: userId,
taskId: taskId,
type: taskType
}
})
}
/**
* 获取用户相关的所有关键词任务任务
* @param {*} word 搜索的关键词或活码名称
* @returns
*/
export function getKeywordTasks (word) {
return request({
url: service + '/filter',
params: {
word: word
}
})
}
import request from '@/utils/request'
const wecom = window.CONFIG.services.wecom
const service = wecom + '/groupCode'
// 通过群活码UUID获取群活码详情及可用的实际群码
export function getDetail (uuid) {
return request({
url: service + '/getActualCode/' + uuid
})
}
import request from '@/utils/request'
const wecom = window.CONFIG.services.wecom
const service = wecom + '/portrait'
// 根据客户id和当前企业员工id获取客户详细信息
export function getCustomerInfo(params) {
return request({
url: service + '/findWeCustomerInfo',
params
})
}
// 客户画像资料更新
export function getWeCustomerInfo(data) {
return request({
url: service + '/updateWeCustomerInfo',
method: 'post',
data: {
externalUserid: data.externalUserid, // 客户Id
userId: data.userId, // 员工Id
remarkMobiles: data.remarkMobiles, // 手机号
birthday: data.birthday, // 客户生日
email: data.email, // 邮箱
address: data.address, // 地址
qq: data.qq, // qq
position: data.position, // 职业
remarkCorpName: data.remarkCorpName, // 公司
description: data.description // 其他描述
}
})
}
// 获取当前系统所有可用标签
export function getAllTags(params) {
return request({
url: service + '/findAllTags',
params
})
}
// 更新客户画像标签
export function updateWeCustomerPorTraitTag(data) {
return request({
url: service + '/updateWeCustomerPorTraitTag',
method: 'post',
data
})
}
// 查看客户添加的员工
export function findAddaddEmployes(params) {
return request({
url: service + '/findAddaddEmployes/' + params
})
}
// 获取用户添加的群
export function findAddGroupNum(params) {
return request({
url: service + '/findAddGroupNum',
params
})
}
// 获取轨迹信息
/**
*
* @param {*}
{
pageNum:
pageSize:
trajectoryType: 轨迹类型(1:信息动态;2:社交动态;3:活动规则;4:待办动态)
userId: 员工的id
externalUserid: 客户id
}
* @returns
*/
export function findTrajectory(params) {
return request({
url: service + '/findTrajectory',
params
})
}
// 添加或编辑轨迹
export function addOrEditWaitHandle(data) {
return request({
url: service + '/addOrEditWaitHandle',
method: 'post',
data
})
}
// 删除轨迹
export function removeTrajectory(params) {
return request({
url: service + '/removeTrajectory/' + params,
method: 'delete'
})
}
// 完成待办
export function handleWait(params) {
return request({
url: service + '/handleWait/' + params,
method: 'delete'
})
}
/* Logo 字体 */
@font-face {
font-family: "iconfont logo";
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834');
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') format('embedded-opentype'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg');
}
.logo {
font-family: "iconfont logo";
font-size: 160px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* tabs */
.nav-tabs {
position: relative;
}
.nav-tabs .nav-more {
position: absolute;
right: 0;
bottom: 0;
height: 42px;
line-height: 42px;
color: #666;
}
#tabs {
border-bottom: 1px solid #eee;
}
#tabs li {
cursor: pointer;
width: 100px;
height: 40px;
line-height: 40px;
text-align: center;
font-size: 16px;
border-bottom: 2px solid transparent;
position: relative;
z-index: 1;
margin-bottom: -1px;
color: #666;
}
#tabs .active {
border-bottom-color: #f00;
color: #222;
}
.tab-container .content {
display: none;
}
/* 页面布局 */
.main {
padding: 30px 100px;
width: 960px;
margin: 0 auto;
}
.main .logo {
color: #333;
text-align: left;
margin-bottom: 30px;
line-height: 1;
height: 110px;
margin-top: -50px;
overflow: hidden;
*zoom: 1;
}
.main .logo a {
font-size: 160px;
color: #333;
}
.helps {
margin-top: 40px;
}
.helps pre {
padding: 20px;
margin: 10px 0;
border: solid 1px #e7e1cd;
background-color: #fffdef;
overflow: auto;
}
.icon_lists {
width: 100% !important;
overflow: hidden;
*zoom: 1;
}
.icon_lists li {
width: 100px;
margin-bottom: 10px;
margin-right: 20px;
text-align: center;
list-style: none !important;
cursor: default;
}
.icon_lists li .code-name {
line-height: 1.2;
}
.icon_lists .icon {
display: block;
height: 100px;
line-height: 100px;
font-size: 42px;
margin: 10px auto;
color: #333;
-webkit-transition: font-size 0.25s linear, width 0.25s linear;
-moz-transition: font-size 0.25s linear, width 0.25s linear;
transition: font-size 0.25s linear, width 0.25s linear;
}
.icon_lists .icon:hover {
font-size: 100px;
}
.icon_lists .svg-icon {
/* 通过设置 font-size 来改变图标大小 */
width: 1em;
/* 图标和文字相邻时,垂直对齐 */
vertical-align: -0.15em;
/* 通过设置 color 来改变 SVG 的颜色/fill */
fill: currentColor;
/* path 和 stroke 溢出 viewBox 部分在 IE 下会显示
normalize.css 中也包含这行 */
overflow: hidden;
}
.icon_lists li .name,
.icon_lists li .code-name {
color: #666;
}
/* markdown 样式 */
.markdown {
color: #666;
font-size: 14px;
line-height: 1.8;
}
.highlight {
line-height: 1.5;
}
.markdown img {
vertical-align: middle;
max-width: 100%;
}
.markdown h1 {
color: #404040;
font-weight: 500;
line-height: 40px;
margin-bottom: 24px;
}
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
color: #404040;
margin: 1.6em 0 0.6em 0;
font-weight: 500;
clear: both;
}
.markdown h1 {
font-size: 28px;
}
.markdown h2 {
font-size: 22px;
}
.markdown h3 {
font-size: 16px;
}
.markdown h4 {
font-size: 14px;
}
.markdown h5 {
font-size: 12px;
}
.markdown h6 {
font-size: 12px;
}
.markdown hr {
height: 1px;
border: 0;
background: #e9e9e9;
margin: 16px 0;
clear: both;
}
.markdown p {
margin: 1em 0;
}
.markdown>p,
.markdown>blockquote,
.markdown>.highlight,
.markdown>ol,
.markdown>ul {
width: 80%;
}
.markdown ul>li {
list-style: circle;
}
.markdown>ul li,
.markdown blockquote ul>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown>ul li p,
.markdown>ol li p {
margin: 0.6em 0;
}
.markdown ol>li {
list-style: decimal;
}
.markdown>ol li,
.markdown blockquote ol>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown code {
margin: 0 3px;
padding: 0 5px;
background: #eee;
border-radius: 3px;
}
.markdown strong,
.markdown b {
font-weight: 600;
}
.markdown>table {
border-collapse: collapse;
border-spacing: 0px;
empty-cells: show;
border: 1px solid #e9e9e9;
width: 95%;
margin-bottom: 24px;
}
.markdown>table th {
white-space: nowrap;
color: #333;
font-weight: 600;
}
.markdown>table th,
.markdown>table td {
border: 1px solid #e9e9e9;
padding: 8px 16px;
text-align: left;
}
.markdown>table th {
background: #F7F7F7;
}
.markdown blockquote {
font-size: 90%;
color: #999;
border-left: 4px solid #e9e9e9;
padding-left: 0.8em;
margin: 1em 0;
}
.markdown blockquote p {
margin: 0;
}
.markdown .anchor {
opacity: 0;
transition: opacity 0.3s ease;
margin-left: 8px;
}
.markdown .waiting {
color: #ccc;
}
.markdown h1:hover .anchor,
.markdown h2:hover .anchor,
.markdown h3:hover .anchor,
.markdown h4:hover .anchor,
.markdown h5:hover .anchor,
.markdown h6:hover .anchor {
opacity: 1;
display: inline-block;
}
.markdown>br,
.markdown>p>br {
clear: both;
}
.hljs {
display: block;
background: white;
padding: 0.5em;
color: #333333;
overflow-x: auto;
}
.hljs-comment,
.hljs-meta {
color: #969896;
}
.hljs-string,
.hljs-variable,
.hljs-template-variable,
.hljs-strong,
.hljs-emphasis,
.hljs-quote {
color: #df5000;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-type {
color: #a71d5d;
}
.hljs-literal,
.hljs-symbol,
.hljs-bullet,
.hljs-attribute {
color: #0086b3;
}
.hljs-section,
.hljs-name {
color: #63a35c;
}
.hljs-tag {
color: #333333;
}
.hljs-title,
.hljs-attr,
.hljs-selector-id,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #795da3;
}
.hljs-addition {
color: #55a532;
background-color: #eaffea;
}
.hljs-deletion {
color: #bd2c00;
background-color: #ffecec;
}
.hljs-link {
text-decoration: underline;
}
/* 代码高亮 */
/* PrismJS 1.15.0
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"],
pre[class*="language-"] {
color: black;
background: none;
text-shadow: 0 1px white;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection,
pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection,
code[class*="language-"] ::-moz-selection {
text-shadow: none;
background: #b3d4fc;
}
pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
text-shadow: none;
background: #b3d4fc;
}
@media print {
code[class*="language-"],
pre[class*="language-"] {
text-shadow: none;
}
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre)>code[class*="language-"],
pre[class*="language-"] {
background: #f5f2f0;
}
/* Inline code */
:not(pre)>code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #999;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #905;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #690;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #9a6e3a;
background: hsla(0, 0%, 100%, .5);
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.function,
.token.class-name {
color: #DD4A68;
}
.token.regex,
.token.important,
.token.variable {
color: #e90;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>IconFont Demo</title>
<link rel="shortcut icon" href="//img.alicdn.com/imgextra/i2/O1CN01ZyAlrn1MwaMhqz36G_!!6000000001499-73-tps-64-64.ico" type="image/x-icon"/>
<link rel="icon" type="image/svg+xml" href="//img.alicdn.com/imgextra/i4/O1CN01EYTRnJ297D6vehehJ_!!6000000008020-55-tps-64-64.svg"/>
<link rel="stylesheet" href="https://g.alicdn.com/thx/cube/1.3.2/cube.min.css">
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="iconfont.css">
<script src="iconfont.js"></script>
<!-- jQuery -->
<script src="https://a1.alicdn.com/oss/uploads/2018/12/26/7bfddb60-08e8-11e9-9b04-53e73bb6408b.js"></script>
<!-- 代码高亮 -->
<script src="https://a1.alicdn.com/oss/uploads/2018/12/26/a3f714d0-08e6-11e9-8a15-ebf944d7534c.js"></script>
</head>
<body>
<div class="main">
<h1 class="logo"><a href="https://www.iconfont.cn/" title="iconfont 首页" target="_blank">&#xe86b;</a></h1>
<div class="nav-tabs">
<ul id="tabs" class="dib-box">
<li class="dib active"><span>Unicode</span></li>
<li class="dib"><span>Font class</span></li>
<li class="dib"><span>Symbol</span></li>
</ul>
<a href="https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=2510853" target="_blank" class="nav-more">查看项目</a>
</div>
<div class="tab-container">
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe600;</span>
<div class="name">性别</div>
<div class="code-name">&amp;#xe600;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe601;</span>
<div class="name">性别</div>
<div class="code-name">&amp;#xe601;</div>
</li>
</ul>
<div class="article markdown">
<h2 id="unicode-">Unicode 引用</h2>
<hr>
<p>Unicode 是字体在网页端最原始的应用方式,特点是:</p>
<ul>
<li>兼容性最好,支持 IE6+,及所有现代浏览器。</li>
<li>支持按字体的方式去动态调整图标大小,颜色等等。</li>
<li>但是因为是字体,所以不支持多色。只能使用平台里单色的图标,就算项目里有多色图标也会自动去色。</li>
</ul>
<blockquote>
<p>注意:新版 iconfont 支持多色图标,这些多色图标在 Unicode 模式下将不能使用,如果有需求建议使用symbol 的引用方式</p>
</blockquote>
<p>Unicode 使用步骤如下:</p>
<h3 id="-font-face">第一步:拷贝项目下面生成的 <code>@font-face</code></h3>
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.eot');
src: url('iconfont.eot?#iefix') format('embedded-opentype'),
url('iconfont.woff2') format('woff2'),
url('iconfont.woff') format('woff'),
url('iconfont.ttf') format('truetype'),
url('iconfont.svg#iconfont') format('svg');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
<pre><code class="language-css"
>.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3>
<pre>
<code class="language-html"
>&lt;span class="iconfont"&gt;&amp;#x33;&lt;/span&gt;
</code></pre>
<blockquote>
<p>"iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。</p>
</blockquote>
</div>
</div>
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-man"></span>
<div class="name">
性别
</div>
<div class="code-name">.icon-man
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-xingbie"></span>
<div class="name">
性别
</div>
<div class="code-name">.icon-xingbie
</div>
</li>
</ul>
<div class="article markdown">
<h2 id="font-class-">font-class 引用</h2>
<hr>
<p>font-class 是 Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。</p>
<p>与 Unicode 使用方式相比,具有如下特点:</p>
<ul>
<li>兼容性良好,支持 IE8+,及所有现代浏览器。</li>
<li>相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。</li>
<li>因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。</li>
<li>不过因为本质上还是使用的字体,所以多色图标还是不支持的。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-fontclass-">第一步:引入项目下面生成的 fontclass 代码:</h3>
<pre><code class="language-html">&lt;link rel="stylesheet" href="./iconfont.css"&gt;
</code></pre>
<h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;span class="iconfont icon-xxx"&gt;&lt;/span&gt;
</code></pre>
<blockquote>
<p>"
iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。</p>
</blockquote>
</div>
</div>
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-man"></use>
</svg>
<div class="name">性别</div>
<div class="code-name">#icon-man</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-xingbie"></use>
</svg>
<div class="name">性别</div>
<div class="code-name">#icon-xingbie</div>
</li>
</ul>
<div class="article markdown">
<h2 id="symbol-">Symbol 引用</h2>
<hr>
<p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:</p>
<ul>
<li>支持多色图标了,不再受单色限制。</li>
<li>通过一些技巧,支持像字体那样,通过 <code>font-size</code>, <code>color</code> 来调整样式。</li>
<li>兼容性较差,支持 IE9+,及现代浏览器。</li>
<li>浏览器渲染 SVG 的性能一般,还不如 png。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-symbol-">第一步:引入项目下面生成的 symbol 代码:</h3>
<pre><code class="language-html">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;
</code></pre>
<h3 id="-css-">第二步:加入通用 CSS 代码(引入一次就行):</h3>
<pre><code class="language-html">&lt;style&gt;
.icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
&lt;/style&gt;
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;svg class="icon" aria-hidden="true"&gt;
&lt;use xlink:href="#icon-xxx"&gt;&lt;/use&gt;
&lt;/svg&gt;
</code></pre>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$('.tab-container .content:first').show()
$('#tabs li').click(function (e) {
var tabContent = $('.tab-container .content')
var index = $(this).index()
if ($(this).hasClass('active')) {
return
} else {
$('#tabs li').removeClass('active')
$(this).addClass('active')
tabContent.hide().eq(index).fadeIn()
}
})
})
</script>
</body>
</html>
@font-face {font-family: "iconfont";
src: url('iconfont.eot?t=1619340295504'); /* IE9 */
src: url('iconfont.eot?t=1619340295504#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAOAAAsAAAAAB1wAAAMzAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCCfgqCTIJEATYCJAMMCwgABCAFhG0HNxuDBsgekiQBeyhJThMigiCE4uFr7H/n7u5XgQbJ3SpE89A90yhFvKo25v3fWhvcKm8Q9ROzlb97onODZxLRQncPCTLpqCQJDaa2SYOKV45GKObVdCmZ1Of65iVDaFNpS3UGXE6/tuA8oJzW2vZP0ZiACQa0N7aBAymQBL1FdhFXxCJPE6jXXbesGbM0FlSoQJMCcWCvyKDCjE1poIZaobpiZRFXValN59IJV4Lvx2fDopakKkMzl+yS8mj+HfQucs5UJjZ4BPl4HijryBgAKcSqSt8SOVFugBz1Vi5XD2hdg4J38V/hHU+22j88QiKqIXIj6MPnE+9QnVOT8xdIIINqFByA3OZNnX13T70b+7Ucf6jffcbHylvVbEqt2gfEit1J0oNeja57PHryOvNG3AvfBWfTG4gf0+RZRfdJH1Bi+/isev2Al5Jv2H6urOxlWz4zjGXScnaXQ4ef6ff5/MKbezpJX+Bndle/dRt3vpZOqHpDV21uWquB09iS/XaazV/s//t0SZPd1+iQSuxNPkeT2tvh5R/qbb3erJtt4+0GjYi6U50rc/MSyYKpYD9PKzDtMcLTaNqZ2BvpdEzryKDV9T6JZH5OrP0lT/8vT5E/5O6Df5tcqan7zixyYH0mwA4d/jMWz4zpS3NntkCo/Es/cz3kOWn3W37j+Z1jy1+h/kUaCnhzz4ODWOVfATfUnrg/+AlyYFOxlcieiymjMjeQje3pSfASNagChdp99jd0AZMJtbokSGp0Q1arB62wBqBKgxGoVmsy6vUnX9+gA5EjSh362eIQWp0hafYYWat3WmFlUKWrb1RrjYx6qwLfsUGv2FvvHAOGAo/ZdRziEnGBOGlxSDWBuBxlSFoZ8GxA0qEkHhg0JF+UQxzIGHPSK+IgpQIWSCKGZdx5EI0mcJIkwsDR3iClycm+wbuqXtTLJWKo2HQEYFCAh7HWYSGchDjB60wVFz5vAkTLohikoawlbgOItFD32IBe/QCaXBcHlV3LJWkrRIMoSoAJiIQYTMZ5QBTnErBk9bAwwKF6BXtkkib1Ce0EqK53fkPsAUqVKtCBOVLkKPLBrfGCzt64yIYAIQA=') format('woff2'),
url('iconfont.woff?t=1619340295504') format('woff'),
url('iconfont.ttf?t=1619340295504') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('iconfont.svg?t=1619340295504#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-man:before {
content: "\e600";
}
.icon-xingbie:before {
content: "\e601";
}
!function(e){var t,n,o,i,c,a,l='<svg><symbol id="icon-man" viewBox="0 0 1024 1024"><path d="M734.81728 575.0016a238.976 238.976 0 0 0-52.80768-79.54432 239.488 239.488 0 0 0-149.4272-69.53472l0.00512-236.58496 89.7024 89.7024a21.6576 21.6576 0 1 0 30.63296-30.63808L528.98304 124.4672a21.6576 21.6576 0 0 0-30.63296 0L374.41536 248.3968a21.66784 21.66784 0 0 0 30.63808 30.63808l84.18816-84.19328v231.26528a239.45728 239.45728 0 0 0-67.70688 16.5376 238.8992 238.8992 0 0 0-79.54432 52.80768 238.9504 238.9504 0 0 0-52.80768 79.54432c-11.68384 28.81024-17.60768 59.24352-17.60768 90.46016s5.92384 61.64992 17.60768 90.46016c12.09856 29.83936 29.87008 56.6016 52.80768 79.54432s49.71008 40.70912 79.54432 52.80768c28.80512 11.68384 59.24352 17.60256 90.46016 17.60256s61.65504-5.91872 90.45504-17.60256a238.93504 238.93504 0 0 0 79.54944-52.8128 238.976 238.976 0 0 0 52.80768-79.54432 239.55456 239.55456 0 0 0 17.60768-90.46016 239.54944 239.54944 0 0 0-17.59744-90.44992z m-83.45088 229.82144c-76.84608 76.84608-201.88672 76.84608-278.72768 0-76.8512-76.84608-76.84608-201.88672 0-278.72768 76.8512-76.84608 201.8816-76.84608 278.72768 0s76.84608 201.88672 0 278.72768z" fill="#40b1fc" ></path></symbol><symbol id="icon-xingbie" viewBox="0 0 1024 1024"><path d="M832.205 631.5a25.615 25.615 0 0 0-36.199 0l-64.153 64.154-68.557-68.556c87.86-106.138 82.125-264.192-17.203-363.52-51.149-51.098-119.04-79.258-191.283-79.258s-140.186 28.16-191.232 79.206-79.258 119.04-79.258 191.284 28.16 140.185 79.206 191.232c52.736 52.736 122.01 79.104 191.232 79.104 61.236 0 122.47-20.634 172.288-61.85l68.557 68.557-64.153 64.153a25.615 25.615 0 0 0 0 36.199c5.017 5.017 11.57 7.475 18.124 7.475s13.108-2.509 18.125-7.475l64.154-64.154 42.496 42.496c5.017 5.018 11.571 7.475 18.125 7.475s13.107-2.508 18.124-7.475a25.615 25.615 0 0 0 0-36.198l-42.496-42.496 64.154-64.154a25.667 25.667 0 0 0-0.051-36.198z m-532.48-21.657c-41.421-41.42-64.205-96.46-64.205-155.033 0-58.573 22.784-113.613 64.205-155.034 41.42-41.472 96.512-64.256 155.085-64.256 58.572 0 113.612 22.784 155.033 64.205 85.504 85.504 85.504 224.614 0 310.118-85.504 85.504-224.614 85.504-310.118 0z" fill="#1296DB" ></path></symbol></svg>',s=(s=document.getElementsByTagName("script"))[s.length-1].getAttribute("data-injectcss");if(s&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>")}catch(e){console&&console.log(e)}}function d(){c||(c=!0,o())}t=function(){var e,t,n,o;(o=document.createElement("div")).innerHTML=l,l=null,(n=o.getElementsByTagName("svg")[0])&&(n.setAttribute("aria-hidden","true"),n.style.position="absolute",n.style.width=0,n.style.height=0,n.style.overflow="hidden",e=n,(t=document.body).firstChild?(o=e,(n=t.firstChild).parentNode.insertBefore(o,n)):t.appendChild(e))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(n=function(){document.removeEventListener("DOMContentLoaded",n,!1),t()},document.addEventListener("DOMContentLoaded",n,!1)):document.attachEvent&&(o=t,i=e.document,c=!1,(a=function(){try{i.documentElement.doScroll("left")}catch(e){return void setTimeout(a,50)}d()})(),i.onreadystatechange=function(){"complete"==i.readyState&&(i.onreadystatechange=null,d())})}(window);
\ No newline at end of file \ No newline at end of file
{
"id": "2510853",
"name": "linkWechart",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "13963323",
"name": "性别",
"font_class": "man",
"unicode": "e600",
"unicode_decimal": 58880
},
{
"icon_id": "16921771",
"name": "性别",
"font_class": "xingbie",
"unicode": "e601",
"unicode_decimal": 58881
}
]
}
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!--
2013-9-30: Created.
-->
<svg>
<metadata>
Created by iconfont
</metadata>
<defs>
<font id="iconfont" horiz-adv-x="1024" >
<font-face
font-family="iconfont"
font-weight="500"
font-stretch="normal"
units-per-em="1024"
ascent="896"
descent="-128"
/>
<missing-glyph />
<glyph glyph-name="man" unicode="&#58880;" d="M734.81728 320.99839999999995a238.976 238.976 0 0 1-52.80768 79.54432 239.488 239.488 0 0 1-149.4272 69.53472l0.00512 236.58496 89.7024-89.7024a21.6576 21.6576 0 1 1 30.63296 30.63808L528.98304 771.5328a21.6576 21.6576 0 0 1-30.63296 0L374.41536 647.6032a21.66784 21.66784 0 0 1 30.63808-30.63808l84.18816 84.19328v-231.26528a239.45728 239.45728 0 0 1-67.70688-16.5376 238.8992 238.8992 0 0 1-79.54432-52.80768 238.9504 238.9504 0 0 1-52.80768-79.54432c-11.68384-28.81024-17.60768-59.24352-17.60768-90.46016s5.92384-61.64992 17.60768-90.46016c12.09856-29.83936 29.87008-56.6016 52.80768-79.54432s49.71008-40.70912 79.54432-52.80768c28.80512-11.68384 59.24352-17.60256 90.46016-17.60256s61.65504 5.91872 90.45504 17.60256a238.93504 238.93504 0 0 1 79.54944 52.8128 238.976 238.976 0 0 1 52.80768 79.54432 239.55456 239.55456 0 0 1 17.60768 90.46016 239.54944 239.54944 0 0 1-17.59744 90.44992z m-83.45088-229.82144c-76.84608-76.84608-201.88672-76.84608-278.72768 0-76.8512 76.84608-76.84608 201.88672 0 278.72768 76.8512 76.84608 201.8816 76.84608 278.72768 0s76.84608-201.88672 0-278.72768z" horiz-adv-x="1024" />
<glyph glyph-name="xingbie" unicode="&#58881;" d="M832.205 264.5a25.615 25.615 0 0 1-36.199 0l-64.153-64.154-68.557 68.556c87.86 106.138 82.125 264.192-17.203 363.52-51.149 51.098-119.04 79.258-191.283 79.258s-140.186-28.16-191.232-79.206-79.258-119.04-79.258-191.284 28.16-140.185 79.206-191.232c52.736-52.736 122.01-79.104 191.232-79.104 61.236 0 122.47 20.634 172.288 61.85l68.557-68.557-64.153-64.153a25.615 25.615 0 0 1 0-36.199c5.017-5.017 11.57-7.475 18.124-7.475s13.108 2.509 18.125 7.475l64.154 64.154 42.496-42.496c5.017-5.018 11.571-7.475 18.125-7.475s13.107 2.508 18.124 7.475a25.615 25.615 0 0 1 0 36.198l-42.496 42.496 64.154 64.154a25.667 25.667 0 0 1-0.051 36.198z m-532.48 21.657c-41.421 41.42-64.205 96.46-64.205 155.033 0 58.573 22.784 113.613 64.205 155.034 41.42 41.472 96.512 64.256 155.085 64.256 58.572 0 113.612-22.784 155.033-64.205 85.504-85.504 85.504-224.614 0-310.118-85.504-85.504-224.614-85.504-310.118 0z" horiz-adv-x="1024" />
</font>
</defs></svg>
<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>
const config = {
/**
* @description token在Cookie中存储的天数,默认1天
*/
cookieExpires: 1,
/**
* @description 默认打开的首页的路由name值,默认为home
*/
homeName: 'home',
}
config.services = {
wecom: '/wecom',
}
export default config
import Vue from 'vue'
import config from '@/config'
import '@/assets/icon/iconfont.css'
window.CONFIG = config
import 'normalize.css/normalize.css'
import Vant from 'vant'
import 'vant/lib/index.css'
Vue.use(Vant)
import '@/styles/index.less' // global css
import App from './App.vue'
import router from './router'
import store from './store'
import VConsole from 'vconsole'
process.env.NODE_ENV === 'production' && new VConsole()
Vue.config.productionTip = false
new Vue({
router,
store,
render: (h) => h(App),
}).$mount('#app')
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'Home',
component: Home,
meta: {
title: '首页'
}
},
{
path: '/chat',
name: 'chat',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/chat'),
meta: {
title: 'chat'
}
},
// 用户画像
{
path: '/portrait',
name: 'portrait',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () =>
import(/* webpackChunkName: "about" */ '../views/portrait/index'),
meta: {
title: 'portrait'
}
},
// 用户画像详情
{
path: '/customerDetail',
name: 'customerDetail',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () =>
import(
/* webpackChunkName: "about" */ '../views/portrait/customerDetail.vue'
),
hidden: true,
meta: {
title: ''
}
},
// 社群关系
{
path: '/community',
name: 'community',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () =>
import(/* webpackChunkName: "about" */ '../views/portrait/community.vue'),
hidden: true,
meta: {
title: ''
}
},
// 群活码扫描跳转页面
{
path: '/groupCode',
name: 'groupCode',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () =>
import(/* webpackChunkName: "about" */ '../views/groupCode/index'),
hidden: true,
meta: {
title: '',
noAuth: true
}
},
// 群活码扫描跳转页面
{
path: '/task',
// name: 'task',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () =>
import(
/* webpackChunkName: "about" */ '../views/communityOperating/task/index'
),
children: [
{
path: '',
component: () =>
import(
/* webpackChunkName: "about" */ '../views/communityOperating/task/list'
),
hidden: true,
meta: {
title: ''
// noAuth: true
}
},
{
path: 'state',
name: 'taskState',
component: () =>
import(
/* webpackChunkName: "about" */ '../views/communityOperating/task/state.vue'
),
hidden: true,
meta: {
title: '',
noAuth: true
}
}
],
hidden: true,
meta: {
title: '',
noAuth: true
}
},
// 群活码扫描跳转页面
{
path: '/keywords',
name: 'keywords',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () =>
import(
/* webpackChunkName: "about" */ '../views/communityOperating/keywords/index'
),
hidden: true,
meta: {
title: ''
}
}
]
const router = new VueRouter({
routes
})
export default router
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
userId: '',
agentConfigStatus: false,
},
mutations: {},
actions: {},
modules: {},
})
@charset "utf-8";
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/**,*:before,*:after{-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;-webkit-tap-highlight-color: rgba(0,0,0,0);-webkit-tap-highlight-color: transparent;max-height: 100000px;}*/
body,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
p,
blockquote,
dl,
dt,
dd,
ul,
ol,
li,
pre,
form,
fieldset,
legend,
button,
input,
textarea,
th,
td {
margin: 0;
padding: 0;
}
body,input, select, textarea /* for ie */ {
font: 14px Microsoft YaHei, '宋体', arial, -apple-system, 'PingFang SC',
'Helvetica Neue', Helvetica, 'DejaVu Sans', 'Lucida Grande', Tahoma,
'Hiragino Sans GB', STHeiti, SimSun, sans-serif;
line-height: 1.15;
color: #333; /*touch-action: none*/
} /** 设置默认字体 **/
header,
section,
footer,
aside,
nav,
article,
figure {
display: block;
}
input,
button,
select,
textarea {
outline: none;
vertical-align: middle; /*解决父级底部多余空白*/
-webkit-appearance: none; /*去掉webkit默认的表单样式*/
font-size: 100%; /* 使得表单元素在 ie 下能继承字体大小 */
border: none;
background: none;
color: inherit;
}
address,
cite,
dfn,
em,
var {
font-style: normal;
} /* 将斜体扶正 , 注:optgroup 无法扶正 */
h1,
h2,
h3,
h4,
h5,
h6 {
font-size: 100%;
background: none;
}
code,
kbd,
pre,
samp {
font-family: courier new, courier, monospace;
} /* 统一等宽字体 */
object,
embed,
video {
max-width: 100%;
}
a:link,
a:active,
a:visited,
a:hover {
text-decoration: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
img {
border: 0;
max-width: 100%;
vertical-align: middle;
} /*解决父级底部多余空白*/
small {
font-size: 12px;
} /* 小于 12px 的中文很难阅读,让 small 正常化 */
legend {
color: #000;
} /*for ie6*/
fieldset {
border: 0;
}
li {
list-style: none;
}
a {
color: inherit;
}
/*click outline for firefox*/
button::-moz-focus-inner,
input[type='reset']::-moz-focus-inner,
input[type='button']::-moz-focus-inner,
input[type='submit']::-moz-focus-inner,
input[type='file'] > input[type='button']::-moz-focus-inner {
border: none;
}
/*click outline for IE and other browser*/
button:focus,
input[type='reset']:focus,
input[type='button']:focus,
input[type='submit']:focus,
input[type='file'] > input[type='button']:focus {
outline: none;
}
/* 注意此处合并写法无效 */
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
color: #fff;
font-size: 16px;
}
input::-moz-placeholder,
textarea::-moz-placeholder {
color: #fff;
font-size: 16px;
}
input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
color: #fff;
font-size: 16px;
}
*:not(input, select, textarea) {
-webkit-user-select: none;
} /*禁止选中文本内容*/
::-webkit-scrollbar {
/*滚动条整体样式*/
width: 10px; /*高宽分别对应横竖滚动条的尺寸*/
height: 10px;
}
::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
border-radius: 10px;
/*深色模式*/
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
background: #bbb;
/*浅色模式*/
/*-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
background: rgb(245, 245, 245);
border: 1px solid #333;
border-bottom-width: 2px;*/
}
::-webkit-scrollbar-track {
/*滚动条里面轨道*/
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
border-radius: 10px;
background: #eee;
}
/* common class */
/*bfc model*/
.bfc-o {
overflow: hidden;
position: relative;
}
.bfc-d {
display: inline-block;
vertical-align: top;
position: relative;
}
.bfc-p {
position: absolute;
}
.fl {
float: left;
position: relative;
}
.fr {
float: right;
position: relative;
}
.flex {
display: flex;
}
.fxbw {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
ais {
align-items: stretch;
}
.aic {
align-items: center;
}
.al {
text-align: left;
}
.ac {
text-align: center;
}
.ar {
text-align: right;
}
.hide {
display: none;
}
/*top-fixed and bottom-fixed*/
.tf,
.bf {
position: fixed;
width: 100%;
height: 50px;
z-index: 999;
}
.tf {
top: 0;
}
.bf {
bottom: 0;
}
/*mask*/
.mask {
position: fixed;
width: 100%;
height: 100%;
background: rgba(39, 39, 39, 0.76);
left: 0;
bottom: 0;
margin: auto;
z-index: 9;
}
/*center-center*/
.cc {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
overflow: auto;
}
/*t-o-h-e*/
.toe {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.line2-toe {
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
display: -webkit-box;
white-space: pre-wrap;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
/*close*/
.close {
position: relative;
float: right;
width: 20px;
height: 20px;
line-height: 20px;
background: #f8f8f8;
text-align: center;
cursor: pointer;
}
/* pc frame */
.wrapper {
position: relative;
max-width: 1920px;
min-width: 1020px;
margin: 0 auto;
padding: 0 15px;
overflow: hidden;
}
.cp {
cursor: pointer;
}
.pt5 {
padding-top: 5px;
}
.pr5 {
padding-right: 5px;
}
.pb5 {
padding-bottom: 5px;
}
.pl5 {
padding-left: 5px;
}
.pt10 {
padding-top: 10px;
}
.pt15 {
padding-top: 15px;
}
.pt20 {
padding-top: 20px;
}
.mt5 {
margin-top: 5px;
}
.mr5 {
margin-right: 5px;
}
.mb5 {
margin-bottom: 5px;
}
.ml5 {
margin-left: 5px;
}
.mb8 {
margin-bottom: 8px;
}
.mt10 {
margin-top: 10px;
}
.mr10 {
margin-right: 10px;
}
.mb10 {
margin-bottom: 10px;
}
.ml10 {
margin-left: 10px;
}
.mt15 {
margin-top: 15px;
}
.mr15 {
margin-right: 15px;
}
.mb15 {
margin-bottom: 15px;
}
.ml15 {
margin-left: 15px;
}
.mt20 {
margin-top: 20px;
}
.mr20 {
margin-right: 20px;
}
.mb20 {
margin-bottom: 20px;
}
.ml20 {
margin-left: 20px;
}
@import './common.css';
@import './transition.less';
\ No newline at end of file \ No newline at end of file
// 全屏转场动画
.slide-left-enter-active,
.slide-right-enter-active {
transition: all 0.2s ease;
}
.slide-left-leave-active,
.slide-right-leave-active {
transition: all 0.2s cubic-bezier(1, 0.5, 0.8, 1);
}
.slide-left-enter,
.slide-right-leave-to {
transform: translateX(10px);
opacity: 0;
}
.slide-left-leave-to,
.slide-right-enter {
transform: translateX(-10px);
opacity: 0;
}
// 内页转场动画
.slide-inside-enter-active {
transition: all 0.3s ease;
}
.slide-inside-leave-active {
transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1);
}
.slide-inside-enter,
.slide-inside-leave-to
/* .slide-down-leave-active for below version 2.1.8 */
{
// position: absolute;
transform: translateY(-10px);
opacity: 0;
}
\ No newline at end of file \ No newline at end of file
@color: #42b9fd;
@colorSub: #4ee699;
@colorSubDeep: #34b071;
@borderColor: #106ed2;
@inputBgColor: #14344b;
@fontColor: #999;
// 画三角形
.triangle(@_, @wwww, @ccccc) {
width: 0px;
height: 0px;
overflow: hidden;
}
.triangle(L, @w, @c) {
border-width: @w;
border-style: dashed solid dashed dashed;
border-color: transparent @c transparent transparent;
}
.triangle(R, @w, @c) {
border-width: @w;
border-style: dashed dashed dashed solid;
border-color: transparent transparent transparent @c;
}
.triangle(T, @w, @c) {
border-width: @w;
border-style: dashed dashed solid dashed;
border-color: transparent transparent @c transparent;
}
.triangle(B, @w, @c) {
border-width: @w;
border-style: solid dashed dashed dashed;
border-color: @c transparent transparent transparent;
}
// 单边框
.border(single, @position: bottom, @color, @width: 1px) {
border-@{position}: @width solid @color;
}
// 全边框
.border(@color, @width: 1px) when (default()) {
border: @width solid @color;
}
/**
* 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
}
import axios from 'axios'
import { Toast, Dialog } from 'vant'
function createAxios(baseURL) {
const instance = axios.create({
baseURL,
headers: {
Auth_token: ''
},
timeout: 10000
})
// 请求拦截
instance.interceptors.request.use(
(config) => {
// console.log('request config: ' + JSON.stringify(config))
return config
},
(error) => {
return Promise.reject(error)
}
)
// 响应拦截
instance.interceptors.response.use(
(res) => {
// console.log('res: ' + res)
const { data, status } = res
// code 0:成功,-1/其它:错误
if (status === 200 && data.code === 200) {
return data
} else if (data.code === 201) {
// Message.error({
// content: `产品已存在`,
// duration: 3
// })
} else {
addErrorLog(res)
}
if (process.env.NODE_ENV === 'development') {
return Promise.reject(res) // 这样控制台会显示报错日志
} else {
return new Promise(() => {}) // 中断promise
}
},
(error) => {
if (error.response) {
addErrorLog(error.response)
} else {
Dialog({ message: '服务器未启动或连接超时' })
console.error('服务器未启动或连接超时')
}
return Promise.reject(error)
}
)
// 错误日志
const addErrorLog = (errorInfo) => {
const {
data,
statusText,
status,
request: { responseText, responseURL }
} = errorInfo
// let info = {
// type: 'ajax',
// code: status,
// mes: statusText,
// url: responseURL
// }
// if (!responseURL.includes('save_error_logger')) store.dispatch('addErrorLog', info)
process.env.NODE_ENV === 'development'
? console.error(`错误: 路径: ${responseURL}, 返回值 : ${responseText}`)
: console.error(`${JSON.parse(responseText).message}`)
Dialog({ message: responseText })
}
return instance
}
// const httpRequest = createAxios()
export default createAxios(process.env.NODE_ENV === 'development' ? '/api' : process.env.VUE_APP_BASE_API)
<template>
<div class="home">
<div class="logo ac">linkWeChat</div>
<router-link
class="router-link"
v-for="(item, index) in $router.options.routes"
:to="item.path"
:key="index"
>{{ item.meta.title }}</router-link
>
</div>
</template>
<script>
// @ is an alias to /src
export default {
name: 'Home',
components: {},
}
</script>
<style lang="less" scoped>
.logo {
margin: 0 auto;
width: 150px;
height: 50px;
line-height: 50px;
border: 2px solid #6582ff;
border-radius: 50px;
}
.router-link {
display: block;
text-align: center;
line-height: 40px;
}
</style>
<script>
import { getMaterialList, getCollectionList, addCollection, cancleCollection, getMaterialMediaId } from '@/api/chat'
export default {
components: {},
props: {
sideId: {
type: String,
default: ''
},
// mediaType 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报
mediaType: {
type: String,
default: '0'
},
userId: {
type: String,
default: ''
},
keyword: {
type: String,
default: ''
}
},
data() {
return {
refreshing: false,
loading: false,
finished: false,
error: false,
pageNum: 1,
pageSize: 10,
list: [],
collectList: [],
mediaTypeObj: {
'0': '图片',
'1': '语音',
'2': '视频',
'3': '普通文件',
'4': '文本',
'5': '海报'
}
}
},
watch: {
userId() {
this.getList(1)
}
},
computed: {},
created() {
this.getList()
// this.userId && this.getCollectionList()
},
mounted() {},
methods: {
getList(page) {
this.loading = true
this.finished = false
let pageNum = page || this.pageNum
let pageSize = this.pageSize
let keyword = this.keyword
if (pageNum == 1) {
this.list = []
this.pageNum = 1
}
;(this.sideId
? getMaterialList({
userId: this.userId,
sideId: this.sideId,
mediaType: this.mediaType,
pageSize,
pageNum,
keyword
})
: getCollectionList({ userId: this.userId, pageSize, pageNum, keyword })
)
.then(({ rows, total }) => {
// 判断我的列表
if (!this.sideId) {
rows.forEach((element) => {
element.collection = 1
})
}
this.list.push(...rows)
this.loading = false
this.refreshing = false
// 数据全部加载完成
if (this.list.length >= +total) {
this.finished = true
} else {
this.pageNum++
}
if (this.list.length == 0) {
this.pageNum = 1
}
})
.catch(() => {
this.error = true
})
},
// getCollectionList() {
// let data = { userId: this.userId, pageSize: 1000, pageNum: 1 }
// getCollectionList(data).then(({ rows, total }) => {
// this.collectList = rows.map((d) => d.materialId)
// })
// },
send(data) {
this.$toast.loading({
message: '正在发送...',
duration: 0,
forbidClick: true
})
let entry = undefined
let _this = this
wx.invoke('getContext', {}, async function(res) {
if (res.err_msg == 'getContext:ok') {
entry = res.entry //返回进入H5页面的入口类型,目前 contact_profile、single_chat_tools、group_chat_tools
let mes = {}
try {
if (!['single_chat_tools', 'group_chat_tools', 'normal'].includes(entry)) {
// _this.$toast.clear()
_this.$toast('入口错误:' + entry)
return
}
// mediaType 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报
// msgtype 文本(“text”),图片(“image”),视频(“video”),文件(“file”),H5(“news”)和小程序(“miniprogram”)
let msgtype = {
0: 'image',
2: 'video',
3: 'file',
4: 'text',
5: 'news'
}
switch (data.mediaType) {
case '4':
default:
mes.text = {
content: data.content //文本内容
}
break
case '0':
case '2':
case '3':
let dataMediaId = {
url: data.materialUrl,
type: msgtype[data.mediaType],
name: data.materialName
}
let resMaterialId = await getMaterialMediaId(dataMediaId)
if (!resMaterialId.data) {
_this.$toast('获取素材id失败')
return
}
mes[msgtype[data.mediaType]] = {
mediaid: resMaterialId.data.media_id //
}
break
case '5':
mes.news = {
link: '', //H5消息页面url 必填
title: '', //H5消息标题
desc: '', //H5消息摘要
imgUrl: '' //H5消息封面图片URL
}
break
// case '6':
// mes.miniprogram = {
// appid: 'wx8bd80126147df384', //小程序的appid
// title: '_this is title', //小程序消息的title
// imgUrl:
// 'https://search-operate.cdn.bcebos.com/d054b8892a7ab572cb296d62ec7f97b6.png', //小程序消息的封面图。必须带http或者https协议头,否则报错 $apiName$:fail invalid imgUrl
// page: '/index/page.html', //小程序消息打开后的路径,注意要以.html作为后缀,否则在微信端打开会提示找不到页面
// }
// break
}
mes.msgtype = msgtype[data.mediaType]
// _this.$dialog({ message: 'mes:' + JSON.stringify(mes) })
} catch (err) {
_this.$dialog({ message: 'err' + JSON.stringify(err) })
}
wx.invoke('sendChatMessage', mes, function(resSend) {
if (resSend.err_msg == 'sendChatMessage:ok') {
//发送成功 sdk会自动弹出成功提示,无需再加
// _this.$toast('发送成功')
} else {
//错误处理
// _this.$dialog({ message: '发送失败:' + JSON.stringify(resSend) })
}
})
_this.$toast.clear()
} else {
_this.$toast.clear()
//错误处理
_this.$dialog({ message: '进入失败:' + JSON.stringify(res) })
}
})
},
collect(data) {
// collection 是否收藏 0未收藏 1 已收藏
;(data.collection == 1 ? cancleCollection : addCollection)({
userId: this.userId,
materialId: data.materialId
}).then(() => {
data.collection = [1, 0][data.collection]
this.$toast('操作成功')
})
}
}
}
</script>
<template>
<div>
<van-pull-refresh v-model="refreshing" success-text="刷新成功" @refresh="getList(1)">
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
:error.sync="error"
error-text="请求失败,点击重新加载"
@load="getList()"
>
<div v-for="(item, index) in list" class="list" :key="index">
<div class="content bfc-o">
<!-- 图片 -->
<van-image v-if="item.mediaType == 0" width="80" height="80" :src="item.materialUrl" />
<!-- 视频 -->
<van-image v-if="item.mediaType == 2" width="80" height="80" :src="item.coverUrl" />
<span class="title">
{{ item.mediaType == 4 ? item.content : item.materialName }}
</span>
</div>
<div class="info">
{{ mediaTypeObj[item.mediaType] }}类型
<span class="time">{{ item.createTime }}</span>
<div class="fr flex">
<div class="action" @click="send(item)">发送</div>
<div v-if="!!userId" class="action" @click="collect(item)">
{{ item.collection == 1 ? '取消' : '' }}收藏
</div>
</div>
</div>
</div>
</van-list>
</van-pull-refresh>
</div>
</template>
<style lang="less" scoped>
.content {
// display: flex;
.van-image {
float: left;
margin: 0 10px 5px 0;
border: 1px solid #eee;
}
.title {
word-break: break-all;
}
}
.time {
margin-left: 5px;
}
</style>
<script>
import { getTypeList } from '@/api/chat'
import List from './List'
export default {
components: { List },
props: {},
data() {
return {
keyword: '',
active: 0,
list: [],
loading: false,
finished: false,
show: false
// userId: this.$store.state.userId,
}
},
watch: {
userId() {
this.getList()
}
},
computed: {
userId() {
return this.$store.state.userId
}
},
beforeCreate() {},
created() {
// this.$toast('userId:' + this.$store.state.userId)
this.getList()
},
mounted() {},
methods: {
getList() {
this.list = []
getTypeList().then(({ rows, total }) => {
this.userId &&
this.list.push({
sideName: '我的'
})
rows && this.list.push(...rows)
})
},
search(pageNum) {
this.$refs['list' + this.active] && this.$refs['list' + this.active][0].getList(pageNum)
},
cancel() {
this.$nextTick(() => this.search(1))
},
add() {}
}
}
</script>
<template>
<div>
<van-search v-model="keyword" show-action placeholder="请输入搜索关键词" @cancel="cancel" @search="search(1)">
<!-- <template #action>
<van-icon name="plus" @click="add" />
</template> -->
</van-search>
<van-tabs v-model="active">
<!-- <van-tab v-if="!!userId" title="我的">
<List ref="list0" :userId="userId" :keyword="keyword"></List>
</van-tab> -->
<van-tab :title="item.sideName" v-for="(item, index) in list" :key="index">
<List
:ref="'list' + index"
:sideId="item.sideId"
:mediaType="item.mediaType"
:userId="userId"
:keyword="keyword"
></List>
</van-tab>
</van-tabs>
<!-- <van-dialog
v-model="show"
:title="`添加&quot;我的&quot;${radio}`"
show-cancel-button
>
<van-form @submit="onSubmit">
<van-field name="radio" label="添加类型">
<template #input>
<van-radio-group v-model="radio" direction="horizontal">
<van-radio name="1">文本</van-radio>
<van-radio name="2">分类</van-radio>
</van-radio-group>
</template>
</van-field>
<van-field
v-model="username"
name="分类名称"
label="分类名称"
placeholder="分类名称"
:rules="[{ required: true, message: '请填写分类名称' }]"
/>
<template>
<van-field
readonly
clickable
name="picker"
:value="value"
label="文本分类"
placeholder="点击选择文本分类"
@click="showPicker = true"
/>
<van-popup v-model="showPicker" position="bottom">
<van-picker
show-toolbar
:columns="columns"
@confirm="onConfirm"
@cancel="showPicker = false"
/>
</van-popup>
<van-field
v-model="message"
rows="5"
autosize
label="文本信息"
type="textarea"
maxlength="150"
placeholder="请输入文本信息"
show-word-limit
/>
</template>
</van-form>
</van-dialog> -->
</div>
</template>
<style lang="less" scoped>
.page {
height: 100vh;
background: #f6f6f6;
}
/deep/ .list {
padding: 10px;
background: #fff;
border-top: 1px solid #eee;
.info {
padding-top: 10px;
}
.action {
padding-left: 5px;
}
}
</style>
<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:' + err.name + ',' + err.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: {
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>
<router-view></router-view>
</template>
<template>
<div>
<van-tabs v-model="isDone">
<van-tab :title="'待处理(' + todo.length + ')'" :name="0"></van-tab>
<van-tab :title="'已处理(' + done.length + ')'" :name="1"></van-tab>
</van-tabs>
<div class="type-area">
<van-button round size="small" @click="taskType = 0" :type="taskType === 0 ? 'info' : 'default'">全部</van-button>
<van-button round size="small" @click="taskType = 1" :type="taskType === 1 ? 'info' : 'default'"
>老客标签建群</van-button
>
<van-button round size="small" @click="taskType = 2" :type="taskType === 2 ? 'info' : 'default'"
>群SOP</van-button
>
</div>
<template v-if="!tasks || tasks.length === 0">
<van-empty description="暂无数据" />
</template>
<template v-else>
<template v-for="task in tasks">
<template v-if="task.type === 1">
<OldCustomerPanel
:key="task.taskId"
:task="task"
:state="isDone ? true : false"
@refresh="getTasks"
></OldCustomerPanel>
</template>
<template v-else>
<SOPPanel :key="task.ruleId" :task="task" :state="isDone ? true : false" @refresh="getTasks"></SOPPanel>
</template>
</template>
</template>
<van-overlay :show="loading" class-name="overlay">
<van-loading type="spinner"></van-loading>
</van-overlay>
</div>
</template>
<script>
import { getTasks } from '@/api/community'
import OldCustomerPanel from '../oldCustomer/panel'
import SOPPanel from '../SOP/panel'
export default {
components: { OldCustomerPanel, SOPPanel },
data() {
return {
isDone: 0, // 0: 待处理 1: 已处理
taskType: 0, // 任务类型 0:全部 1:老客标签建群 2:群SOP
loading: false, // 加载状态
todo: [], // 待处理数据
done: [] // 已处理数据
}
},
methods: {
// 获取老客标签建群和群SOP任务数据
getTasks() {
this.loading = true
getTasks(this.$store.state.userId, this.taskType)
.then((res) => {
if (res.code === 200) {
this.todo = res.todo || []
this.done = res.done || []
} else {
}
this.loading = false
})
.catch((error) => {
this.loading = false
})
}
},
computed: {
userId() {
return this.$store.state.userId
},
tasks() {
if (this.isDone === 1) return this.done
return this.todo
}
},
watch: {
taskType(val) {
if (this.userId) this.getTasks()
},
userId(val) {
if (val) {
this.getTasks()
}
}
},
created() {
document.title = '消息群发'
this.taskType = parseInt(this.$route.query.type)
}
}
</script>
<style lang="less" scoped>
.type-area {
padding: 8px;
background-color: #f2f2f2;
.van-button {
margin: 0 3px;
}
}
.overlay {
display: flex;
align-items: center;
.van-loading {
margin: auto;
}
}
</style>
<template>
<div>
<van-tabs :active="active" v-model="active">
<van-tab :title="'未完成(' + todoNum + ')'" :name="0">
<template v-if="todoMembers.length === 0">
<van-empty description="暂无数据" />
</template>
<template v-else>
<div v-for="member in todoMembers" :key="member.userId" class="cell">
<van-image width="45" :src="member.avatar"></van-image>
<div class="content"> {{ member.name }} </div>
</div>
</template>
</van-tab>
<van-tab :title="'已完成(' + doneNum + ')'" :name="1">
<template v-if="doneMembers.length === 0">
<van-empty description="暂无数据" />
</template>
<template v-else>
<div v-for="member in doneMembers" :key="member.userId" class="cell">
<van-image width="45" :src="member.avatar"></van-image>
<div class="content"> {{ member.name }} </div>
</div>
</template>
</van-tab>
</van-tabs>
<van-overlay :show="loading" class-name="overlay">
<van-loading type="spinner"></van-loading>
</van-overlay>
</div>
</template>
<script>
import { getState } from '@/api/community'
export default {
data () {
return {
taskId: '', // 任务ID
active: 0, // 0: 未完成 1: 已完成
taskType: 0, // 0: 老客标签建群 1: 群SOP
waitingCustomers: [], // 未完成客户
finishedCustomers: [], // 已完成客户
members: [], // 任务关联员工列表
loading: false, // 加载状态
}
},
methods: {
// 获取任务状态
getState () {
if (!this.taskId) return
this.loading = true
getState(this.taskId, this.taskType).then((res) => {
if (res.code === 200) {
this.members = res.data || []
}
this.loading = false
}).catch(() => {
this.loading = false
})
}
},
computed: {
// 带处理人员
todoMembers () {
const members = this.members.filter((m) => {
return !m.done
})
return members
},
todoNum () {
return this.todoMembers.length
},
// 已处理人员
doneMembers () {
const members = this.members.filter((m) => {
return m.done
})
return members
},
doneNum () {
return this.doneMembers.length
},
},
created () {
this.taskId = this.$route.query.taskId
this.active = this.$route.query.active || 0
this.taskType = this.$route.query.taskType || 0
this.getState()
}
}
</script>
<style lang="less" scoped>
/deep/ .van-tabs__wrap {
border-bottom: 1px solid #EEEEEE;
}
.cell {
display: flex;
align-items: center;
padding: 20px 15px;
border-bottom: 1px solid #EEEEEE;
:nth-child(n+2) {
margin-left: 20px;
}
.content {
font-size: 20px;
// font-weight: bold;
}
}
.overlay {
display: flex;
align-items: center;
.van-loading {
margin: auto;
}
}
</style>
<template>
<div>
<div v-if="!code || !code.actualQRCode">
<van-empty :description="message" />
</div>
<div v-else class="code-wrapper">
<div class="header">
{{ code.activityName }}
</div>
<div class="welcome">
{{ code.guide }}
</div>
<div class="code-name">
{{ code.groupName }}
</div>
<div class="code-image">
<van-image width="300" :src="code.actualQRCode"></van-image>
</div>
<div class="service" v-if="code.isOpenTip === '1'">
<van-button type="danger" @click="dialog = true">无法加群?</van-button>
</div>
<van-dialog v-model="dialog" class="service-dialog" :showConfirmButton="false" :closeOnClickOverlay="true">
<div>
<van-image :src="code.serviceQrCode" width="200"> </van-image>
<div class="service-message">
{{ code.tipMsg }}
</div>
<div class="tip">
请长按二维码添加客服微信
</div>
</div>
<van-icon name="cross" class="close" @click="dialog = false" />
</van-dialog>
</div>
</div>
</template>
<script>
import { getDetail } from '@/api/groupCode'
export default {
data() {
return {
groupCodeUUID: '', // 群活码ID
code: {
activityName: '', // 活码名称
guide: '', // 加群引导语
actualQRCode: '', // 实际群码
isOpenTip: '', // 是否显示无法加群提示
tipMsg: '', // 无法加群提示语
serviceQrCode: '', // 客服二维码
groupName: '' // 实际群名称
},
dialog: false,
message: '抱歉,暂无可用实际群码'
}
},
methods: {
// 获取群活码详情
getDetail() {
if (!this.groupCodeUUID) return
getDetail(this.groupCodeUUID)
.then(({ data, msg }) => {
this.code = Object.assign(this.code, data)
if (msg) this.message = msg
})
.catch(() => {})
}
},
created() {
document.title = '群活码'
this.groupCodeUUID = this.$route.query.id
this.getDetail()
}
}
</script>
<style lang="less" scoped>
.code-wrapper {
margin: 20px 10px;
.header {
font-size: 18px;
margin: 20px 10px;
text-align: center;
}
.welcome {
font-size: 16px;
color: #aaaaaa;
margin: 20px 10px 60px;
}
.code-name {
font-size: 20px;
margin: 20px 10px 2px;
font-weight: bold;
text-align: center;
}
.code-image {
text-align: center;
margin-bottom: 100px;
}
.service {
text-align: center;
.van-button {
border-radius: 4px;
height: 36px;
}
}
}
.service-dialog {
text-align: center;
border-radius: 0;
padding: 20px;
.service-message {
margin-bottom: 30px;
}
.tip {
font-size: 12px;
color: #aaaaaa;
}
.close {
position: absolute;
top: 10px;
right: 10px;
}
}
</style>
<template>
<div>
<!-- 头部 -->
<div class="header">
<span class="title"> 社群关系 </span>
<van-icon
name="cross"
color="#9c9c9c"
size="16"
@click="$router.back()"
/>
</div>
<van-divider />
<!-- 标签页 -->
<div class="labelPge">
<van-tabs
v-model="active"
color="#2C8CF0"
line-width="50%"
line-height="1.4px"
title-active-color="#2C8CF0"
>
<van-tab :title="'添加的员工(' + staff.length + ')'">
<van-list v-model="loading" :finished="finished" @load="onLoad">
<van-cell v-for="(item, index) in staff" :key="index">
<div class="details">
<div class="detail">
<div class="left">
<div class="img">
<img :src="item.headImageUrl" alt="" />
</div>
<div class="right">
<div>
<span>{{ item.userName }} &nbsp; &nbsp;</span>
</div>
<div class="c9">
<span>添加时间:</span>
<span>{{ getTime(item.createTime) }}</span>
</div>
</div>
</div>
</div>
</div>
</van-cell>
</van-list>
</van-tab>
<van-tab :title="'添加的群聊(' + groupChat.length + ')'">
<div class="groupchat1" @click="conGroup">只看与我共同的群聊</div>
<van-list v-model="loading" :finished="finished" @load="onLoad">
<van-cell v-for="(item, index) in groupChat" :key="index">
<div class="details">
<div class="detail">
<div class="left">
<div class="img">
<img src="@/assets/avatar.jpg" alt="" />
</div>
<div class="right">
<div>
{{ item.groupName + '(' + item.groupMemberNum + ')' }}
</div>
<div>
<span class="c9">群主:</span>
<span class="c9">{{ item.ownerName }}</span>
</div>
<div class="c9">
<span>入群时间:</span
><span>{{ getTime(item.joinTime) }}</span>
</div>
</div>
</div>
<div class="groupchat2" v-if="!item.commonGroup">
共同群聊
</div>
</div>
</div>
</van-cell>
</van-list>
</van-tab>
</van-tabs>
</div>
</div>
</template>
<script>
import { findAddaddEmployes, findAddGroupNum } from '@/api/portrait'
export default {
data() {
return {
active: 0,
// 添加员工
list: [],
loading: false,
finished: false,
staff: [], // 添加的员工
groupChat: [], // 添加的群聊
commonGroup: [], // 共同的群聊
// externalUserid: "wmiGuBCgAAIH-T9ekaE-Q52N2lKWeInw",
externalUserid: ''
}
},
computed: {
userId() {
return this.$store.state.userId // 员工Id
}
},
created() {
this.externalUserid = this.$route.query.customerId
this.findAddaddEmployes()
this.findAddGroupNum()
},
methods: {
conGroup() {
this.groupChat = this.commonGroup
// console.log(123);
},
onLoad() {
setTimeout(() => {
for (let i = 0; i < 2; i++) {
this.list.push(this.list.length + 1)
}
// 加载状态结束
this.loading = false
// 数据全部加载完成
if (this.list.length >= 2) {
this.finished = true
}
}, 1000)
},
findAddaddEmployes() {
findAddaddEmployes(this.externalUserid)
.then(({ data }) => {
// console.log(data);
this.staff = data
})
.catch((err) => {
console.log(err)
})
},
findAddGroupNum() {
findAddGroupNum({
externalUserid: this.externalUserid,
userId: this.userId
})
.then(({ data }) => {
// console.log(data);
// debugger
this.groupChat = data
this.commonGroup = this.groupChat.filter((ele) => {
// debugger
return ele.groupMemberNum == 1
})
})
.catch((err) => {
console.log(err)
})
},
// 时间处理器
getTime(data) {
const date = new Date(data)
// 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() + ' '
var h =
(date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
var m =
date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
return Y + M + D + h + m
}
}
}
</script>
<style lang="less" scoped>
/deep/body {
width: 100%;
height: 600px;
}
.labelPge {
width: 100%;
height: 100%;
background-color: #f2f2f2;
}
.header {
margin: 20px 20px 10px;
vertical-align: center;
text-align: left;
}
.van-icon-cross {
float: right;
}
.title {
text-align: center;
font-size: 14px;
}
/* 添加的员工 */
.details {
margin: 10px;
}
.detail {
display: flex;
justify-content: space-between;
.c9 {
color: #9c9c9c;
font-size: 12px;
}
}
.left {
display: flex;
margin-bottom: 20px;
.img {
width: 50px;
height: 50px;
background-color: #f2f2f2;
margin-right: 10px;
border-radius: 25px;
vertical-align: bottom;
}
.right {
display: flex;
flex-direction: column;
justify-content: space-between;
}
}
// 添加的群聊
.groupchat1 {
width: 120px;
height: 20px;
font-size: 12px;
background-color: #fff;
border-radius: 20px;
text-align: center;
line-height: 20px;
margin: 10px 20px;
}
.groupchat2 {
width: 60px;
height: 20px;
font-size: 12px;
background-color: #fff;
border-radius: 5px;
text-align: center;
line-height: 20px;
margin: 10px 0px;
color: #2c8cf0;
border: 1px solid #2c8cf0;
}
</style>
<template>
<div>
<!-- 头部 -->
<div class="header">
<van-icon
name="arrow-left"
color="#9c9c9c"
size="16"
@click="$router.back()"
/>
<span class="title"> 客户资料 </span>
<div class="data" v-if="flage" @click="edit">编辑</div>
<div class="data" v-else @click="saveUserInformation">保存</div>
</div>
<van-divider />
<!-- 详细资料 -->
<van-form @submit="saveUserInformation" :disabled="flage">
<div class="details">
<div class="detail">
<div class="left">
<div class="img"><img :src="form.avatar" alt="" /></div>
<div class="right">
<div>
<span
>{{
user.remark
? user.remark
: (user.name || '') + '-' + (user.remarkCorpName || '')
}}
</span>
<span class="icon iconfont icon-man" v-if="user.gender == 1">
</span>
<span
class="icon iconfont icon-xingbie"
v-else-if="user.gender == 2"
></span>
<van-icon name="manager" color="#9c9c9c" v-else />
</div>
<div class="c9">
<span>昵称:</span><span>{{ user.name }}</span>
</div>
</div>
</div>
</div>
</div>
<van-field
v-model="form.remarkMobiles"
name="手机号"
label="手机号"
placeholder="手机号"
input-align="right"
/>
<van-field
v-if="flage"
v-model="form.age"
name="年龄"
label="年龄"
placeholder="年龄"
input-align="right"
disabled
/>
<van-field
v-model="form.birthday"
name="生日"
label="生日"
placeholder="生日"
input-align="right"
@click="!flage ? (show = true) : ''"
/>
<van-popup
v-model="show"
position="bottom"
round
:style="{ height: '60%' }"
>
<van-datetime-picker
v-model="currentDate"
type="date"
title="选择年月日"
:min-date="minDate"
:max-date="maxDate"
@confirm="confirm"
@cancel="cancel"
/></van-popup>
<!-- -------------------------- -->
<van-field
v-model="form.email"
name="邮箱"
label="邮箱"
placeholder="邮箱"
input-align="right"
/>
<van-field
v-model="form.address"
name="地址"
label="地址"
placeholder="地址"
input-align="right"
/>
<van-field
v-model="form.qq"
name="QQ"
label="QQ"
placeholder="QQ"
input-align="right"
/>
<van-field
v-model="form.position"
name="职业"
label="职业"
placeholder="职业"
input-align="right"
/>
<van-field
v-model="form.remarkCorpName"
name="公司"
label="公司"
placeholder="公司"
input-align="right"
/>
<van-field
v-model="form.description"
name="其他描述"
label="其他描述"
placeholder="其他描述"
input-align="left"
type="textarea"
class="others"
/>
</van-form>
</div>
</template>
<script>
import { getCustomerInfo, getWeCustomerInfo } from '@/api/portrait'
export default {
data() {
return {
flage: true,
// 选择生日
show: false,
minDate: new Date(1940, 0, 1),
maxDate: new Date(),
currentDate: new Date(2000, 0, 17),
// 接口开始
// 表单数据
user: {},
form: {
externalUserid: '', // 客户Id
userId: '', // 员工Id
name: '', // 昵称
remarkMobiles: '', // 手机号
birthday: '', // 客户生日
age: '', // 年龄
email: '', // 邮箱
address: '', // 地址
qq: '', // qq
position: '', // 职业
remarkCorpName: '', // 公司
description: '' // 其他描述
}
}
},
computed: {
userId() {
return this.$store.state.userId // 员工Id
}
},
created() {
this.form.externalUserid = this.$route.query.customerId
// 获取客户详细信息
getCustomerInfo({
externalUserid: this.form.externalUserid,
userId: this.userId
})
.then(({ data }) => {
this.form = data
this.user = Object.assign({}, data)
})
.catch((err) => {
console.log(err)
})
},
methods: {
// 选择生日
confirm(val) {
this.show = false
this.form.birthday = this.getTime(val)
console.log(val)
},
cancel() {
this.show = false
},
edit() {
this.flage = !this.flage
},
// 时间处理器
getTime(data) {
const date = new Date(data)
// 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() + ' '
// var h =
// (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
// var m =
// date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
return Y + M + D
},
// 点击保存按钮提交表单
saveUserInformation() {
this.$toast.loading({
message: 'loading...',
duration: 0,
forbidClick: true
})
this.flage = !this.flage
this.form.userId = this.userId
getWeCustomerInfo(this.form)
.then((data) => {
this.$toast('操作成功')
})
.catch((err) => {
console.log(err)
})
}
}
}
</script>
<style lang="less" scoped>
.iconfont {
color: #2c8cf0;
}
.icon-xingbie {
color: pink;
}
.header {
margin: 20px 10px 10px;
vertical-align: center;
// text-align: center;
}
.van-icon-cross {
position: absolute;
left: 10px;
}
.title {
text-align: center;
font-size: 14px;
}
// 详细资料
.details {
margin: 10px 16px;
}
.detail {
display: flex;
justify-content: space-between;
.c9 {
color: #c8c9cc;
}
}
.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: #5fa7f3;
float: right;
}
.divider {
width: 100%;
height: 10px;
background-color: #f2f2f2;
}
/deep/.others {
line-height: 40px;
flex-direction: column;
.van-field__control--left {
float: left;
line-height: 20px;
.textarea {
margin-top: 20px;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!