Commit 67fc0149 by xinla

优化

1 parent 277850be
...@@ -113,14 +113,15 @@ export const loadView = (route) => { ...@@ -113,14 +113,15 @@ export const loadView = (route) => {
res = modules[path] res = modules[path]
// 为需要单独使用的路由命名,避免使用绝对路径跳转 // 为需要单独使用的路由命名,避免使用绝对路径跳转
// 组件路径: route name
let routeNames = { let routeNames = {
// 组件路径: route name
'customerManage/customerDetail': window.lwConfig.CUSTOMER_DETAIL_ROUTE_NAME, // 客户详情 'customerManage/customerDetail': window.lwConfig.CUSTOMER_DETAIL_ROUTE_NAME, // 客户详情
'drainageCode/staff/list': 'staffCode', // 员工活码 'drainageCode/staff/list': 'staffCode', // 员工活码
'drainageCode/group/list': 'customerGroupCode', // 群活码 'drainageCode/group/list': 'customerGroupCode', // 群活码
'drainageCode/store/list': 'storeCode', //门店活码 'drainageCode/store/list': 'storeCode', //门店活码
'drainageCode/identity/list': 'identityCode', //识客码 'drainageCode/identity/list': 'identityCode', //识客码
'drainageCode/pullNews/list': 'pullNewsCode', //拉新活码 'drainageCode/pullNews/list': 'pullNewsCode', //拉新活码
'contentCenter/templateWel/index': 'templateWel', //拉新活码
'enterpriseWechat/list': window.lwConfig.WORK_WEIXIN_CONFIG_ROUTE_NAME, //企微配置 'enterpriseWechat/list': window.lwConfig.WORK_WEIXIN_CONFIG_ROUTE_NAME, //企微配置
} }
routeNames[route.component] && (route.name = routeNames[route.component]) routeNames[route.component] && (route.name = routeNames[route.component])
......
...@@ -103,7 +103,8 @@ export function selectDictLabels(datas, value, separator) { ...@@ -103,7 +103,8 @@ export function selectDictLabels(datas, value, separator) {
* @param {*} downloadName 下载文件名,需含文件后缀名 可选 * @param {*} downloadName 下载文件名,需含文件后缀名 可选
*/ */
export function downloadBlob(blob, downloadName, type) { export function downloadBlob(blob, downloadName, type) {
if (blob && downloadName) { if (!blob || !downloadName) return
if (blob instanceof Blob) {
const typeDict = { const typeDict = {
excel: 'application/vnd.ms-excel', excel: 'application/vnd.ms-excel',
zip: 'application/zip', zip: 'application/zip',
...@@ -117,6 +118,20 @@ export function downloadBlob(blob, downloadName, type) { ...@@ -117,6 +118,20 @@ export function downloadBlob(blob, downloadName, type) {
a.click() a.click()
a.remove() a.remove()
URL.revokeObjectURL(url) // 释放内存 URL.revokeObjectURL(url) // 释放内存
} else if (/^http/.test(blob) && type === 'image') {
let image = new Image()
image.setAttribute('crossOrigin', 'anonymous')
image.src = blob
image.onload = () => {
let canvas = document.createElement('canvas')
canvas.width = image.width
canvas.height = image.height
let ctx = canvas.getContext('2d')
ctx.drawImage(image, 0, 0, image.width, image.height)
canvas.toBlob((blob) => {
downloadBlob(blob, downloadName)
})
}
} }
} }
...@@ -348,6 +363,21 @@ export function $delConfirm(remove, callback) { ...@@ -348,6 +363,21 @@ export function $delConfirm(remove, callback) {
}) })
.catch(function () {}) .catch(function () {})
} }
export function $copyText(txt) {
let clipboard = new this.ClipboardJS(event.currentTarget.localName, {
target: function (trigger) {
return trigger
},
text: function (trigger) {
return txt
},
})
setTimeout(() => {
clipboard.destroy()
}, 0)
}
/** /**
* 通用js方法封装处理,挂载到 Vue.prototype * 通用js方法封装处理,挂载到 Vue.prototype
*/ */
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
props: {}, props: {},
data() { data() {
return { return {
active: '1', active: this.$route.query.index || '1',
total1: 0, total1: 0,
total2: 0, total2: 0,
total3: 0, total3: 0,
......
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
props: {}, props: {},
data() { data() {
return { return {
currentActive: '1', currentActive: this.$route.query.index || '1',
form: {}, form: {},
disabled: false, disabled: false,
loading: false, loading: false,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!