From 6afca6bef8720bca3d954f9374150f8aca35d3c3 Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Wed, 26 Mar 2025 16:47:55 +0800
Subject: [PATCH] =?UTF-8?q?feat(member):=20=E6=B7=BB=E5=8A=A0=E5=AD=A6?=
=?UTF-8?q?=E5=91=98=E8=AF=B7=E5=81=87=E5=8A=9F=E8=83=BD-=20=E5=9C=A8=20me?=
=?UTF-8?q?mber.js=20=E4=B8=AD=E6=96=B0=E5=A2=9E=20askForLeave=20=E6=96=B9?=
=?UTF-8?q?=E6=B3=95=EF=BC=8C=E7=94=A8=E4=BA=8E=E5=8F=91=E9=80=81=E8=AF=B7?=
=?UTF-8?q?=E5=81=87=E7=94=B3=E8=AF=B7-=20=E5=9C=A8=20info.vue=20=E4=B8=AD?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=B7=E5=81=87=E7=9B=B8=E5=85=B3UI?=
=?UTF-8?q?=E5=92=8C=E9=80=BB=E8=BE=91=20-=20=E5=AE=9E=E7=8E=B0=E4=BA=86?=
=?UTF-8?q?=E8=AF=B7=E5=81=87=E7=94=B3=E8=AF=B7=E5=92=8C=E5=8F=96=E6=B6=88?=
=?UTF-8?q?=E8=AF=B7=E5=81=87=E7=9A=84=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
api/member.js | 9 ++
pages/student/timetable/info.vue | 145 +++++++++++++++++++++++++++++++
2 files changed, 154 insertions(+)
diff --git a/api/member.js b/api/member.js
index 773a12d..bc34432 100644
--- a/api/member.js
+++ b/api/member.js
@@ -100,6 +100,15 @@ export default {
},
+ //发送请假申请
+ askForLeave(data) {
+ let url = '/member/ask_for_leave'
+ return http.post(url, data).then(res => {
+ return res;
+ })
+ },
+
+
diff --git a/pages/student/timetable/info.vue b/pages/student/timetable/info.vue
index bc1a746..7c9efcc 100644
--- a/pages/student/timetable/info.vue
+++ b/pages/student/timetable/info.vue
@@ -42,12 +42,34 @@
{{infoData.hour}}个课时
+
已上
+
+
+
+ 请假
+
+ 取消请假
+
+
+
+
+
+ 请假申请
+
+
+
+
+
+
+
+
+
@@ -67,10 +89,25 @@ export default {
filteredData: {
id: '',//课程id
},
+
+ leaveShow:false,//请假模态框显示状态
+
+ //请假表单
+ leaveFormData:{
+ schedules_id: '',//详情 id
+ courses_id: '',//课程id
+ reason: '',//请假原因
+ file_url: '',//附件
+ },
+
+ //取消请相关
+ cancelLeaveShow:false,//取消请假模态框显示状态
}
},
onLoad(options) {
this.filteredData.id = options.id//课程id
+ this.leaveFormData.courses_id = options.id//课程id
+
},
onShow(){
this.init()
@@ -103,6 +140,92 @@ export default {
url: '/pages/coach/course/info'
})
},
+
+ //请假/取消请假 type|1=请求,2=取消请假
+ askForLeave(type){
+ if(type == 1){
+ //打开请假模态框
+ this.leaveShow = true
+ }else{
+ //取消请假
+ this.cancelLeaveShow = true
+ }
+ },
+ //打开请假模态框
+ openLeaveModal(){
+ this.leaveShow = true
+ },
+ //关闭请假模态框
+ closeLeaveModal(e){
+ if(e.index == 0){
+ //点击了取消
+ this.leaveFormData.reason = ''
+ }else{
+ //点击了确定
+ if (!this.leaveFormData.reason){
+ uni.showToast({
+ title: '请输入请假原因',
+ icon: 'none'
+ })
+ return
+ }
+ this.submitLeave()//发送请假请求
+ }
+ this.leaveShow = false
+ },
+ //发送请假申请
+ async submitLeave(){
+ let data = {...this.leaveFormData}
+ let res = await memberApi.askForLeave(data)
+ if(res.code != 1){
+ uni.showToast({
+ title: res.msg,
+ icon: 'none'
+ })
+ return
+ }
+ uni.showToast({
+ title: res.msg,
+ icon: 'success'
+ })
+ //延迟1s执行
+ setTimeout(() => {
+ this.init()
+ }, 1000)
+ },
+ //发送取消请假申请
+ async submitCancelLeave(e){
+ if(e.index == 0){
+ //点击了取消按钮
+ return
+ }
+
+ uni.showToast({
+ title: '需要取消请假接口',
+ icon: 'none'
+ })
+ return
+
+ //取消请假
+ let data = {...this.leaveFormData}
+ let res = await memberApi.askForLeave(data)
+ if(res.code != 1){
+ uni.showToast({
+ title: res.msg,
+ icon: 'none'
+ })
+ return
+ }
+ uni.showToast({
+ title: res.msg,
+ icon: 'success'
+ })
+ //延迟1s执行
+ setTimeout(() => {
+ this.init()
+ }, 1000)
+ },
+
}
}
@@ -182,8 +305,30 @@ export default {
transform: rotate(-35deg); /* 旋转 */
}
}
+
+ .state_box_btn{
+ position: absolute;
+ bottom: 50rpx;
+ right: 10rpx;
+ view{
+ width: 160rpx;
+ height: 60rpx;
+ line-height: 60rpx;
+ background-color: #00BE8C;
+ border-radius: 8rpx;
+ color: #fff;
+ font-size: 28rpx;
+ text-align: center;
+ }
+ }
}
}
+
+ //请假模态框
+ .leave_section {
+
+ }
+
}