Browse Source

培训计划

tiaosheng-ms
xuesinan 4 years ago
parent
commit
311019c4e8
  1. 45
      index.html

45
index.html

@ -51,15 +51,22 @@
<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> -->
<input type="file" id="iptFile">
<input type="button" id="upload" value="点击上传"/>
<!-- <input type="button" id="upload" value="点击上传"/> -->
</div>
<div class="border-2 w-full mt-2.5 flex justify-between p-2 text-sm file-check" style="display: none;">
<p style="color: #999999;">山西跳协**培训红头文件</p>
<button class="text-xs text-blue-400 border border-blue-400 rounded-full w-10 h-5">预览</button>
</div>
</div>
</div>
@ -106,7 +113,7 @@
},
getTrainPlan(){
var that = this
var that = this;
fetch(`https://test.tall.wiki/gateway/sports/training/get`, {
headers: new Headers({
'Authorization': 'Bearer ' + that.token,
@ -124,26 +131,32 @@
const { success, code, data, msg } = res;
if (success && code === 200) {
var trainPlan = that.dom.querySelector('.train-plan');
var fileCheck = that.dom.querySelector('.file-check');
if (!data) {
trainPlan.style.display = 'block'
trainPlan.style.display = 'block';
fileCheck.style.display = 'flex'; // 预览开启
// document.querySelector('#upload').on('click',function(){
// var xhr = new XMLHttpRequest();
// // xhr.open('post','../PHP/post_file.php',true);
document.querySelector('#upload').on('click',function(){
var xhr = new XMLHttpRequest();
// xhr.open('post','../PHP/post_file.php',true);
// xhr.onload = ()=>{
// console.log('上传成功');
// };
xhr.onload = ()=>{
console.log('上传成功');
};
// // 通过file表单的files属性拿到文件数据 通过formData将数据转换为二进制格式
// var fileInfo = new FormData();
// fileInfo.append( 'file',document.querySelector('#iptFile')[0].files[0] );
// 通过file表单的files属性拿到文件数据 通过formData将数据转换为二进制格式
var fileInfo = new FormData();
fileInfo.append( 'file',document.querySelector('#iptFile')[0].files[0] );
// // 发送数据
// xhr.send(fileInfo);
// 发送数据
xhr.send(fileInfo);
});
// fileCheck.style.display = 'flex'; // 预览开启
// });
} else if (data && data.checkStatus === 0 || data && data.checkStatus === 2) {
trainPlan.style.display = 'block';
fileCheck.style.display = 'flex';
} else {
trainPlan.style.display = 'none'
trainPlan.style.display = 'none';
}
} else {
console.log('msg: ', msg);

Loading…
Cancel
Save