Browse Source

导师接受委派

tiaosheng-ds
xuesinan 4 years ago
parent
commit
92aa1e8055
  1. 165
      index.html

165
index.html

@ -49,25 +49,25 @@
<div class="flex justify-between">
<div class="text-sm">培训委派</div>
<div class="btn-group">
<button class="nightClockBtn border text-xs rounded-md py-1 px-3" onclick="p1449944565271502848.refuse()">拒绝</button>
<button class="nightClockBtn bg-blue-500 text-xs rounded-md py-1 px-3 text-white">接受</button>
<button class="nightClockBtn mr-2 text-sm text-gray-400 border border-gray-400 rounded w-12 h-6" onclick="p1449944565271502848.refuse()">拒绝</button>
<button class="nightClockBtn bg-blue-500 text-xs rounded py-1 px-3 text-white" onclick="p1449944565271502848.accept()">接受</button>
</div>
<div class="refuse-status" style="display: none;">已拒绝</div>
</div>
<div class="border-2 w-full mt-2.5 flex justify-between p-2 text-sm">
<p style="color: #999999;">山西跳协**培训红头文件</p>
<div class="mt-2.5 px-2 flex justify-between items-center w-full h-8 border border-gray-200 rounded-sm text-sm">
<p class="file-name text-gray-400 truncate" style="width: calc(100vw - 9rem)"></p>
<button class="text-xs text-blue-400 border border-blue-400 rounded-full w-10 h-5" onclick="p1449944565271502848.lookFile()">查看</button>
</div>
<div class="border-2 w-full mt-2.5 flex justify-between p-2 text-sm">
<div class="mt-2.5 px-2 flex justify-between items-center w-full h-8 border border-gray-200 rounded-sm text-sm">
<p style="color: #999999;">报名人员</p>
<button class="check-btn text-xs text-blue-400 border border-blue-400 rounded-full w-10 h-5" style="display: none;">查看</button>
<button class="check-btn-disabled text-xs text-gray-400 border border-gray-400 rounded-full w-10 h-5" onclick="p1449944565271502848.peopleList()">查看</button>
<!-- <button class="check-btn text-xs text-blue-400 border border-blue-400 rounded-full w-10 h-5" style="display: none;">查看</button> -->
<button class="check-btn-disabled text-xs text-blue-400 border border-blue-400 rounded-full w-10 h-5" onclick="p1449944565271502848.peopleList()">查看</button>
</div>
<div class="refuse-reason border-2 w-full mt-2.5 flex justify-between p-2 text-sm" style="display: none;">
<p class="w-20 flex-shrink-0" style="color: #999999;">拒绝原因</p>
<div class="refuse-reason mt-2.5 px-2 py-1 flex justify-between w-full border border-gray-200 rounded-sm text-sm" style="display: none;">
<p class="w-20 flex-shrink-0 text-gray-400">拒绝原因</p>
<div>时间原因已拒绝</div>
</div>
@ -77,7 +77,7 @@
<p class="mt-8 checkReject text-center">拒绝原因</p>
<div class="pl-6 pr-6">
<div class="mt-8 border-b pt-2 pb-2">
<input type="text" class="border-none outline-none" style="width: 100%;" placeholder="请输入拒绝原因">
<input type="text" class="reason border-none outline-none" style="width: 100%;" placeholder="请输入拒绝原因">
</div>
</div>
<div class="border-t btn mt-6 flex justify-between">
@ -104,7 +104,10 @@
projectId: '',
roleId: '',
dom: '',
lists: [],
planId: '',
planTeacherId: '',
remark: '',
status: 0,
init() {
this.dom = document.querySelector("div[data-root=p1449944565271502848]");
@ -130,6 +133,8 @@
const { success, code, data, msg } = res;
if (success && code === 200) {
that.token = data.token;
// 查询培训计划
that.getTrainPlan();
// 查询委派信息
that.getAppointStatus();
} else {
@ -138,6 +143,34 @@
});
},
// 查询培训计划
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) {
that.planId = data.id;
that.dom.querySelector('.file-name').innerHTML = data.name;
} else {
console.log('msg: ', msg);
}
});
},
// 查询委派信息
getAppointStatus() {
var that = this;
@ -145,36 +178,39 @@
var teacherBox = that.dom.querySelector('.teacher-box');
teacherTitle.style.display = 'none';
teacherBox.style.display = 'block';
// fetch(`https://test.tall.wiki/gateway/sports/training/getAppoint`, {
// 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) {
// if (!data) {
// for (var i = 0; i < data.length; i++) {
// if (data[i].mine == 1) {
// var teacherTitle = that.dom.querySelector('.teacher-title');
// var teacherBox = that.dom.querySelector('.teacher-box');
// teacherTitle.style.display = 'none';
// teacherBox.style.display = 'block';
// }
// }
// }
// } else {
// console.log('msg: ', msg);
// }
// });
fetch(`https://test.tall.wiki/gateway/sports/teacher/getAppoint`, {
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) {
if (!data) {
for (var i = 0; i < data.length; i++) {
if (data[i].mine == 1) {
that.planTeacherId = data.planTeacherId;
that.remark = data.remark;
that.status = data.status;
var teacherTitle = that.dom.querySelector('.teacher-title');
var teacherBox = that.dom.querySelector('.teacher-box');
teacherTitle.style.display = 'none';
teacherBox.style.display = 'block';
}
}
}
} else {
console.log('msg: ', msg);
}
});
},
// 培训委派拒绝按钮弹出框
@ -184,15 +220,46 @@
},
// 提交拒绝原因
submit() {
submit(type) {
var that = this;
that.hide();
var reasonBox = that.dom.querySelector('.refuse-reason');
reasonBox.style.display = 'flex';
var btnGroup = that.dom.querySelector('.btn-group');
var refuseText = that.dom.querySelector('.refuse-status');
btnGroup.style.display = 'none';
refuseText.style.display = 'block';
that.status = type;
that.remark = that.dom.querySelector(".reason").value;
if (type === 2 && !reason) {
window.alert("请填写驳回原因");
return false;
}
fetch(`https://test.tall.wiki/gateway/sports/teacher/getAppoint`, {
headers: new Headers({
'Authorization': 'Bearer ' + that.token,
'Content-Type': 'application/json; charset=utf-8'
}),
method: 'POST',
body: JSON.stringify({
param: {
planTeacherId: that.planTeacherId,
status: that.status,
remark: that.remark
}
})
})
.then(function(response) {
return response.json();
})
.then(function(res) {
const { success, code, data, msg } = res;
if (success && code === 200) {
var reasonBox = that.dom.querySelector('.refuse-reason');
reasonBox.style.display = 'flex';
var btnGroup = that.dom.querySelector('.btn-group');
var refuseText = that.dom.querySelector('.refuse-status');
btnGroup.style.display = 'none';
refuseText.style.display = 'block';
} else {
console.log('msg: ', msg);
}
});
},
// 取消
@ -208,6 +275,8 @@
const rId = this.dom.parentNode.getAttribute('data-rid');
location.href=`https://test.tall.wiki/ts/file?pid=${pId}&uid=${uId}&rid=${rId}`
},
// 查看学员列表
peopleList(){
const pId = this.dom.parentNode.getAttribute('data-pid');
const uId = this.dom.parentNode.getAttribute('data-uid');

Loading…
Cancel
Save