index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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 flex flex-col justify-center items-center">
  11. <img class="logo" :src="supplierInfo.logo" />
  12. <div class="mt-2 name">
  13. <span v-text="supplierInfo.shopName"></span>
  14. <span>官方医师认证</span>
  15. </div>
  16. </div>
  17. <div class="page-content">
  18. <!-- 搜索区域 -->
  19. <div class="search">
  20. <SimpleSearch
  21. v-model="listQuery.doctorName"
  22. @search="onSearch"
  23. placeholder="搜索医师"
  24. />
  25. </div>
  26. <!-- 标题 -->
  27. <div class="title px-4 pt-12 pb-6">
  28. 共<span v-text="total"></span>位医师
  29. </div>
  30. <!-- 列表 -->
  31. <div class="list">
  32. <div
  33. class="section flex justify-between mb-4"
  34. v-for="item in list"
  35. :key="item.doctorId"
  36. @click="toDetail(item)"
  37. >
  38. <img class="cover" :src="item.doctorImage" />
  39. <div class="info">
  40. <div class="name" v-text="item.doctorName"></div>
  41. <div class="tag">{{ item.tagList.join(' | ') }}</div>
  42. <div class="code">资格证编号:{{ item.certificateNo }}</div>
  43. <div class="club-name">所在机构:{{ item.clubName }}</div>
  44. </div>
  45. </div>
  46. <div class="empty" v-for="i in emptyList" :key="'empty' + i"></div>
  47. </div>
  48. <!-- 列表为空 -->
  49. <SimpleEmpty
  50. v-if="!total && !isRequest"
  51. name="icon-empty-device.png"
  52. description="敬请期待~"
  53. ></SimpleEmpty>
  54. </div>
  55. </van-list>
  56. </div>
  57. </template>
  58. <script>
  59. import { mapGetters } from 'vuex'
  60. import { debounce } from '@/utils'
  61. export default {
  62. layout: 'app',
  63. data() {
  64. return {
  65. isLoadingMore: true,
  66. finished: false,
  67. isRequest: true,
  68. listQuery: {
  69. authUserId: '',
  70. doctorType: 1,
  71. doctorName: '',
  72. pageNum: 1,
  73. pageSize: 9,
  74. },
  75. list: [],
  76. total: 0,
  77. }
  78. },
  79. computed: {
  80. ...mapGetters(['supplierInfo', 'authUserId', 'routePrefix']),
  81. isEmpty() {
  82. return this.list.length === 0
  83. },
  84. emptyList() {
  85. return 3 - (this.list.length % 3)
  86. },
  87. },
  88. mounted() {
  89. this.fetchList()
  90. },
  91. methods: {
  92. fetchList: debounce(async function () {
  93. try {
  94. this.isLoadingMore = true
  95. this.listQuery.authUserId = this.authUserId
  96. const res = await this.$http.api.fetchDoctorList(this.listQuery)
  97. this.list = [...this.list, ...res.data.list]
  98. this.finished = !res.data.hasNextPage
  99. this.total = res.data.total
  100. this.listQuery.pageNum += 1
  101. this.isLoadingMore = false
  102. } catch (error) {
  103. console.log(error)
  104. } finally {
  105. this.isRequest = false
  106. }
  107. }, 400),
  108. // 搜索
  109. onSearch() {
  110. this.list = []
  111. this.listQuery.pageNum = 1
  112. this.fetchList()
  113. },
  114. // 医师详情
  115. toDetail(item) {
  116. const url = `${this.routePrefix}/approve/personnel/operate/detail?id=${item.doctorId}`
  117. this.$router.push(url)
  118. },
  119. // 加载更多
  120. onLoadMore() {
  121. this.fetchList()
  122. },
  123. },
  124. }
  125. </script>
  126. <style scoped lang="scss">
  127. .page {
  128. position: relative;
  129. min-height: calc(100vh - 80px - 80px);
  130. background-color: #fff;
  131. }
  132. // pc 端
  133. @media screen and (min-width: 768px) {
  134. .page-top {
  135. height: 420px;
  136. background: url(https://static.caimei365.com/www/authentic/pc/bg-doctor.png)
  137. no-repeat center;
  138. background-size: auto 420px;
  139. .logo {
  140. display: block;
  141. width: 120px;
  142. height: 120px;
  143. border-radius: 50%;
  144. background: #fff;
  145. }
  146. .name {
  147. font-size: 30px;
  148. color: #fff;
  149. }
  150. .logo,
  151. .name {
  152. transform: translateY(-30px);
  153. }
  154. }
  155. .page-content {
  156. width: 1200px;
  157. margin: 0 auto;
  158. .search {
  159. position: absolute;
  160. left: 50%;
  161. top: 300px;
  162. transform: translateX(-50%);
  163. }
  164. .title {
  165. font-size: 16px;
  166. color: #404040;
  167. span {
  168. color: #bc1724;
  169. }
  170. }
  171. .list {
  172. display: flex;
  173. align-items: center;
  174. flex-wrap: wrap;
  175. justify-content: space-between;
  176. .empty {
  177. width: 390px;
  178. }
  179. .section {
  180. width: 390px;
  181. background-color: #f3f5f6;
  182. border-radius: 4px;
  183. box-sizing: border-box;
  184. padding: 12px;
  185. cursor: pointer;
  186. transition: all 0.4s;
  187. &:hover {
  188. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  189. }
  190. .cover {
  191. display: block;
  192. width: 84px;
  193. height: 84px;
  194. }
  195. .info {
  196. width: 270px;
  197. position: relative;
  198. margin-left: 12px;
  199. .name {
  200. font-size: 16px;
  201. color: #101010;
  202. font-weight: bold;
  203. text-overflow: ellipsis;
  204. white-space: nowrap;
  205. overflow: hidden;
  206. }
  207. .tag,
  208. .code,
  209. .club-name {
  210. height: 20px;
  211. position: relative;
  212. font-size: 14px;
  213. color: #404040;
  214. line-height: 20px;
  215. text-overflow: ellipsis;
  216. white-space: nowrap;
  217. overflow: hidden;
  218. span {
  219. color: #6d9eff;
  220. }
  221. }
  222. .tag {
  223. color: #909399;
  224. }
  225. }
  226. }
  227. }
  228. }
  229. }
  230. // 移动 端
  231. @media screen and (max-width: 768px) {
  232. .page-top {
  233. height: 46vw;
  234. background: url(https://static.caimei365.com/www/authentic/h5/bg-doctor.png);
  235. background-size: auto 46vw;
  236. .logo {
  237. display: block;
  238. width: 14.8vw;
  239. height: 14.8vw;
  240. border-radius: 50%;
  241. background: #fff;
  242. }
  243. .name {
  244. font-size: 4vw;
  245. color: #fff;
  246. }
  247. }
  248. .page-content {
  249. position: relative;
  250. .search {
  251. position: absolute;
  252. left: 50%;
  253. top: 0;
  254. transform: translate(-50%, -50%);
  255. }
  256. .city {
  257. padding-top: 12vw;
  258. }
  259. .title {
  260. font-size: 3.4vw;
  261. color: #404040;
  262. span {
  263. color: #bc1724;
  264. }
  265. }
  266. .list {
  267. display: flex;
  268. align-items: center;
  269. flex-direction: column;
  270. .section {
  271. width: 93.6vw;
  272. background-color: #f3f5f6;
  273. border-radius: 4px;
  274. box-sizing: border-box;
  275. padding: 3.2vw;
  276. .cover {
  277. display: block;
  278. width: 21.6vw;
  279. height: 21.6vw;
  280. }
  281. .info {
  282. position: relative;
  283. margin-left: 3.2vw;
  284. .name {
  285. font-size: 4vw;
  286. color: #101010;
  287. font-weight: bold;
  288. margin-bottom: 0.8vw;
  289. text-overflow: ellipsis;
  290. white-space: nowrap;
  291. overflow: hidden;
  292. }
  293. .tag,
  294. .code,
  295. .club-name {
  296. width: 62vw;
  297. height: 5vw;
  298. position: relative;
  299. font-size: 3vw;
  300. color: #404040;
  301. line-height: 5vw;
  302. text-overflow: ellipsis;
  303. white-space: nowrap;
  304. overflow: hidden;
  305. span {
  306. color: #6d9eff;
  307. }
  308. }
  309. .tag {
  310. color: #909399;
  311. }
  312. }
  313. }
  314. }
  315. }
  316. }
  317. </style>