classDetails.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <template>
  2. <view>
  3. <u-navbar :title="classDetail.className"></u-navbar>
  4. <u-tabs :list="list" :is-scroll="false" :current="current" @change="change" active-color="#1CBECA"
  5. bar-width="100"></u-tabs>
  6. <view class="content-1" v-if="this.current==0">
  7. <u-cell-group>
  8. <!-- <u-cell-item title="所属学部" value="文艺部" :arrow="false"></u-cell-item> -->
  9. <u-cell-item title="所属课程项目" :value="classDetail.courseSortName" :arrow="false"></u-cell-item>
  10. <!-- <u-cell-item title="上课时间" value="周四晚上18:00-19:30周六上午11:20-12:40" :arrow="false"></u-cell-item> -->
  11. <u-cell-item title="上课教室" :value="classDetail.classroomName" :arrow="false"></u-cell-item>
  12. <u-cell-item title="授课老师" :value="classDetail.teacherNames" :arrow="false"></u-cell-item>
  13. <u-cell-item title="咨询电话" :value="classDetail.consultPhone" :arrow="false"></u-cell-item>
  14. <u-cell-item title="学员总数" :value="classDetail.crtStudentCount+'人'" :arrow="false"></u-cell-item>
  15. </u-cell-group>
  16. </view>
  17. <view class="content-2" v-if="this.current==1">
  18. <view class="search">
  19. <u-search v-model="queryName" placeholder="搜索学员姓名" action-text="查询"
  20. @custom="queryStudent"></u-search>
  21. </view>
  22. <!-- <view class="student-details" @click="gotoUrl('pages/teacher/myClass/studentDetails')">
  23. <view class="photo">
  24. <img src="../../../assets/img/photo@1x.png" alt="">
  25. </view>
  26. <view class="details">
  27. <view class="name-tel">
  28. <view class="name">
  29. 王紫瑄
  30. </view>
  31. <view class="tel">
  32. <img src="../../../assets/img/riLine-smartphone-line@1x.png" alt="">
  33. <view class="">17700112233
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="more">
  39. <u-icon name="arrow-right" color="#cccccc"></u-icon>
  40. </view>
  41. </view> -->
  42. <view class="student-card" v-for="(item,index) in studentList" :key="index">
  43. <!-- <view class="title">
  44. <view><img src="../../../assets/img/fas fa-graduation-cap@1x.png" alt=""></view>
  45. <view>
  46. 学员详情
  47. </view>
  48. </view> -->
  49. <view class="details">
  50. <view class="photo">
  51. <u-avatar class="avatar" mode="square"
  52. :src="item.headPhoto != null ? item.headPhoto : '../../assets/img/head.png'" size="112">
  53. </u-avatar>
  54. </view>
  55. <view class="information">
  56. <view class="name">
  57. {{item.studentName}}
  58. </view>
  59. <view class="item">
  60. <view class="item-name">
  61. 年龄
  62. </view>
  63. <view class="item-content">
  64. {{getAge(item.birthday)}}
  65. </view>
  66. </view>
  67. <view class="item">
  68. <view class="item-name">
  69. 联系人手机号
  70. </view>
  71. <view class="item-content">
  72. {{item.firstContactPhone}}
  73. </view>
  74. </view>
  75. <view class="item">
  76. <view class="item-name">
  77. 第二联系人手机号
  78. </view>
  79. <view class="item-content">
  80. {{item.secondContactPhone}}
  81. </view>
  82. </view>
  83. <view class="item">
  84. <view class="item-name">
  85. 接送家长姓名
  86. </view>
  87. <view class="item-content">
  88. {{item.takerName}}
  89. </view>
  90. </view>
  91. <view class="item">
  92. <view class="item-name">
  93. 剩余课时
  94. </view>
  95. <view class="item-content">
  96. {{item.stuRemainNum}}
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. import * as myClassApi from '@/apis/teacher/myClass.js'
  107. export default {
  108. data() {
  109. return {
  110. list: [{
  111. name: '班级信息'
  112. }, {
  113. name: '学员信息',
  114. }],
  115. current: 0,
  116. classId: '',
  117. queryName: '',
  118. classDetail: {},
  119. studentList: [],
  120. }
  121. },
  122. onLoad(op) {
  123. if(op.id) {
  124. this.classId = op.id;
  125. this.getLoadMyClass();
  126. this.getLoadClassStudents();
  127. }
  128. },
  129. methods: {
  130. queryStudent() {
  131. this.getLoadClassStudents();
  132. },
  133. getAge(str) {
  134. var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
  135. if (r == null) return false;
  136. var d = new Date(r[1], r[3] - 1, r[4]);
  137. if (d.getFullYear() == r[1] && (d.getMonth() + 1) == r[3] && d.getDate() == r[4]) {
  138. var date = new Date();
  139. var Y = date.getFullYear() - r[1];
  140. var M = date.getMonth() + 1 - r[3];
  141. var D = date.getDate();
  142. if (parseInt(D) - parseInt(r[4]) < 0) {
  143. M--;
  144. if (M < 0) {
  145. Y--;
  146. M = 11;
  147. }
  148. }
  149. if (M < 0) {
  150. Y--;
  151. M = 11;
  152. }
  153. if(Y != 0 && M != 0) {
  154. return (Y + "岁" + M + "个月");
  155. }else if(Y != 0 && M == 0) {
  156. return (Y + "岁");
  157. }else {
  158. return (M + "个月");
  159. }
  160. }
  161. return ("输入的日期格式错误!");
  162. },
  163. getLoadClassStudents() {
  164. uni.showLoading({
  165. title: "加载中",
  166. mask: true,
  167. })
  168. myClassApi.loadClassStudents({
  169. classId: this.classId,
  170. queryName: this.queryName
  171. }).then((res) => {
  172. uni.hideLoading();
  173. this.studentList = res.data;
  174. }).catch(error => {
  175. uni.showToast({
  176. title: error,
  177. icon: "none"
  178. })
  179. })
  180. },
  181. getLoadMyClass() {
  182. uni.showLoading({
  183. title: "加载中",
  184. mask: true,
  185. })
  186. myClassApi.loadMyClass({
  187. classId: this.classId
  188. }).then((res) => {
  189. uni.hideLoading();
  190. this.classDetail = res.data[0];
  191. }).catch(error => {
  192. uni.showToast({
  193. title: error,
  194. icon: "none"
  195. })
  196. })
  197. },
  198. change(index) {
  199. this.current = index;
  200. },
  201. }
  202. }
  203. </script>
  204. <style lang="scss" scoped>
  205. .u-tabs{
  206. position: fixed;
  207. top: 88rpx;
  208. left: 0;
  209. right: 0;
  210. z-index: 999;
  211. }
  212. .content-1{
  213. margin-top: 80rpx;
  214. }
  215. .student-card{
  216. margin: 0rpx 32rpx 16rpx;
  217. padding: 2rpx 32rpx 16rpx 32rpx;
  218. background-color: #fff;
  219. border-radius: 12px;
  220. .title{
  221. display: flex;
  222. align-items: center;
  223. color: rgba(51, 51, 51, 1);
  224. font-weight: bold;
  225. img{
  226. vertical-align: middle;
  227. margin-right: 16rpx;
  228. }
  229. }
  230. .details{
  231. margin-top: 40rpx;
  232. display: flex;
  233. .photo{
  234. width: 160rpx;
  235. height: 160px;
  236. border-radius: 8px;
  237. margin-right: 32rpx;
  238. overflow: hidden;
  239. img{
  240. width: 100%;
  241. height: 100%;
  242. }
  243. }
  244. }
  245. .information{
  246. .name{
  247. color: rgba(51, 51, 51, 1);
  248. font-size: 36rpx;
  249. font-weight: bold;
  250. margin-bottom: 20rpx;
  251. }
  252. .item{
  253. display: flex;
  254. margin-bottom: 16rpx;
  255. justify-content: space-between;
  256. font-size: 28rpx;
  257. .item-name{
  258. width: 240rpx;
  259. color: rgba(119, 119, 119, 1);
  260. }
  261. .item-content{
  262. flex: 1;
  263. color: rgba(51, 51, 51, 1);
  264. margin-left: 16rpx;
  265. }
  266. }
  267. }
  268. }
  269. ::v-deep.u-tab-item {
  270. color: #101010 !important;
  271. }
  272. ::v-deep.u-cell_title {
  273. color: rgba(119, 119, 119, 1);
  274. }
  275. ::v-deep.u-cell__value {
  276. color: #333333;
  277. flex: 0.45;
  278. margin-left: auto;
  279. }
  280. .search {
  281. // background-color: #fff;
  282. padding: 16rpx 24rpx;
  283. margin-top: 80rpx;
  284. }
  285. ::v-deep.u-action {
  286. width: 17.1%;
  287. text-align: center;
  288. line-height: 56rpx;
  289. border-radius: 50px;
  290. background-color: rgba(13, 186, 199, 1);
  291. color: rgba(255, 255, 255, 1);
  292. }
  293. ::v-deep.u-content {
  294. height: 56rpx !important;
  295. background-color: #fff !important;
  296. }
  297. ::v-deep.u-input {
  298. background-color: #fff !important;
  299. }
  300. .student-details {
  301. padding: 24rpx 32rpx;
  302. background-color: #fff;
  303. display: flex;
  304. position: relative;
  305. border-bottom: 1px solid rgba(229, 231, 234, 1);
  306. ;
  307. .photo {
  308. width: 112rpx;
  309. height: 112rpx;
  310. border-radius: 4px;
  311. overflow: hidden;
  312. margin-right: 22rpx;
  313. img {
  314. width: 100%;
  315. height: 100%;
  316. }
  317. }
  318. .details {
  319. display: flex;
  320. align-items: center;
  321. .name-tel {
  322. .name {
  323. margin-right: 12px;
  324. color: rgba(51, 51, 51, 1);
  325. font-size: 18px;
  326. margin-bottom: 16rpx;
  327. }
  328. .tel {
  329. color: rgba(119, 119, 119, 1);
  330. // line-height: 24px;
  331. display: flex;
  332. align-items: center;
  333. }
  334. }
  335. }
  336. .more {
  337. color: #333333;
  338. position: absolute;
  339. bottom: 65rpx;
  340. right: 24rpx;
  341. }
  342. }
  343. @media screen and (max-width:320px){
  344. .student-card{
  345. padding: 2rpx 12rpx 0rpx 12rpx;
  346. margin: 32rpx 16rpx;
  347. }
  348. .item-name{
  349. width: 244rpx !important;
  350. }
  351. }
  352. ::v-deep.uni-input-placeholder{
  353. font-size: 24rpx
  354. }
  355. .content-2{
  356. margin-top: 180rpx;
  357. .search{
  358. position: fixed;
  359. left: 24rpx;
  360. right: 24rpx;
  361. top: 88rpx;
  362. z-index: 999;
  363. background-color: #F2F4F4;
  364. }
  365. }
  366. </style>