classDetail.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view class="content">
  3. <u-card :title="classInfo.name" :show-foot="false" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
  4. <view slot="body">
  5. <view class="class-info-text">
  6. <u-icon name="clock"></u-icon>
  7. {{classInfo.classStartDate}}&nbsp;&nbsp;{{classInfo.classStartHours}}&nbsp;&nbsp;{{classInfo.residue}}课时
  8. </view>
  9. <view class="class-info-text">
  10. <u-icon name="map"></u-icon>
  11. {{classInfo.address}}
  12. </view>
  13. </view>
  14. </u-card>
  15. <u-card :title="'学员信息(' + classInfo.studentSignList.length + ')'" title-size="32" margin="0px 0px 10px 0px"
  16. :head-style="cardStyle">
  17. <u-grid :col="3" slot="body" :border="false">
  18. <u-grid-item v-for="(item, index) in classInfo.studentSignList" :key="index" :custom-style="gridCustomStyle" @click="goToStudentInfo(item)">
  19. <view class="class-student-col" :class="item.state ? 'student-active' : ''">
  20. {{item.name}}
  21. <u-icon name="bookmark" :color="mainColor" size="48"></u-icon>
  22. </view>
  23. </u-grid-item>
  24. </u-grid>
  25. </u-card>
  26. <u-card title="班级近况" :show-foot="false" title-size="32" margin="0px" :head-style="cardStyle">
  27. <view class="class-show-box" slot="body">
  28. <view v-for="(item, index) in classInfo.showList" :key="index" class="class-show-card">
  29. <u-image :src="item.url" mode="aspectFill" height="30vw" border-radius="10px"></u-image>
  30. <view class="class-show-name">{{item.name}}</view>
  31. </view>
  32. </view>
  33. </u-card>
  34. <view class="handle-fix-box">
  35. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="goToSignForm()">立即签到</u-button>
  36. </view>
  37. <u-top-tips ref="uTips"></u-top-tips>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. mapGetters
  43. } from 'vuex'
  44. const NET = require('@/utils/request')
  45. const API = require('@/config/api')
  46. export default {
  47. computed: {
  48. ...mapGetters([
  49. 'mainColor',
  50. 'customStyle',
  51. ])
  52. },
  53. data() {
  54. return {
  55. classId: '',
  56. classInfo: {
  57. name: '',
  58. classStartDate: '',
  59. classStartHours: '',
  60. residue: '',
  61. address: '',
  62. studentSignList: [],
  63. showList: [],
  64. },
  65. cardStyle: {
  66. fontWeight: 'bold'
  67. },
  68. gridCustomStyle: {
  69. padding: '0 2px'
  70. }
  71. }
  72. },
  73. onLoad(options) {
  74. this.classId = options.id
  75. this.initialize()
  76. },
  77. onReady() {},
  78. onPullDownRefresh() {
  79. this.initialize()
  80. },
  81. methods: {
  82. // 获取初始化数据
  83. initialize() {
  84. NET.request(API.getClassDetail, {
  85. id: this.classId
  86. }, 'POST').then(res => {
  87. this.classInfo = res.data
  88. uni.stopPullDownRefresh();
  89. }).catch(error => {
  90. this.$refs.uTips.show({
  91. title: error.message,
  92. type: 'warning',
  93. })
  94. })
  95. },
  96. // 跳转学生详情
  97. goToStudentInfo(item) {
  98. uni.navigateTo({
  99. url: '/pagesMain/studentInfo?type=1&id=' + item.id + '&classId=' + this.classId
  100. });
  101. },
  102. // 跳转签到表单
  103. goToSignForm() {
  104. uni.removeStorageSync('signUserList')
  105. uni.navigateTo({
  106. url: '/pagesClass/signForm?id=' + this.classId + '&status=' + this.classInfo.signStatus
  107. });
  108. },
  109. },
  110. }
  111. </script>
  112. <style>
  113. page {
  114. width: 100%;
  115. height: 100%;
  116. background-color: #f7f7f7;
  117. position: relative;
  118. }
  119. </style>
  120. <style lang="scss" scoped>
  121. @import "@/static/css/themes.scss";
  122. .content {
  123. width: 100%;
  124. float: left;
  125. padding-bottom: 60px;
  126. .class-info-text {
  127. color: #999999;
  128. line-height: 18px;
  129. u-icon {
  130. margin-right: 4px;
  131. }
  132. }
  133. .class-student-col {
  134. height: 28px;
  135. display: flex;
  136. padding: 0 10px;
  137. line-height: 28px;
  138. color: $mainColor;
  139. white-space: nowrap;
  140. border: 1px solid $mainColor;
  141. border-radius: 5px;
  142. /deep/u-icon {
  143. margin-left: 5px;
  144. }
  145. }
  146. .student-active {
  147. background-color: $mainColor;
  148. color: #FFFFFF;
  149. }
  150. .class-student-box {
  151. display: flex;
  152. justify-content: space-around;
  153. }
  154. .class-show-box {
  155. width: 100%;
  156. float: left;
  157. .class-show-card {
  158. width: calc(50% - 16px);
  159. margin: 0 8px 16px 8px;
  160. float: left;
  161. .class-show-name {
  162. width: 100%;
  163. text-align: center;
  164. line-height: 20px;
  165. font-size: 14px;
  166. margin-top: 5px;
  167. }
  168. }
  169. }
  170. }
  171. </style>