Silent vor 6 Jahren
Ursprung
Commit
5b45d79363

+ 1 - 1
app/Http/Controllers/WeChat/ApiController.php

@@ -243,7 +243,7 @@ class ApiController extends Controller
             return response()->json(['status' => 'fail', 'info' => '找不到学员']);
             return response()->json(['status' => 'fail', 'info' => '找不到学员']);
         }
         }
         $student_course = StudentCourse::where('student_id', $student->id)->first();
         $student_course = StudentCourse::where('student_id', $student->id)->first();
-        if(empty($course)) {
+        if(empty($student_course)) {
             return response()->json(['status' => 'fail', 'info' => '暂无课程']);
             return response()->json(['status' => 'fail', 'info' => '暂无课程']);
         }
         }
         $res = Leave::create([
         $res = Leave::create([

+ 19 - 2
wechat/pages/apply-leave/apply-leave.js

@@ -5,7 +5,7 @@ Page({
   data: {
   data: {
     date: '',
     date: '',
     typeEnum: [
     typeEnum: [
-      '短假1天', '长假7天'
+      '短假', '长假'
     ],
     ],
     selectedType: 0
     selectedType: 0
   },
   },
@@ -44,7 +44,24 @@ Page({
       data: {
       data: {
         'student_id': wx.getStorageSync('pt_student').id,
         'student_id': wx.getStorageSync('pt_student').id,
         'date': value.date,
         'date': value.date,
-        'type': value.type
+        'type': value.type == 0 ? '1' : '2',
+        'days': value.days,
+        'remark': value.remark
+      },
+      success: res => {
+        if(res.data.status == 'success') {
+          wx.showToast({
+            title: '请假成功',
+            icon: 'none',
+            duration: 800
+          })
+        } else {
+          wx.showToast({
+            title: res.data.info,
+            icon: 'none',
+            duration: 800
+          })
+        }
       }
       }
     })
     })
   }
   }

+ 6 - 1
wechat/pages/apply-leave/apply-leave.wxml

@@ -11,9 +11,14 @@
           {{typeEnum[selectedType]}}
           {{typeEnum[selectedType]}}
         </picker>
         </picker>
       </zan-cell>
       </zan-cell>
+      <zan-cell title="天数">
+        <view class="section">
+          <input placeholder="请输入请假天数" name='days'/>
+        </view>
+      </zan-cell>
       <zan-cell title="说明">
       <zan-cell title="说明">
         <view class="section">
         <view class="section">
-          <textarea placeholder="请输入请假说明" auto-height name='info'/>
+          <textarea placeholder="请输入请假说明" auto-height name='remark'/>
         </view>
         </view>
       </zan-cell>
       </zan-cell>
     </zan-cell-group>
     </zan-cell-group>

+ 0 - 3
wechat/pages/index/index.js

@@ -33,9 +33,6 @@ Page({
       }
       }
     })
     })
     var pt_student = wx.getStorageSync('pt_student')
     var pt_student = wx.getStorageSync('pt_student')
-    let ok = 1;
-    let tmp = ok == 1 ? '2' : '3';
-    console.log(tmp)
     wx.request({
     wx.request({
       url: api.getShareInfoUrl,
       url: api.getShareInfoUrl,
       method: 'GET',
       method: 'GET',