|
@@ -11,37 +11,73 @@
|
|
|
<span class="ml10"><i class="el-icon-download"></i> {{info.downloadCount}}</span>
|
|
|
</h4>
|
|
|
</div>
|
|
|
- <div class="mt35">
|
|
|
- <h2> 文章简介 </h2>
|
|
|
- <div class="content mt20 p20">
|
|
|
- <div>{{info.brief}} </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+
|
|
|
+
|
|
|
+ <el-form :inline="true" class="p20" label-width="80px" label-position="left">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="所属部门">
|
|
|
+ <span class="pl10 nowrap span-tit">{{info.department }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="文件分类">
|
|
|
+ <span class="pl10 nowrap span-tit">{{info.category }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="发布人">
|
|
|
+ <span class="pl10 nowrap span-tit">{{info.username||'超管' }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="发布时间">
|
|
|
+ <span class="pl10 nowrap span-tit">{{info.publishTime|toDatetime }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="是否公开">
|
|
|
+ <span class="pl10 nowrap span-tit">{{info.isOpen?'是':'否' }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="我的权限">
|
|
|
+ <span class="pl10 nowrap span-tit">{{owners[isLeader]}}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <div class="mt35">
|
|
|
+ <h2> 文章简介 </h2>
|
|
|
+ <div class="content mt20 p20">
|
|
|
+ <div>{{info.brief}} </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
|
|
|
<div class="p20">
|
|
|
<el-button v-if="!isLike" icon="el-icon-star-off" @click="likeArtical"> 收藏</el-button>
|
|
|
<el-button v-else icon="el-icon-star-on" type="info" @click="unLikeArtical">取消</el-button>
|
|
|
|
|
|
- <el-button icon="el-icon-download" @click="likeArtical"> 下载</el-button>
|
|
|
|
|
|
|
|
|
+ <el-button icon="el-icon-download" v-if="isLeader>0 || info.isOpen" @click="download"> 下载</el-button>
|
|
|
+ <el-button icon="el-icon-download" v-else @click="applyDownload">申请下载</el-button>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
- <!-- -->
|
|
|
- <el-card class="mt10">
|
|
|
- <el-row>
|
|
|
- <el-col :span="12" >
|
|
|
- <h2>我的下载记录</h2>
|
|
|
- </el-col>
|
|
|
-
|
|
|
- <el-col :span="12">
|
|
|
- <h2>我的下载记录</h2>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-card>
|
|
|
+
|
|
|
|
|
|
<div style="height: 60px;"></div>
|
|
|
</div>
|
|
@@ -51,7 +87,10 @@
|
|
|
import IHeader from "./components/IHeader";
|
|
|
import IFooter from "./components/IFooter";
|
|
|
import {toDatetime } from '@/utils/date.js'
|
|
|
+ import data from '../data/data.js'
|
|
|
import { getArticalInfo, likeArtical, unLikeArtical} from '@/api/article.js'
|
|
|
+ import { downloadArtical, applyArtical} from '@/api/article.js'
|
|
|
+ import { mapGetters } from "vuex";
|
|
|
|
|
|
export default {
|
|
|
name: 'application',
|
|
@@ -70,9 +109,13 @@
|
|
|
recommend: [],
|
|
|
apply_list: [],
|
|
|
isLike: 0,
|
|
|
+ owners: data.owners,
|
|
|
info: {}
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...mapGetters("user", ["userDepartments"])
|
|
|
+ },
|
|
|
created() {
|
|
|
this.articalId = +this.$route.query.articalId || 0;
|
|
|
if (this.articalId) {
|
|
@@ -80,6 +123,44 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ download(){
|
|
|
+ let param ={articalId: this.articalId, isLeader:this.isLeader}
|
|
|
+ this.loading = true;
|
|
|
+ this.$message.successMsg("文件生成中", 1)
|
|
|
+ downloadArtical( param ).then( res=>{
|
|
|
+ console.log( "res", res)
|
|
|
+ if( res.status != 200 ) {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.errorMsg("下载失败", 1)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const blob = new Blob([res.data])
|
|
|
+ const fileName = res.header.filename
|
|
|
+ const link = document.createElement('a')
|
|
|
+ link.download = fileName
|
|
|
+ link.style.display = 'none'
|
|
|
+ link.href = URL.createObjectURL(blob)
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ URL.revokeObjectURL(link.href)
|
|
|
+ document.body.removeChild(link)
|
|
|
+ this.loading = false;
|
|
|
+ }).catch( ()=>{
|
|
|
+ this.loading = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ applyDownload(){
|
|
|
+ let param ={articalId: this.articalId}
|
|
|
+ this.loading = true;
|
|
|
+ applyArtical( param ).then( res=>{
|
|
|
+ if( res.code == 200){
|
|
|
+ this.$message.successMsg("申请成功", 3)
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
+ }).catch( ()=>{
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
likeArtical(){
|
|
|
let param ={articalId: this.articalId}
|
|
|
this.loading = true;
|
|
@@ -92,7 +173,6 @@
|
|
|
}).catch( ()=>{
|
|
|
this.loading = false
|
|
|
})
|
|
|
-
|
|
|
},
|
|
|
unLikeArtical(){
|
|
|
let param ={articalId: this.articalId}
|
|
@@ -115,6 +195,11 @@
|
|
|
getArticalInfo(param).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
this.info = res.data.info;
|
|
|
+ for( let i in this.userDepartments){
|
|
|
+ if( this.userDepartments[i].departmentId == this.info.departmentId){
|
|
|
+ this.isLeader = this.userDepartments[i].isLeader;
|
|
|
+ }
|
|
|
+ }
|
|
|
this.recommend = res.data.recommend || [];
|
|
|
this.apply_list = res.data.apply_list || [];
|
|
|
this.isLike = res.data.isLike || 0;
|