manage.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view class="box u-skeleton">
  3. <u-skeleton :loading="loading" :animation="true"></u-skeleton>
  4. <view class="top">
  5. <u-search shape="round" :action-style="styobj" height="80" :clearabled="false" placeholder="请输入实验室名称"
  6. @custom="custom" @search="search"></u-search>
  7. </view>
  8. <view style="padding-top: 68px;display: flex;flex-direction: column;width: 100%;">
  9. <view class="list" v-for="(item,index) in list" :key="index">
  10. <view class="list-top">
  11. <text class="txt1">{{item.name}}</text>
  12. <view>
  13. <image src="/static/image/record/user.png" mode="" style="width: 16px;height: 16px;"></image>
  14. <text style="padding-left: 2px;">{{item.max_student_nums}}人</text>
  15. </view>
  16. </view>
  17. <view class="list-bottom">
  18. <view @click="whRecord(item.id)">
  19. <text>维护记录</text>
  20. </view>
  21. <view class="heng">
  22. </view>
  23. <view @click="lookTable(item)">
  24. <text>查看课表</text>
  25. </view>
  26. </view>
  27. </view>
  28. <u-loadmore :status="statuss " :load-text="loadText" icon="true" />
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. styobj: {
  37. 'width': '66px',
  38. 'height': '32px',
  39. 'background': '#3665FF',
  40. 'border-radius': '20px',
  41. 'opacity': '1',
  42. 'display': 'flex',
  43. 'align-items': 'center',
  44. 'justify-content': 'center',
  45. 'color': 'white',
  46. 'margin-left': '-70px',
  47. 'font-size': '14px',
  48. 'z-index': '2'
  49. },
  50. list: '',
  51. name: '',
  52. statuss: 'loadmore',
  53. loadText: {
  54. loadmore: '轻轻上拉',
  55. loading: '努力加载中',
  56. nomore: '实在没有了'
  57. },
  58. meta: '',
  59. page: 1,
  60. loading: true
  61. }
  62. },
  63. methods: {
  64. whRecord(id) {
  65. uni.navigateTo({
  66. url: '/pages/laboratory/whRecord?id=' + id
  67. })
  68. },
  69. //查看课表
  70. lookTable(item) {
  71. uni.navigateTo({
  72. url: '/pages/laboratory/table?id=' + item.id + '&room_name=' + item.name
  73. })
  74. },
  75. custom(e) {
  76. this.name = e;
  77. this.lists()
  78. },
  79. search(e) {
  80. this.name = e;
  81. this.lists()
  82. },
  83. lists() {
  84. this.$u.get('school/room?page=1&name=' + this.name).then(res => {
  85. console.log(res)
  86. this.list = res.data.list;
  87. this.loading = false;
  88. this.meta = res.data.meta.pagination;
  89. if (res.data.list.length < 10) {
  90. this.statuss = 'nomore'
  91. }
  92. })
  93. }
  94. },
  95. onLoad() {
  96. this.lists()
  97. },
  98. onPullDownRefresh() {
  99. this.lists()
  100. this.page = 1;
  101. uni.stopPullDownRefresh()
  102. },
  103. onReachBottom() {
  104. this.statuss = 'loading';
  105. var page = this.page;
  106. if (page >= this.meta.total_pages) {
  107. this.statuss = 'nomore';
  108. } else {
  109. this.$u.get('school/room?page=' + Number(page + 1) + '&name=' + this.name).then(res => {
  110. console.log(res)
  111. this.list = this.list.concat(res.data.list);
  112. this.page = ++page;
  113. })
  114. this.statuss = 'loadmore';
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. .box {
  121. width: 100vw;
  122. min-height: 100vh;
  123. background: #F5F5F5;
  124. padding-bottom: 30px;
  125. box-sizing: border-box;
  126. display: flex;
  127. flex-direction: column;
  128. padding-left:15px ;
  129. padding-right: 15px;
  130. u-loadmore {
  131. margin-top: 10px;
  132. }
  133. .top {
  134. width: 100%;
  135. height: 64px;
  136. background: #FFFFFF;
  137. opacity: 1;
  138. background: white;
  139. display: flex;
  140. align-items: center;
  141. justify-content: center;
  142. position: fixed;
  143. top: 0;
  144. left: 0;
  145. z-index: 1;
  146. u-search {
  147. width: 343px !important;
  148. display: flex;
  149. align-items: center;
  150. }
  151. }
  152. .list {
  153. display: flex;
  154. flex-direction: column;
  155. align-items: center;
  156. width: 100%;
  157. background: #FFFFFF;
  158. border-radius: 8px 8px 8px 8px;
  159. opacity: 1;
  160. display: flex;
  161. margin: 0 auto;
  162. margin-top: 12px !important;
  163. .list-top {
  164. display: flex;
  165. align-items: center;
  166. justify-content: space-between;
  167. width: 100%;
  168. padding: 16px 12px 16px 12px;
  169. box-sizing: border-box;
  170. .txt1 {
  171. font-size: 16px;
  172. font-family: PingFang SC-Bold, PingFang SC;
  173. font-weight: bold;
  174. color: #333333;
  175. width: 80%;
  176. }
  177. view {
  178. display: flex;
  179. align-items: center;
  180. font-size: 13px;
  181. font-weight: 400;
  182. color: #999999;
  183. }
  184. }
  185. .list-bottom {
  186. display: flex;
  187. align-items: center;
  188. justify-content: space-between;
  189. width: 100%;
  190. border-top: 1px solid #F2F2F2;
  191. padding-top: 12px;
  192. padding-bottom: 12px;
  193. view {
  194. width: 49.5%;
  195. display: flex;
  196. align-items: center;
  197. justify-content: center;
  198. font-size: 14px;
  199. font-weight: 400;
  200. color: #3665FF;
  201. }
  202. .heng {
  203. width: 0px !important;
  204. height: 20px !important;
  205. opacity: 0.2;
  206. border: 1px solid #3665FF;
  207. }
  208. }
  209. }
  210. }
  211. </style>