leaveClass.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view class="center">
  3. <scroll-view scroll-y="true" class="list">
  4. <view v-for="(item,index) in courseList" :key="index" class="listBox" @click="nav(index)">
  5. <view class="type">待完成</view>
  6. <view class="top flex">
  7. <image src="../../static/img/indexMycourse.png"></image>
  8. <view class="font">
  9. <view class="title">奥数能力提升班</view>
  10. <view class="time">{{item.start_time}}</view>
  11. </view>
  12. </view>
  13. <view class="main">
  14. <view class="left">
  15. <view class="font">授课科目: <text style=" display: inline-block;padding-left: 20rpx;">{{item.subject}}</text></view>
  16. <view class="font">班主任: <text style=" display: inline-block;padding-left: 20rpx;">{{ bzr }}</text></view>
  17. </view>
  18. <view class="right">
  19. <view class="font">授课老师: <text style=" display: inline-block;padding-left: 20rpx;">{{ item.teacher }}</text></view>
  20. <view class="font">电话:<text style=" display: inline-block;padding-left: 20rpx;">{{ phone }}</text></view>
  21. </view>
  22. </view>
  23. <view class="button">请假</view>
  24. </view>
  25. <uni-load-more :status="loadingType"></uni-load-more>
  26. </scroll-view>
  27. <view class="jilv" @click="navTo('/pages/leave/details')">
  28. 申请记录
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import { getCourse } from '@/api/course.js';
  34. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  35. import { mapState, mapMutations } from 'vuex';
  36. import { my } from '@/api/user.js';
  37. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  38. export default {
  39. computed: {
  40. ...mapState(['hasLogin', 'userInfo', 'baseURL', 'urlFile'])
  41. },
  42. components: {
  43. uniLoadMore
  44. },
  45. data() {
  46. return {
  47. page: 1,
  48. limit: 10,
  49. loadingType: 'more',
  50. courseList: [
  51. ],
  52. bzr: '',
  53. phone:'',
  54. }
  55. },
  56. onLoad() {
  57. if (this.hasLogin) {
  58. console.log(this.userInfo)
  59. this.loadData();
  60. this.data();
  61. }else{
  62. uni.showModal({
  63. title: '登录',
  64. content: '您未登录,是否马上登陆?',
  65. success: e => {
  66. console.log(e)
  67. if (e.confirm) {
  68. console.log("1111")
  69. interceptor();
  70. }
  71. },
  72. fail: e => {
  73. console.log(e);
  74. }
  75. });
  76. return;
  77. }
  78. },
  79. //下拉刷新
  80. onPullDownRefresh() {
  81. this.loadData('refresh');
  82. },
  83. //监听页面是否滚动到底部加载更多
  84. onReachBottom() {
  85. this.loadData();
  86. },
  87. methods: {
  88. async loadData(type = 'add', loading) {
  89. let obj = this;
  90. if (type === 'add') {
  91. if (obj.loadingType === 'nomore') {
  92. return;
  93. }
  94. obj.loadingType = 'loading';
  95. } else {
  96. obj.loadingType = 'more';
  97. }
  98. if (type === 'refresh') {
  99. // 清空数组
  100. obj.courseList = [];
  101. obj.page = 1
  102. }
  103. //获取课程
  104. getCourse({
  105. page: obj.page,
  106. limit: obj.limit,
  107. type: 1
  108. }).then(e => {
  109. obj.courseList = obj.courseList.concat(e.data.data);
  110. console.log(obj.courseList);
  111. //判断是否还有下一页,有是more 没有是nomore
  112. if (obj.limit==e.data.data.length) {
  113. obj.page++
  114. obj.loadingType='more'
  115. } else{
  116. obj.loadingType='nomore'
  117. }
  118. if (type === 'refresh') {
  119. if (loading == 1) {
  120. uni.hideLoading();
  121. } else {
  122. uni.stopPullDownRefresh();
  123. }
  124. }
  125. })
  126. },
  127. data(){
  128. my({}).then(({data}) => {
  129. this.bzr = data.manage.real_name;
  130. this.phone = data.manage.phone;
  131. })
  132. },
  133. nav(index){
  134. uni.navigateTo({
  135. url: '/pages/leave/leave?id='+ this.courseList[index].id +'&ifyid='+this.courseList[index].ifyid + '&grade_id=' + this.courseList[index].grade_id + '&subject_id=' + this.courseList[index].subject_id
  136. })
  137. },
  138. navTo(url){
  139. uni.navigateTo({
  140. url: url
  141. })
  142. }
  143. }
  144. }
  145. </script>
  146. <style lang="scss">
  147. page,
  148. .center {
  149. width: 100%;
  150. height: 100%;
  151. background-color: #f8f8f8;
  152. }
  153. .listBox {
  154. position: relative;
  155. padding-left: 28rpx;
  156. padding-top: 42rpx;
  157. margin: 0 auto;
  158. margin: 20rpx;
  159. padding-bottom: 20rpx;
  160. background: #FFFFFF;
  161. box-shadow: 0px 5rpx 24rpx 0px rgba(4, 0, 0, 0.06);
  162. border-radius: 15rpx;
  163. .type {
  164. position: absolute;
  165. top: 38rpx;
  166. right: 32rpx;
  167. width: 97rpx;
  168. height: 38rpx;
  169. text-align: center;
  170. background: #FFDEDF;
  171. border-radius: 5rpx;
  172. font-size: 22rpx;
  173. font-weight: 500;
  174. color: #FF5850;
  175. line-height: 38rpx;
  176. }
  177. .top {
  178. justify-content: start;
  179. margin-bottom: 34rpx;
  180. image {
  181. width: 76rpx;
  182. height: 60rpx;
  183. }
  184. .font {
  185. margin-left: 10rpx;
  186. .title {
  187. font-size: 32rpx;
  188. font-weight: bold;
  189. color: #333333;
  190. }
  191. .time {
  192. margin-top: 14rpx;
  193. font-size: 24rpx;
  194. font-weight: 400;
  195. color: #808080;
  196. }
  197. }
  198. }
  199. .main {
  200. display: flex;
  201. justify-content: start;
  202. .left {
  203. padding-left: 10rpx;
  204. width: 50%;
  205. .font{
  206. margin-top: 20rpx;
  207. font-size: 28rpx;
  208. font-weight: 500;
  209. color: #808080;
  210. }
  211. }
  212. .right {
  213. padding-left: 10rpx;
  214. .font{
  215. margin-top: 20rpx;
  216. font-size: 28rpx;
  217. font-weight: 500;
  218. color: #808080;
  219. }
  220. }
  221. }
  222. .button {
  223. margin-top: 40rpx;
  224. margin-left: 500rpx;
  225. width: 145rpx;
  226. height: 48rpx;
  227. border: 1rpx solid #FF8219;
  228. border-radius: 24rpx;
  229. font-size: 26rpx;
  230. font-weight: 500;
  231. color: #FF8219;
  232. text-align: center;
  233. line-height: 48rpx;
  234. }
  235. }
  236. .jilv {
  237. text-align: center;
  238. background: #1CC7C7;
  239. color: #FFFFFF;
  240. font-size: 30rpx;
  241. position: fixed;
  242. bottom: 0;
  243. width: 100%;
  244. height: 80rpx;
  245. line-height: 80rpx;
  246. }
  247. </style>