lesson.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <template>
  2. <view>
  3. <view class="top-content">
  4. <view class="search-cont">
  5. <view class="inner">
  6. <u-icon name="search" size="24" color="#C8C9CC"></u-icon>
  7. <input type="text" v-model="searchValue" placeholder="请输入关键字或作者" confirm-type="search"
  8. @confirm="doSearch"
  9. placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
  10. </view>
  11. </view>
  12. <view class="keyword-list">
  13. <u-tabs :list="cates" :activeStyle="{fontWeight: '500',color: '#333333',fontSize: '32rpx',lineHeight:'88rpx'}"
  14. :inactiveStyle="{color: '#999999',fontSize: '28rpx',lineHeight:'88rpx'}" @click="choseCate"
  15. scrollable="false" lineColor="#388BFF"></u-tabs>
  16. </view>
  17. </view>
  18. <mescroll-body :top="top" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
  19. :down="downOption" :up="upOption">
  20. <view class="know-list">
  21. <view class="item" v-for="(item,index) in dataList" :key="index" @click="showDetail(item)">
  22. <view class="image-box">
  23. <image class="bg" mode="aspectFill" :src="item.coverUrl"></image>
  24. <view class="zhibo">
  25. <image mode="aspectFill" src="@/static/image/icon_video.png"></image>
  26. </view>
  27. </view>
  28. <view class="article-title-box">
  29. <view class="article-title one-t">{{item.title}}</view>
  30. <view class="name-title ">
  31. <image mode="aspectFill" src="@/static/image/icon_doctor.png"></image>
  32. <view class="one-t">
  33. {{item.doctorName+'-'+item.jobTitle+'/'+item.department}}
  34. </view>
  35. </view>
  36. <view class="position-title">
  37. <image mode="aspectFill" src="@/static/image/icon_hospital.png"></image>
  38. <view class="one-t">
  39. {{item.institution||'-'}}
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </mescroll-body>
  46. </view>
  47. </template>
  48. <script>
  49. import {
  50. getClassroomList
  51. } from '@/api/index'
  52. import {
  53. getTaskTypeList
  54. } from '@/api/common'
  55. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  56. export default {
  57. mixins: [MescrollMixin],
  58. data() {
  59. return {
  60. top: '0px',
  61. cates: [
  62. // {name: '全部',cateId:0},
  63. // {name:'内分泌',cateId:1},
  64. // {name:'肾病',cateId:2},
  65. // {name:'心血管',cateId:3},
  66. // {name:'风湿免疫',cateId:4},
  67. // {name:'风湿免疫',cateId:5},
  68. ],
  69. choseCateId:'',
  70. // 状态栏的高度
  71. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  72. searchValue: '',
  73. mescroll: null,
  74. // 上拉加载的配置
  75. downOption: {
  76. },
  77. upOption: {
  78. onScroll: true,
  79. use: true, // 是否启用上拉加载; 默认true
  80. page: {
  81. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  82. size: 10 // 每页数据的数量,默认10
  83. },
  84. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  85. empty: {
  86. icon: '/static/image/img_blank_nodata.png',
  87. tip: '暂无数据'
  88. },
  89. textNoMore: '没有更多了~'
  90. },
  91. // 列表数据
  92. dataList: [],
  93. };
  94. },
  95. onShow() {
  96. this.getArticleCate();
  97. var that = this;
  98. setTimeout(function() {
  99. let query = uni.createSelectorQuery().select(".top-content");
  100. query.boundingClientRect(function(data) { //data - 各种参数
  101. console.log(data.height) // 获取元素宽度
  102. that.top = data.height + "px";
  103. }).exec()
  104. }, 500);
  105. },
  106. methods: {
  107. doSearch() {
  108. this.mescroll.resetUpScroll()
  109. },
  110. getArticleCate() {
  111. var that = this;
  112. getTaskTypeList({dictType:'cloud_class_group'}).then(
  113. res => {
  114. if (res.code == 200) {
  115. this.cates = res.data.map(item => ({
  116. name: item.dictLabel,
  117. id: item.dictValue
  118. }));
  119. this.cates.unshift({
  120. name: '全部',
  121. id: ''
  122. });
  123. } else {
  124. uni.showToast({
  125. icon: 'none',
  126. title: "请求失败",
  127. });
  128. }
  129. },
  130. rej => {}
  131. );
  132. },
  133. mescrollInit(mescroll) {
  134. this.mescroll = mescroll;
  135. },
  136. /*下拉刷新的回调 */
  137. downCallback(mescroll) {
  138. mescroll.resetUpScroll()
  139. },
  140. upCallback(page) {
  141. //联网加载数据
  142. var that = this;
  143. var data = {
  144. keyWord:this.searchValue,
  145. groupId:this.choseCateId,
  146. pageNum: page.num,
  147. pageSize: page.size
  148. };
  149. getClassroomList(data).then(res => {
  150. if (res.code == 200) {
  151. //设置列表数据
  152. if (page.num == 1) {
  153. that.dataList = res.data.rows;
  154. } else {
  155. that.dataList = that.dataList.concat(res.data.rows);
  156. }
  157. that.mescroll.endBySize(res.data.rows.length, res.data.total);
  158. } else {
  159. uni.showToast({
  160. icon: 'none',
  161. title: "请求失败",
  162. });
  163. that.dataList = null;
  164. that.mescroll.endErr();
  165. }
  166. });
  167. },
  168. // 关键词选择
  169. choseCate(item) {
  170. this.choseCateId = item.id;
  171. this.mescroll.resetUpScroll()
  172. },
  173. // 查看详情
  174. showDetail(item) {
  175. uni.navigateTo({
  176. url: '/pages_live/lessonDetail?groupId='+item.groupId
  177. })
  178. }
  179. }
  180. }
  181. </script>
  182. <style lang="scss">
  183. page {
  184. background: #EFF3F7;
  185. }
  186. .status_bar {
  187. width: 100%;
  188. }
  189. .top-content {
  190. width: 100%;
  191. position: fixed;
  192. top: 0;
  193. left: 0;
  194. z-index: 10;
  195. }
  196. .top-title {
  197. height: 88upx;
  198. line-height: 88upx;
  199. font-size: 42upx;
  200. font-family: Source Han Sans CN;
  201. font-weight: bold;
  202. color: #222222;
  203. padding-left: 41upx;
  204. }
  205. .search-cont {
  206. padding: 16upx 30upx;
  207. background: #fff;
  208. .inner {
  209. box-sizing: border-box;
  210. width: 100%;
  211. height: 72upx;
  212. background: #F7F8FA;
  213. border-radius: 36upx;
  214. display: flex;
  215. align-items: center;
  216. padding: 0 30upx;
  217. .icon-search {
  218. width: 28upx;
  219. height: 28upx;
  220. margin-right: 20upx;
  221. }
  222. input {
  223. height: 60upx;
  224. line-height: 60upx;
  225. flex: 1;
  226. }
  227. }
  228. }
  229. .keyword-list {
  230. box-sizing: border-box;
  231. padding:0 24rpx;
  232. height: 88rpx;
  233. background: #FFFFFF;
  234. flex-shrink: 0;
  235. .inner {
  236. display: flex;
  237. align-items: center;
  238. justify-content: space-between;
  239. }
  240. .item {
  241. flex:1;
  242. display: flex;
  243. align-items: center;
  244. justify-content: center;
  245. flex-shrink: 0;
  246. height: 88upx;
  247. line-height: 88upx;
  248. font-size: 28upx;
  249. font-family: PingFang SC;
  250. font-weight: 400;
  251. color: #999999;
  252. position: relative;
  253. &.active {
  254. font-weight: 500;
  255. font-size: 32rpx;
  256. color: #333333;
  257. &::after {
  258. content: "";
  259. width: 56upx;
  260. height: 6upx;
  261. background: #388BFF;
  262. position: absolute;
  263. bottom: 0;
  264. border-radius: 3rpx 3rpx 3rpx 3rpx;
  265. }
  266. }
  267. }
  268. }
  269. .know-list {
  270. margin-top: 24upx;
  271. padding: 0 24upx;
  272. display: flex;
  273. align-items: center;
  274. flex-direction: row;
  275. flex-shrink: 0;
  276. flex-wrap: wrap;
  277. width: 100%;
  278. box-sizing: border-box;
  279. .item {
  280. box-sizing: border-box;
  281. width: calc(50% - 10rpx);
  282. height: 340rpx;
  283. background: #FFFFFF;
  284. border-radius: 16upx;
  285. display: flex;
  286. align-items: center;
  287. justify-content: flex-start;
  288. flex-direction: column;
  289. margin-bottom: 18rpx;
  290. margin-right: 18rpx;
  291. &:nth-child(2n){
  292. margin-right:0;
  293. }
  294. .image-box {
  295. width: 100%;
  296. height: 192rpx;
  297. position: relative;
  298. border-radius: 16rpx 16rpx 0rpx 0rpx;
  299. .bg {
  300. border-radius: 16rpx 16rpx 0rpx 0rpx;
  301. width: 100%;
  302. height: 100%;
  303. }
  304. .views {
  305. position: absolute;
  306. top: 0rpx;
  307. left: 0rpx;
  308. width: 112rpx;
  309. height: 32rpx;
  310. display: flex;
  311. align-items: center;
  312. background: rgba(0, 0, 0, 0.4);
  313. border-radius: 16rpx 0rpx 16rpx 0rpx;
  314. font-weight: 500;
  315. font-size: 20rpx;
  316. color: #FFFFFF;
  317. font-family: PingFang SC-Bold, PingFang SC;
  318. image {
  319. width: 36rpx;
  320. height: 32rpx;
  321. margin-right: 8rpx;
  322. }
  323. }
  324. .zhibo {
  325. position: absolute;
  326. top: 50%;
  327. left: 50%;
  328. transform: translate(-50%, -50%);
  329. image {
  330. width: 56rpx;
  331. height: 56rpx;
  332. }
  333. }
  334. }
  335. .article-title-box {
  336. width: 100%;
  337. padding: 16rpx;
  338. display: flex;
  339. align-items: flex-start;
  340. flex-direction: column;
  341. justify-content: space-between;
  342. height: 148rpx;
  343. box-sizing: border-box;
  344. .article-title {
  345. font-family: PingFang SC, PingFang SC;
  346. font-weight: 500;
  347. font-size: 28rpx;
  348. color: #333333;
  349. .one-t{
  350. width: 100%;
  351. }
  352. }
  353. .name-title {
  354. display: flex;
  355. align-items: center;
  356. font-family: PingFang SC, PingFang SC;
  357. font-weight: 400;
  358. font-size: 22rpx;
  359. color: #999999;
  360. .one-t{
  361. width: 80%;
  362. }
  363. image {
  364. width: 28rpx;
  365. height: 28rpx;
  366. margin-right: 14rpx;
  367. }
  368. }
  369. .position-title {
  370. width: 100%;
  371. display: flex;
  372. align-items: center;
  373. font-family: PingFang SC, PingFang SC;
  374. font-weight: 400;
  375. font-size: 22rpx;
  376. color: #999999;
  377. .one-t{
  378. width: 80%;
  379. }
  380. image {
  381. width: 28rpx;
  382. height: 28rpx;
  383. margin-right: 14rpx;
  384. }
  385. }
  386. }
  387. }
  388. }
  389. </style>