hospitalList.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view>
  3. <view class="top-content">
  4. <!-- 搜索框 -->
  5. <view class="search-cont">
  6. <view class="inner">
  7. <image class="icon-search" src="/static/images/icon_search.png" mode=""></image>
  8. <input type="text" v-model="keyword" placeholder="输入关键字搜索" confirm-type="search" @confirm="doSearch" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
  9. </view>
  10. </view>
  11. </view>
  12. <mescroll-body top="88rpx" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  13. <view class="hos-list">
  14. <view class="item" v-for="(item,index) in dataList" :key="index" @click="showDetail(item)">
  15. <view class="left">
  16. <image :src="item.imgUrl" mode="aspectFit"></image>
  17. </view>
  18. <view class="right">
  19. <view class="title one-t">{{ item.hospitalName }}</view>
  20. <view class="desc">
  21. <text class="tag">二甲</text>
  22. <text class="tag">综合医院</text>
  23. </view>
  24. <view class="address-box">
  25. <view class="address-left">
  26. <view class="address one-t">{{item.address}}</view>
  27. </view>
  28. <view class="address-right">
  29. <image src="../../static/images/icon_arrow_r.png"></image>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </mescroll-body>
  36. </view>
  37. </template>
  38. <script>
  39. import {getHospitalList} from '@/api/hospital.js'
  40. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  41. export default {
  42. mixins: [MescrollMixin],
  43. data() {
  44. return {
  45. keyword: '',
  46. mescroll:null,
  47. downOption: { //下拉刷新
  48. use:true,
  49. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  50. },
  51. upOption: {
  52. onScroll:false,
  53. use: true, // 是否启用上拉加载; 默认true
  54. page: {
  55. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  56. size: 10 // 每页数据的数量,默认10
  57. },
  58. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  59. textNoMore:"已经到底了",
  60. empty: {
  61. icon:'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
  62. tip: '暂无数据'
  63. }
  64. },
  65. dataList: []
  66. };
  67. },
  68. onShow() {
  69. },
  70. methods:{
  71. doSearch(){
  72. this.mescroll.resetUpScroll()
  73. },
  74. mescrollInit(mescroll) {
  75. this.mescroll = mescroll;
  76. },
  77. /*下拉刷新的回调 */
  78. downCallback(mescroll) {
  79. mescroll.resetUpScroll()
  80. },
  81. upCallback(page) {
  82. //联网加载数据
  83. var that = this;
  84. var data = {
  85. keyword:this.keyword,
  86. pageNum: page.num,
  87. pageSize: page.size
  88. };
  89. getHospitalList(data).then(res => {
  90. if(res.code==200){
  91. //设置列表数据
  92. if (page.num == 1) {
  93. that.dataList = res.data.list;
  94. } else {
  95. that.dataList = that.dataList.concat(res.data.list);
  96. }
  97. that.mescroll.endBySize(res.data.list.length, res.data.total);
  98. }else{
  99. uni.showToast({
  100. icon:'none',
  101. title: "请求失败",
  102. });
  103. that.dataList = null;
  104. that.mescroll.endErr();
  105. }
  106. });
  107. },
  108. // 查看详情
  109. showDetail(item) {
  110. uni.navigateTo({
  111. url: './hospitalDetails?hospitalId=' + item.hospitalId
  112. })
  113. }
  114. }
  115. }
  116. </script>
  117. <style lang="scss">
  118. .top-content{
  119. width: 100%;
  120. position: fixed;
  121. top: 0;
  122. left: 0;
  123. z-index: 10;
  124. }
  125. .top-title{
  126. height: 88upx;
  127. line-height: 88upx;
  128. font-size: 42upx;
  129. font-family: Source Han Sans CN;
  130. font-weight: bold;
  131. color: #222222;
  132. padding-left: 41upx;
  133. background-color: #FFFFFF;
  134. }
  135. .search-cont{
  136. padding: 16upx 30upx;
  137. background-color: #FFFFFF;
  138. .inner{
  139. box-sizing: border-box;
  140. width: 100%;
  141. background: #F7F7F7;
  142. border-radius: 36upx;
  143. display: flex;
  144. align-items: center;
  145. padding: 0 30upx;
  146. .icon-search{
  147. width: 28upx;
  148. height: 28upx;
  149. margin-right: 20upx;
  150. }
  151. input{
  152. height: 60upx;
  153. line-height: 60upx;
  154. flex: 1;
  155. }
  156. }
  157. }
  158. .hos-list{
  159. margin-top: 20upx;
  160. padding: 0 10upx;
  161. .item{
  162. width: 100%;
  163. box-sizing: border-box;
  164. background: #FFFFFF;
  165. border-radius: 15upx;
  166. padding: 30upx;
  167. display: flex;
  168. align-items: center;
  169. justify-content: flex-start;
  170. margin-bottom: 20upx;
  171. .left{
  172. width: 190upx;
  173. height: 190upx;
  174. border-radius: 8upx;
  175. image{
  176. width: 190upx;
  177. height: 190upx;
  178. }
  179. }
  180. .right{
  181. height:190upx;
  182. width: calc(100% - 210rpx);
  183. padding-left: 20upx;
  184. display: flex;
  185. flex-direction: column;
  186. justify-content: space-between;
  187. .title{
  188. width: 100%;
  189. font-size: 32upx;
  190. font-family: PingFang SC;
  191. font-weight: bold;
  192. color: #111111;
  193. }
  194. .desc{
  195. font-size: 28upx;
  196. font-family: PingFang SC;
  197. font-weight: 500;
  198. color: #111;
  199. .tag{
  200. margin-right: 10rpx;
  201. }
  202. }
  203. .address-box{
  204. display: flex;
  205. align-items: center;
  206. justify-content: space-between;
  207. .address-left{
  208. width: calc(100% - 30rpx);
  209. display: flex;
  210. align-items: center;
  211. justify-content: flex-start;
  212. .address{
  213. font-size: 28upx;
  214. font-family: PingFang SC;
  215. color: #9a9a9c;
  216. }
  217. }
  218. .address-right{
  219. image{
  220. width: 30upx;
  221. height: 30upx;
  222. }
  223. }
  224. }
  225. }
  226. }
  227. }
  228. </style>