Commit d9e5c81c by wenbin_font

任务宝

2 parents c56726fb 7b729153
Showing 135 changed files with 3357 additions and 720 deletions
...@@ -19,3 +19,4 @@ velocity.log ...@@ -19,3 +19,4 @@ velocity.log
.DS_Store .DS_Store
logs logs
.m2 .m2
linkwe-ui/.env.production
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<div align="center"> <div align="center">
![GVP Stars](http://img.shields.io/badge/GPV%20Stars-600+-yellow) ![GVP Stars](http://img.shields.io/badge/GPV%20Stars-700+-yellow)
![GVP Forks](http://img.shields.io/badge/GPV%20Forks-200+-yellow) ![GVP Forks](http://img.shields.io/badge/GPV%20Forks-200+-yellow)
![license](http://img.shields.io/badge/license-GPL%203.0-green) ![license](http://img.shields.io/badge/license-GPL%203.0-green)
......
# 开发环境配置
ENV = 'development'
# 塬微管理系统/开发环境
VUE_APP_BASE_API = 'http://146.56.222.200/api'
# VUE_APP_BASE_API = 'http://3x2d6z.natappfree.cc'
# 开发环境IP
VUE_APP_BASE_URL = 'http://192.168.0.101'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
# 生产环境配置
ENV = 'production'
# 塬微管理系统/生产环境api
VUE_APP_BASE_API = 'http://106.13.201.219'
# 生产环境IP
VUE_APP_BASE_URL = 'http://106.13.201.219'
...@@ -7609,6 +7609,11 @@ ...@@ -7609,6 +7609,11 @@
"integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=",
"dev": true "dev": true
}, },
"mutation-observer": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/mutation-observer/-/mutation-observer-1.0.3.tgz",
"integrity": "sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA=="
},
"mute-stream": { "mute-stream": {
"version": "0.0.8", "version": "0.0.8",
"resolved": "https://registry.npm.taobao.org/mute-stream/download/mute-stream-0.0.8.tgz", "resolved": "https://registry.npm.taobao.org/mute-stream/download/mute-stream-0.0.8.tgz",
...@@ -7793,6 +7798,11 @@ ...@@ -7793,6 +7798,11 @@
"integrity": "sha1-suHE3E98bVd0PfczpPWXjRhlBVk=", "integrity": "sha1-suHE3E98bVd0PfczpPWXjRhlBVk=",
"dev": true "dev": true
}, },
"normalize.css": {
"version": "8.0.1",
"resolved": "https://registry.npm.taobao.org/normalize.css/download/normalize.css-8.0.1.tgz",
"integrity": "sha1-m5iiCHOLnMJjTKrLxC0THJdIe/M="
},
"npm-run-path": { "npm-run-path": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnpm-run-path%2Fdownload%2Fnpm-run-path-2.0.2.tgz", "resolved": "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnpm-run-path%2Fdownload%2Fnpm-run-path-2.0.2.tgz",
...@@ -10804,6 +10814,11 @@ ...@@ -10804,6 +10814,11 @@
"punycode": "^2.1.1" "punycode": "^2.1.1"
} }
}, },
"transitionEnd": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/transitionEnd/-/transitionEnd-1.0.2.tgz",
"integrity": "sha1-GRTbW0Wn79w0oBr2koWjppOHFjM="
},
"tryer": { "tryer": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/tryer/download/tryer-1.0.1.tgz", "resolved": "https://registry.npm.taobao.org/tryer/download/tryer-1.0.1.tgz",
...@@ -11206,6 +11221,15 @@ ...@@ -11206,6 +11221,15 @@
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
"dev": true "dev": true
}, },
"vconsole": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/vconsole/-/vconsole-3.4.0.tgz",
"integrity": "sha512-N9py7Ch9M9nzsigYf8T/WHIOood7jq2MNtUWDqicnrCsPsOZj8Z3NsmFgBmDA3bPKwnzace11HXHxYKPfwV32A==",
"requires": {
"mutation-observer": "^1.0.3",
"transitionEnd": "^1.0.2"
}
},
"vendors": { "vendors": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npm.taobao.org/vendors/download/vendors-1.0.4.tgz?cache=0&sync_timestamp=1579857106626&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvendors%2Fdownload%2Fvendors-1.0.4.tgz", "resolved": "https://registry.npm.taobao.org/vendors/download/vendors-1.0.4.tgz?cache=0&sync_timestamp=1579857106626&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvendors%2Fdownload%2Fvendors-1.0.4.tgz",
...@@ -11300,8 +11324,8 @@ ...@@ -11300,8 +11324,8 @@
}, },
"vue-loader-v16": { "vue-loader-v16": {
"version": "npm:vue-loader@16.1.2", "version": "npm:vue-loader@16.1.2",
"resolved": "https://registry.npm.taobao.org/vue-loader/download/vue-loader-16.1.2.tgz?cache=0&sync_timestamp=1608188050165&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-loader%2Fdownload%2Fvue-loader-16.1.2.tgz", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.2.tgz",
"integrity": "sha1-XAO2xQ0qX5g8fOuhXFDXjKKymPQ=", "integrity": "sha512-8QTxh+Fd+HB6fiL52iEVLKqE9N1JSlMXLR92Ijm6g8PZrwIxckgpqjPDWRP5TWxdiPaHR+alUWsnu1ShQOwt+Q==",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
...@@ -11312,8 +11336,8 @@ ...@@ -11312,8 +11336,8 @@
"dependencies": { "dependencies": {
"ansi-styles": { "ansi-styles": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-4.3.0.tgz?cache=0&sync_timestamp=1606792382140&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fansi-styles%2Fdownload%2Fansi-styles-4.3.0.tgz", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
...@@ -11322,8 +11346,8 @@ ...@@ -11322,8 +11346,8 @@
}, },
"chalk": { "chalk": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npm.taobao.org/chalk/download/chalk-4.1.0.tgz?cache=0&sync_timestamp=1591687076871&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-4.1.0.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
"integrity": "sha1-ThSHCmGNni7dl92DRf2dncMVZGo=", "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
...@@ -11333,8 +11357,8 @@ ...@@ -11333,8 +11357,8 @@
}, },
"color-convert": { "color-convert": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
...@@ -11343,22 +11367,22 @@ ...@@ -11343,22 +11367,22 @@
}, },
"color-name": { "color-name": {
"version": "1.1.4", "version": "1.1.4",
"resolved": "https://registry.npm.taobao.org/color-name/download/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"has-flag": { "has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"loader-utils": { "loader-utils": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/loader-utils/download/loader-utils-2.0.0.tgz", "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
"integrity": "sha1-5MrOW4FtQloWa18JfhDNErNgZLA=", "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
...@@ -11369,8 +11393,8 @@ ...@@ -11369,8 +11393,8 @@
}, },
"supports-color": { "supports-color": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-7.2.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
......
...@@ -11,7 +11,9 @@ ...@@ -11,7 +11,9 @@
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"normalize.css": "^8.0.1",
"vant": "^2.12.2", "vant": "^2.12.2",
"vconsole": "^3.4.0",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-router": "^3.2.0", "vue-router": "^3.2.0",
"vuex": "^3.4.0" "vuex": "^3.4.0"
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<meta charset="utf-8"> <head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<title><%= htmlWebpackPlugin.options.title %></title> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
</head> <title><%= htmlWebpackPlugin.options.title %></title>
<body> <script src="./jweixin-1.2.0.js"></script>
<noscript> <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> </head>
</noscript>
<div id="app"></div> <body>
<!-- built files will be auto injected --> <noscript>
</body> <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
</html> 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> <script>
import { getUserInfo } from '@/api/common'
import { getAgentTicket, getAppTicket } from '@/api/common'
import { param2Obj } from '@/utils/index'
export default { export default {
name: 'App', name: 'App',
data() { data() {
return { return {
timestamp: '', corpId: '',
nonceStr: '', agentId: '',
signature: '',
} }
}, },
created() { async created() {
// 调取服务端signature // 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 code = query.code
this.corpId = query.corpId
this.agentId = query.agentId
if (!code) {
this.$toast('未获得授权')
return
}
let { data } = await getUserInfo(code, query.agentId)
this.$store.state.userId = data.userId
// this.$toast('userId:' + this.$store.state.userId)
}, },
watch: { watch: {
// 通过config接口注入权限验证配置 // 通过config接口注入权限验证配置
// 所有需要使用JS-SDK的页面必须先注入配置信息,否则将无法调用(同一个url仅需调用一次,对于变化url的SPA(single-page application)的web app可在每次url变化时进行调用) // 所有需要使用JS-SDK的页面必须先注入配置信息,否则将无法调用(同一个url仅需调用一次,对于变化url的SPA(single-page application)的web app可在每次url变化时进行调用)
$router() { $route() {
wx.config({ this.wxConfig()
beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: '123456', // 必填,企业微信的corpID
timestamp: this.timestamp, // 必填,生成签名的时间戳
nonceStr: this.nonceStr, // 必填,生成签名的随机串
signature: this.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
jsApiList: [], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
})
}, },
}, },
methods: {
wxConfig() {
getAgentTicket(window.location.href.split('#')[0], this.agentId).then(
({ data }) => {
let { timestamp, nonceStr, signature } = data
wx.agentConfig({
debug: true,
corpid: this.corpId, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: this.agentId, // 必填,企业微信的应用id (e.g. 1000247)
timestamp, // 必填,生成签名的时间戳
nonceStr, // 必填,生成签名的随机串
signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList: [
'sendChatMessage',
'getContext',
'getCurExternalContact',
], //必填
success: (res) => {
// 回调
// this.$toast('agentId成功:')
},
fail: (res) => {
this.$toast('agentId失败:' + JSON.stringify(res))
if (res.errMsg.indexOf('function not exist') > -1) {
alert('版本过低请升级')
}
},
})
}
)
},
// 丢弃
// _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> </script>
<template> <template>
<div id="app"> <div id="app">
<div id="nav"> <router-view class="page" />
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</div>
<router-view />
</div> </div>
</template> </template>
...@@ -43,20 +121,6 @@ export default { ...@@ -43,20 +121,6 @@ export default {
font-family: Avenir, Helvetica, Arial, sans-serif; font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50; color: #2c3e50;
} }
#nav {
padding: 30px;
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
}
}
}
</style> </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,
},
})
}
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 getAllTags() {
return request({
url: service + '/findAllTags'
})
}
\ No newline at end of file \ No newline at end of file
...@@ -4,38 +4,13 @@ const config = { ...@@ -4,38 +4,13 @@ const config = {
*/ */
cookieExpires: 1, cookieExpires: 1,
/** /**
* @description 是否使用国际化,默认为false
* 如果不使用,则需要在路由中给需要在菜单中展示的路由设置meta: {title: 'xxx'}
* 用来在菜单中显示文字
*/
useI18n: false,
/**
* @description api请求基础路径
*/
// 测试服
domain: process.env.NODE_ENV === 'development' ? 'http://192.168.1.32:8888' : 'http://192.168.1.26:8888', //
// 正式服
// domain: process.env.NODE_ENV === 'development' ? 'http://192.168.1.35:8118' : 'https://gateway.visualinsur.cn:8888', //
/**
* @description 默认打开的首页的路由name值,默认为home * @description 默认打开的首页的路由name值,默认为home
*/ */
homeName: 'home', homeName: 'home',
/**
* @description 需要加载的插件
*/
plugin: {
// 'error-store': {
// showInHeader: true, // 设为false后不会在顶部显示错误日志徽标
// developmentOff: false // 设为true后在开发环境不会收集错误信息,方便开发中排查错误
// }
},
// get domain() {
// return process.env.NODE_ENV === 'development' ? this.baseUrl.dev : this.baseUrl.pro
// }
} }
config.services = { config.services = {
wecom: '/wecom',
} }
export default config
\ No newline at end of file \ No newline at end of file
export default config
import wx from '@/utils/jweixin-1.2.0.js'
import Vue from 'vue' import Vue from 'vue'
import config from '@/config'
window.CONFIG = config
import 'normalize.css/normalize.css'
import Vant from 'vant' import Vant from 'vant'
import 'vant/lib/index.css' import 'vant/lib/index.css'
Vue.use(Vant) Vue.use(Vant)
import '@/styles/index.less' // global css
import App from './App.vue' import App from './App.vue'
import router from './router' import router from './router'
import store from './store' import store from './store'
window.wx = wx import VConsole from 'vconsole'
process.env.NODE_ENV === 'production' && new VConsole()
Vue.config.productionTip = false Vue.config.productionTip = false
......
import Vue from "vue"; import Vue from 'vue'
import VueRouter from "vue-router"; import VueRouter from 'vue-router'
import Home from "../views/Home.vue"; import Home from '../views/Home.vue'
Vue.use(VueRouter); Vue.use(VueRouter)
const routes = [ const routes = [
{ {
path: "/", path: '/',
name: "Home", name: 'Home',
component: Home component: Home,
meta: {
title: '首页',
},
}, },
{ {
path: "/about", path: '/chat',
name: "About", name: 'chat',
// route level code-splitting // route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route // this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited. // which is lazy-loaded when the route is visited.
component: () => component: () => import(/* webpackChunkName: "about" */ '../views/chat'),
import(/* webpackChunkName: "about" */ "../views/About.vue") 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: '/detail',
name: 'detail',
// 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/detail.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: '',
},
},
]
const router = new VueRouter({ const router = new VueRouter({
routes routes,
}); })
export default router; export default router
import Vue from "vue"; import Vue from 'vue'
import Vuex from "vuex"; import Vuex from 'vuex'
Vue.use(Vuex); Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
state: {}, state: {
userId: '',
},
mutations: {}, mutations: {},
actions: {}, actions: {},
modules: {} modules: {},
}); })
...@@ -33,9 +33,9 @@ td { ...@@ -33,9 +33,9 @@ td {
padding: 0; padding: 0;
} }
body,input, select, textarea /* for ie */ { body,input, select, textarea /* for ie */ {
font: 14px Microsoft YaHei, "宋体", arial, -apple-system, "PingFang SC", font: 14px Microsoft YaHei, '宋体', arial, -apple-system, 'PingFang SC',
"Helvetica Neue", Helvetica, "DejaVu Sans", "Lucida Grande", Tahoma, 'Helvetica Neue', Helvetica, 'DejaVu Sans', 'Lucida Grande', Tahoma,
"Hiragino Sans GB", STHeiti, SimSun, sans-serif; 'Hiragino Sans GB', STHeiti, SimSun, sans-serif;
line-height: 1.15; line-height: 1.15;
color: #333; /*touch-action: none*/ color: #333; /*touch-action: none*/
} /** 设置默认字体 **/ } /** 设置默认字体 **/
...@@ -119,18 +119,18 @@ a { ...@@ -119,18 +119,18 @@ a {
} }
/*click outline for firefox*/ /*click outline for firefox*/
button::-moz-focus-inner, button::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner, input[type='reset']::-moz-focus-inner,
input[type="button"]::-moz-focus-inner, input[type='button']::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner, input[type='submit']::-moz-focus-inner,
input[type="file"] > input[type="button"]::-moz-focus-inner { input[type='file'] > input[type='button']::-moz-focus-inner {
border: none; border: none;
} }
/*click outline for IE and other browser*/ /*click outline for IE and other browser*/
button:focus, button:focus,
input[type="reset"]:focus, input[type='reset']:focus,
input[type="button"]:focus, input[type='button']:focus,
input[type="submit"]:focus, input[type='submit']:focus,
input[type="file"] > input[type="button"]:focus { input[type='file'] > input[type='button']:focus {
outline: none; outline: none;
} }
...@@ -203,6 +203,23 @@ textarea:-ms-input-placeholder { ...@@ -203,6 +203,23 @@ textarea:-ms-input-placeholder {
float: right; float: right;
position: relative; 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 { .al {
text-align: left; text-align: left;
} }
...@@ -255,6 +272,17 @@ textarea:-ms-input-placeholder { ...@@ -255,6 +272,17 @@ textarea:-ms-input-placeholder {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; 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*/
.close { .close {
position: relative; position: relative;
...@@ -278,3 +306,99 @@ textarea:-ms-input-placeholder { ...@@ -278,3 +306,99 @@ textarea:-ms-input-placeholder {
.cp { .cp {
cursor: pointer; cursor: pointer;
} }
.pt5 {
padding-top: 5px;
}
.pb5 {
padding-bottom: 5px;
}
.pt10 {
padding-top: 10px;
}
.pt15 {
padding-top: 15px;
}
.pt20 {
padding-top: 20px;
}
.pr5 {
padding-right: 5px;
}
.pb5 {
padding-bottom: 5px;
}
.pl5 {
padding-left: 5px;
}
.mt5 {
margin-top: 5px;
}
.mr5 {
margin-right: 5px;
}
.mb5 {
margin-bottom: 5px;
}
.mb8 {
margin-bottom: 8px;
}
.ml5 {
margin-left: 5px;
}
.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
/**
* 请求路径参数转为对象
* @param {*} url
*/
export function param2Obj(url) {
const search = decodeURIComponent(url)
.split('?')[1]
.split('#')[0]
if (!search) {
return {}
}
return JSON.parse(
'{"' +
search
.replace(/"/g, '\\"')
.replace(/&/g, '","')
.replace(/=/g, '":"') +
'"}'
)
}
import axios from axios import axios from 'axios'
import config from "@/config" import { Toast, Dialog } from 'vant'
function createAxios(baseUrl) { function createAxios(baseURL) {
const instance = axios.create({ const instance = axios.create({
baseUrl, baseURL,
headers: { headers: {
Auth_token: "" Auth_token: '',
}, },
timeout: 3000, timeout: 10000,
}) })
// 请求拦截 // 请求拦截
instance.interceptors.request.use(config => { instance.interceptors.request.use(
// console.log('request config: ' + JSON.stringify(config)) (config) => {
return config // console.log('request config: ' + JSON.stringify(config))
}, error => { return config
return Promise.reject(error) },
}) (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 === 0) {
return JSON.stringify(data.result) ? data.result : data.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) instance.interceptors.response.use(
} else { (res) => {
// Message.error({ // console.log('res: ' + res)
// content: `服务器未启动或连接超时`, const { data, status } = res
// duration: 3 // code 0:成功,-1/其它:错误
// }) if (status === 200 && data.code === 200) {
console.error("服务器未启动或连接超时") 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)
} }
return Promise.reject(error) )
})
// 错误日志 // 错误日志
const addErrorLog = errorInfo => { const addErrorLog = (errorInfo) => {
const { data, statusText, status, request: { responseText, responseURL } } = errorInfo const {
data,
statusText,
status,
request: { responseText, responseURL },
} = errorInfo
// let info = { // let info = {
// type: 'ajax', // type: 'ajax',
// code: status, // code: status,
...@@ -59,8 +67,9 @@ function createAxios(baseUrl) { ...@@ -59,8 +67,9 @@ function createAxios(baseUrl) {
// } // }
// if (!responseURL.includes('save_error_logger')) store.dispatch('addErrorLog', info) // if (!responseURL.includes('save_error_logger')) store.dispatch('addErrorLog', info)
process.env.NODE_ENV === 'development' process.env.NODE_ENV === 'development'
? console.error(`错误: 路径: ${responseURL}, 返回值 : ${responseText}`,) ? console.error(`错误: 路径: ${responseURL}, 返回值 : ${responseText}`)
: console.error(`${JSON.parse(responseText).message}`,) : console.error(`${JSON.parse(responseText).message}`)
Dialog({ message: responseText })
} }
return instance return instance
...@@ -68,4 +77,4 @@ function createAxios(baseUrl) { ...@@ -68,4 +77,4 @@ function createAxios(baseUrl) {
// const httpRequest = createAxios() // const httpRequest = createAxios()
export default createAxios(config.domain)
\ No newline at end of file \ No newline at end of file
export default createAxios(process.env.VUE_APP_BASE_API)
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>
<template> <template>
<div class="home"> <div class="home">
<img alt="Vue logo" src="../assets/logo.png" /> <div class="logo ac">linkWeChat</div>
<HelloWorld msg="Welcome to Your Vue.js App" /> <router-link
class="router-link"
v-for="(item, index) in $router.options.routes"
:to="item.path"
:key="index"
>{{ item.meta.title }}</router-link
>
</div> </div>
</template> </template>
<script> <script>
// @ is an alias to /src // @ is an alias to /src
import HelloWorld from "@/components/HelloWorld.vue";
export default { export default {
name: "Home", name: 'Home',
components: { components: {},
HelloWorld }
}
};
</script> </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) {
let pageNum = page || this.pageNum++
let pageSize = this.pageSize
let keyword = this.keyword
page == 1 && (this.list = [])
;(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
}
})
.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: {},
computed: {
userId() {
return this.$store.state.userId
},
},
beforeCreate() {},
created() {
// this.$toast('userId:' + this.$store.state.userId)
this.getList()
},
mounted() {},
methods: {
getList() {
getTypeList().then(({ rows, total }) => {
this.list = rows
})
},
search() {
this.$refs['list' + this.active].getList(1)
},
add() {},
},
}
</script>
<template>
<div>
<van-search
v-model="keyword"
show-action
placeholder="请输入搜索关键词"
@search="search"
>
<!-- <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 + 1)"
: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="header">
<van-icon
name="cross"
color="#9c9c9c"
size="16"
@click="$router.back()"
/>
<span class="title"> 社群关系 </span>
</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="添加的员工(5)">
<van-list v-model="loading" :finished="finished" @load="onLoad">
<van-cell v-for="item in list" :key="item">
<div class="details">
<div class="detail">
<div class="left">
<div class="img"><img src="" alt="" /></div>
<div class="right">
<div>
<span>张三 &nbsp; &nbsp;</span>
</div>
<div class="c9">
<span>添加时间:</span><span>2021-02-17 00:50</span>
</div>
</div>
</div>
</div>
</div>
</van-cell>
</van-list>
</van-tab>
<van-tab title="添加的群聊(3)"
>
<div class="groupchat1">只看与我共同的群聊</div>
<van-list v-model="loading" :finished="finished" @load="onLoad">
<van-cell v-for="item in list" :key="item">
<div class="details">
<div class="detail">
<div class="left">
<div class="img"><img src="" alt="" /></div>
<div class="right">
<div>客户分享群(群人数)</div>
<div>
<span class="c9">群主:</span>
<span class="c9">张三</span>
</div>
<div class="c9">
<span>入群时间:</span><span>2021-02-17 00:50</span>
</div>
</div>
</div>
<div class="groupchat2">共同群聊</div>
</div>
</div>
</van-cell>
</van-list>
</van-tab>
</van-tabs>
</div>
</div>
</template>
<script>
export default {
data() {
return {
active: 0,
// 添加员工
list: [],
loading: false,
finished: false,
};
},
methods: {
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);
},
},
};
</script>
<style lang="less" scoped>
/deep/body {
width: 100%;
height: 600px;
}
.labelPge {
width: 100%;
height: 100%;
background-color: #f2f2f2;
}
.header {
margin: 20px 10px 10px;
vertical-align: center;
text-align: center;
}
.van-icon-cross {
position: absolute;
left: 10px;
}
.title {
text-align: center;
}
/* 添加的员工 */
.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="cross"
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="" alt="" /></div>
<div class="right">
<div>
<span>张三 &nbsp; &nbsp;</span
><van-icon name="manager" color="#9c9c9c" />
</div>
<div class="c9"><span>昵称:</span><span>王二毛</span></div>
</div>
</div>
</div>
</div>
<van-field
v-model="phonenumber"
name="手机号"
label="手机号"
placeholder="手机号"
input-align="right"
/>
<van-field
v-model="userage"
name="年龄"
label="年龄"
placeholder="年龄"
input-align="right"
/>
<div class="details">
<div class="detail">
<div class="c9" >生日</div>
<div class="c9" >123@qq.com</div>
</div>
</div>
<!-- -------------------------- -->
<van-field
v-model="emaile"
name="邮箱"
label="邮箱"
placeholder="邮箱"
input-align="right"
/>
<van-field
v-model="address"
name="地址"
label="地址"
placeholder="地址"
input-align="right"
/>
<van-field
v-model="userQQ"
name="QQ"
label="QQ"
placeholder="QQ"
input-align="right"
/>
<van-field
v-model="occupation"
name="职业"
label="职业"
placeholder="职业"
input-align="right"
/>
<van-field
v-model="company"
name="公司"
label="公司"
placeholder="公司"
input-align="right"
/>
<van-field
v-model="others"
name="其他描述"
label="其他描述"
placeholder="其他描述"
input-align="left"
type="textarea"
class="others"
/>
</van-form>
</div>
</template>
<script>
export default {
data() {
return {
flage: true,
// 表单数据
phonenumber: "456456",
userage:'23',
emaile:'227385@qq.com',
address:'address',
userQQ:'227385',
occupation:'occupation',
company:'company',
others:'11111111111111111111111111111111111111111111111111111111111'
};
},
methods: {
edit() {
this.flage = !this.flage;
},
// 点击保存按钮提交表单
saveUserInformation() {
this.flage = !this.flage;
},
},
};
</script>
<style lang="less" scoped>
.header {
margin: 20px 10px 10px;
vertical-align: center;
text-align: center;
}
.van-icon-cross {
position: absolute;
left: 10px;
}
.title {
text-align: center;
}
// 详细资料
.details {
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>
# 开发环境配置 # 开发环境配置
ENV = 'development' ENV = 'development'
# 塬微管理系统/开发环境 # 仟微管理系统/开发环境
VUE_APP_BASE_API = 'http://146.56.222.200/api' VUE_APP_BASE_API = 'http://119.45.28.29:8090'
# VUE_APP_BASE_API = 'http://n3rpzt.natappfree.cc' # VUE_APP_BASE_API = 'http://n3rpzt.natappfree.cc'
# 开发环境IP # 开发环境IP
VUE_APP_BASE_URL = 'http://192.168.0.101' VUE_APP_BASE_URL = 'http://119.45.28.29:8090'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true
# 生产环境配置 # 生产环境配置
ENV = 'production' ENV = 'production'
# 塬微管理系统/生产环境api # 仟微管理系统/生产环境api
VUE_APP_BASE_API = 'http://106.13.236.58:8080' VUE_APP_BASE_API = 'http://119.45.28.29:8090'
# 生产环境IP # 生产环境IP
VUE_APP_BASE_URL = 'http://106.13.236.58:8080' VUE_APP_BASE_URL = 'http://119.45.28.29:8090'
tag-version-prefix=""
registry=https://registry.npm.taobao.org
\ No newline at end of file \ No newline at end of file
...@@ -22,9 +22,9 @@ npm run serve ...@@ -22,9 +22,9 @@ npm run serve
## 发布 ## 发布
```bash ```bash
# 构建测试环境 # 构建测试环境(暂未配置)
npm run build:stage # npm run build:stage
# 构建生产环境 # 构建生产环境
npm run build:prod
```
\ No newline at end of file \ No newline at end of file
npm run build
```
...@@ -38,12 +38,16 @@ ...@@ -38,12 +38,16 @@
"url": "https://gitee.com/LinkWeChat/link-wechat.git" "url": "https://gitee.com/LinkWeChat/link-wechat.git"
}, },
"dependencies": { "dependencies": {
"@liripeng/vue-audio-player": "^1.2.8",
"@riophae/vue-treeselect": "0.4.0", "@riophae/vue-treeselect": "0.4.0",
"awesome-qr": "^2.0.1-rc.0",
"axios": "0.18.1", "axios": "0.18.1",
"clipboard": "2.0.4", "clipboard": "2.0.4",
"core-js": "3.6.5", "core-js": "3.6.5",
"echarts": "4.2.1", "echarts": "4.2.1",
"element-resize-detector": "^1.2.2",
"element-ui": "2.13.2", "element-ui": "2.13.2",
"fabric": "^3.5.1",
"file-saver": "2.0.1", "file-saver": "2.0.1",
"fuse.js": "3.4.4", "fuse.js": "3.4.4",
"js-beautify": "1.10.2", "js-beautify": "1.10.2",
...@@ -56,14 +60,20 @@ ...@@ -56,14 +60,20 @@
"promise.prototype.finally": "^3.1.2", "promise.prototype.finally": "^3.1.2",
"screenfull": "4.2.0", "screenfull": "4.2.0",
"sortablejs": "1.8.4", "sortablejs": "1.8.4",
"video.js": "^7.10.2", "tui-color-picker": "^2.2.6",
"tui-image-editor": "^3.11.0",
"uuid": "^8.3.2",
"video.js": "^7.11.4",
"videojs-contrib-hls": "^5.15.0",
"vue": "2.6.10", "vue": "2.6.10",
"vue-amap": "^0.5.10",
"vue-count-to": "1.0.13", "vue-count-to": "1.0.13",
"vue-cropper": "0.4.9", "vue-cropper": "0.4.9",
"vue-quill-editor": "3.0.6", "vue-quill-editor": "3.0.6",
"vue-router": "3.0.2", "vue-router": "3.0.2",
"vue-splitpane": "1.0.4", "vue-splitpane": "1.0.4",
"vue-ueditor-wrap": "^2.4.4", "vue-ueditor-wrap": "^2.4.4",
"vue-video-player": "^5.0.2",
"vuedraggable": "2.20.0", "vuedraggable": "2.20.0",
"vuex": "3.1.0" "vuex": "3.1.0"
}, },
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<meta name="renderer" content="webkit"> <meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=wI3zLlyN01Ej3ZD6ZD4WiuoE8N6AC6Lm"></script>
<title><%= VUE_APP_TITLE %></title> <title><%= VUE_APP_TITLE %></title>
<style> <style>
html, html,
......
...@@ -2,15 +2,12 @@ import request from '@/utils/request' ...@@ -2,15 +2,12 @@ import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/chat' const service = window.CONFIG.services.wecom + '/chat'
/** /**
* * 侧边栏列表
* @param {*} params * @param {*} params
*/ */
export function getList(params) { export function getList() {
return request({ return request({
url: service + '/side/list', url: service + '/side/list',
params: {
h5: 0,
},
}) })
} }
......
import request from '@/utils/request' import request from '@/utils/request'
import { dataURLtoFile } from '@/utils/common'
const service = window.CONFIG.services.common
export function upload(data) {
return request({
url: service + '/uploadFile2Cos',
method: 'POST',
data,
})
}
/** /**
* 下载网络连接文件 * 下载网络连接文件
...@@ -14,3 +25,24 @@ export function download(url, name) { ...@@ -14,3 +25,24 @@ export function download(url, name) {
`/common/download/url?url=${url}&name=${name}` `/common/download/url?url=${url}&name=${name}`
) )
} }
/**
* 上传文件
* @param {*} data
{
"dataURL": 本地文件(base64)
}
*/
export function uploadDataURL(dataURL) {
const data = new window.FormData()
const f = dataURLtoFile(dataURL)
data.append('file', f)
return request({
url: process.env.VUE_APP_BASE_API +
'/common/uploadFile2Cos',
method: 'post',
processData: false,
data,
})
}
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/communityGroupSop'
/**
* 获取群SOP列表
* @param {*} params
*
*/
export function getList(params) {
return request({
url: service + '/list',
method: 'get',
params,
})
}
/**
* 获取群SOP详情
* @param {*} params
*
*/
export function getDetail(id) {
return request({
url: service + '/' + id,
method: 'get',
})
}
/**
* 新增群SOP
* @param {Object} data
{
"ruleName": "string",
"groupIdList": [],
"title": "string",
"content": "string",
"materialIdList": [],
"startExeTime": "string",
"stopExeTime": "string",
}
*/
export function add(data) {
return request({
url: service + '/',
method: 'post',
data,
})
}
/**
* 修改群SOP
* @param {*} data
{
"ruleName": "string",
"groupIdList": [],
"title": "string",
"content": "string",
"materialIdList": [],
"startExeTime": "string",
"stopExeTime": "string",
}
*/
export function update(id, data) {
return request({
url: service + '/' + id,
method: 'put',
data,
})
}
/**
* 删除群SOP
* @param {*} ids
*/
export function remove(ids) {
return request({
url: service + '/' + ids,
method: 'DELETE',
})
}
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/communityKeywordGroup'
/**
* 获取关键词拉群列表
* @param {*} params
*
*/
export function getList(params) {
return request({
url: service + '/list',
method: 'get',
params,
})
}
/**
* 获取关键词拉群详情
* @param {*} params
*
*/
export function getDetail(id) {
return request({
url: service + '/' + id,
method: 'get',
})
}
/**
* 新增关键词拉群
* @param {Object} data
{
"taskName": "string",
"groupCodeId": 0,
"welcomeMsg": "string",
"keywords": "string",
}
*/
export function add(data) {
return request({
url: service + '/',
method: 'post',
data,
})
}
/**
* 修改关键词拉群
* @param {*} data
{
"taskName": "string",
"groupCodeId": 0,
"welcomeMsg": "string",
"keywords": "string",
}
*/
export function update(id, data) {
return request({
url: service + '/' + id,
method: 'put',
data,
})
}
/**
* 删除关键词拉群
* @param {*} ids
*/
export function remove(ids) {
return request({
url: service + '/' + ids,
method: 'DELETE',
})
}
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/communityNewGroup'
/**
* 获取新客自动拉群列表
* @param {*} params
*
*/
export function getList(params) {
return request({
url: service + '/list',
method: 'get',
params,
})
}
/**
* 获取新客自动拉群详情
* @param {*} params
*
*/
export function getDetail(id) {
return request({
url: service + '/' + id,
method: 'get',
})
}
/**
* 新增新客自动拉群
* @param {Object} data
{
"activityScene": "string",
"groupCodeId": 0,
"isJoinConfirmFriends": true,
"mediaId": 0,
"qrCode": "string",
"weEmpleCodeTags": [
{
"delFlag": 0,
"empleCodeId": 0,
"id": 0,
"tagId": "string",
"tagName": "string"
}
],
"weEmpleCodeUseScops": [
{
"businessId": "string",
"businessIdType": 0,
"businessName": "string",
"delFlag": 0,
"empleCodeId": 0,
"id": 0,
"mobile": "string"
}
],
"welcomeMsg": "string"
}
*/
export function add(data) {
return request({
url: service + '/add',
method: 'post',
data,
})
}
/**
* 修改新客自动拉群
* @param {*} data
{
"activityScene": "string",
"groupCodeId": 0,
"isJoinConfirmFriends": true,
"mediaId": 0,
"qrCode": "string",
"weEmpleCodeTags": [
{
"delFlag": 0,
"empleCodeId": 0,
"id": 0,
"tagId": "string",
"tagName": "string"
}
],
"weEmpleCodeUseScops": [
{
"businessId": "string",
"businessIdType": 0,
"businessName": "string",
"delFlag": 0,
"empleCodeId": 0,
"id": 0,
"mobile": "string"
}
],
"welcomeMsg": "string"
}
*/
export function update(data) {
return request({
url: service + '/update',
method: 'put',
data,
})
}
/**
* 删除新客自动拉群
* @param {*} ids
*/
export function remove(ids) {
return request({
url: service + '/delete/' + ids,
method: 'DELETE',
})
}
/**
* 批量下载
* @param {*} 员工活码ids,多个逗号隔开
*/
export function downloadBatch(ids) {
return request({
url: service + '/downloadBatch',
params: {
ids,
},
responseType: 'blob',
})
}
export function download(id) {
return request({
url: service + '/download',
params: {
id,
},
responseType: 'blob',
})
}
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/communityPresTagGroup'
/**
* 获取老客标签建群列表
* @param {*} params
*
*/
export function getList(params) {
return request({
url: service + '/list',
method: 'get',
params,
})
}
/**
* 获取老客标签建群详情
* @param {*} params
* id: 老客标签建群任务ID
*/
export function getDetail(id) {
return request({
url: service + '/' + id,
method: 'get',
})
}
/**
* 新增老客标签建群
* @param {Object} data
{
"taskName": "string",
"welcomeMsg": "string",
"sendType": 0,
"groupCodeId": "string",
"weOldGroupTagList": [],
"weOldGroupUseScopeList": [],
"sendScope": 0,
"sendGender": 0,
"cusBeginTime": "string",
"cusEndTime": "string",
}
*/
export function add(data) {
return request({
url: service + '/',
method: 'post',
data,
})
}
/**
* 修改老客标签建群
* @param {*} data
{
"taskName": "string",
"welcomeMsg": "string",
"sendType": 0,
"groupCodeId": "string",
"weOldGroupTagList": [],
"weOldGroupUseScopeList": [],
"sendScope": 0,
"sendGender": 0,
"cusBeginTime": "string",
"cusEndTime": "string",
}
*/
export function update(id, data) {
return request({
url: service + '/' + id,
method: 'put',
data,
})
}
/**
* 删除老客标签建群
* @param {*} ids
*/
export function remove(ids) {
return request({
url: service + '/' + ids,
method: 'DELETE',
})
}
/**
* 客户统计
* @param {*} params
* id: 老客标签建群任务ID
*/
export function getStat(id, params) {
return request({
url: service + '/stat/' + id,
method: 'get',
params,
})
}
\ No newline at end of file \ No newline at end of file
import request from '@/utils/request' import request from '@/utils/request'
const getTree=(params)=>{
return request({
url:'/chat/mapping/list',
method: 'get',
params,
})
}
const chatList=(params)=>{
return request({
url:'/wecom/finance/getChatContactList',
method: 'get',
params,
})
}
const listByCustomer=(params)=>{
return request({
url:'/chat/mapping/listByCustomer',
method: 'get',
params,
})
}
const getChatAllList=(params)=>{
return request({
url:'/wecom/finance/getChatAllList',
method: 'get',
params,
})
}
//
export const content={
getTree,
chatList,
listByCustomer,
getChatAllList
}
\ No newline at end of file \ No newline at end of file
const getTree = (params) => {
return request({
url: '/chat/mapping/list',
method: 'get',
params,
})
}
const chatList = (params) => {
return request({
url: '/wecom/finance/getChatContactList',
method: 'get',
params,
})
}
const indexTable = () => {
return request({
url: '/wecom/page/getCorpBasicData',
method: 'get'
})
}
const indexEchart = () => {
return request({
url: '/wecom/page/getCorpRealTimeData',
method: 'get'
})
}
//
const chatGrounpList = (params) => {
return request({
url: '/wecom/finance/getChatRoomContactList',
method: 'get',
params,
})
}
const listByCustomer = (params) => {
return request({
url: '/wecom/customer/list',
method: 'get',
params,
})
}
const getChatAllList = (params) => {
return request({
url: '/wecom/finance/getChatAllList',
method: 'get',
params,
})
}
//
export const content = {
indexEchart,
indexTable,
getTree,
chatList,
listByCustomer,
getChatAllList,
chatGrounpList
}
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/sensitive'
/**
* 获取敏感词触发列表
* @param {*} params
*
*/
export function getSecurityList(params) {
return request({
url: service + '/hit/list',
method: 'get',
params,
})
}
/**
* 获取敏感词设置列表
* @param {*} params
*
*/
export function getSettingSensitiveList(params) {
return request({
url: service + '/list',
method: 'get',
params,
})
}
/**
* 添加敏感词设置
* @param {*} params
*
*/
export function addSettingSensitive(data) {
return request({
url: service,
method: 'post',
data: data
})
}
/**
* 修改敏感词设置
* @param {*} params
*
*/
export function modifySettingSensitive(data) {
return request({
url: service,
method: 'put',
data: data
})
}
/**
* 获取敏感词详情
* @param {*} params
*
*/
export function getSensitiveDetails(tableId) {
return request({
url: service + '/' + tableId,
method: 'get'
})
}
/**
* 删除敏感词
* @param {*} params
*
*/
export function deleteSensitive(tableId) {
return request({
url: service + '/' + tableId,
method: 'delete'
})
}
/**
* 获取敏感行为警告敏感记录列表
* @param {*} params
*
*/
export function getSensitiveRecord(params) {
return request({
url: service + '/act/hit/list',
method: 'get',
params,
})
}
/**
* 获取敏感行为管理列表
* @param {*} params
*
*/
export function getSensitiveManagement(params) {
return request({
url: service + '/act/list',
method: 'get',
params,
})
}
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/actual'
/**
* 获取实际群码
* @param {*} params
{
"groupCodeId": "群活码ID",
"pageNum": "当前页",
"pageSize": "每页显示条数",
"state": "状态",
}
*/
export function getList(params) {
return request({
url: service + '/list',
params
})
}
/**
* 添加实际群码
* @param {*} data
{
"groupName": 群名称,
"actualGroupQrCode": 实际群码图片,
"effectTime": 有效期,
"scanCodeTimesLimit": 扫码次数限制,
"chatId": 客户群,
"chatGroupName": 客户群名称
}
*/
export function add(data) {
return request({
url: service + '/',
method: 'post',
data
})
}
/**
* 添加实际群码
* @param {*} data
{
"id": 实际群码ID,
"groupName": 群名称,
"actualGroupQrCode": 实际群码图片,
"effectTime": 有效期,
"scanCodeTimesLimit": 扫码次数限制,
"chatId": 客户群,
"chatGroupName": 客户群名称
}
*/
export function update(data) {
return request({
url: service + '/',
method: 'put',
data
})
}
/**
* 删除实际群码
* @param {*}
* "ids": 实际群活ID,多个ID以逗号分隔
*/
export function remove(ids) {
return request({
url: service + '/' + ids,
method: 'delete',
})
}
import request from '@/utils/request'
const service = window.CONFIG.services.wecom + '/groupCode'
/**
* 获取群活码列表
* @param {*} params
{
"pageNum": "当前页",
"pageSize": "每页显示条数",
"activityName": "活码名",
"createBy": "创建人",
"beginTime": "开始时间",
"endTime": "结束时间"
}
*/
export function getList(params) {
return request({
url: service + '/list',
params
})
}
/**
* 新增群活码
* @param {*} data
{
"file": 活码头像
"activityName": 活码名称
"activityDesc": 活码描述
"guide": 引导语
"joinGroupIsTip": 进群是否提示:1:是;0:否
"tipMsg": 进群提示语
"customerServerQrCode":客服二维码
}
*/
export function add(data) {
return request({
url: service + '/',
method: 'post',
data,
})
}
/**
* 更新群活码
* @param {*} id 群活码ID
* @param {*} data
{
"file": 活码头像
"activityName": 活码名称
"activityDesc": 活码描述
"guide": 引导语
"joinGroupIsTip": 进群是否提示:1:是;0:否
"tipMsg": 进群提示语
"customerServerQrCode":客服二维码
}
*/
export function update(id, data) {
return request({
url: service + '/' + id,
method: 'put',
data,
})
}
/**
* 根据ID获取群活码数据
* @param {*} params
*/
export function getDetail(id) {
return request({
url: service + '/' + id,
})
}
/**
* 删除群活码
* @param {*}
* "ids": 群活码ID,多个ID以逗号分隔
*/
export function remove(ids) {
return request({
url: service + '/' + ids,
method: 'delete',
})
}
/**
* 批量下载群活码
* @param {*}
* "ids": 群活码ID,多个ID以逗号分隔
*/
export function downloadBatch(ids) {
return request({
url: service + '/downloadBatch',
params: {
ids,
},
responseType: 'blob'
})
}
/**
* 下载群活码
* @param {*}
* "id": 群活码ID,多个ID以逗号分隔
*/
export function download(id) {
return request({
url: service + '/download',
params: {
id,
},
responseType: 'blob'
})
}
import request from "@/utils/request"; import request from '@/utils/request'
const service = window.CONFIG.services.wecom + "/customerMessagePush"; const service = window.CONFIG.services.wecom + '/customerMessagePush'
/** /**
* 新增企业id * 新增企业id
...@@ -35,10 +35,10 @@ const service = window.CONFIG.services.wecom + "/customerMessagePush"; ...@@ -35,10 +35,10 @@ const service = window.CONFIG.services.wecom + "/customerMessagePush";
*/ */
export function add(data) { export function add(data) {
return request({ return request({
url: service + "/add", url: service + '/add',
method: "post", method: 'post',
data data,
}); })
} }
/** /**
...@@ -53,9 +53,9 @@ endTime:结束时间} ...@@ -53,9 +53,9 @@ endTime:结束时间}
*/ */
export function getList(params) { export function getList(params) {
return request({ return request({
url: service + "/list", url: service + '/list',
params params,
}); })
} }
/** /**
...@@ -64,9 +64,9 @@ export function getList(params) { ...@@ -64,9 +64,9 @@ export function getList(params) {
*/ */
export function getDetail(messageId) { export function getDetail(messageId) {
return request({ return request({
url: service + "/getInfo", url: service + '/getInfo',
params: { messageId } params: { messageId },
}); })
} }
/** /**
...@@ -77,7 +77,21 @@ status:发送状态 0-未发送 1-已发送 2-因客户不是好友导致发送 ...@@ -77,7 +77,21 @@ status:发送状态 0-未发送 1-已发送 2-因客户不是好友导致发送
*/ */
export function getPushResult(params) { export function getPushResult(params) {
return request({ return request({
url: service + "/pushResults", url: service + '/pushResults',
params params,
}); })
}
/**
* 同步消息发送结果
* @param {*} data
* msgid:列表msgid
messageId:消息id
*/
export function syncMsg(data) {
return request({
url: service + '/asyncResult',
method: 'post',
data,
})
} }
...@@ -11,10 +11,20 @@ export function getList(params) { ...@@ -11,10 +11,20 @@ export function getList(params) {
} }
/** /**
* 更新海报
* @param {*} params
*/
export function updatePoster(data) {
console.log('poster change:', JSON.stringify(data))
return request({ url: serviceCategory + '/update', method: 'put', data })
}
/**
* 添加海报 * 添加海报
* @param {*} data * @param {*} data
*/ */
export function addPoster(data) { export function addPoster(data) {
console.log('poster add:', JSON.stringify(data))
return request({ url: serviceCategory + '/insert', method: 'post', data }) return request({ url: serviceCategory + '/insert', method: 'post', data })
} }
...@@ -22,8 +32,8 @@ export function addPoster(data) { ...@@ -22,8 +32,8 @@ export function addPoster(data) {
* 查询海报详情 * 查询海报详情
* @param {*} data * @param {*} data
*/ */
export function getPosterInfo(data) { export function getPosterInfo(id) {
return request({ url: serviceCategory + '/entity', method: 'get', data }) return request({ url: serviceCategory + '/entity/' + id })
} }
/** /**
......

1.42 KB | W: | H:

9.6 KB | W: | H:

linkwe-ui/src/assets/logo/logo.png
linkwe-ui/src/assets/logo/logo.png
linkwe-ui/src/assets/logo/logo.png
linkwe-ui/src/assets/logo/logo.png
  • 2-up
  • Swipe
  • Onion skin
No preview for this file type
<script> <script>
import * as api from "@/api/customer/tag"; import * as api from '@/api/customer/tag'
export default { export default {
name: "AddTag", name: 'AddTag',
components: {}, components: {},
props: { props: {
// 添加标签显隐 // 添加标签显隐
...@@ -14,7 +14,7 @@ export default { ...@@ -14,7 +14,7 @@ export default {
form: { form: {
type: Object, type: Object,
default: () => ({ default: () => ({
gourpName: "", gourpName: '',
weTags: [], weTags: [],
}), }),
}, },
...@@ -22,15 +22,15 @@ export default { ...@@ -22,15 +22,15 @@ export default {
data() { data() {
return { return {
// 添加标签输入框 // 添加标签输入框
newInput: "", newInput: '',
// 表单验证规则 // 表单验证规则
rules: Object.freeze({ rules: Object.freeze({
gourpName: [{ required: true, message: "必填项", trigger: "blur" }], gourpName: [{ required: true, message: '必填项', trigger: 'blur' }],
weTags: [{ required: true, message: "必填项", trigger: "blur" }], weTags: [{ required: true, message: '必填项', trigger: 'blur' }],
}), }),
// 添加便签按钮显隐 // 添加便签按钮显隐
visibleAdd: false, visibleAdd: false,
}; }
}, },
watch: {}, watch: {},
computed: { computed: {
...@@ -38,13 +38,13 @@ export default { ...@@ -38,13 +38,13 @@ export default {
get() { get() {
if (this.visible) { if (this.visible) {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["form"].clearValidate(); this.$refs['form'].clearValidate()
}); })
} }
return this.visible; return this.visible
}, },
set(val) { set(val) {
this.$emit("update:visible", val); this.$emit('update:visible', val)
}, },
}, },
}, },
...@@ -53,43 +53,50 @@ export default { ...@@ -53,43 +53,50 @@ export default {
methods: { methods: {
closeTag(tag, index) { closeTag(tag, index) {
if (tag.id) { if (tag.id) {
tag.status = 1; tag.status = 1
} else { } else {
this.form.weTags.splice(index, 1); this.form.weTags.splice(index, 1)
} }
}, },
showInput() { showInput() {
this.visibleAdd = true; this.visibleAdd = true
this.$nextTick((_) => { this.$nextTick((_) => {
this.$refs.saveTagInput.$refs.input.focus(); this.$refs.saveTagInput.$refs.input.focus()
}); })
}, },
newInputConfirm() { newInputConfirm() {
let name = this.newInput; let name = this.newInput
if (name) { if (name) {
Array.isArray(this.form.weTags) || (this.form.weTags = []); Array.isArray(this.form.weTags) || (this.form.weTags = [])
this.form.weTags.push({ name }); let isExist = this.form.weTags.some((e) => {
return e.name === name
})
if (isExist) {
this.msgError('标签名已存在,不可重复添加')
return
}
this.form.weTags.push({ name })
} }
this.visibleAdd = false; this.visibleAdd = false
this.newInput = ""; this.newInput = ''
}, },
submit() { submit() {
this.$refs["form"].validate((valid) => { this.$refs['form'].validate((valid) => {
let form = JSON.parse(JSON.stringify(this.form)); this.newInput = ''
let form = JSON.parse(JSON.stringify(this.form))
if (!form.weTags.length) { if (!form.weTags.length) {
return; return
} }
debugger; api[form.groupId ? 'update' : 'add'](form).then(() => {
api[form.groupId ? "update" : "add"](form).then(() => { this.msgSuccess('操作成功')
this.msgSuccess("操作成功"); this.Pvisible = false
this.Pvisible = false; this.$emit('success')
this.$emit("success"); })
}); })
});
}, },
}, },
}; }
</script> </script>
<template> <template>
...@@ -102,7 +109,7 @@ export default { ...@@ -102,7 +109,7 @@ export default {
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="标签组名称" prop="gourpName"> <el-form-item label="标签组名称" prop="gourpName">
<el-input <el-input
v-model="form.gourpName" v-model.trim="form.gourpName"
maxlength="15" maxlength="15"
show-word-limit show-word-limit
placeholder="请输入标签组名称,该名称不支持再次修改" placeholder="请输入标签组名称,该名称不支持再次修改"
...@@ -118,12 +125,14 @@ export default { ...@@ -118,12 +125,14 @@ export default {
size="medium" size="medium"
:key="index" :key="index"
@close="closeTag(item, index)" @close="closeTag(item, index)"
>{{item.name}}</el-tag> >
{{ item.name }}
</el-tag>
</template> </template>
<el-input <el-input
class="input-new-tag" class="input-new-tag"
v-if="visibleAdd" v-if="visibleAdd"
v-model="newInput" v-model.trim="newInput"
ref="saveTagInput" ref="saveTagInput"
size="mini" size="mini"
maxlength="10" maxlength="10"
...@@ -138,11 +147,14 @@ export default { ...@@ -138,11 +147,14 @@ export default {
class="button-new-tag" class="button-new-tag"
size="mini" size="mini"
@click="showInput" @click="showInput"
>+ 添加标签</el-button> >+ 添加标签</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit">确 定</el-button> <el-button type="primary" @click="submit" v-preventReClick="1000"
>确 定</el-button
>
<el-button @click="Pvisible = false">取 消</el-button> <el-button @click="Pvisible = false">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
......
...@@ -10,6 +10,14 @@ export default { ...@@ -10,6 +10,14 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
imageList: {
type: Array,
default: () => []
},
messageList: {
type: Array,
default: () => []
}
}, },
data() { data() {
return {} return {}
...@@ -25,26 +33,48 @@ export default { ...@@ -25,26 +33,48 @@ export default {
<template> <template>
<div class="preview ac"> <div class="preview ac">
<div class="top">小微</div> <div class="top">小微</div>
<div class="small">塬微科技-企微</div> <div class="small">仟微科技-企微</div>
<div class="time">凌晨2:20</div> <div class="time">凌晨2:20</div>
<div class="flex msg-li"> <ul class="msg-ul">
<el-avatar <li class="flex msg-li">
shape="square" <el-avatar
size="small" shape="square"
:src="require('@/assets/image/profile.jpg')" size="small"
></el-avatar> :src="require('@/assets/image/profile.jpg')"
<div class="msg">{{ message }}</div> ></el-avatar>
</div> <div class="msg">{{ message }}</div>
<div class="flex msg-li" v-if="isOther"> </li>
<el-avatar <li class="flex msg-li" v-if="isOther">
shape="square" <el-avatar
size="small" shape="square"
:src="require('@/assets/image/profile.jpg')" size="small"
></el-avatar> :src="require('@/assets/image/profile.jpg')"
<div class="msg" style="line-height: 0; padding: 5px;"> ></el-avatar>
<slot></slot> <div class="msg" style="line-height: 0; padding: 5px;">
</div> <slot></slot>
</div> </div>
</li>
<li class="flex msg-li" v-for="message in messageList" :key="message">
<el-avatar
shape="square"
size="small"
:src="require('@/assets/image/profile.jpg')"
></el-avatar>
<div class="msg">
<slot name="text" v-bind:text="message"></slot>
</div>
</li>
<li class="flex msg-li" v-for="image in imageList" :key="image">
<el-avatar
shape="square"
size="small"
:src="require('@/assets/image/profile.jpg')"
></el-avatar>
<div class="msg" style="line-height: 0; padding: 5px;">
<slot name="image" v-bind:image="image"></slot>
</div>
</li>
</ul>
</div> </div>
</template> </template>
...@@ -68,6 +98,12 @@ export default { ...@@ -68,6 +98,12 @@ export default {
transform: scale(0.8); transform: scale(0.8);
padding: 10px 0 5px; padding: 10px 0 5px;
} }
.msg-ul {
margin: 0;
padding: 0;
max-height: 80%;
overflow: auto;
}
.msg-li { .msg-li {
margin-bottom: 10px; margin-bottom: 10px;
} }
......
<script>
import { getList } from '@/api/customer/group'
export default {
components: {},
props: {
// 选择客户群聊显隐
visible: {
type: Boolean,
default: false,
},
title: {
type: String,
default: '选择客户群聊',
},
// 多选
multiSelect: {
type: Boolean,
default: false
},
selected: {
type: Array,
default: () => [],
},
},
data() {
return {
loading: true, // 遮罩层
query: {
pageNum: 1,
pageSize: 10,
groupLeader: '',
groupName: '',
beginTime: '',
endTime: '',
},
list: [], // 列表
total: 0, // 总条数
selectedGroup: '',
multiSelectedGroups: [],
}
},
watch: {
selected (val) {
this.setSelected()
},
list (val) {
this.setSelected()
}
},
computed: {
Pvisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
},
},
},
created() {
this.getList()
},
mounted() {},
methods: {
// 获取列表
getList(page) {
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
})
.catch(() => {
this.loading = false
})
},
submit() {
this.Pvisible = false
this.$emit('success', this.multiSelect ? this.multiSelectedGroups : this.selectedGroup)
},
setSelected () {
if (!this.selected.length) return
this.list.forEach((code) => {
if (code.id == this.selected[0].id) {
this.selectedGroup = code
}
})
},
handleSelectionChange (val) {
this.multiSelectedGroups = val
}
},
}
</script>
<template>
<el-dialog
:title="title"
:visible.sync="Pvisible"
width="650px"
append-to-body
>
<div>
<el-form ref="form" :model="query" label-width="">
<el-form-item label="">
<el-input
v-model="query.groupName"
class="ml10 mr10"
style="width: 150px;"
placeholder="请输入群名"
@keydown.enter="getList(1)"
clearable
@clear="getList(1)"
></el-input>
<el-button
v-hasPermi="['contacts:organization:query']"
icon="el-icon-search"
circle
@click="getList(1)"
></el-button>
<el-pagination
class="fr"
@current-change="getList"
:current-page="query.pageNum"
:page-size="query.pageSize"
layout="prev, pager, next"
:total="total"
></el-pagination>
</el-form-item>
</el-form>
<el-table :data="list" v-loading="loading" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" v-if="multiSelect"/>
<el-table-column width="30" v-else>
<template slot-scope="scope">
<el-radio v-model="selectedGroup" :label="scope.row">'</el-radio>
</template>
</el-table-column>
<el-table-column
prop="groupName"
label="群名"
align="center"
></el-table-column>
<el-table-column
prop="memberNum"
label="群人数"
align="center"
>
</el-table-column>
<el-table-column
prop="groupLeaderName"
label="群主"
align="center"
></el-table-column>
<el-table-column
prop="createTime"
label="创建时间"
align="center"
></el-table-column>
</el-table>
</div>
<div slot="footer">
<el-button @click="Pvisible = false">取 消</el-button>
<el-button type="primary" @click="submit">确 定</el-button>
</div>
</el-dialog>
</template>
<style lang="scss" scoped>
.code-image {
width: 200px;
height: 200px;
}
.code-image--small {
width: 50px;
height: 50px;
}
.expire-icon {
color: red;
}
</style>
...@@ -69,7 +69,7 @@ export default { ...@@ -69,7 +69,7 @@ export default {
</script> </script>
<template> <template>
<el-dialog title="选择素材" :visible.sync="Pvisible" width="650px"> <el-dialog title="选择素材" :visible.sync="Pvisible" width="650px" append-to-body>
<div> <div>
<el-tabs v-model="Ptype"> <el-tabs v-model="Ptype">
<el-tab-pane name="0" v-if="showArr.includes(0)"> <el-tab-pane name="0" v-if="showArr.includes(0)">
......
...@@ -134,7 +134,7 @@ export default { ...@@ -134,7 +134,7 @@ export default {
v-model="radio" v-model="radio"
> >
<el-radio v-for="(item, index) in list" :label="item" :key="index"> <el-radio v-for="(item, index) in list" :label="item" :key="index">
<img class="img-li" :src="item.materialUrl" alt /> <img crossorigin="anonymous" class="img-li" :src="item.materialUrl" alt />
<div class="ac mt5">{{ item.materialName }}</div> <div class="ac mt5">{{ item.materialName }}</div>
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
......
...@@ -3,6 +3,7 @@ import { getTree, getList } from '@/api/material' ...@@ -3,6 +3,7 @@ import { getTree, getList } from '@/api/material'
export default { export default {
components: {}, components: {},
props: { props: {
// 0: '图片', 1: '语音', 2: '视频', 3: '普通文件', 4: '文本', 5: '海报',
type: { type: {
type: String, type: String,
default: '4', default: '4',
...@@ -51,6 +52,7 @@ export default { ...@@ -51,6 +52,7 @@ export default {
children: 'children', children: 'children',
label: 'name', label: 'name',
}, },
selectedx: [],
} }
}, },
watch: { watch: {
...@@ -114,7 +116,7 @@ export default { ...@@ -114,7 +116,7 @@ export default {
<el-input <el-input
v-model="query.search" v-model="query.search"
class="ml10 mr10" class="ml10 mr10"
style="width: 150px;" style="width: 150px"
@keydown.enter="getList(1)" @keydown.enter="getList(1)"
></el-input> ></el-input>
<el-button <el-button
...@@ -167,6 +169,7 @@ export default { ...@@ -167,6 +169,7 @@ export default {
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="6"> <el-col :span="6">
<el-tree <el-tree
class="bfc-o"
ref="tree" ref="tree"
:data="treeData" :data="treeData"
:props="treeProps" :props="treeProps"
...@@ -190,33 +193,58 @@ export default { ...@@ -190,33 +193,58 @@ export default {
></el-pagination> ></el-pagination>
</div> </div>
<el-table <el-table
v-if="[3, 4].includes(+type)" v-if="[1, 3, 4].includes(+type)"
:data="list" :data="list"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column prop="content" label="文本内容"></el-table-column> <el-table-column
v-if="type == 4"
prop="content"
label="文本内容"
></el-table-column>
<el-table-column
v-else
prop="materialName"
label="素材名称"
></el-table-column>
<el-table-column prop="createTime" label="时间"></el-table-column> <el-table-column prop="createTime" label="时间"></el-table-column>
</el-table> </el-table>
<el-row v-else :gutter="20"> <el-row v-else :gutter="20">
<el-col <el-checkbox-group
:span="6" v-model="selectedx"
style="margin-bottom: 24px;min-width: 220px;" @change="handleSelectionChange"
v-for="(item, index) in list"
:key="index"
> >
<el-card shadow="hover" body-style="padding: 0px;"> <el-col
<div class="img-wrap"> :span="6"
<el-image :src="item.materialUrl" fit="contain"></el-image> style="margin-bottom: 24px; min-width: 220px"
</div> v-for="(item, index) in list"
<div style="padding: 14px;"> :key="index"
<el-checkbox v-model="ids" :label="item.id">{{ >
item.materialName <el-card shadow="hover" body-style="padding: 0px;">
}}</el-checkbox> <div class="img-wrap">
</div> <el-image
</el-card> v-if="type == 0"
</el-col> :src="item.materialUrl"
fit="contain"
></el-image>
<el-image
v-else-if="type == 2"
:src="item.coverUrl"
fit="contain"
></el-image>
</div>
<div style="padding: 14px">
<el-checkbox :label="item">
<span class="label">
{{ item.materialName }}
</span>
</el-checkbox>
</div>
</el-card>
</el-col>
</el-checkbox-group>
</el-row> </el-row>
</el-col> </el-col>
</el-row> </el-row>
...@@ -251,4 +279,10 @@ export default { ...@@ -251,4 +279,10 @@ export default {
top: 0; top: 0;
} }
} }
/deep/ .el-checkbox__label {
vertical-align: text-top;
}
.label {
white-space: normal;
}
</style> </style>
<script>
import { getList } from '@/api/drainageCode/group'
export default {
components: {},
props: {
// 添加标签显隐
visible: {
type: Boolean,
default: false,
},
title: {
type: String,
default: '选择群活码',
},
selected: {
type: Array,
default: () => [],
},
},
data() {
return {
loading: true, // 遮罩层
query: {
pageNum: 1,
pageSize: 10,
activityName: '',
createBy: '',
beginTime: '',
endTime: '',
},
list: [], // 列表
total: 0, // 总条数
radio: '',
}
},
watch: {
selected (val) {
this.setSelected()
},
list (val) {
this.setSelected()
}
},
computed: {
Pvisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
},
},
},
created() {
this.getList()
},
mounted() {},
methods: {
// 获取列表
getList(page) {
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
})
.catch(() => {
this.loading = false
})
},
submit() {
this.Pvisible = false
this.$emit('success', this.radio)
},
setSelected () {
if (!this.selected.length) return
this.list.forEach((code) => {
if (code.id == this.selected[0].id) {
this.radio = code
}
})
}
},
}
</script>
<template>
<el-dialog
:title="title"
:visible.sync="Pvisible"
width="650px"
append-to-body
>
<div>
<el-form ref="form" :model="query" label-width="">
<el-form-item label="">
<el-input
v-model="query.activityName"
class="ml10 mr10"
style="width: 150px;"
placeholder="请输入名称"
@keydown.enter="getList(1)"
></el-input>
<el-button
v-hasPermi="['contacts:organization:query']"
icon="el-icon-search"
circle
@click="getList(1)"
></el-button>
<el-pagination
class="fr"
@current-change="getList"
:current-page="query.pageNum"
:page-size="query.pageSize"
layout="prev, pager, next"
:total="total"
></el-pagination>
</el-form-item>
</el-form>
<el-table :data="list" v-loading="loading">
<el-table-column width="30">
<template slot-scope="scope">
<el-radio v-model="radio" :label="scope.row">'</el-radio>
</template>
</el-table-column>
<el-table-column
prop="activityName"
label="活码名称"
align="center"
></el-table-column>
<el-table-column
prop="activityDesc"
label="活码描述"
align="center"
width="160"
>
<template #default="{ row }">
<el-popover
placement="bottom"
width="200"
trigger="hover"
:content="row.activityDesc"
>
<div slot="reference" class="table-desc overflow-ellipsis">
{{ row.activityDesc }}
</div>
</el-popover>
</template>
</el-table-column>
<el-table-column
prop="codeUrl"
label="活码样式"
align="center"
width="130"
>
<template #default="{ row }">
<el-popover placement="bottom" trigger="hover">
<el-image
slot="reference"
:src="row.codeUrl"
class="code-image--small"
></el-image>
<el-image :src="row.codeUrl" class="code-image"> </el-image>
</el-popover>
</template>
</el-table-column>
<el-table-column label="实际群码总数" align="center">
<template #default="{ row }">
{{ (row.actualList && row.actualList.length) || 0 }}
</template>
</el-table-column>
<el-table-column
prop="availableCodes"
label="可用实际群码数"
align="center"
>
<template #default="{ row }">
<el-popover
v-if="row.aboutToExpireCodes > 0"
placement="bottom"
width="200"
trigger="hover"
:content="'有' + row.aboutToExpireCodes + '个实际群码即将过期。'"
>
<i slot="reference" class="el-icon-warning expire-icon"></i>
</el-popover>
{{ row.availableCodes }}
</template>
</el-table-column>
</el-table>
</div>
<div slot="footer">
<el-button @click="Pvisible = false">取 消</el-button>
<el-button type="primary" @click="submit">确 定</el-button>
</div>
</el-dialog>
</template>
<style lang="scss" scoped>
.code-image {
width: 200px;
height: 200px;
}
.code-image--small {
width: 50px;
height: 50px;
}
.expire-icon {
color: red;
}
</style>
...@@ -29,13 +29,42 @@ export default { ...@@ -29,13 +29,42 @@ export default {
listOneArray: [], listOneArray: [],
selectedGroup: '', // 选择的标签分组 selectedGroup: '', // 选择的标签分组
removeTag: [], removeTag: [],
Pselected: this.selected, Pselected: [],
} }
}, },
watch: { watch: {
type(val) { // type(val) {
val === 'remove' && (this.removeTag = this.selected.slice()) // val === 'remove' && (this.removeTag = this.selected.slice())
// },
selected(val) {
if (this.type === 'add') {
this.Pselected = []
val.forEach((element) => {
let find = this.listOneArray.find((d) => {
return element.tagId === d.tagId
})
this.Pselected.push(find)
})
} else if (this.type === 'remove') {
this.removeTag = val.slice()
this.Pselected = val.slice()
}
// this.list = JSON.parse(JSON.stringify(this.list))
}, },
list (val) {
if (this.type === 'add') {
this.Pselected = []
this.selected.forEach((element) => {
let find = this.listOneArray.find((d) => {
return element.tagId === d.tagId
})
this.Pselected.push(find)
})
} else if (this.type === 'remove') {
this.removeTag = this.selected.slice()
this.Pselected = this.selected.slice()
}
}
}, },
computed: { computed: {
Pvisible: { Pvisible: {
...@@ -49,14 +78,14 @@ export default { ...@@ -49,14 +78,14 @@ export default {
}, },
}, },
created() { created() {
// this.type === 'remove' && (this.removeTag = this.Pselected.slice())
this.getList() this.getList()
}, },
mounted() {}, mounted() {},
methods: { methods: {
getList() { getList() {
getList().then(({ rows }) => { getList().then(({ rows }) => {
this.list = Object.freeze(rows) // this.list = Object.freeze(rows)
this.list = rows
this.listOneArray = [] this.listOneArray = []
this.list.forEach((element) => { this.list.forEach((element) => {
element.weTags.forEach((d) => { element.weTags.forEach((d) => {
...@@ -66,9 +95,22 @@ export default { ...@@ -66,9 +95,22 @@ export default {
}) })
}, },
submit() { submit() {
if (!this.Pselected.length) {
this.msgError('请至少选择一个标签')
return
}
this.Pvisible = false this.Pvisible = false
this.$emit('success', this.Pselected) this.$emit('success', this.Pselected)
}, },
isChecked(unit) {
// debugger
return this.Pselected.some((el) => {
return unit.tagId === el.tagId
})
},
toJson(data) {
return JSON.stringify(data)
},
}, },
} }
</script> </script>
...@@ -86,20 +128,22 @@ export default { ...@@ -86,20 +128,22 @@ export default {
:value="item.groupId" :value="item.groupId"
></el-option> ></el-option>
</el-select> </el-select>
<div class="mt20"> <div class="mt20" v-if="Pvisible">
<el-checkbox-group v-model="Pselected" v-if="type !== 'remove'"> <el-checkbox-group v-if="type !== 'remove'" v-model="Pselected">
<template v-for="(item, index) in list"> <template v-for="(item, index) in list">
<div <div
class="bfc-d mr30" class="bfc-d mr30"
v-show="item.groupId === selectedGroup || !selectedGroup" v-if="item.groupId === selectedGroup || !selectedGroup"
:key="index" :key="index"
> >
<el-checkbox <template v-for="(unit, unique) in item.weTags">
:label="unit" <el-checkbox
v-for="(unit, unique) in item.weTags" v-if="unit.name.trim()"
:key="index + unique" :label="unit"
>{{ unit.name }}</el-checkbox :key="index + '' + unique"
> >{{ unit.name }}</el-checkbox
>
</template>
</div> </div>
</template> </template>
</el-checkbox-group> </el-checkbox-group>
...@@ -109,7 +153,7 @@ export default { ...@@ -109,7 +153,7 @@ export default {
v-if="item.groupId === selectedGroup || !selectedGroup" v-if="item.groupId === selectedGroup || !selectedGroup"
:label="item" :label="item"
:key="index" :key="index"
>{{ item.name }}</el-checkbox >{{ item.name.trim() || '(空的无效标签,请移除)' }}</el-checkbox
> >
</template> </template>
</el-checkbox-group> </el-checkbox-group>
......
...@@ -84,14 +84,23 @@ export default { ...@@ -84,14 +84,23 @@ export default {
}, },
// 选择变化 // 选择变化
handleCheckChange(data, checked, indeterminate) { handleCheckChange(data, checked, indeterminate) {
// debugger
if (checked) { if (checked) {
if (this.isSigleSelect) { if (this.isSigleSelect) {
// 单选情况 // 单选情况
this.$refs.tree.setCheckedKeys([data.key]) this.$refs.tree.setCheckedKeys([data.key])
} }
this.userList.push(data) if (this.isOnlyLeaf) {
if (data.userId) {
this.userList.push(data)
}
} else {
this.userList.push(data)
}
} else { } else {
this.userList.splice(this.userList.indexOf(data), 1) let index = this.userList.indexOf(data)
index > -1 && this.userList.splice(index, 1)
} }
// console.log(data, checked, indeterminate); // console.log(data, checked, indeterminate);
}, },
......
...@@ -30,9 +30,9 @@ export default { ...@@ -30,9 +30,9 @@ export default {
loading: false, loading: false,
action: action:
process.env.VUE_APP_BASE_API + process.env.VUE_APP_BASE_API +
window.CONFIG.services.wecom + '/common/uploadFile2Cos',
'/material/upload',
headers: window.CONFIG.headers, headers: window.CONFIG.headers,
domain: process.env.VUE_APP_BASE_API
} }
}, },
watch: {}, watch: {},
...@@ -101,8 +101,11 @@ export default { ...@@ -101,8 +101,11 @@ export default {
onSuccess(res, file) { onSuccess(res, file) {
if (res.code === 200) { if (res.code === 200) {
this.loading = false this.loading = false
this.$emit('update:fileUrl', res.data.materialUrl) // this.$emit('update:fileUrl', res.data.materialUrl)
this.$emit('update:fileName', res.data.materialName) // this.$emit('update:fileName', res.data.materialName)
this.$emit('update:fileUrl', res.url)
this.$emit('update:fileName', res.fileName)
this.$emit('update:file', file)
// this.fileUrl = URL.createObjectURL(file.raw) // this.fileUrl = URL.createObjectURL(file.raw)
} }
}, },
......
...@@ -31,6 +31,7 @@ window.CONFIG = { ...@@ -31,6 +31,7 @@ window.CONFIG = {
services: { services: {
wecom: '/wecom', wecom: '/wecom',
common: '/common',
}, },
get headers() { get headers() {
......
import hasRole from './hasRole' import hasRole from './permission/hasRole'
import hasPermi from './hasPermi' import hasPermi from './permission/hasPermi'
import preventReClick from './preventReClick'
const install = function(Vue) { const install = function(Vue) {
Vue.directive('hasRole', hasRole) Vue.directive('hasRole', hasRole)
Vue.directive('hasPermi', hasPermi) Vue.directive('hasPermi', hasPermi)
Vue.directive('preventReClick', preventReClick)
} }
if (window.Vue) { if (window.Vue) {
window['hasRole'] = hasRole window['hasRole'] = hasRole
window['hasPermi'] = hasPermi window['hasPermi'] = hasPermi
Vue.use(install); // eslint-disable-line Vue.use(install) // eslint-disable-line
} }
export default install export default install
/**
* vue 自定义阻止按钮连续点击指令
* 使用 <div @click="search" v-preventReClick="1000">搜索</div>
*/
export default {
inserted(el, binding) {
el.addEventListener('click', () => {
el.style.pointerEvents = 'none'
setTimeout(() => {
el.style.pointerEvents = 'auto'
}, binding.value || 2000)
})
},
}
...@@ -6,34 +6,34 @@ ...@@ -6,34 +6,34 @@
<template> <template>
<section class="app-main"> <section class="app-main">
<transition name="fade-transform" mode="out-in"> <transition name="fade-transform" mode="out-in">
<keep-alive :include="cachedViews"> <router-view class="page" :key="key" />
<router-view class="page" :key="key" /> <!-- <keep-alive :include="cachedViews">
</keep-alive> </keep-alive> -->
</transition> </transition>
</section> </section>
</template> </template>
<script> <script>
export default { export default {
name: "AppMain", name: 'AppMain',
computed: { computed: {
cachedViews() { cachedViews() {
return this.$store.state.tagsView.cachedViews; return this.$store.state.tagsView.cachedViews
}, },
key() { key() {
return this.$route.path; return this.$route.path
}, },
}, },
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.app-main { .app-main {
/* 50= navbar 50 */ /* 50= navbar 50 */
min-height: calc(100vh - 50px); // min-height: calc(100vh - 50px);
width: 100%; width: 100%;
position: relative; position: relative;
overflow: hidden; overflow: auto;
background-color: #fff; background-color: #fff;
} }
...@@ -44,7 +44,7 @@ export default { ...@@ -44,7 +44,7 @@ export default {
.hasTagsView { .hasTagsView {
.app-main { .app-main {
/* 84 = navbar + tags-view = 50 + 34 */ /* 84 = navbar + tags-view = 50 + 34 */
min-height: calc(100vh - 84px); height: calc(100vh - 84px);
} }
.fixed-header + .app-main { .fixed-header + .app-main {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" /> <breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
<div class="right-menu"> <div class="right-menu">
<template v-if="device!=='mobile'"> <template v-if="device !== 'mobile'">
<search id="header-search" class="right-menu-item" /> <search id="header-search" class="right-menu-item" />
<el-tooltip content="源码地址" effect="dark" placement="bottom"> <el-tooltip content="源码地址" effect="dark" placement="bottom">
...@@ -28,9 +28,12 @@ ...@@ -28,9 +28,12 @@
<screenfull id="screenfull" class="right-menu-item hover-effect" /> <screenfull id="screenfull" class="right-menu-item hover-effect" />
</template> </template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click"> <el-dropdown
class="avatar-container right-menu-item hover-effect"
trigger="click"
>
<div class="avatar-wrapper"> <div class="avatar-wrapper">
塬微 仟微
<!-- <img :src="avatar" class="user-avatar"> --> <!-- <img :src="avatar" class="user-avatar"> -->
<i class="el-icon-caret-bottom" /> <i class="el-icon-caret-bottom" />
</div> </div>
...@@ -51,11 +54,11 @@ ...@@ -51,11 +54,11 @@
</template> </template>
<script> <script>
import { mapGetters } from "vuex"; import { mapGetters } from 'vuex'
import Breadcrumb from "@/components/Breadcrumb"; import Breadcrumb from '@/components/Breadcrumb'
import Hamburger from "@/components/Hamburger"; import Hamburger from '@/components/Hamburger'
import Search from "@/components/HeaderSearch"; import Search from '@/components/HeaderSearch'
import screenfull from "@/components/Screenfull"; import screenfull from '@/components/Screenfull'
export default { export default {
components: { components: {
...@@ -65,43 +68,43 @@ export default { ...@@ -65,43 +68,43 @@ export default {
screenfull, screenfull,
}, },
computed: { computed: {
...mapGetters(["sidebar", "avatar", "device"]), ...mapGetters(['sidebar', 'avatar', 'device']),
setting: { setting: {
get() { get() {
return this.$store.state.settings.showSettings; return this.$store.state.settings.showSettings
}, },
set(val) { set(val) {
this.$store.dispatch("settings/changeSetting", { this.$store.dispatch('settings/changeSetting', {
key: "showSettings", key: 'showSettings',
value: val, value: val,
}); })
}, },
}, },
}, },
methods: { methods: {
toggleSideBar() { toggleSideBar() {
this.$store.dispatch("app/toggleSideBar"); this.$store.dispatch('app/toggleSideBar')
}, },
async logout() { async logout() {
this.$confirm("确定注销并退出系统吗?", "提示", { this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning',
}).then(() => { }).then(() => {
this.$store.dispatch("LogOut").then(() => { this.$store.dispatch('LogOut').then(() => {
location.href = "/"; location.href = '/'
}); })
}); })
}, },
goto(type) { goto(type) {
window.open( window.open(
type type
? "https://gitee.com/LinkWeChat/link-wechat" ? 'https://gitee.com/LinkWeChat/link-wechat'
: "https://gitee.com/LinkWeChat/link-wechat" : 'https://gitee.com/LinkWeChat/link-wechat'
); )
}, },
}, },
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
<template> <template>
<div class="sidebar-logo-container" :class="{'collapse':collapse}"> <div class="sidebar-logo-container" :class="{ collapse: collapse }">
<transition name="sidebarLogoFade"> <transition name="sidebarLogoFade">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/"> <router-link
v-if="collapse"
key="collapse"
class="sidebar-logo-link"
to="/"
>
<img v-if="logo" :src="logo" class="sidebar-logo" /> <img v-if="logo" :src="logo" class="sidebar-logo" />
<h1 v-else class="sidebar-title">{{ title }}</h1> <h1 v-else class="sidebar-title">{{ title }}</h1>
</router-link> </router-link>
...@@ -14,10 +19,10 @@ ...@@ -14,10 +19,10 @@
</template> </template>
<script> <script>
import logoImg from "@/assets/logo/logo.png"; import logoImg from '@/assets/logo/logo.png'
export default { export default {
name: "SidebarLogo", name: 'SidebarLogo',
props: { props: {
collapse: { collapse: {
type: Boolean, type: Boolean,
...@@ -28,9 +33,9 @@ export default { ...@@ -28,9 +33,9 @@ export default {
return { return {
title: process.env.VUE_APP_TITLE, title: process.env.VUE_APP_TITLE,
logo: logoImg, logo: logoImg,
}; }
}, },
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -57,7 +62,7 @@ export default { ...@@ -57,7 +62,7 @@ export default {
width: 100%; width: 100%;
& .sidebar-logo { & .sidebar-logo {
width: 32px; // width: 32px;
height: 32px; height: 32px;
vertical-align: middle; vertical-align: middle;
margin-right: 12px; margin-right: 12px;
......
<template> <template>
<div id="tags-view-container" class="tags-view-container"> <div id="tags-view-container" class="tags-view-container">
<scroll-pane ref="scrollPane" class="tags-view-wrapper" @scroll="handleScroll"> <scroll-pane
ref="scrollPane"
class="tags-view-wrapper"
@scroll="handleScroll"
>
<router-link <router-link
v-for="tag in visitedViews" v-for="tag in visitedViews"
ref="tag" ref="tag"
:key="tag.path" :key="tag.path"
:class="isActive(tag)?'active':''" :class="isActive(tag) ? 'active' : ''"
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }" :to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
tag="span" tag="span"
class="tags-view-item" class="tags-view-item"
:style="activeStyle(tag)" :style="activeStyle(tag)"
@click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''" @click.middle.native="!isAffix(tag) ? closeSelectedTag(tag) : ''"
@contextmenu.prevent.native="openMenu(tag,$event)" @contextmenu.prevent.native="openMenu(tag, $event)"
> >
{{ tag.title }} {{ tag.meta.title }}
<span <span
v-if="!isAffix(tag)" v-if="!isAffix(tag)"
class="el-icon-close" class="el-icon-close"
...@@ -21,9 +25,15 @@ ...@@ -21,9 +25,15 @@
/> />
</router-link> </router-link>
</scroll-pane> </scroll-pane>
<ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu"> <ul
v-show="visible"
:style="{ left: left + 'px', top: top + 'px' }"
class="contextmenu"
>
<li @click="refreshSelectedTag(selectedTag)">刷新页面</li> <li @click="refreshSelectedTag(selectedTag)">刷新页面</li>
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">关闭当前</li> <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">
关闭当前
</li>
<li @click="closeOthersTags">关闭其他</li> <li @click="closeOthersTags">关闭其他</li>
<li @click="closeAllTags(selectedTag)">关闭所有</li> <li @click="closeAllTags(selectedTag)">关闭所有</li>
</ul> </ul>
...@@ -31,8 +41,8 @@ ...@@ -31,8 +41,8 @@
</template> </template>
<script> <script>
import ScrollPane from "./ScrollPane"; import ScrollPane from './ScrollPane'
import path from "path"; import path from 'path'
export default { export default {
components: { ScrollPane }, components: { ScrollPane },
...@@ -43,177 +53,177 @@ export default { ...@@ -43,177 +53,177 @@ export default {
left: 0, left: 0,
selectedTag: {}, selectedTag: {},
affixTags: [], affixTags: [],
}; }
}, },
computed: { computed: {
visitedViews() { visitedViews() {
return this.$store.state.tagsView.visitedViews; return this.$store.state.tagsView.visitedViews
}, },
routes() { routes() {
return this.$store.state.permission.routes; return this.$store.state.permission.routes
}, },
theme() { theme() {
return this.$store.state.settings.theme; return this.$store.state.settings.theme
}, },
}, },
watch: { watch: {
$route() { $route() {
this.addTags(); this.addTags()
this.moveToCurrentTag(); this.moveToCurrentTag()
}, },
visible(value) { visible(value) {
if (value) { if (value) {
document.body.addEventListener("click", this.closeMenu); document.body.addEventListener('click', this.closeMenu)
} else { } else {
document.body.removeEventListener("click", this.closeMenu); document.body.removeEventListener('click', this.closeMenu)
} }
}, },
}, },
mounted() { mounted() {
this.initTags(); this.initTags()
this.addTags(); this.addTags()
}, },
methods: { methods: {
isActive(route) { isActive(route) {
return route.path === this.$route.path; return route.path === this.$route.path
}, },
activeStyle(tag) { activeStyle(tag) {
if (!this.isActive(tag)) return {}; if (!this.isActive(tag)) return {}
return { return {
"background-color": this.theme, 'background-color': this.theme,
"border-color": this.theme, 'border-color': this.theme,
}; }
}, },
isAffix(tag) { isAffix(tag) {
return tag.meta && tag.meta.affix; return tag.meta && tag.meta.affix
}, },
filterAffixTags(routes, basePath = "/") { filterAffixTags(routes, basePath = '/') {
let tags = []; let tags = []
routes.forEach((route) => { routes.forEach((route) => {
if (route.meta && route.meta.affix) { if (route.meta && route.meta.affix) {
const tagPath = path.resolve(basePath, route.path); const tagPath = path.resolve(basePath, route.path)
tags.push({ tags.push({
fullPath: tagPath, fullPath: tagPath,
path: tagPath, path: tagPath,
name: route.name, name: route.name,
meta: { ...route.meta }, meta: { ...route.meta },
}); })
} }
if (route.children) { if (route.children) {
const tempTags = this.filterAffixTags(route.children, route.path); const tempTags = this.filterAffixTags(route.children, route.path)
if (tempTags.length >= 1) { if (tempTags.length >= 1) {
tags = [...tags, ...tempTags]; tags = [...tags, ...tempTags]
} }
} }
}); })
return tags; return tags
}, },
initTags() { initTags() {
const affixTags = (this.affixTags = this.filterAffixTags(this.routes)); const affixTags = (this.affixTags = this.filterAffixTags(this.routes))
for (const tag of affixTags) { for (const tag of affixTags) {
// Must have tag name // Must have tag name
if (tag.name) { if (tag.name) {
this.$store.dispatch("tagsView/addVisitedView", tag); this.$store.dispatch('tagsView/addVisitedView', tag)
} }
} }
}, },
addTags() { addTags() {
const { name } = this.$route; const { name } = this.$route
if (name) { if (name) {
this.$store.dispatch("tagsView/addView", this.$route); this.$store.dispatch('tagsView/addView', this.$route)
} }
return false; return false
}, },
moveToCurrentTag() { moveToCurrentTag() {
const tags = this.$refs.tag; const tags = this.$refs.tag
this.$nextTick(() => { this.$nextTick(() => {
for (const tag of tags) { for (const tag of tags) {
if (tag.to.path === this.$route.path) { if (tag.to.path === this.$route.path) {
this.$refs.scrollPane.moveToTarget(tag); this.$refs.scrollPane.moveToTarget(tag)
// when query is different then update // when query is different then update
if (tag.to.fullPath !== this.$route.fullPath) { if (tag.to.fullPath !== this.$route.fullPath) {
this.$store.dispatch("tagsView/updateVisitedView", this.$route); this.$store.dispatch('tagsView/updateVisitedView', this.$route)
} }
break; break
} }
} }
}); })
}, },
refreshSelectedTag(view) { refreshSelectedTag(view) {
this.$store.dispatch("tagsView/delCachedView", view).then(() => { this.$store.dispatch('tagsView/delCachedView', view).then(() => {
const { fullPath } = view; const { fullPath } = view
this.$nextTick(() => { this.$nextTick(() => {
this.$router.replace({ this.$router.replace({
path: "/redirect" + fullPath, path: '/redirect' + fullPath,
}); })
}); })
}); })
}, },
closeSelectedTag(view) { closeSelectedTag(view) {
this.$store this.$store
.dispatch("tagsView/delView", view) .dispatch('tagsView/delView', view)
.then(({ visitedViews }) => { .then(({ visitedViews }) => {
if (this.isActive(view)) { if (this.isActive(view)) {
this.toLastView(visitedViews, view); this.toLastView(visitedViews, view)
} }
}); })
}, },
closeOthersTags() { closeOthersTags() {
this.$router.push(this.selectedTag); this.$router.push(this.selectedTag)
this.$store this.$store
.dispatch("tagsView/delOthersViews", this.selectedTag) .dispatch('tagsView/delOthersViews', this.selectedTag)
.then(() => { .then(() => {
this.moveToCurrentTag(); this.moveToCurrentTag()
}); })
}, },
closeAllTags(view) { closeAllTags(view) {
this.$store.dispatch("tagsView/delAllViews").then(({ visitedViews }) => { this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {
if (this.affixTags.some((tag) => tag.path === view.path)) { if (this.affixTags.some((tag) => tag.path === view.path)) {
return; return
} }
this.toLastView(visitedViews, view); this.toLastView(visitedViews, view)
}); })
}, },
toLastView(visitedViews, view) { toLastView(visitedViews, view) {
const latestView = visitedViews.slice(-1)[0]; const latestView = visitedViews.slice(-1)[0]
if (latestView) { if (latestView) {
this.$router.push(latestView.fullPath); this.$router.push(latestView.fullPath)
} else { } else {
// now the default is to redirect to the home page if there is no tags-view, // now the default is to redirect to the home page if there is no tags-view,
// you can adjust it according to your needs. // you can adjust it according to your needs.
if (view.name === "Dashboard") { if (view.name === 'Dashboard') {
// to reload home page // to reload home page
this.$router.replace({ path: "/redirect" + view.fullPath }); this.$router.replace({ path: '/redirect' + view.fullPath })
} else { } else {
this.$router.push("/"); this.$router.push('/')
} }
} }
}, },
openMenu(tag, e) { openMenu(tag, e) {
const menuMinWidth = 105; const menuMinWidth = 105
const offsetLeft = this.$el.getBoundingClientRect().left; // container margin left const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
const offsetWidth = this.$el.offsetWidth; // container width const offsetWidth = this.$el.offsetWidth // container width
const maxLeft = offsetWidth - menuMinWidth; // left boundary const maxLeft = offsetWidth - menuMinWidth // left boundary
const left = e.clientX - offsetLeft + 15; // 15: margin right const left = e.clientX - offsetLeft + 15 // 15: margin right
if (left > maxLeft) { if (left > maxLeft) {
this.left = maxLeft; this.left = maxLeft
} else { } else {
this.left = left; this.left = left
} }
this.top = e.clientY; this.top = e.clientY
this.visible = true; this.visible = true
this.selectedTag = tag; this.selectedTag = tag
}, },
closeMenu() { closeMenu() {
this.visible = false; this.visible = false
}, },
handleScroll() { handleScroll() {
this.closeMenu(); this.closeMenu()
}, },
}, },
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -248,7 +258,7 @@ export default { ...@@ -248,7 +258,7 @@ export default {
color: #fff; color: #fff;
border-color: #42b983; border-color: #42b983;
&::before { &::before {
content: ""; content: '';
background: #fff; background: #fff;
display: inline-block; display: inline-block;
width: 8px; width: 8px;
......
...@@ -20,7 +20,7 @@ import config from '@/config' ...@@ -20,7 +20,7 @@ import config from '@/config'
import App from './App' import App from './App'
import store from './store' import store from './store'
import router from './router' import router from './router'
import permission from './directive/permission' import directive from './directive'
import './assets/icons' // icon import './assets/icons' // icon
import './permission' // permission control import './permission' // permission control
...@@ -64,12 +64,29 @@ Vue.prototype.msgInfo = function(msg) { ...@@ -64,12 +64,29 @@ Vue.prototype.msgInfo = function(msg) {
this.$message.info(msg) this.$message.info(msg)
} }
import { pickerOptions } from '@/utils/index'
Vue.prototype.pickerOptions = pickerOptions
import VideoPlayer from 'vue-video-player'
Vue.use(VideoPlayer);
import AudioPlayer from '@liripeng/vue-audio-player'
import '@liripeng/vue-audio-player/lib/vue-audio-player.css'
Vue.use(AudioPlayer)
import VueAMap from 'vue-amap';
Vue.use(VueAMap);
VueAMap.initAMapApiLoader({
  key: '32396af00cd726deed804cf5b63ed2d8',
  plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
  v: '1.4.4'
});
// 全局组件挂载 // 全局组件挂载
Vue.component('Pagination', Pagination) Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar) Vue.component('RightToolbar', RightToolbar)
Vue.component('Upload', Upload) Vue.component('Upload', Upload)
Vue.use(permission) Vue.use(directive)
/** /**
* If you don't want to use mock-server * If you don't want to use mock-server
......
const state = { const state = {
visitedViews: [], visitedViews: [],
cachedViews: [] cachedViews: [],
} }
const mutations = { const mutations = {
ADD_VISITED_VIEW: (state, view) => { ADD_VISITED_VIEW: (state, view) => {
if (state.visitedViews.some(v => v.path === view.path)) return if (state.visitedViews.some((v) => v.path === view.path)) return
state.visitedViews.push( view.meta.title = view.meta.title || 'no-name'
Object.assign({}, view, { state.visitedViews.push(Object.assign({}, view))
title: view.meta.title || 'no-name'
})
)
}, },
ADD_CACHED_VIEW: (state, view) => { ADD_CACHED_VIEW: (state, view) => {
if (state.cachedViews.includes(view.name)) return if (state.cachedViews.includes(view.name)) return
...@@ -33,7 +30,7 @@ const mutations = { ...@@ -33,7 +30,7 @@ const mutations = {
}, },
DEL_OTHERS_VISITED_VIEWS: (state, view) => { DEL_OTHERS_VISITED_VIEWS: (state, view) => {
state.visitedViews = state.visitedViews.filter(v => { state.visitedViews = state.visitedViews.filter((v) => {
return v.meta.affix || v.path === view.path return v.meta.affix || v.path === view.path
}) })
}, },
...@@ -46,12 +43,12 @@ const mutations = { ...@@ -46,12 +43,12 @@ const mutations = {
} }
}, },
DEL_ALL_VISITED_VIEWS: state => { DEL_ALL_VISITED_VIEWS: (state) => {
// keep affix tags // keep affix tags
const affixTags = state.visitedViews.filter(tag => tag.meta.affix) const affixTags = state.visitedViews.filter((tag) => tag.meta.affix)
state.visitedViews = affixTags state.visitedViews = affixTags
}, },
DEL_ALL_CACHED_VIEWS: state => { DEL_ALL_CACHED_VIEWS: (state) => {
state.cachedViews = [] state.cachedViews = []
}, },
...@@ -62,7 +59,7 @@ const mutations = { ...@@ -62,7 +59,7 @@ const mutations = {
break break
} }
} }
} },
} }
const actions = { const actions = {
...@@ -78,69 +75,69 @@ const actions = { ...@@ -78,69 +75,69 @@ const actions = {
}, },
delView({ dispatch, state }, view) { delView({ dispatch, state }, view) {
return new Promise(resolve => { return new Promise((resolve) => {
dispatch('delVisitedView', view) dispatch('delVisitedView', view)
dispatch('delCachedView', view) dispatch('delCachedView', view)
resolve({ resolve({
visitedViews: [...state.visitedViews], visitedViews: [...state.visitedViews],
cachedViews: [...state.cachedViews] cachedViews: [...state.cachedViews],
}) })
}) })
}, },
delVisitedView({ commit, state }, view) { delVisitedView({ commit, state }, view) {
return new Promise(resolve => { return new Promise((resolve) => {
commit('DEL_VISITED_VIEW', view) commit('DEL_VISITED_VIEW', view)
resolve([...state.visitedViews]) resolve([...state.visitedViews])
}) })
}, },
delCachedView({ commit, state }, view) { delCachedView({ commit, state }, view) {
return new Promise(resolve => { return new Promise((resolve) => {
commit('DEL_CACHED_VIEW', view) commit('DEL_CACHED_VIEW', view)
resolve([...state.cachedViews]) resolve([...state.cachedViews])
}) })
}, },
delOthersViews({ dispatch, state }, view) { delOthersViews({ dispatch, state }, view) {
return new Promise(resolve => { return new Promise((resolve) => {
dispatch('delOthersVisitedViews', view) dispatch('delOthersVisitedViews', view)
dispatch('delOthersCachedViews', view) dispatch('delOthersCachedViews', view)
resolve({ resolve({
visitedViews: [...state.visitedViews], visitedViews: [...state.visitedViews],
cachedViews: [...state.cachedViews] cachedViews: [...state.cachedViews],
}) })
}) })
}, },
delOthersVisitedViews({ commit, state }, view) { delOthersVisitedViews({ commit, state }, view) {
return new Promise(resolve => { return new Promise((resolve) => {
commit('DEL_OTHERS_VISITED_VIEWS', view) commit('DEL_OTHERS_VISITED_VIEWS', view)
resolve([...state.visitedViews]) resolve([...state.visitedViews])
}) })
}, },
delOthersCachedViews({ commit, state }, view) { delOthersCachedViews({ commit, state }, view) {
return new Promise(resolve => { return new Promise((resolve) => {
commit('DEL_OTHERS_CACHED_VIEWS', view) commit('DEL_OTHERS_CACHED_VIEWS', view)
resolve([...state.cachedViews]) resolve([...state.cachedViews])
}) })
}, },
delAllViews({ dispatch, state }, view) { delAllViews({ dispatch, state }, view) {
return new Promise(resolve => { return new Promise((resolve) => {
dispatch('delAllVisitedViews', view) dispatch('delAllVisitedViews', view)
dispatch('delAllCachedViews', view) dispatch('delAllCachedViews', view)
resolve({ resolve({
visitedViews: [...state.visitedViews], visitedViews: [...state.visitedViews],
cachedViews: [...state.cachedViews] cachedViews: [...state.cachedViews],
}) })
}) })
}, },
delAllVisitedViews({ commit, state }) { delAllVisitedViews({ commit, state }) {
return new Promise(resolve => { return new Promise((resolve) => {
commit('DEL_ALL_VISITED_VIEWS') commit('DEL_ALL_VISITED_VIEWS')
resolve([...state.visitedViews]) resolve([...state.visitedViews])
}) })
}, },
delAllCachedViews({ commit, state }) { delAllCachedViews({ commit, state }) {
return new Promise(resolve => { return new Promise((resolve) => {
commit('DEL_ALL_CACHED_VIEWS') commit('DEL_ALL_CACHED_VIEWS')
resolve([...state.cachedViews]) resolve([...state.cachedViews])
}) })
...@@ -148,12 +145,12 @@ const actions = { ...@@ -148,12 +145,12 @@ const actions = {
updateVisitedView({ commit }, view) { updateVisitedView({ commit }, view) {
commit('UPDATE_VISITED_VIEW', view) commit('UPDATE_VISITED_VIEW', view)
} },
} }
export default { export default {
namespaced: true, namespaced: true,
state, state,
mutations, mutations,
actions actions,
} }
/** /**
* 通用css样式布局处理 * 通用css样式布局处理
*/ */
*,
*:before,
*:after {
box-sizing: border-box;
}
body {
height: 100%;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
}
html {
height: 100%;
font-size: 14px;
}
li {
list-style: none;
}
/** 基础通用 **/
.bfc-o {
overflow: hidden;
position: relative;
}
.bfc-d {
display: inline-block;
vertical-align: top;
position: relative;
}
.bfc-p {
position: absolute;
}
.flex {
display: flex;
}
.fxbw {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
ais {
align-items: stretch;
}
.aic {
align-items: center;
}
.fl {
float: left;
position: relative;
}
.fr {
float: right;
position: relative;
}
.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%;
left: 0;
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;
}
.toe {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.cp {
cursor: pointer;
}
.pt5 {
padding-top: 5px;
}
.pr5 {
padding-right: 5px;
}
.pb5 {
padding-bottom: 5px;
}
.mt5 {
margin-top: 5px;
}
.mr5 {
margin-right: 5px;
}
.mb5 {
margin-bottom: 5px;
}
.mb8 {
margin-bottom: 8px;
}
.ml5 {
margin-left: 5px;
}
.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;
}
\ No newline at end of file \ No newline at end of file
*,
*:before,
*:after {
box-sizing: border-box;
}
body {
height: 100%;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
Microsoft YaHei, Arial, sans-serif;
}
html {
height: 100%;
font-size: 14px;
}
li {
list-style: none;
}
/** 基础通用 **/
.bfc-o {
overflow: hidden;
position: relative;
}
.bfc-d {
display: inline-block;
vertical-align: top;
position: relative;
}
.bfc-p {
position: absolute;
}
.flex {
display: flex;
}
.fxbw {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.ais {
align-items: stretch;
}
.aic {
align-items: center;
}
.fl {
float: left;
position: relative;
}
.fr {
float: right;
position: relative;
}
.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%;
left: 0;
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;
}
.toe {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.cp {
cursor: pointer;
}
.pt5 {
padding-top: 5px;
}
.pr5 {
padding-right: 5px;
}
.pb5 {
padding-bottom: 5px;
}
.mt5 {
margin-top: 5px;
}
.mr5 {
margin-right: 5px;
}
.mb5 {
margin-bottom: 5px;
}
.mb8 {
margin-bottom: 8px;
}
.ml5 {
margin-left: 5px;
}
.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;
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!