|
@@ -25,28 +25,31 @@
|
|
|
},
|
|
|
previewFile() {
|
|
|
console.log(this.src);
|
|
|
- uni.showLoading({
|
|
|
- title: "下载中...",
|
|
|
- mask: true,
|
|
|
- });
|
|
|
- uni.downloadFile({
|
|
|
- url: this.src,
|
|
|
- success: (res) => {
|
|
|
- if (res.statusCode === 200) {
|
|
|
- uni.openDocument({
|
|
|
- filePath: res.tempFilePath,
|
|
|
- // filePath: escape(res.tempFilePath),
|
|
|
- // 如果文件名包含中文,建议使用escape(res.tempFilePath)转码,防止ios和安卓客户端导致的差异
|
|
|
- success: function(res) {
|
|
|
- console.log("打开文档成功");
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- uni.hideLoading();
|
|
|
- },
|
|
|
- });
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/preview/preview?fileSrc=' + this.src
|
|
|
+ })
|
|
|
+ // uni.showLoading({
|
|
|
+ // title: "下载中...",
|
|
|
+ // mask: true,
|
|
|
+ // });
|
|
|
+ // uni.downloadFile({
|
|
|
+ // url: this.src,
|
|
|
+ // success: (res) => {
|
|
|
+ // if (res.statusCode === 200) {
|
|
|
+ // uni.openDocument({
|
|
|
+ // filePath: res.tempFilePath,
|
|
|
+ // // filePath: escape(res.tempFilePath),
|
|
|
+ // // 如果文件名包含中文,建议使用escape(res.tempFilePath)转码,防止ios和安卓客户端导致的差异
|
|
|
+ // success: function(res) {
|
|
|
+ // console.log("打开文档成功");
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // complete: () => {
|
|
|
+ // uni.hideLoading();
|
|
|
+ // },
|
|
|
+ // });
|
|
|
},
|
|
|
},
|
|
|
};
|
|
@@ -63,4 +66,4 @@
|
|
|
color: #2f42ca;
|
|
|
text-decoration: underline;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|