dzl 1 year ago
parent
commit
7e62e5e9ad
2 changed files with 77 additions and 36 deletions
  1. 2 2
      manifest.json
  2. 75 34
      pages/newsContent/newsContent.vue

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "协同办公",
     "appid" : "__UNI__EEB5AF5",
     "description" : "",
-    "versionName" : "1.5.2",
-    "versionCode" : 152,
+    "versionName" : "1.55",
+    "versionCode" : 155,
     "transformPx" : false,
     "app-plus" : {
         /* 5+App特有相关 */

+ 75 - 34
pages/newsContent/newsContent.vue

@@ -24,7 +24,7 @@
 				附件
 			</view>
 			<view style="margin-bottom: 30rpx;" v-for="v in content.fjFiles" :key="v.fileId">
-				<u--text :lines="1" size="15" color="#2979FF" decoration="underline" :text="v.name" @click="downLoad(v.path)"></u--text>
+				<u--text :lines="1" size="15" color="#2979FF" decoration="underline" :text="v.name" @click="downLoad(v)"></u--text>
 			</view>
 		</view>
 	</view>
@@ -44,7 +44,7 @@
 		},
 		methods: {
 			getNewsContent(id){
-				uni.$u.http.get('/oa/article/'+id).then(res=>{
+				uni.$u.http.get('/oa/article/detail/'+id).then(res=>{
 					// console.log(res)
 					this.content = res.data
 					uni.setNavigationBarTitle({
@@ -58,43 +58,84 @@
 				uni.showLoading({
 					title:"打开中...",
 				})
-				if(that.list1.indexOf(v) == -1){
-					uni.downloadFile({
-					  url:getApp().globalData.saveUrl+v,
-					  success: function(res) {
-					    if (res.statusCode === 200) {
-							that.list1.push(v)
-							that.list2.push(res.tempFilePath)
-					      uni.openDocument({
-					        filePath: res.tempFilePath,
-							success: function (qwe) {
-								uni.hideLoading();
+				if(v.path == null){
+					let qaz = v.url.slice(10).replace(/[\\]/g,'/')
+					if(that.list1.indexOf(v.url.slice(10)) == -1){
+						uni.downloadFile({
+						  url:getApp().globalData.updateUrl+qaz,
+						  success: function(res) {
+						    if (res.statusCode === 200) {
+								that.list1.push(v.url.slice(10))
+								that.list2.push(res.tempFilePath)
+						      uni.openDocument({
+						        filePath: res.tempFilePath,
+								success: function (qwe) {
+									uni.hideLoading();
+								}
+						      });
+						    }else{
+								uni.hideLoading()
+								uni.showToast({
+									title:"下载失败",
+									icon:'none'
+								})
 							}
-					      });
-					    }else{
-							uni.hideLoading()
-							uni.showToast({
-								title:"下载失败",
+						  },fail:function(){
+							  uni.hideLoading()
+							  uni.showToast({
+							  	title:"下载失败",
 								icon:'none'
-							})
-						}
-					  },fail:function(){
-						  uni.hideLoading()
-						  uni.showToast({
-						  	title:"下载失败",
-							icon:'none'
-						  })
-					  }
-					});
+							  })
+						  }
+						});
+					}else{
+						uni.openDocument({
+						  filePath: that.list2[that.list1.indexOf(v.url.slice(10))],
+						  success: function (res) {
+						  	uni.hideLoading();
+						  }
+						});
+					}
 				}else{
-					uni.openDocument({
-					  filePath: that.list2[that.list1.indexOf(v)],
-					  success: function (res) {
-					  	uni.hideLoading();
-					  }
-					});
+					if(that.list1.indexOf(v.path) == -1){
+						uni.downloadFile({
+						  url:getApp().globalData.saveUrl+v.path,
+						  success: function(res) {
+						    if (res.statusCode === 200) {
+								that.list1.push(v.path)
+								that.list2.push(res.tempFilePath)
+						      uni.openDocument({
+						        filePath: res.tempFilePath,
+								success: function (qwe) {
+									uni.hideLoading();
+								}
+						      });
+						    }else{
+								uni.hideLoading()
+								uni.showToast({
+									title:"下载失败",
+									icon:'none'
+								})
+							}
+						  },fail:function(){
+							  uni.hideLoading()
+							  uni.showToast({
+							  	title:"下载失败",
+								icon:'none'
+							  })
+						  }
+						});
+					}else{
+						uni.openDocument({
+						  filePath: that.list2[that.list1.indexOf(v.path)],
+						  success: function (res) {
+						  	uni.hideLoading();
+						  }
+						});
+					}
 				}
 				
+				
 			}
 		}
 	}