|
|
@@ -2,7 +2,7 @@
|
|
|
<div>
|
|
|
<div @click="detail">
|
|
|
<slot name="title">
|
|
|
- <el-button type="primary" text @click="detail">查看</el-button>
|
|
|
+ <el-button type="primary" text>查看</el-button>
|
|
|
</slot>
|
|
|
</div>
|
|
|
<el-image-viewer
|
|
|
@@ -34,7 +34,12 @@
|
|
|
<el-button type="primary" icon="Download" @click="downloadClick"
|
|
|
>下 载</el-button
|
|
|
>
|
|
|
- <share class="ml-20" :row="data" v-if="isAccess === 2" />
|
|
|
+ <share
|
|
|
+ class="ml-20"
|
|
|
+ :project-id="projectId"
|
|
|
+ :ids="id"
|
|
|
+ v-if="isAccess === 2"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-drawer>
|
|
|
@@ -64,6 +69,10 @@ export default {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
},
|
|
|
+ projectId: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
id: {
|
|
|
type: String,
|
|
|
default: null
|
|
|
@@ -78,36 +87,38 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- openFile() {
|
|
|
- if (
|
|
|
- this.data.fileAttach.id === -1 ||
|
|
|
- api.offices.includes(this.data.fileAttach.suffix)
|
|
|
- ) {
|
|
|
- this.show = true
|
|
|
- } else {
|
|
|
- this.preList.length = 0
|
|
|
- this.preList.push(this.data.url)
|
|
|
- this.showImage = true
|
|
|
- }
|
|
|
- },
|
|
|
detail() {
|
|
|
- console.log(Number(this.id, 10))
|
|
|
if (Number(this.id, 10).toString() === 'NaN') {
|
|
|
+ // 如果id 不是数字开头,即mongo 62开头的id,查看文章详情
|
|
|
this.$api.resource.fileDetail(this.id).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
this.data = res.data
|
|
|
- this.openFile()
|
|
|
+ this.show = true
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
- this.$api.resource.fileDetailByFile(this.id).then(res => {
|
|
|
+ this.$api.resource.fileInfo({ id: this.id }).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
- this.data = res.data
|
|
|
- this.openFile()
|
|
|
+ const tmp = res.data
|
|
|
+ if (api.offices.includes(tmp.suffix)) {
|
|
|
+ this.openByFile()
|
|
|
+ } else {
|
|
|
+ this.preList.length = 0
|
|
|
+ this.preList.push(tmp.filePath)
|
|
|
+ this.showImage = true
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ openByFile() {
|
|
|
+ this.$api.resource.fileDetailByFile(this.id).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.data = res.data
|
|
|
+ this.show = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
async downloadClick() {
|
|
|
const link = document.createElement('a')
|
|
|
link.href = this.data.url
|