doctorArticleList.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <template>
  2. <view class="column " style="height: calc(100% - 300rpx);">
  3. <view class="top-content flex-1" >
  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. <!-- <view class="cate-list" v-if="showcate">
  12. 关键字列表
  13. <scroll-view scroll-x="true" >
  14. <view class="inner">
  15. <view v-for="(item,index) in cateOptions" :key="index" :class="cateId == item.dictValue?'item active':'item'" @click="choseCate(item)">
  16. {{ item.dictLabel }}
  17. </view>
  18. </view>
  19. </scroll-view>
  20. </view> -->
  21. </view>
  22. <mescroll-body ref="mescrollRef" top="92rpx"
  23. @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  24. <view class="article-list">
  25. <view class="item" v-for="(item,index) in dataList" :key="index" @click="showDetail(item)">
  26. <view class="left">
  27. <view class="title ellipsis2">{{ item.title }}</view>
  28. <view class="info-box">
  29. <view class="readers">
  30. <view class="head-box" >
  31. <view class="head" >
  32. <image class="eye" mode="aspectFill" src="https://beiliyo-2025.obs.cn-north-4.myhuaweicloud.com/fs/20250115/1736944490230.png" ></image>
  33. </view>
  34. </view>
  35. <view class="readings">
  36. <image class="eye" src="/static/images/eye.png" ></image>
  37. <text class="num">{{item.views}}</text>
  38. </view>
  39. </view>
  40. <!-- <view class="time-box">{{item.createTime}}</view> -->
  41. </view>
  42. </view>
  43. <view class="right">
  44. <image :src="item.imageUrl" mode="aspectFill"></image>
  45. </view>
  46. </view>
  47. </view>
  48. </mescroll-body>
  49. </view>
  50. </template>
  51. <script>
  52. import {getDictByKey} from '@/api/common.js'
  53. import {getDoctorArticleList} from '@/api/doctorArticle.js'
  54. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  55. export default {
  56. mixins: [MescrollMixin],
  57. data() {
  58. return {
  59. cateOptions:[],
  60. cateId:0,
  61. keyword: '',
  62. mescroll:null,
  63. downOption: { //下拉刷新
  64. use:true,
  65. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  66. },
  67. upOption: {
  68. onScroll:false,
  69. use: true, // 是否启用上拉加载; 默认true
  70. page: {
  71. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  72. size: 10 // 每页数据的数量,默认10
  73. },
  74. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  75. textNoMore:"已经到底了",
  76. empty: {
  77. icon:'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
  78. tip: '暂无数据'
  79. }
  80. },
  81. dataList: [],
  82. showcate:true
  83. };
  84. },
  85. onShow() {
  86. this.getDictByKey("sys_doctor_article_cate");
  87. },
  88. onLoad(option) {
  89. if (option.title) {
  90. uni.setNavigationBarTitle({
  91. title: option.title
  92. });
  93. }
  94. if(option.cateId){
  95. this.showcate=false
  96. this.cateId=option.cateId
  97. }
  98. console.log('标题',option)
  99. },
  100. methods:{
  101. getDictByKey(key){
  102. //获取tab标题列表
  103. var data={key:key}
  104. console.log(data)
  105. getDictByKey(data).then(
  106. res => {
  107. if(res.code==200){
  108. this.cateOptions=res.data;
  109. }
  110. },
  111. err => {
  112. }
  113. );
  114. },
  115. doSearch(){
  116. this.mescroll.resetUpScroll()
  117. },
  118. mescrollInit(mescroll) {
  119. this.mescroll = mescroll;
  120. },
  121. /*下拉刷新的回调 */
  122. downCallback(mescroll) {
  123. mescroll.resetUpScroll()
  124. },
  125. upCallback(page) {
  126. //联网加载数据 点击tab标题获取列表数据
  127. var that = this;
  128. var data = {
  129. keyword:this.keyword,
  130. cateId:this.cateId,
  131. pageNum: page.num,
  132. pageSize: page.size
  133. };
  134. console.log(data)
  135. getDoctorArticleList(data).then(res => {
  136. if(res.code==200){
  137. //设置列表数据
  138. if (page.num == 1) {
  139. that.dataList = res.data.list;
  140. } else {
  141. that.dataList = that.dataList.concat(res.data.list);
  142. }
  143. that.mescroll.endBySize(res.data.list.length, res.data.total);
  144. }else{
  145. uni.showToast({
  146. icon:'none',
  147. title: "请求失败",
  148. });
  149. that.dataList = null;
  150. that.mescroll.endErr();
  151. }
  152. });
  153. },
  154. // 关键词选择
  155. choseCate(item) {
  156. this.cateId = item.dictValue;
  157. this.mescroll.resetUpScroll()
  158. },
  159. // 查看详情
  160. showDetail(item) {
  161. uni.navigateTo({
  162. url: './doctorArticleDetails?articleId=' + item.articleId
  163. })
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="scss">
  169. .top-content{
  170. width: 100%;
  171. position: fixed;
  172. top:0;
  173. left: 0;
  174. z-index: 10;
  175. }
  176. .top-title{
  177. height: 88upx;
  178. line-height: 88upx;
  179. font-size: 42upx;
  180. font-family: Source Han Sans CN;
  181. font-weight: bold;
  182. color: #222222;
  183. padding-left: 41upx;
  184. background-color: #FFFFFF;
  185. }
  186. .search-cont{
  187. padding: 16upx 30upx;
  188. background-color: #FFFFFF;
  189. .inner{
  190. box-sizing: border-box;
  191. width: 100%;
  192. height: 72upx;
  193. background: #F7F7F7;
  194. border-radius: 36upx;
  195. display: flex;
  196. align-items: center;
  197. padding: 0 30upx;
  198. .icon-search{
  199. width: 28upx;
  200. height: 28upx;
  201. margin-right: 20upx;
  202. }
  203. input{
  204. height: 60upx;
  205. line-height: 60upx;
  206. flex: 1;
  207. }
  208. }
  209. }
  210. .cate-list{
  211. box-sizing: border-box;
  212. background: #fff;
  213. padding: 10upx 27upx;
  214. height: 100upx;
  215. .inner{
  216. display: flex;
  217. }
  218. .item{
  219. flex-shrink: 0;
  220. padding: 0 24upx;
  221. height: 64upx;
  222. line-height: 64upx;
  223. font-size: 28upx;
  224. font-family: PingFang SC;
  225. font-weight: 500;
  226. color: #018C39;
  227. background: #ffffff;
  228. border: 1px solid #018C39;
  229. border-radius: 32upx;
  230. margin: 0 20upx 20upx 0;
  231. &.active{
  232. color: #FFFFFF;
  233. background:#018C39;
  234. border: 1px solid #018C39;
  235. }
  236. }
  237. }
  238. .article-list{
  239. margin-top: 20upx;
  240. padding: 0 10upx;
  241. .item{
  242. box-sizing: border-box;
  243. height: 271upx;
  244. background: #FFFFFF;
  245. border-radius: 16upx;
  246. padding: 40upx 30upx;
  247. display: flex;
  248. align-items: center;
  249. justify-content: space-between;
  250. margin-bottom: 20upx;
  251. .left{
  252. flex: 1;
  253. padding-right: 40upx;
  254. height: 190upx;
  255. display: flex;
  256. flex-direction: column;
  257. justify-content: space-between;
  258. .title{
  259. font-size: 32upx;
  260. font-family: PingFang SC;
  261. font-weight: 500;
  262. color: #111111;
  263. line-height: 48upx;
  264. }
  265. .info-box{
  266. width: 100%;
  267. display: flex;
  268. align-items: center;
  269. justify-content: space-between;
  270. .readers{
  271. display: flex;
  272. align-items: center;
  273. .head-box{
  274. margin-right: 27upx;
  275. display: flex;
  276. align-items: center;
  277. .head{
  278. width: 48upx;
  279. height: 48upx;
  280. border-radius: 50%;
  281. overflow: hidden;
  282. box-shadow: 0 0 0 1px #fff;
  283. margin-right: -10upx;
  284. image{
  285. width: 100%;
  286. height: 100%;
  287. }
  288. }
  289. }
  290. .readings{
  291. display: flex;
  292. align-items: center;
  293. .eye{
  294. width: 26upx;
  295. height: 20upx;
  296. margin-right: 9upx;
  297. }
  298. .num{
  299. font-size: 24upx;
  300. font-family: PingFang SC;
  301. font-weight: 500;
  302. color: #999999;
  303. line-height: 1;
  304. }
  305. }
  306. }
  307. .time{
  308. font-size: 24upx;
  309. line-height: 1;
  310. font-family: PingFang SC;
  311. font-weight: 500;
  312. color: #999999;
  313. }
  314. }
  315. }
  316. .right{
  317. width: 250upx;
  318. height: 190upx;
  319. border-radius: 8upx;
  320. overflow: hidden;
  321. image{
  322. width: 100%;
  323. height: 100%;
  324. }
  325. }
  326. }
  327. }
  328. </style>