index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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="https://picsum.photos/200/200" />
  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. }
  145. .name {
  146. font-size: 30px;
  147. color: #fff;
  148. }
  149. .logo,
  150. .name {
  151. transform: translateY(-30px);
  152. }
  153. }
  154. .page-content {
  155. width: 1200px;
  156. margin: 0 auto;
  157. .search {
  158. position: absolute;
  159. left: 50%;
  160. top: 300px;
  161. transform: translateX(-50%);
  162. }
  163. .title {
  164. font-size: 16px;
  165. color: #404040;
  166. span {
  167. color: #bc1724;
  168. }
  169. }
  170. .list {
  171. display: flex;
  172. align-items: center;
  173. flex-wrap: wrap;
  174. justify-content: space-between;
  175. .empty {
  176. width: 390px;
  177. }
  178. .section {
  179. width: 390px;
  180. background-color: #f3f5f6;
  181. border-radius: 4px;
  182. box-sizing: border-box;
  183. padding: 12px;
  184. cursor: pointer;
  185. transition: all 0.4s;
  186. &:hover {
  187. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  188. }
  189. .cover {
  190. display: block;
  191. width: 84px;
  192. height: 84px;
  193. }
  194. .info {
  195. width: 270px;
  196. position: relative;
  197. margin-left: 12px;
  198. .name {
  199. font-size: 16px;
  200. color: #101010;
  201. font-weight: bold;
  202. text-overflow: ellipsis;
  203. white-space: nowrap;
  204. overflow: hidden;
  205. }
  206. .tag,
  207. .code,
  208. .club-name {
  209. height: 20px;
  210. position: relative;
  211. font-size: 14px;
  212. color: #404040;
  213. line-height: 20px;
  214. text-overflow: ellipsis;
  215. white-space: nowrap;
  216. overflow: hidden;
  217. span {
  218. color: #6d9eff;
  219. }
  220. }
  221. .tag {
  222. color: #909399;
  223. }
  224. }
  225. }
  226. }
  227. }
  228. }
  229. // 移动 端
  230. @media screen and (max-width: 768px) {
  231. .page-top {
  232. height: 46vw;
  233. background: url(https://static.caimei365.com/www/authentic/h5/bg-doctor.png);
  234. background-size: auto 46vw;
  235. .logo {
  236. display: block;
  237. width: 14.8vw;
  238. height: 14.8vw;
  239. border-radius: 50%;
  240. }
  241. .name {
  242. font-size: 4vw;
  243. color: #fff;
  244. }
  245. }
  246. .page-content {
  247. position: relative;
  248. .search {
  249. position: absolute;
  250. left: 50%;
  251. top: 0;
  252. transform: translate(-50%, -50%);
  253. }
  254. .city {
  255. padding-top: 12vw;
  256. }
  257. .title {
  258. font-size: 3.4vw;
  259. color: #404040;
  260. span {
  261. color: #bc1724;
  262. }
  263. }
  264. .list {
  265. display: flex;
  266. align-items: center;
  267. flex-direction: column;
  268. .section {
  269. width: 93.6vw;
  270. background-color: #f3f5f6;
  271. border-radius: 4px;
  272. box-sizing: border-box;
  273. padding: 3.2vw;
  274. .cover {
  275. display: block;
  276. width: 21.6vw;
  277. height: 21.6vw;
  278. }
  279. .info {
  280. position: relative;
  281. margin-left: 3.2vw;
  282. .name {
  283. font-size: 4vw;
  284. color: #101010;
  285. font-weight: bold;
  286. margin-bottom: 0.8vw;
  287. text-overflow: ellipsis;
  288. white-space: nowrap;
  289. overflow: hidden;
  290. }
  291. .tag,
  292. .code,
  293. .club-name {
  294. width: 62vw;
  295. height: 5vw;
  296. position: relative;
  297. font-size: 3vw;
  298. color: #404040;
  299. line-height: 5vw;
  300. text-overflow: ellipsis;
  301. white-space: nowrap;
  302. overflow: hidden;
  303. span {
  304. color: #6d9eff;
  305. }
  306. }
  307. .tag {
  308. color: #909399;
  309. }
  310. }
  311. }
  312. }
  313. }
  314. }
  315. </style>