diseaseList.vue 5.6 KB

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