From a94d46abe031d827c0e3bc49999cc02782ec09b8 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期五, 21 七月 2023 15:34:47 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 pages/tabBar/notice/detail.vue |  176 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 123 insertions(+), 53 deletions(-)

diff --git a/pages/tabBar/notice/detail.vue b/pages/tabBar/notice/detail.vue
index 08871d0..2cda4c5 100644
--- a/pages/tabBar/notice/detail.vue
+++ b/pages/tabBar/notice/detail.vue
@@ -31,23 +31,43 @@
 			<text class="textTop"><b>短信内容:</b><i style="background-color: rgb(240, 248, 255);">{{detailData.content}}发布单位:{{detailData.publishingUnit}}</i></text>
 			<view style="display: flex;">
 				<text class="textTop" style="width: 76px;" ><b>附件内容:</b></text>
-				<view class="attache">
+				<view class="attache" v-if="isAllImg == 'no'">
 					<view v-for="(item, index) in detailData.attachments" :key="index" >
-						
-							<view style="display: flex;margin-top: 10px;" @click="openFile(item)">
+							<view  style="display: flex;margin-top: 10px;" v-if="item.suffix == 'jpg'|| item.suffix =='jpeg' || item.suffix =='png'"> 
+								<image  @click="previewSqs(item)" :src="item.attachment" style="width: 100rpx; height: 100rpx;margin-left: 5rpx;border: 3px solid #ccc;margin-right: 3px;"></image>
+							</view>
+							<view style="display: flex;margin-top: 10px;" @click="openFile(item)" v-else>
 								<u-icon name="attach" color="#2979ff" size="20"></u-icon> {{item.attachementName}}
 							</view>
-							
+					</view>
+				</view>
+				<view class="attache_img" v-else>
+					<view v-for="(item, index) in detailData.attachments" :key="index" >
+							<view  style="display: flex;margin-top: 10px;" v-if="item.suffix == 'jpg'|| item.suffix =='jpeg' || item.suffix =='png'"> 
+								<image  @click="previewSqs(item,index)" :src="item.attachment" style="width: 100rpx; height: 100rpx;margin-left: 5rpx;border: 3px solid #ccc;margin-right: 3px;"></image>
+							</view>
+							<view style="display: flex;margin-top: 10px;" @click="openFile(item)" v-else>
+								<u-icon name="attach" color="#2979ff" size="20"></u-icon> {{item.attachementName}}
+							</view>
 					</view>
 				</view>
 			</view>
-			<text class="textTop" v-if="detailData.role == 'leader'"><b>信息提交人:</b>{{detailData.infoSubmitter}}</text>
+			<text class="textTop" v-if="detailData.role == 'leader'"><b>信息提交人:</b>{{detailData.infoSubmitterRealName}}</text>
 			<view class="textTop" v-if="detailData.role == 'leader'">
 				<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>
+					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 +90,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,12 +103,14 @@
 <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 {
 				// 状态栏高度
 				statusBarHeight: 0,
 				key: 1,
+				isAllImg: '',
 				detailData: {
 					id: null,
 				    warnInfoId: null,
@@ -105,17 +133,32 @@
 			this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight'];
 		    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) => {
 						item.attachementName = this.detailData.attachment[index].attachmentName;
 					})
 				}
-
-				
 			}
+			if (this.detailData.attachments){
+				this.detailData.attachments.forEach((item,index) => {
+					item.suffix = item.attachementName.substring(item.attachementName.lastIndexOf(".") + 1);
+					if(item.suffix == 'jpg'|| item.suffix =='jpeg' || item.suffix =='png' ){
+						if(this.detailData.role == 'leader' || this.detailData.role == 'infoPeople' ){
+						  item.attachment = VUE_APP_BASE_URL + item.attachment;
+						}else {
+						  item.attachment = VUE_APP_BASE_URL + item.attachement;
+						}
+						
+					}else {
+						this.isAllImg = 'no';
+					}
+				})
+			}
+			console.log("this.isAllImg",this.isAllImg)
+			console.log("detailData",this.detailData)
 			this.detailData.disaster = test.disasterType == 1 ? '地震': test.disasterType == 2 ? '洪涝' : test.disasterType == 3 ? '气象' : test.disasterType == 4 ? '泥石流': test.disasterType == 5 ? '水旱': '森林草原火灾';
 		},
 		methods: {
@@ -145,49 +188,70 @@
 					}
 				})
 			},
-      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("urlllllllllllll",fileUrl)
-        uni.downloadFile({
-          url: fileUrl,
-          header: {
-
-            // 'tk':uni.getStorageSync('tk'),
-            // 'uid': uni.getStorageSync('uid'),
-          },
-          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("信息发布")
+			},
+			//预览图片
+			previewSqs(item,index) {
+				
+				let imgs = [];
+				for (let i = 0; i < this.detailData.attachments.length; i++) {
+					imgs.push(this.detailData.attachments[i].attachment)
+				}
+				console.log("预览",imgs)
+				uni.previewImage({
+					urls: imgs,
+					current: index,
+					indicator: 'number',
+					loop: true
+				})
+			},
+			//预览文件
+			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>
@@ -228,6 +292,11 @@
 	display: flex;
 	flex-direction: column;
 }
+.attache_img {
+	flex: 1;
+	display: flex;
+	flex-wrap: wrap;
+}
 .responseStatus{
 	padding:5px;
 	color:#2a2a2a;
@@ -246,4 +315,5 @@
 	justify-content: space-around;
 	width: 100%;
 }
+
 </style>

--
Gitblit v1.9.2