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);