studentList.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div class="studentList">
  3. <van-sticky :offset-top="isHead ? '.46rem' : 0">
  4. <van-dropdown-menu active-color="#01C1B5">
  5. <van-dropdown-item v-model="value1" @change="getList" :options="option1" />
  6. <van-dropdown-item v-model="value2" @change="getList" :options="option2" />
  7. </van-dropdown-menu>
  8. <!-- <van-search
  9. show-action
  10. shape="round"
  11. :left-icon="searchIcon"
  12. @search="onSearch"
  13. v-model="search"
  14. placeholder="请输入学生名或手机号"
  15. >
  16. <template #action>
  17. <div @click="onSearch">搜索</div>
  18. </template>
  19. </van-search> -->
  20. </van-sticky>
  21. <div class="studentContainer">
  22. <van-cell-group v-if="dataShow">
  23. <van-cell
  24. v-for="(item, index) in dataListArray"
  25. :key="index"
  26. class="input-cell"
  27. :center="true"
  28. >
  29. <template slot="icon">
  30. <img class="logo" v-if="item.headUrl" :src="item.headUrl" alt="" />
  31. <img class="logo" v-else src="@/assets/images/icon_student.png" alt="" />
  32. </template>
  33. <template slot="title">
  34. <div class="studentName">
  35. {{ item.name }}
  36. <div class='icon' v-if="item.memberRankSettingId">
  37. <img src='./icons/vip_icon.png' />
  38. </div>
  39. </div>
  40. </template>
  41. <template slot="label">
  42. <span>{{ (item.subjectName) }}</span>
  43. </template>
  44. </van-cell>
  45. </van-cell-group>
  46. <m-empty class="empty" v-else key="data" />
  47. </div>
  48. <!-- <div class="button-group-popup">
  49. <span class="btn">取消</span>
  50. </div> -->
  51. </div>
  52. </template>
  53. <script>
  54. import MEmpty from "@/components/MEmpty"
  55. import deepClone from '@/helpers/deep-clone'
  56. export default {
  57. props: {
  58. isHead: {
  59. type: Boolean,
  60. default() {
  61. return false
  62. }
  63. },
  64. dataList: {
  65. type: Array,
  66. default() {
  67. return []
  68. }
  69. },
  70. dataSubjectList: {
  71. type: Array,
  72. default() {
  73. return []
  74. }
  75. }
  76. },
  77. components: { MEmpty },
  78. watch: {
  79. dataList(newVal) {
  80. this.dataListArray = newVal
  81. }
  82. },
  83. data() {
  84. return {
  85. search: null,
  86. value1: 0,
  87. value2: 0,
  88. option1: [
  89. { text: '全部声部', value: 0 },
  90. ],
  91. option2: [
  92. { text: '全部学员', value: 0 },
  93. { text: '会员学员', value: 'b' },
  94. { text: '普通会员', value: 'c' },
  95. ],
  96. dataShow: true,
  97. dataListArray: [],
  98. allArray: [],
  99. searchIcon: require("@/assets/images/search.png"),
  100. }
  101. },
  102. mounted() {
  103. this.dataListArray = this.dataList
  104. // console.log(this.dataList)
  105. this.allArray = deepClone(this.dataList)
  106. this.dataSubjectList.forEach(subject => {
  107. this.option1.push({
  108. text: subject.subjectName,
  109. value: subject.id
  110. })
  111. })
  112. },
  113. methods: {
  114. onSearch() {
  115. this.getList()
  116. },
  117. getList() {
  118. this.dataShow = true
  119. let search = this.search,
  120. subject = this.value1 ? this.value1 : null,
  121. student = this.value2 ? this.value2 : null
  122. let tempArray = []
  123. let allArray = this.allArray
  124. for(let i = 0; i < allArray.length; i++) {
  125. if(search && allArray[i].name.indexOf(search) < 0) {
  126. break
  127. }
  128. if(subject && allArray[i].subjectIdList != subject) {
  129. break
  130. }
  131. if(student) {
  132. if(student == 'a' && !allArray[i].memberRankSettingId) {
  133. break
  134. } else if(student == 'c' && allArray[i].memberRankSettingId) {
  135. break
  136. }
  137. }
  138. tempArray.push(allArray[i])
  139. }
  140. this.dataListArray = tempArray
  141. if(tempArray.length <= 0) {
  142. this.dataShow = false
  143. }
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="less" scoped>
  149. @import url("../../../assets/commonLess/variable.less");
  150. .studentList {
  151. background-color: #f5f5f5;
  152. min-height: calc(100vh - .8rem);
  153. }
  154. /deep/.van-search .van-cell {
  155. padding: 5px 8px 5px 0 !important;
  156. }
  157. .paddingB80 {
  158. padding-bottom: 0.8rem;
  159. }
  160. .studentName {
  161. font-size: 0.16rem;
  162. color: #1a1a1a;
  163. line-height: 0.22rem;
  164. display: flex;
  165. }
  166. .studentContainer {
  167. /deep/.van-cell__title {
  168. font-size: 0.14rem;
  169. color: @mFontColor;
  170. // flex: 1 auto;
  171. }
  172. .logo {
  173. width: 0.42rem;
  174. height: 0.42rem;
  175. margin-right: 0.12rem;
  176. border-radius: 100%;
  177. }
  178. .input-cell {
  179. padding: 0.2rem 0.16rem;
  180. .van-radio {
  181. justify-content: flex-end;
  182. }
  183. }
  184. /deep/.van-cell__value {
  185. height: 0.2rem;
  186. }
  187. /deep/.van-radio__icon .van-icon {
  188. border-color: #d3d3d3;
  189. }
  190. /deep/.van-radio__icon--checked {
  191. .van-icon {
  192. border-color: @mColor;
  193. background: @mColor;
  194. }
  195. }
  196. .icon{
  197. display: flex;
  198. align-items: center;
  199. margin-left: .15rem;
  200. img{
  201. width: .4rem;
  202. // margin-top: -.02rem;
  203. }
  204. }
  205. .van-tag {
  206. margin-left: 0.08rem;
  207. }
  208. }
  209. .button-group-popup {
  210. position: fixed;
  211. bottom: 0;
  212. padding: 0.2rem 0;
  213. width: 100%;
  214. text-align: center;
  215. background-color: #ffffff;
  216. .btn {
  217. line-height: 0.5rem;
  218. display: inline-block;
  219. border: 1px solid @mColor;
  220. width: 1.65rem;
  221. border-radius: 0.4rem;
  222. color: @mColor;
  223. background: #fff;
  224. font-size: 0.18rem;
  225. &.primary {
  226. color: #fff;
  227. background: @mColor;
  228. }
  229. }
  230. .btn + .btn {
  231. margin-left: 0.1rem;
  232. }
  233. }
  234. </style>