diff --git a/pages/work/d-b-s-x/up/index.js b/pages/work/d-b-s-x/up/index.js
index 094895a..ef25465 100644
--- a/pages/work/d-b-s-x/up/index.js
+++ b/pages/work/d-b-s-x/up/index.js
@@ -63,7 +63,43 @@ Page({
const name = e.currentTarget.dataset.name;
this.data.postData[name] = e.detail.value;
},
-
+ /**
+ * 阅览文件
+ */
+ openread: function (e) {
+ const item = e.currentTarget.dataset.item;
+ const extension = item.filepath.split('.').pop().toLowerCase();
+ if(extension == 'jpg' || extension == 'png' ){
+ wx.previewImage({
+ urls: [app.FILE_SERVER_URL + item.filepath] // 需要预览的图片http链接列表
+ })
+ return
+ }
+ if(extension == 'mp4'){
+ this.setData({
+ videoSrc:app.FILE_SERVER_URL + item.filepath,
+ video: true
+ });
+ return
+ }
+ wx.downloadFile({
+ url: app.FILE_SERVER_URL + item.filepath, //仅为示例,并非真实的资源
+ success(res) {
+ if (res.statusCode === 200) {
+ wx.openDocument({
+ filePath: res.tempFilePath,
+ fail: function (res) {
+ wx.showToast({
+ title: '不支持此格式',
+ icon: 'none',
+ duration: 1000
+ });
+ }
+ })
+ }
+ }
+ })
+ },
/**
* 选择文件
*/
diff --git a/pages/work/d-b-s-x/up/index.wxml b/pages/work/d-b-s-x/up/index.wxml
index 3d4a70f..8a596cf 100644
--- a/pages/work/d-b-s-x/up/index.wxml
+++ b/pages/work/d-b-s-x/up/index.wxml
@@ -59,12 +59,21 @@
文件上传
-
+
+
+
+ {{ index + 1 }}
+ {{ item.realfilename }}
+
+
+
+
+
diff --git a/pages/work/s-b/index/index.js b/pages/work/s-b/index/index.js
index 6be01bf..5942eeb 100644
--- a/pages/work/s-b/index/index.js
+++ b/pages/work/s-b/index/index.js
@@ -109,7 +109,43 @@ Page({
}
});
},
-
+ /**
+ * 阅览文件
+ */
+ openread: function (e) {
+ const item = e.currentTarget.dataset.item;
+ const extension = item.filepath.split('.').pop().toLowerCase();
+ if(extension == 'jpg' || extension == 'png' ){
+ wx.previewImage({
+ urls: [app.FILE_SERVER_URL + item.filepath] // 需要预览的图片http链接列表
+ })
+ return
+ }
+ if(extension == 'mp4'){
+ this.setData({
+ videoSrc:app.FILE_SERVER_URL + item.filepath,
+ video: true
+ });
+ return
+ }
+ wx.downloadFile({
+ url: app.FILE_SERVER_URL + item.filepath, //仅为示例,并非真实的资源
+ success(res) {
+ if (res.statusCode === 200) {
+ wx.openDocument({
+ filePath: res.tempFilePath,
+ fail: function (res) {
+ wx.showToast({
+ title: '不支持此格式',
+ icon: 'none',
+ duration: 1000
+ });
+ }
+ })
+ }
+ }
+ })
+ },
/**
* 获取工作类型
*/
diff --git a/pages/work/s-b/index/index.wxml b/pages/work/s-b/index/index.wxml
index 8a1eea8..ac2de80 100644
--- a/pages/work/s-b/index/index.wxml
+++ b/pages/work/s-b/index/index.wxml
@@ -44,12 +44,21 @@
添加图片
文件上传
-
+
+
+
+ {{ index + 1 }}
+ {{ item.realfilename }}
+
+
+
+
+