index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <div class="page">
  3. <van-list
  4. v-model="isLoadingMore"
  5. :finished="finished"
  6. :immediate-check="false"
  7. :finished-text="total ? '没有更多了' : ''"
  8. @load="onLoadMore"
  9. >
  10. <div class="page-top"></div>
  11. <div class="page-content">
  12. <div class="title">专业美容培训师</div>
  13. <div class="list">
  14. <div
  15. class="section flex items-center"
  16. v-for="item in list"
  17. :key="item.doctorId"
  18. >
  19. <img class="cover" :src="item.doctorImage" />
  20. <div class="info">
  21. <div class="name">{{ item.doctorName }}<i /></div>
  22. <div class="tag">{{ item.tagList.join(' | ') }}</div>
  23. <div class="more" @click="toDetail(item)">点击查看</div>
  24. </div>
  25. </div>
  26. </div>
  27. <!-- 列表为空 -->
  28. <LdmEmpty v-if="!total && !isRequest" name="ldm-empty.png"></LdmEmpty>
  29. </div>
  30. </van-list>
  31. </div>
  32. </template>
  33. <script>
  34. import { mapGetters } from 'vuex'
  35. export default {
  36. layout: 'app-ldm',
  37. data() {
  38. return {
  39. isLoadingMore: true,
  40. finished: false,
  41. isRequest: true,
  42. listQuery: {
  43. authUserId: '',
  44. doctorType: 2,
  45. doctorName: '',
  46. pageNum: 1,
  47. pageSize: 10,
  48. },
  49. list: [],
  50. total: 0,
  51. }
  52. },
  53. computed: {
  54. ...mapGetters(['supplierInfo', 'authUserId']),
  55. },
  56. mounted() {
  57. this.fetchList()
  58. },
  59. methods: {
  60. fetchList: debounce(async function () {
  61. try {
  62. this.isLoadingMore = true
  63. this.listQuery.authUserId = this.authUserId
  64. const res = await this.$http.api.fetchDoctorList(this.listQuery)
  65. this.list = [...this.list, ...res.data.list]
  66. this.total = res.data.total
  67. this.finished = !res.data.hasNextPage
  68. } catch (error) {
  69. console.log(error)
  70. } finally {
  71. this.isRequest = false
  72. this.isLoadingMore = false
  73. }
  74. }, 400),
  75. // 搜索
  76. onSearch() {
  77. this.listQuery.pageNum = 1
  78. this.list = []
  79. this.fetchList()
  80. },
  81. // 加载更多
  82. onLoadMore() {
  83. this.listQuery.pageNum += 1
  84. this.fetchList()
  85. },
  86. // 页码变化
  87. onPagiantionChange(index) {
  88. this.listQuery.pageNum = index
  89. this.fetchList()
  90. },
  91. // 医师详情
  92. toDetail(item) {
  93. localStorage.setItem('doctorInfo', JSON.stringify(item))
  94. const authUserId = this.$store.getters.authUserId
  95. this.$router.push(`/${authUserId}/ldm/approve/personnel/training/detail`)
  96. },
  97. },
  98. }
  99. </script>
  100. <style scoped lang="scss">
  101. @media screen and (min-width: 768px) {
  102. .page-top {
  103. height: 596px;
  104. background: url(https://static.caimei365.com/www/authentic/pc/ldm-bg-training-doctor.png)
  105. no-repeat center;
  106. background-size: auto 596px;
  107. }
  108. .page-content {
  109. width: 838px;
  110. margin: 0 auto;
  111. overflow: hidden;
  112. .title {
  113. font-size: 22px;
  114. color: #221815;
  115. padding-top: 112px;
  116. }
  117. .list {
  118. display: flex;
  119. align-items: center;
  120. justify-content: space-between;
  121. flex-wrap: wrap;
  122. margin-top: 27px;
  123. .section {
  124. width: 407px;
  125. padding: 14px;
  126. background: #f1f1f1;
  127. border-radius: 20px;
  128. box-sizing: border-box;
  129. margin-bottom: 25px;
  130. .cover {
  131. display: block;
  132. width: 92px;
  133. height: 92px;
  134. border-radius: 17px;
  135. }
  136. .info {
  137. position: relative;
  138. flex: 1;
  139. margin-left: 25px;
  140. .name {
  141. font-size: 28px;
  142. color: #000;
  143. text-overflow: ellipsis;
  144. overflow: hidden;
  145. white-space: nowrap;
  146. i {
  147. font-size: 0;
  148. display: inline-block;
  149. background: url(https://static.caimei365.com/www/authentic/pc/ldm-icon-star.png)
  150. no-repeat left center;
  151. padding-left: 13px;
  152. vertical-align: 2px;
  153. margin-left: 7px;
  154. &::after,
  155. &::before {
  156. display: inline-block;
  157. content: '';
  158. width: 13px;
  159. height: 13px;
  160. background: url(https://static.caimei365.com/www/authentic/pc/ldm-icon-star.png)
  161. no-repeat center;
  162. vertical-align: middle;
  163. margin-left: 4px;
  164. }
  165. }
  166. }
  167. .tag {
  168. width: 190px;
  169. font-size: 10px;
  170. color: #221815;
  171. text-overflow: ellipsis;
  172. overflow: hidden;
  173. white-space: nowrap;
  174. margin-top: 12px;
  175. }
  176. .more {
  177. position: absolute;
  178. bottom: 0;
  179. right: 0;
  180. font-size: 12px;
  181. color: #0080ed;
  182. cursor: pointer;
  183. &::after {
  184. content: '>';
  185. margin-left: 8px;
  186. }
  187. }
  188. }
  189. }
  190. }
  191. }
  192. }
  193. @media screen and (max-width: 768px) {
  194. .page-top {
  195. height: 59.6vw;
  196. background: url(https://static.caimei365.com/www/authentic/h5/ldm-bg-training-doctor.png);
  197. background-size: auto 59.6vw;
  198. }
  199. .page-content {
  200. .title {
  201. font-size: 3.6vw;
  202. color: #221815;
  203. padding-left: 5.6vw;
  204. padding-top: 9.8vw;
  205. }
  206. .list {
  207. display: flex;
  208. flex-direction: column;
  209. align-items: center;
  210. margin-top: 6vw;
  211. .section {
  212. width: 95vw;
  213. padding: 3.2vw;
  214. background: #f1f1f1;
  215. border-radius: 2vw;
  216. box-sizing: border-box;
  217. margin-bottom: 4.8vw;
  218. .cover {
  219. display: block;
  220. width: 21.5vw;
  221. height: 21.5vw;
  222. border-radius: 1.7vw;
  223. }
  224. .info {
  225. position: relative;
  226. flex: 1;
  227. margin-left: 2.7vw;
  228. .name {
  229. font-size: 6.6vw;
  230. color: #000;
  231. text-overflow: ellipsis;
  232. overflow: hidden;
  233. white-space: nowrap;
  234. i {
  235. font-size: 0;
  236. display: inline-block;
  237. background: url(https://static.caimei365.com/www/authentic/h5/ldm-icon-star.png)
  238. no-repeat left center;
  239. padding-left: 3.2vw;
  240. vertical-align: 1vw;
  241. margin-left: 1.8vw;
  242. &::after,
  243. &::before {
  244. display: inline-block;
  245. content: '';
  246. width: 3.2vw;
  247. height: 3.2vw;
  248. background: url(https://static.caimei365.com/www/authentic/h5/ldm-icon-star.png)
  249. no-repeat center;
  250. vertical-align: middle;
  251. margin-left: 0.9vw;
  252. }
  253. }
  254. }
  255. .tag {
  256. width: 46vw;
  257. font-size: 2.5vw;
  258. color: #221815;
  259. text-overflow: ellipsis;
  260. overflow: hidden;
  261. white-space: nowrap;
  262. margin-top: 1.2vw;
  263. }
  264. .more {
  265. position: absolute;
  266. bottom: 0;
  267. right: 0;
  268. font-size: 3vw;
  269. color: #0080ed;
  270. &::after {
  271. content: '>';
  272. margin-left: 1vw;
  273. }
  274. }
  275. }
  276. }
  277. }
  278. }
  279. }
  280. </style>