From 6f89c68df4326cb8b4e28859c426b764a666426d Mon Sep 17 00:00:00 2001 From: zhouwenxuan <1175765986@qq.com> Date: 星期三, 19 七月 2023 10:33:29 +0800 Subject: [PATCH] 文件预览 --- pages/tabBar/notice/detail.vue | 62 ++++++++++++++++++++++++++++--- pages/tabBar/notice/notice.vue | 2 unpackage/cache/certdata | 4 +- App.vue | 21 +++------- 4 files changed, 66 insertions(+), 23 deletions(-) diff --git a/App.vue b/App.vue index 6922043..290aca9 100644 --- a/App.vue +++ b/App.vue @@ -12,36 +12,27 @@ }); //消息回调——点击通知栏消息 跳转指定页面 jpushModule.addNotificationListener(result=>{ - console.log(result) if (result.notificationEventType == "notificationOpened") { //判断是否登录 if (uni.getStorageSync('tk')) { //工作通知——工作人员工作通知页 if (result.title.includes('工作通知')){ - uni.navigateTo({ + uni.switchTab({ url: '/pages/tabBar/notice/notice', - complete(res) { - console.log(res); - } }) //信息审核——领导审核页 }else if(result.title == '您有新的信息需要审批'){ - uni.navigateTo({ + uni.switchTab({ url: '/pages/tabBar/examine/examine', - complete(res) { - console.log(res); - } }) //审核结果——首页(后续加pc端信息发布页) }else if(result.title.includes('信息审核')){ - uni.navigateTo({ + uni.switchTab({ url: '/pages/tabBar/information/information', - complete(res) { - console.log(res); - } }) } }else { + console.log("未登录") //未登录跳转首页 uni.navigateTo({ url: '/pages/index/index', @@ -80,6 +71,8 @@ }) + + // jpushModule.addGeofenceListener(result => { // let code = result.code // let type = result.type @@ -115,7 +108,7 @@ console.log('App Show') }, onHide: function() { - jpushModule.initJPushService(); + // jpushModule.initJPushService(); console.log('App Hide') } } diff --git a/pages/tabBar/notice/detail.vue b/pages/tabBar/notice/detail.vue index 4b4ffe8..2cda4c5 100644 --- a/pages/tabBar/notice/detail.vue +++ b/pages/tabBar/notice/detail.vue @@ -31,17 +31,28 @@ <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" @@ -99,6 +110,7 @@ // 状态栏高度 statusBarHeight: 0, key: 1, + isAllImg: '', detailData: { id: null, warnInfoId: null, @@ -121,7 +133,7 @@ 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' || this.detailData.role == 'infoPeople' ) { this.detailData.attachments = this.detailData.attachment; if (this.detailData.attachments){ @@ -130,6 +142,23 @@ }) } } + 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: { @@ -168,6 +197,22 @@ }) 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) @@ -247,6 +292,11 @@ display: flex; flex-direction: column; } +.attache_img { + flex: 1; + display: flex; + flex-wrap: wrap; +} .responseStatus{ padding:5px; color:#2a2a2a; diff --git a/pages/tabBar/notice/notice.vue b/pages/tabBar/notice/notice.vue index 83c328a..4bcb792 100644 --- a/pages/tabBar/notice/notice.vue +++ b/pages/tabBar/notice/notice.vue @@ -148,7 +148,7 @@ }, onShow () { this.tabBarLists = uni.getStorageSync('tabBarList'); - this.user.name = uni.getStorageSync('user').name; + this.user.name = uni.getStorageSync('user').realName; this.getNoticeList(); // this.registerID = uni.getStorageSync('registrationID'); // this.page = this.$route.meta.pagePath; diff --git a/unpackage/cache/certdata b/unpackage/cache/certdata index c9620c5..49e77f8 100644 --- a/unpackage/cache/certdata +++ b/unpackage/cache/certdata @@ -1,3 +1,3 @@ -andrCertfile=D:/HBuilderX.3.8.4.20230531/HBuilderX/plugins/app-safe-pack/Test.keystore -andrCertAlias=android +andrCertfile=C:/Users/Administrator/Desktop/sznmyjs.keystore +andrCertAlias=sznmyjs andrCertPass=ep/Tdjka4Y7WYqDB6/S7dw== -- Gitblit v1.9.2