From c7602189ba81dbc66aa1ab69d1b046991fef8177 Mon Sep 17 00:00:00 2001 From: xuesinan <1404152492@qq.com> Date: Tue, 26 Oct 2021 17:06:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BB=93=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 907b10b..1caec3f 100644 --- a/index.html +++ b/index.html @@ -97,6 +97,7 @@ roleId: '', dom: '', status: 0, + isShowCertificate: 0, init() { this.dom = document.querySelector("div[data-root=p1452841234849865728]"); @@ -122,6 +123,8 @@ const { success, code, data, msg } = res; if (success && code === 200) { that.token = data.token; + // 查询当前培训计划 + that.getTrainPlan(); // 查询证书颁发状况(是否审核、是否发证) that.getCertificateStatus(); } else { @@ -130,6 +133,38 @@ }); }, + /** + * 查询当前培训计划 + */ + getTrainPlan(){ + var that = this; + fetch(`https://test.tall.wiki/gateway/sports/training/get`, { + headers: new Headers({ + 'Authorization': 'Bearer ' + that.token, + 'Content-Type': 'application/json; charset=utf-8' + }), + method: 'POST', + body: JSON.stringify({ + param: {projectId: that.projectId} + }) + }) + .then(function(response) { + return response.json(); + }) + .then(function(res) { + const { success, code, data, msg } = res; + if (success && code === 200) { + let date = new Date(); + let time = date.getTime(); + if (data && time > data.startTime) { + isShowCertificate = 1; + } + } else { + console.log('msg: ', msg); + } + }); + }, + // 查询证书颁发状况(是否审核、是否发证) getCertificateStatus(){ var that = this; @@ -150,7 +185,7 @@ .then(function(res) { const { success, code, data, msg } = res; if (success && code === 200) { - if (!data) { // 尚未提交结业申请 + if (!data && that.isShowCertificate === 1) { // 尚未提交结业申请 that.renderStatus(0, 0); } else if (data.completeStatus === 1) { // 已申请结业、待审核 that.renderStatus(1, 0);