diff --git a/pages/grade/grade.vue b/pages/grade/grade.vue index 0c32561..03cf62e 100644 --- a/pages/grade/grade.vue +++ b/pages/grade/grade.vue @@ -24,12 +24,15 @@ {{item.totalFraction}} - + - - 查看报告 - 查看报告 + 暂无报告 + 查看报告 + + + 查看报告 + @@ -70,42 +73,42 @@ }, methods: { - showToast() { - this.$refs.uToast.show({ - message: "暂无报告", - type: 'error', - duration: 1000 - }) - }, - lookbook(item) { - uni.showLoading({ - title: '获取报告中' - }); - var that = this - wx.downloadFile({ - url: baseurl + item.downloadAddress, - success: function(res) { - var filePath = res.tempFilePath; - wx.openDocument({ - filePath: filePath, - showMenu: true, - success: function(res) { - uni.hideLoading(); - }, - fail: function(err) { - uni.hideLoading(); - } - }); - }, - fail: function(err) { - uni.hideLoading(); - that.$refs.uToast.show({ - message: '请求报告失败', - type: 'error' - }) - } - }); + if (item.existFlag == false) { + this.$refs.uToast.show({ + message: "暂无报告", + type: 'error', + duration: 1000 + }) + } else { + uni.showLoading({ + title: '获取报告中' + }); + var that = this + wx.downloadFile({ + url: baseurl + item.downloadAddress, + success: function(res) { + var filePath = res.tempFilePath; + wx.openDocument({ + filePath: filePath, + showMenu: true, + success: function(res) { + uni.hideLoading(); + }, + fail: function(err) { + uni.hideLoading(); + } + }); + }, + fail: function(err) { + uni.hideLoading(); + that.$refs.uToast.show({ + title: '请求报告失败', + type: 'error' + }) + } + }); + } }, getPhoneNumberp(val) { wx.login({