diseaseList.vue 5.8 KB

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