diff --git a/app.js b/app.js index b461ee2..9600c0d 100644 --- a/app.js +++ b/app.js @@ -50,10 +50,10 @@ App({ globalData: { versionCode: 'V1', userInfo: {}, - // headerUrl: "http://42.193.40.239:8017/" //线上 + headerUrl: "http://42.193.40.239:8017/" //线上 // headerUrl: "http://192.168.110.10:8017/" //线下 // headerUrl: "http://192.168.110.186:8017/" - headerUrl: "https://city.sczysoft.com/df/" + // headerUrl: "https://city.sczysoft.com/df/" }, // https://city.sczysoft.com/df/doc.html //接口 // https://city.sczysoft.com/dffile //查看拼接 diff --git a/pages/emergency/t-x-l/index/index.js b/pages/emergency/t-x-l/index/index.js index cd63bfb..df5c832 100644 --- a/pages/emergency/t-x-l/index/index.js +++ b/pages/emergency/t-x-l/index/index.js @@ -63,7 +63,7 @@ Component({ userId: app.globalData.userInfo.userId, condition: this.data.condition } - app.axios("GET", "app", "/Othexpert/performUserPage", params, false).then(res => { + app.axios("GET", "app", "/Othteam/getOthteamPage", params, false).then(res => { console.log(res,'res===>'); this.data.freshIng = false; if (res.code == 1) { diff --git a/pages/emergency/y-a/index/index.js b/pages/emergency/y-a/index/index.js index 1ca53f2..40c5fcd 100644 --- a/pages/emergency/y-a/index/index.js +++ b/pages/emergency/y-a/index/index.js @@ -13,6 +13,7 @@ Component({ * 组件的初始数据 */ data: { + baseUrl: app.FILE_SERVER_URL, condition: '', curTab: 0, tabs: [], @@ -21,7 +22,7 @@ Component({ freshIng: false, page: 1, pageSize: 10, - list: [] + list: [], }, pageLifetimes: { @@ -90,7 +91,55 @@ Component({ this.setData(this.data) }) }, - + download :function (item) { + console.log(item,'item====>'); + console.log(this.data.baseUrl+item.currentTarget.dataset.item.filePath); + //触发点击事件,使用uni.showLoading()展示交互提示 + wx.showLoading({ + title: '正在下载……' + }); + // 使用wx.downloadFile()开始下载文件 + wx.downloadFile({ + url: this.data.baseUrl+item.currentTarget.dataset.item.filePath, //url:请求的完整地址 + success: function(res) { + wx.hideLoading() //调用结束,隐藏加载框 + const filePath = res.tempFilePath //临时文件路径 (本地路径) + if (res.statusCode == 200) { + //判断后端数据接收成功时提示下载完成 + wx.showToast({ + icon: 'none', + mask: true, + title: '下载完成,正在打开文件...', + duration: 2000, + }); + } + //设置定时器2秒后打开文件 + setTimeout(() => { + //调用wx.openDocument()打开刚刚下载的文件 + wx.openDocument({ + filePath: filePath, //上一步存储的临时文件路径 (本地路径) + fileType: item.type, //要打开的文件类型, + showMenu: true, //是否显示右上角菜单 + //下面的测试用了,写不写无所谓 + success: function(res) { + + }, + complete: function(msg) { + + } + }) + }, 2000) + }, + //文件下载失败,会走这里,具体可以把err打印出来看看有什么错误 + fail: (err) => { + uni.showToast({ + icon: 'none', + mask: true, + title: '文件下载失败', + }); + }, + }) + }, /** * 获取预案类型 */ diff --git a/pages/emergency/y-a/index/index.wxml b/pages/emergency/y-a/index/index.wxml index 04616e4..8c13f03 100644 --- a/pages/emergency/y-a/index/index.wxml +++ b/pages/emergency/y-a/index/index.wxml @@ -13,7 +13,7 @@ - + 预案名称: {{item.planname}} @@ -29,7 +29,7 @@ {{item.introduction}} - + 附件下载