top.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <!-- 完成了商学院页面 -->
  2. <template>
  3. <view class="business ">
  4. <view class="two-item">
  5. <view class="plat-form" @click="goToplatform()">
  6. <image :src="imgUrl+'/platform.png'" mode=""></image>
  7. </view>
  8. <view class="propaganda" @click="goTomaterial()">
  9. <image :src="imgUrl+'/propaganda.png'" mode=""></image>
  10. </view>
  11. </view>
  12. <!-- <view class="" @click="getList">
  13. 123123123
  14. </view> -->
  15. <view class="choice-course">
  16. <view class="item" v-for="(item,index) in curriculum" :class="{itemActive:colorIndex==index}" @click="getMsg(item,index)" :key="index">
  17. {{item.course_name}}
  18. </view>
  19. <view class="item"></view>
  20. </view>
  21. <view class="curriculum-list">
  22. <view class="curriculum-list-item">
  23. <view v-if="bottomList&&bottomList.length>0">
  24. <view class="item" v-for="(item) in bottomList" :key="item.id" @click="gotoarticle(item)">
  25. <view class="image" style="position: relative;">
  26. <image :src="item.cover" mode="aspectFill" ></image>
  27. <text v-if="item.article_type==0" style="position: absolute; left: 10rpx; top: 10rpx; width: 30rpx; height: 30rpx; color: #053520;" class="iconfont">&#xe683;</text>
  28. <text v-if="item.article_type==1" style="position: absolute; left: 10rpx; top: 10rpx; width: 30rpx; height: 30rpx; color: #053520;" class="iconfont">&#xe631;</text>
  29. </view>
  30. <view class="right-title">
  31. <view class="title">
  32. {{item.title}}
  33. </view>
  34. <view class="video-num">
  35. 观看 {{item.browse_sum}}
  36. </view>
  37. </view>
  38. </view>
  39. <loadMore v-if="bottomList.length>0" :status="status" ></loadMore>
  40. </view>
  41. <nodata v-else style="height: 100%;" :config="{top:1,content:'暂无课程'}"></nodata>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import {classifyList,articleList,recommendList,hotList} from "@/api/notice.js"
  48. export default{
  49. data(){
  50. return{
  51. curriculum:[
  52. {
  53. id:-1,
  54. course_name:"推荐课程",
  55. },
  56. {
  57. id:-2,
  58. course_name:"热门课程",
  59. },
  60. ],
  61. params:{
  62. page:1,
  63. limit:10
  64. },
  65. bottomList:[],//底部list数据
  66. colorIndex:0,
  67. status:"more",
  68. page:1,
  69. limit:10,
  70. imgUrl: this.$mConfig.staticUrl
  71. }
  72. },
  73. created(){
  74. this.getList()
  75. },
  76. methods:{
  77. getMsg(item,index){
  78. this.colorIndex=index
  79. delete this.params.recommend
  80. delete this.params.hot
  81. delete this.params.course_id
  82. this.params.page=1
  83. this.bottomList=[]
  84. if(index==0){
  85. this.params.recommend=1
  86. }
  87. if(index==1){
  88. this.params.hot=1
  89. }
  90. if(index>1){
  91. this.params.course_id=item.id
  92. }
  93. this.initialization()
  94. },
  95. //上拉加载
  96. loaderMore(){
  97. if(this.status=="more"){
  98. this.params.page++
  99. this.initialization()
  100. }
  101. },
  102. isload(){
  103. this.params.page = 1;
  104. this.bottomList=[],
  105. this.initialization()
  106. },
  107. initialization(){
  108. this.$http.get('/bbs/article/list',this.params).then(res=>{
  109. if(res&&res.code==200){
  110. this.bottomList =this.bottomList.concat(res.page.list)
  111. this.$emit("bottomList",this.bottomList)
  112. if (res.page.totalPage <= res.page.currPage) {
  113. this.status = "noMore";
  114. } else {
  115. this.status = "more";
  116. }
  117. }
  118. })
  119. },
  120. //获取头部list内容
  121. getList(){
  122. this.$http.get(classifyList).then(res=>{
  123. if(res&&res.code==200){
  124. console.log(res)
  125. this.curriculum = this.curriculum.concat(res.list)
  126. this.params.recommend=1
  127. this.initialization()
  128. }
  129. })
  130. },
  131. //跳转平台公告页面
  132. goToplatform(){
  133. uni.navigateTo({
  134. url:"../../../pages/research/business/platform"
  135. })
  136. },
  137. //跳转宣传素材页面
  138. goTomaterial(){
  139. uni.navigateTo({
  140. url:"../../../pages/research/business/material"
  141. })
  142. },
  143. gotoarticle(item){
  144. uni.navigateTo({
  145. url:"../../../pages/research/business/article?id="+item.id
  146. })
  147. }
  148. }
  149. }
  150. </script>
  151. <style>
  152. page{
  153. background-color: #F5F5F5;
  154. }
  155. </style>
  156. <style lang="scss" scoped>
  157. /deep/.uni-load-more__text{
  158. font-size: 24rpx;
  159. }
  160. .business{
  161. overflow: hidden;
  162. .two-item{
  163. background-color: #02331e;
  164. margin-top: 148rpx;
  165. display: flex;
  166. padding: 32rpx 30rpx 41rpx 30rpx;
  167. .plat-form{
  168. image{
  169. width: 328rpx;
  170. height: 172rpx;
  171. margin-right: 34rpx;
  172. }
  173. }
  174. .propaganda{
  175. image{
  176. width: 328rpx;
  177. height: 172rpx;
  178. }
  179. }
  180. }
  181. .curriculum-list{
  182. background-color: #02331e;
  183. .curriculum-list-item{
  184. padding: 40rpx 30rpx 40rpx 30rpx;
  185. border-radius: 40rpx 40rpx 0 0;
  186. background-color: #f5f5f5;
  187. .item{
  188. background-color: #ffffff;
  189. padding: 20rpx;
  190. display: flex;
  191. margin-bottom: 25rpx;
  192. border-radius: 18rpx;
  193. .image{
  194. margin-right: 40rpx;
  195. image{
  196. border-radius: 18rpx;
  197. width: 238rpx;
  198. height: 151rpx;
  199. }
  200. }
  201. }
  202. .right-title{
  203. display: flex;
  204. flex-direction: column;
  205. justify-content: space-between;
  206. .title{
  207. word-break:break-all;
  208. line-height: 36rpx;
  209. margin-top: 4rpx;
  210. color: #181818;
  211. font-size: 28rpx;
  212. font-weight: 400;
  213. }
  214. .video-num{
  215. margin-bottom: 4rpx;
  216. color: #999999;
  217. font-weight: 400;
  218. font-size: 24rpx;
  219. }
  220. }
  221. }
  222. }
  223. .choice-course{
  224. background-color: #02331e;
  225. display: flex;
  226. align-items: center;
  227. white-space: nowrap;
  228. overflow-x: auto;
  229. -webkit-overflow-scrolling: touch;
  230. color: #ffffff;
  231. padding: 38rpx 33rpx 19rpx 30rpx;
  232. padding-right: 20rpx;
  233. .item:last-child{
  234. margin-right: 33rpx;
  235. }
  236. .item{
  237. margin-right: 33rpx;
  238. padding-bottom: 19rpx;
  239. margin-bottom: 10rpx;
  240. font-size: 28rpx;
  241. font-weight: Medium;
  242. color: rgba(255,255,255,1);
  243. position: relative;
  244. }
  245. .itemActive:before{
  246. content: "";
  247. position: absolute;
  248. left: 25%;
  249. bottom: 0;
  250. width: 50%;
  251. height: 2rpx;
  252. background-color: #FFFFFF;
  253. }
  254. .itemActive{
  255. font-size: 32rpx;
  256. font-weight: 700;
  257. }
  258. }
  259. }
  260. </style>