From 369d2aa870663b2409857a8ae6770e922dfcba93 Mon Sep 17 00:00:00 2001
From: heyiheng <vastisy@163.com>
Date: Fri, 11 Aug 2023 16:26:15 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=86=E4=BA=AB=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/pages/mobile/articleDetails/index.vue | 28 +++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/pages/mobile/articleDetails/index.vue b/src/pages/mobile/articleDetails/index.vue
index 3da56c2..ade6c2a 100644
--- a/src/pages/mobile/articleDetails/index.vue
+++ b/src/pages/mobile/articleDetails/index.vue
@@ -3,13 +3,19 @@
     <h2>{{ informationDetail.title }}</h2>
     <div class="downBox">
       <span>{{ formatDate(informationDetail.add_time) }}</span>
-      <!-- <a
-        v-if="informationDetail.is_down"
+      <a
+        v-if="informationDetail.is_down && downType == 1"
         :href="imgUrl + informationDetail.pdf_url"
         :download="informationDetail.title"
         >点击下载</a
-      > -->
-      <div class="downLoadBtn" @click="downLoad">点击下载</div>
+      >
+      <div
+        class="downLoadBtn"
+        v-if="informationDetail.is_down && downType == 0"
+        @click="downLoad"
+      >
+        点击下载
+      </div>
     </div>
     <p v-html="informationDetail.content"></p>
   </div>
@@ -40,7 +46,21 @@ onMounted(() => {
   script.type = "text/javascript";
   script.src = "https://res.wx.qq.com/open/js/jweixin-1.3.2.js";
   document.body.appendChild(script);
+
+  //微信环境下
+  if (globalProperties.$wx.isWeixin()) {
+    wx.miniProgram.getEnv(function (res) {
+      if (res.miniprogram) {
+        // 小程序环境下逻辑
+        downType.value = 0;
+      } else {
+        //非小程序环境下逻辑
+        downType.value = 1;
+      }
+    });
+  }
 });
+let downType: any = ref(0);
 let id = route.currentRoute.value.query.id;
 let informationDetail: any = ref();
 const getInformationDetail = async (id) => {
-- 
2.24.1