From afc6b360101014645cd9bcfeaf544507b23ee419 Mon Sep 17 00:00:00 2001
From: ajyy <125933ajy@gmail.com>
Date: Wed, 27 May 2020 01:22:22 +0800
Subject: [PATCH 1/2] fix issue 71
---
package.json | 3 +-
src/main.js | 2 +
src/views/attachment/AttachmentList.vue | 43 ++++++++++++++++++
.../components/AttachmentDrawer.vue | 44 +++++++++++++++++++
4 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 8f69c43cb..0a9427622 100644
--- a/package.json
+++ b/package.json
@@ -28,7 +28,8 @@
"vue-router": "^3.1.6",
"vuejs-logger": "^1.5.3",
"vuex": "^3.1.1",
- "flv.js": "^1.5.0"
+ "flv.js": "^1.5.0",
+ "vue-contextmenujs": "^1.3.9"
},
"devDependencies": {
"@babel/polyfill": "^7.4.4",
diff --git a/src/main.js b/src/main.js
index 17d9f0f47..7cabec64e 100644
--- a/src/main.js
+++ b/src/main.js
@@ -2,6 +2,7 @@ import '@babel/polyfill'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
+import Contextmenu from 'vue-contextmenujs'
import store from './store/'
import './logger'
@@ -15,6 +16,7 @@ Vue.config.productionTip = false
Vue.prototype.VERSION = version
Vue.use(router)
+Vue.use(Contextmenu)
new Vue({
router,
diff --git a/src/views/attachment/AttachmentList.vue b/src/views/attachment/AttachmentList.vue
index 03c30139a..71388c484 100644
--- a/src/views/attachment/AttachmentList.vue
+++ b/src/views/attachment/AttachmentList.vue
@@ -132,6 +132,7 @@
:bodyStyle="{ padding: 0 }"
hoverable
@click="handleShowDetailDrawer(item)"
+ @contextmenu.prevent="handleContextMenu($event, item)"
>
当前格式不支持预览
@@ -298,6 +299,48 @@ export default {
this.drawerVisible = true
}
},
+ handleContextMenu(event, item) {
+ this.$contextmenu({
+ items: [
+ {
+ label: '复制图片链接',
+ onClick: () => {
+ const text = `${encodeURI(item.path)}`
+ this.$copyText(text)
+ .then(message => {
+ this.$log.debug('copy', message)
+ this.$message.success('复制成功!')
+ })
+ .catch(err => {
+ this.$log.debug('copy.err', err)
+ this.$message.error('复制失败!')
+ })
+ },
+ divided: true
+ },
+ {
+ label: '复制Markdown格式链接',
+ onClick: () => {
+ const text = `})`
+ this.$copyText(text)
+ .then(message => {
+ this.$log.debug('copy', message)
+ this.$message.success('复制成功!')
+ })
+ .catch(err => {
+ this.$log.debug('copy.err', err)
+ this.$message.error('复制失败!')
+ })
+ }
+ }
+ ],
+ event,
+ customClass: 'class-a',
+ zIndex: 3,
+ minWidth: 230
+ })
+ return false
+ },
handlePaginationChange(page, size) {
this.$log.debug(`Current: ${page}, PageSize: ${size}`)
this.pagination.page = page
diff --git a/src/views/attachment/components/AttachmentDrawer.vue b/src/views/attachment/components/AttachmentDrawer.vue
index c1ebd80f1..3f77ed2d8 100644
--- a/src/views/attachment/components/AttachmentDrawer.vue
+++ b/src/views/attachment/components/AttachmentDrawer.vue
@@ -5,6 +5,7 @@
:width="isMobile()?'100%':'480'"
closable
:visible="visible"
+ :z-index="1005"
destroyOnClose
@close="onClose"
>
@@ -37,6 +38,7 @@
v-for="(item, index) in formattedDatas"
:key="index"
@click="handleShowDetailDrawer(item)"
+ @contextmenu.prevent="handleContextMenu($event, item)"
>
当前格式不支持预览
![]()
{
+ const text = `${encodeURI(item.path)}`
+ this.$copyText(text)
+ .then(message => {
+ this.$log.debug('copy', message)
+ this.$message.success('复制成功!')
+ })
+ .catch(err => {
+ this.$log.debug('copy.err', err)
+ this.$message.error('复制失败!')
+ })
+ },
+ divided: true
+ },
+ {
+ label: '复制Markdown格式链接',
+ onClick: () => {
+ const text = `})`
+ this.$copyText(text)
+ .then(message => {
+ this.$log.debug('copy', message)
+ this.$message.success('复制成功!')
+ })
+ .catch(err => {
+ this.$log.debug('copy.err', err)
+ this.$message.error('复制失败!')
+ })
+ }
+ }
+ ],
+ event,
+ customClass: 'class-a',
+ zIndex: 1006,
+ minWidth: 230
+ })
+ return false
+ },
loadAttachments() {
this.queryParam.page = this.pagination.page - 1
this.queryParam.size = this.pagination.size
From 539ea38b141ea9c56381c0812a35a7c83f2b1604 Mon Sep 17 00:00:00 2001
From: ajyy <125933ajy@gmail.com>
Date: Wed, 27 May 2020 11:28:20 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A0=E9=99=A4class-a,=E8=B0=83?=
=?UTF-8?q?=E6=95=B4label,z-index=E5=92=8CminWidth?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/attachment/AttachmentList.vue | 6 ++----
src/views/attachment/components/AttachmentDrawer.vue | 8 +++-----
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/views/attachment/AttachmentList.vue b/src/views/attachment/AttachmentList.vue
index 71388c484..67218240a 100644
--- a/src/views/attachment/AttachmentList.vue
+++ b/src/views/attachment/AttachmentList.vue
@@ -319,7 +319,7 @@ export default {
divided: true
},
{
- label: '复制Markdown格式链接',
+ label: '复制 Markdown 格式链接',
onClick: () => {
const text = `})`
this.$copyText(text)
@@ -335,9 +335,7 @@ export default {
}
],
event,
- customClass: 'class-a',
- zIndex: 3,
- minWidth: 230
+ minWidth: 210
})
return false
},
diff --git a/src/views/attachment/components/AttachmentDrawer.vue b/src/views/attachment/components/AttachmentDrawer.vue
index 3f77ed2d8..e1bb1f70f 100644
--- a/src/views/attachment/components/AttachmentDrawer.vue
+++ b/src/views/attachment/components/AttachmentDrawer.vue
@@ -5,7 +5,6 @@
:width="isMobile()?'100%':'480'"
closable
:visible="visible"
- :z-index="1005"
destroyOnClose
@close="onClose"
>
@@ -187,7 +186,7 @@ export default {
divided: true
},
{
- label: '复制Markdown格式链接',
+ label: '复制 Markdown 格式链接',
onClick: () => {
const text = `})`
this.$copyText(text)
@@ -203,9 +202,8 @@ export default {
}
],
event,
- customClass: 'class-a',
- zIndex: 1006,
- minWidth: 230
+ zIndex: 1001,
+ minWidth: 210
})
return false
},