From 807b4ab1519e1ec49fac5626fe98f4be8802ecea Mon Sep 17 00:00:00 2001 From: zhouwenxuan <1175765986@qq.com> Date: 星期三, 28 六月 2023 16:12:18 +0800 Subject: [PATCH] 文件预览 --- pages/tabBar/notice/detail.vue | 108 +++++++++++++++++++++++++++++++++-------------------- 1 files changed, 67 insertions(+), 41 deletions(-) diff --git a/pages/tabBar/notice/detail.vue b/pages/tabBar/notice/detail.vue index 922e911..4b4ffe8 100644 --- a/pages/tabBar/notice/detail.vue +++ b/pages/tabBar/notice/detail.vue @@ -47,7 +47,16 @@ <text v-if="detailData.reviewStatus == 1" class="responseStatus" style='color: red;'>待审核</text> <text v-else-if="detailData.reviewStatus == 2" class="responseStatus" - style='color: rgb(17, 204, 33);'>已审核通过</text> + style='color: rgb(17, 204, 33);'>审核通过</text> + <text v-else class="responseStatus" + style='color: rgb(153, 148, 143);'>已驳回</text> + </view> + <view class="textTop" v-else-if="detailData.role == 'infoPeople'"> + <text ><b>审核状态:</b></text> + <text v-if="detailData.reviewStatus == 1" class="responseStatus" + style='color: red;'>待审核</text> + <text v-else-if="detailData.reviewStatus == 2" class="responseStatus" + style='color: rgb(17, 204, 33);'>审核通过</text> <text v-else class="responseStatus" style='color: rgb(153, 148, 143);'>已驳回</text> </view> @@ -70,6 +79,12 @@ @click="reject" >审核驳回</u-button> </view> + <view v-if="detailData.role == 'infoPeople' && detailData.reviewStatus == 2" class="btn"> + <u-button + style="background-color:rgb(6, 202, 23);color: white;width: 180px;" + @click="infoSend" + >确认发布</u-button> + </view> </view> </view> </template> @@ -77,6 +92,7 @@ <script> import VUE_APP_BASE_URL from '../../../common/constant.js' import { submit } from '../../../api/examine.js' + import { publishInfo } from '../../../api/information.js' export default { data() { return { @@ -106,7 +122,7 @@ let test = options.data && JSON.parse(decodeURIComponent(options.data)); this.detailData = test; console.log("wwwwwwww",this.detailData) - if(this.detailData.role == 'leader') { + if(this.detailData.role == 'leader' || this.detailData.role == 'infoPeople' ) { this.detailData.attachments = this.detailData.attachment; if (this.detailData.attachments){ this.detailData.attachments.forEach((item,index) => { @@ -143,45 +159,54 @@ } }) }, - openFile(item) { - let fileUrl = ''; - console.log("iiii",item) - if(this.detailData.role == 'leader'){ - fileUrl = VUE_APP_BASE_URL + item.attachment; - }else { - fileUrl = VUE_APP_BASE_URL + item.attachement; - } - console.log("urlllllllll",fileUrl) - uni.downloadFile({ - url: fileUrl, - header: {}, - success:function(res){ - console.log("下载res",res); - var filePath = res.tempFilePath; - const sidx = filePath.lastIndexOf('('); - const eidx = filePath.lastIndexOf(')'); - // 用于处理文档打开问题(ps:第一次打开 第二次无法打开问题) - if (sidx > -1 && eidx > -1) { - const restr = filePath.substr(sidx, eidx - sidx + 1); - filePath = filePath.replace(restr, ''); - } - // plus.runtime.openFile(filePath) - uni.openDocument({ - filePath: filePath, - success:function(){ - console.log('成功') - }, - fail:function(){ - uni.showToast({ - icon: 'none', - title: '暂不支持此类型', - duration: 2000 - }) - } - }) - } - }) - } + //信息发布 + infoSend() { + publishInfo({id: this.detailData.id}).then(res => { + if(res.code==100) { + this.goBack(); + } + }) + console.log("信息发布") + }, + openFile(item) { + let fileUrl = ''; + console.log("iiii",item) + if(this.detailData.role == 'leader' || this.detailData.role == 'infoPeople' ){ + fileUrl = VUE_APP_BASE_URL + item.attachment; + }else { + fileUrl = VUE_APP_BASE_URL + item.attachement; + } + console.log("urlllllllll",fileUrl) + uni.downloadFile({ + url: fileUrl, + header: {}, + success:function(res){ + console.log("下载res",res); + var filePath = res.tempFilePath; + const sidx = filePath.lastIndexOf('('); + const eidx = filePath.lastIndexOf(')'); + // 用于处理文档打开问题(ps:第一次打开 第二次无法打开问题) + if (sidx > -1 && eidx > -1) { + const restr = filePath.substr(sidx, eidx - sidx + 1); + filePath = filePath.replace(restr, ''); + } + // plus.runtime.openFile(filePath) + uni.openDocument({ + filePath: filePath, + success:function(){ + console.log('成功') + }, + fail:function(){ + uni.showToast({ + icon: 'none', + title: '暂不支持此类型', + duration: 2000 + }) + } + }) + } + }) + } } } </script> @@ -240,4 +265,5 @@ justify-content: space-around; width: 100%; } + </style> -- Gitblit v1.9.2