classDetail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. "name": "班级近",
  64. "state": 0,
  65. },
  66. {
  67. "name": "班级近",
  68. "state": 0,
  69. },
  70. {
  71. "name": "班级近",
  72. "state": 1,
  73. },
  74. {
  75. "name": "班级近",
  76. "state": 1,
  77. },
  78. {
  79. "name": "班级近",
  80. "state": 0,
  81. },
  82. {
  83. "name": "班级近",
  84. "state": 0,
  85. },
  86. ],
  87. showList: [],
  88. },
  89. cardStyle: {
  90. fontWeight: 'bold'
  91. },
  92. gridCustomStyle: {
  93. padding: '0 2px'
  94. }
  95. }
  96. },
  97. onLoad(options) {
  98. this.classId = options.id
  99. this.initialize()
  100. },
  101. onReady() {},
  102. onPullDownRefresh() {
  103. this.initialize()
  104. },
  105. methods: {
  106. // 获取初始化数据
  107. initialize() {
  108. NET.request(API.getClassDetail, {
  109. id: this.classId
  110. }, 'POST').then(res => {
  111. this.classInfo = res.data
  112. uni.stopPullDownRefresh();
  113. }).catch(error => {
  114. this.$refs.uTips.show({
  115. title: '获取班级详情失败',
  116. type: 'warning',
  117. })
  118. })
  119. },
  120. // 跳转学生详情
  121. goToStudentInfo(item) {
  122. uni.navigateTo({
  123. url: '/pagesMain/studentInfo?type=1&id=' + item.id
  124. });
  125. },
  126. // 跳转签到表单
  127. goToSignForm() {
  128. uni.removeStorageSync({
  129. key: 'signUserList'
  130. })
  131. uni.navigateTo({
  132. url: '/pagesClass/signForm?id=' + this.classId + '&status=' + this.classInfo.signStatus
  133. });
  134. },
  135. },
  136. }
  137. </script>
  138. <style>
  139. page {
  140. width: 100%;
  141. height: 100%;
  142. background-color: #f7f7f7;
  143. position: relative;
  144. }
  145. </style>
  146. <style lang="scss" scoped>
  147. @import "@/static/css/themes.scss";
  148. .content {
  149. width: 100%;
  150. float: left;
  151. padding-bottom: 60px;
  152. .class-info-text {
  153. color: #999999;
  154. line-height: 18px;
  155. }
  156. .class-student-col {
  157. height: 28px;
  158. display: flex;
  159. padding: 0 10px;
  160. line-height: 28px;
  161. color: $mainColor;
  162. white-space: nowrap;
  163. border: 1px solid $mainColor;
  164. border-radius: 5px;
  165. /deep/u-icon {
  166. margin-left: 5px;
  167. }
  168. }
  169. .student-active {
  170. background-color: $mainColor;
  171. color: #FFFFFF;
  172. }
  173. .class-student-box {
  174. display: flex;
  175. justify-content: space-around;
  176. }
  177. .class-show-box {
  178. width: calc(100% + 32px);
  179. margin: 0 -16px;
  180. float: left;
  181. .class-show-card {
  182. width: calc(50% - 16px);
  183. margin: 0 8px 16px 8px;
  184. float: left;
  185. .class-show-name {
  186. width: 100%;
  187. text-align: center;
  188. line-height: 20px;
  189. font-size: 14px;
  190. margin-top: 5px;
  191. }
  192. }
  193. }
  194. }
  195. </style>