zhouwenxuan
2023-06-28 807b4ab1519e1ec49fac5626fe98f4be8802ecea
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,15 +122,13 @@
          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;
               })
            }
         }
         this.detailData.disaster = test.disasterType == 1 ? '地震': test.disasterType == 2 ? '洪涝' : test.disasterType == 3 ? '气象' : test.disasterType == 4 ? '泥石流': test.disasterType == 5 ? '水旱': '森林草原火灾';
      },
@@ -145,24 +159,27 @@
               }
            })
         },
         //信息发布
         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(item.role == 'leader'){
               fileUrl = VUE_APP_BASE_URL + item.attachment;
               console.log("url",fileUrl)
            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("url",VUE_APP_BASE_URL + item.attachement)
              fileUrl = VUE_APP_BASE_URL + item.attachement;
            }
            console.log("urlllllllll",fileUrl)
            uni.downloadFile({
               url: encodeURI('http://192.168.0.38:8086/uploadtest/2023/naturalDisaster/Warninginfo/0620/abc051b6ee66402d98e7b27216662d17.pdf'),
               header: {
                  'Content-type': 'application/json',
                  'tk':uni.getStorageSync('tk'),
                  'uid': uni.getStorageSync('uid')
               },
               url: fileUrl,
               header: {},
               success:function(res){
                  console.log("下载res",res);
                  var filePath = res.tempFilePath;
@@ -170,26 +187,26 @@
                  const eidx = filePath.lastIndexOf(')');
                  //  用于处理文档打开问题(ps:第一次打开 第二次无法打开问题)
                  if (sidx > -1 && eidx > -1) {
                    const restr = filePath.substr(sidx, eidx - sidx + 1);
                    filePath = filePath.replace(restr, '');
                     const restr = filePath.substr(sidx, eidx - sidx + 1);
                     filePath = filePath.replace(restr, '');
                  }
                  // plus.runtime.openFile(filePath)
                  uni.openDocument({
                     filePath: escape(filePath),
                     success:function(){
                        console.log('成功')
                     },
                     fail:function(){
                     uni.showToast({
                           icon: 'none',
                           title: '暂不支持此类型',
                           duration: 2000
                        })
                     }
                  })
               }
            })
         }
                    filePath: filePath,
                    success:function(){
                     console.log('成功')
                  },
                 fail:function(){
                  uni.showToast({
                       icon: 'none',
                       title: '暂不支持此类型',
                       duration: 2000
                     })
                  }
               })
            }
         })
        }
      }
   }
</script>
@@ -248,4 +265,5 @@
   justify-content: space-around;
   width: 100%;
}
</style>