index.vue 7.5 KB

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