|
|
@ -48,15 +48,18 @@ |
|
|
|
<div class="title"></div> |
|
|
|
<div class="flex justify-between"> |
|
|
|
<div class="text-sm">制定培训计划</div> |
|
|
|
<div id="submitProject" class="nightClockBtn bg-blue-500 text-xs rounded-md py-1 px-3 text-white" onclick="p1449927427387301888.submit()">提交</div> |
|
|
|
<div class="train-plan-status" style="display: none;">待审核</div> |
|
|
|
<div class="train-plan-btn bg-blue-500 text-xs rounded-md py-1 px-3 text-white" onclick="p1449927427387301888.submit()">提交</div> |
|
|
|
</div> |
|
|
|
<div class="border-2 w-full mt-2.5 flex justify-between p-2 text-sm"> |
|
|
|
<p style="color: #999999;">红头文件模板</p> |
|
|
|
<button>下载</button> |
|
|
|
</div> |
|
|
|
<div class="border-2 w-full mt-2.5 flex justify-between p-2 text-sm"> |
|
|
|
<p style="color: #999999;">文件上传</p> |
|
|
|
<div onclick="p1432643387798069248.upload()">上传</div> |
|
|
|
<!-- <p style="color: #999999;">文件上传</p> |
|
|
|
<div onclick="p1432643387798069248.upload()">上传</div> --> |
|
|
|
<input type="file" id="iptFile"> |
|
|
|
<input type="button" id="upload" value="点击上传"/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -123,6 +126,22 @@ |
|
|
|
var trainPlan = that.dom.querySelector('.train-plan'); |
|
|
|
if (!data) { |
|
|
|
trainPlan.style.display = 'block' |
|
|
|
|
|
|
|
document.querySelector('#upload').on('click',function(){ |
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
|
// xhr.open('post','../PHP/post_file.php',true); |
|
|
|
|
|
|
|
xhr.onload = ()=>{ |
|
|
|
console.log('上传成功'); |
|
|
|
}; |
|
|
|
|
|
|
|
// 通过file表单的files属性拿到文件数据 通过formData将数据转换为二进制格式 |
|
|
|
var fileInfo = new FormData(); |
|
|
|
fileInfo.append( 'file',document.querySelector('#iptFile')[0].files[0] ); |
|
|
|
|
|
|
|
// 发送数据 |
|
|
|
xhr.send(fileInfo); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
trainPlan.style.display = 'none' |
|
|
|
} |
|
|
@ -160,40 +179,52 @@ |
|
|
|
submit() { |
|
|
|
var that = this |
|
|
|
if (!that.file) { |
|
|
|
|
|
|
|
// 弹框提示请上传文件 |
|
|
|
that.statusChange(); |
|
|
|
} else { |
|
|
|
fetch(`https://test.tall.wiki/gateway/sports/training/save`, { |
|
|
|
headers: new Headers({ |
|
|
|
'Authorization': 'Bearer ' + that.token, |
|
|
|
'Content-Type': 'application/json; charset=utf-8' |
|
|
|
}), |
|
|
|
method: 'POST', |
|
|
|
body: JSON.stringify({ |
|
|
|
projectId: that.projectId, |
|
|
|
name: '', |
|
|
|
description: '', |
|
|
|
startTime: '', |
|
|
|
endTime: '', |
|
|
|
fileId: '' |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(function(response) { |
|
|
|
return response.json(); |
|
|
|
}) |
|
|
|
.then(function(res) { |
|
|
|
const { success, code, data, msg } = res; |
|
|
|
if (success && code === 200) { |
|
|
|
var submitProject = that.dom.querySelector('#submitProject') |
|
|
|
submitProject.onclick = function(){ |
|
|
|
this.innerHTML='待审核' |
|
|
|
} |
|
|
|
} else { |
|
|
|
console.log('msg: ', msg); |
|
|
|
} |
|
|
|
}); |
|
|
|
that.statusChange(); |
|
|
|
|
|
|
|
// fetch(`https://test.tall.wiki/gateway/sports/training/save`, { |
|
|
|
// headers: new Headers({ |
|
|
|
// 'Authorization': 'Bearer ' + that.token, |
|
|
|
// 'Content-Type': 'application/json; charset=utf-8' |
|
|
|
// }), |
|
|
|
// method: 'POST', |
|
|
|
// body: JSON.stringify({ |
|
|
|
// projectId: that.projectId, |
|
|
|
// name: '', |
|
|
|
// description: '', |
|
|
|
// startTime: '', |
|
|
|
// endTime: '', |
|
|
|
// fileId: '' |
|
|
|
// }) |
|
|
|
// }) |
|
|
|
// .then(function(response) { |
|
|
|
// return response.json(); |
|
|
|
// }) |
|
|
|
// .then(function(res) { |
|
|
|
// const { success, code, data, msg } = res; |
|
|
|
// if (success && code === 200) { |
|
|
|
// var submitBtn = that.dom.querySelector('.train-plan-btn') |
|
|
|
// submitBtn.style.display = 'none' |
|
|
|
// var trainStatus = that.dom.querySelector('.train-plan-status') |
|
|
|
// trainStatus.style.display = 'block' |
|
|
|
// } else { |
|
|
|
// console.log('msg: ', msg); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 按钮切换成状态值 |
|
|
|
statusChange() { |
|
|
|
var that = this |
|
|
|
var submitBtn = that.dom.querySelector('.train-plan-btn') |
|
|
|
submitBtn.style.display = 'none' |
|
|
|
var trainStatus = that.dom.querySelector('.train-plan-status') |
|
|
|
trainStatus.style.display = 'block' |
|
|
|
}, |
|
|
|
|
|
|
|
// 跳转详情 |
|
|
|
jumpDetails(that) { |
|
|
|
const pId = this.dom.parentNode.getAttribute('data-pid'); |
|
|
|