leave.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="center">
  3. <view class="text">
  4. <text>请假原因</text>
  5. <textarea v-model="reason" maxlength="300" focus placeholder="您为什么要请假呢?"></textarea>
  6. </view>
  7. <view class="buttom" @click="submit('/pages/course/success')">
  8. 立即提交
  9. </view>
  10. <view class="jilv" @click="nav('/pages/leave/details')">
  11. 申请记录
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import { setLeave} from '@/api/course.js';
  17. import { mapState, mapMutations } from 'vuex';
  18. export default {
  19. computed: {
  20. ...mapState(['hasLogin', 'userInfo', 'baseURL', 'urlFile'])
  21. },
  22. data(){
  23. return{
  24. id: '',
  25. ifyid: '',
  26. grade_id: '',
  27. subject_id: '',
  28. manage_admin: '',
  29. reason: ''
  30. }
  31. },
  32. onLoad(option) {
  33. if (this.hasLogin) {
  34. this.id = option.id;
  35. this.ifyid = option.ifyid;
  36. this.grade_id = option.grade_id;
  37. this.subject_id = option.subject_id
  38. }else{
  39. uni.showModal({
  40. title: '登录',
  41. content: '您未登录,是否马上登陆?',
  42. success: e => {
  43. console.log(e)
  44. if (e.confirm) {
  45. console.log("1111")
  46. interceptor();
  47. }
  48. },
  49. fail: e => {
  50. console.log(e);
  51. }
  52. });
  53. return;
  54. }
  55. },
  56. methods: {
  57. submit(url){
  58. setLeave({
  59. timetable_id: this.id,
  60. ifyid: this.ifyid,
  61. grade_id: this.grade_id,
  62. subject_id: this.subject_id,
  63. reason: this.reason,
  64. manage_admin:this.manage_admin
  65. }).then(() =>{
  66. uni.navigateTo({
  67. url: url
  68. })
  69. }).catch(err =>{
  70. console.log(err);
  71. })
  72. },
  73. nav(url){
  74. uni.navigateTo({
  75. url: url
  76. })
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss">
  82. .text{
  83. position: relative;
  84. width: 90%;
  85. margin: 30rpx auto;
  86. height: 430rpx;
  87. font-size: 30rpx;
  88. font-weight: 500;
  89. color: #000000;
  90. .js{
  91. position: absolute;
  92. right: 50rpx;
  93. bottom: 24rpx;
  94. }
  95. textarea {
  96. height: 100%;
  97. width: 100%;
  98. }
  99. }
  100. .buttom {
  101. margin: 10rpx auto;
  102. width: 560rpx;
  103. height: 90rpx;
  104. background: #1CC7C7;
  105. border-radius: 45px;
  106. text-align: center;
  107. line-height: 90rpx;
  108. }
  109. .jilv {
  110. margin-top: 30rpx;
  111. text-align: center;
  112. color: #999999;
  113. font-size: 30rpx;
  114. }
  115. </style>