index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <template>
  2. <view class="content">
  3. <pcNav :data="'index'"></pcNav>
  4. <view style="height: 72px;"></view>
  5. <view class="swiperBox">
  6. <view class="swiperCont">
  7. <view class="tuijbox">
  8. <image src="../../static/pcimg/icon_tuijian@2x.png" mode="" class="tuijImg"></image>
  9. <span class="tuijTitle">推荐文章</span>
  10. </view>
  11. <swiper class="swiper" :autoplay="false" :circular="true" :current="swpIndex">
  12. <swiper-item v-for="(item,index) in recommendList" v-if="(index+1)%2!=0">
  13. <view class="swpCont">
  14. <view class="swiper-item" @click="goDetail(item)">
  15. <view class="swpimgBox swpBr">
  16. <image :src="item.logoImg" mode="" class="swpimg"></image>
  17. </view>
  18. <view class="swpTitleBox">
  19. <view class="swpTitle">{{item.title}}</view>
  20. <view class="categoryName">{{item.categoryName}}</view>
  21. </view>
  22. </view>
  23. <view class="swiper-item" v-if="(index+1)<recommendList.length" @click="goDetail(item)">
  24. <view class="swpimgBox swpBr">
  25. <image :src="recommendList[index+1].logoImg" mode="" class="swpimg"></image>
  26. </view>
  27. <view class="swpTitleBox">
  28. <view class="swpTitle">{{recommendList[index+1].title}}</view>
  29. <view class="categoryName">{{recommendList[index+1].categoryName}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. </swiper-item>
  34. </swiper>
  35. <image src="../../static/pcimg/icon_arrow_zuo_sel@2x.png" mode="" class="swpImgleft" @click="swpBtnLeft"></image>
  36. <image src="../../static/pcimg/legtspx.png" mode="" class="swpImgright" @click="swpBtnRight"></image>
  37. </view>
  38. </view>
  39. <view class="main">
  40. <view class="mainCont">
  41. <view class="mainline" v-for="(item,index) in indexData.categoryList">
  42. <view class="mainlineTop">
  43. <view class="mainlineTopleft">
  44. <view class="mainlineTitle">{{item.name}}</view>
  45. <view class="mainlinecount">共{{item.count}}篇文章</view>
  46. </view>
  47. <view class="mainlineMore" @click="mainMore(item)">查看更多></view>
  48. </view>
  49. <view class="mainwzbox" >
  50. <view class="mainwzline" v-for="(wz,wzindex) in item.children" v-if="wzindex<4" :class="{'mainwzlineR':wzindex!=3}">
  51. <view class="mainwzImgBox">
  52. <img :src="wz.logoImg" alt="" class="mainwzImg">
  53. </view>
  54. <view class="wztitle">{{wz.title}}</view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="gotop" @click="gotoTop">
  61. <image src="../../static/pcimg/btn_top@2x.png" mode="" class="gotopImg"></image>
  62. </view>
  63. <!-- <view>
  64. <a class="table-btn" href="http://phone.66km.cn:8088/marketing/training/940C4BF0A2E04542A1A1AD244EAFB6E2.xlsx" target='_blank'>下载入口</a>
  65. </view> -->
  66. </view>
  67. </template>
  68. <script>
  69. import pcNav from '../../components/pcNav/pcNav.vue'
  70. export default {
  71. components: {
  72. pcNav,
  73. },
  74. data() {
  75. return {
  76. title: 'Hello',
  77. allCategory:[],
  78. navMoret:false,
  79. swpIndex:0,
  80. indexData:'',
  81. recommendList:[],
  82. }
  83. },
  84. onLoad() {
  85. this.getindexData()
  86. },
  87. methods: {
  88. goDetail(item){
  89. console.log(item)
  90. },
  91. gotoTop(){
  92. uni.pageScrollTo({
  93.    scrollTop: 0, duration: 300
  94. });
  95. },
  96. swpBtnRight(){
  97. var length=this.recommendList.length
  98. var num=Math.ceil(length/2)
  99. if(this.swpIndex<num){
  100. this.swpIndex++
  101. }
  102. },
  103. swpBtnLeft(){
  104. if(this.swpIndex==0){
  105. }else{
  106. this.swpIndex--
  107. }
  108. },
  109. getindexData(){
  110. uni.showLoading({
  111. title: '加载中'
  112. })
  113. this.$http('/trainingOpenApi/indexData', {}, 'GET').then(res => {
  114. uni.hideLoading();
  115. this.indexData = res.data;
  116. this.recommendList=this.indexData.recommendList
  117. })
  118. },
  119. mainMore(item){
  120. console.log(item)
  121. uni.navigateTo({
  122. url:'list?code='+item.code+'&topName='+item.name+'&comment='+item.comment
  123. })
  124. }
  125. }
  126. }
  127. </script>
  128. <style scoped>
  129. .swiperBox{
  130. height: 356px;
  131. background: #F3F8FF;
  132. width: 100%;
  133. }
  134. .swiperCont{
  135. width: 1200px;
  136. margin: 0 auto;
  137. position: relative;
  138. }
  139. .tuijImg{
  140. width: 24px;height: 24px;
  141. }
  142. .tuijbox{
  143. display: flex;padding-top: 44px;padding-bottom: 30px;
  144. }
  145. .tuijTitle{
  146. font-size: 24px;
  147. font-family: PingFangSC-Medium, PingFang SC;
  148. font-weight: 500;
  149. color: #111111;
  150. padding-left: 7px;
  151. line-height: 24px;
  152. }
  153. .swpImgleft{
  154. width: 44px;
  155. height: 44px;
  156. position: absolute;
  157. top: 150px;
  158. left: -50px;
  159. cursor: pointer;
  160. }
  161. .swpImgright{
  162. width: 44px;
  163. height: 44px;
  164. position: absolute;
  165. top: 150px;
  166. right: -50px;
  167. cursor: pointer;
  168. }
  169. .swiper-item{
  170. width: 576px;
  171. height: 184px;
  172. background: #FFFFFF;
  173. box-shadow: 0px 0px 16px 0px rgba(153, 153, 153, 0.2);
  174. border-radius: 9px;
  175. margin-top: 14px;
  176. position: relative;
  177. cursor: pointer;
  178. }
  179. .swpCont{
  180. display: flex;
  181. height: 200px;
  182. justify-content: space-between;
  183. }
  184. .swpimg{
  185. width: 276px;
  186. height: 184px;
  187. }
  188. .swpimgBox{
  189. width: 276px;
  190. height: 184px;
  191. position: absolute;
  192. left: 0;
  193. top: -14px;
  194. }
  195. .swpBr{
  196. width: 276px;
  197. height: 184px;
  198. border-radius: 10px;
  199. overflow: hidden;
  200. }
  201. .swiper{
  202. height: 200px;
  203. }
  204. .swpTitleBox{
  205. padding-left: 296px;
  206. display: flex;
  207. flex-direction: column;
  208. justify-content: space-between;
  209. height: 160px;
  210. padding-top: 10px;
  211. }
  212. .swpTitle{
  213. width: 260px;
  214. height: 44px;
  215. font-size: 16px;
  216. font-weight: 500;
  217. color: #3C3C3C;
  218. line-height: 22px;
  219. text-overflow: -o-ellipsis-lastline;
  220. overflow: hidden;
  221. text-overflow: ellipsis;
  222. display: -webkit-box;
  223. -webkit-line-clamp: 2;
  224. line-clamp: 2;
  225. -webkit-box-orient: vertical;
  226. }
  227. .swpTitleBox:hover .swpTitle{
  228. color: #FF4F00;
  229. }
  230. .categoryName{
  231. line-height: 24px;
  232. width: 84px;
  233. height: 24px;
  234. background: rgba(63, 144, 247, 0.1);
  235. border-radius: 14px;
  236. font-size: 12px;
  237. color: #3F90F7;
  238. text-align: center;
  239. white-space: nowrap;
  240. overflow: hidden;
  241. text-overflow: ellipsis;
  242. }
  243. .mainCont{
  244. width: 1200px;
  245. margin: 0 auto;
  246. }
  247. .mainline{
  248. padding-top: 48px;
  249. }
  250. .mainlineTop{
  251. display: flex;
  252. justify-content: space-between;
  253. }
  254. .mainlineTopleft{
  255. display: flex;
  256. }
  257. .mainlineTitle{
  258. font-size: 24px;
  259. font-weight: 500;
  260. color: #111111;
  261. line-height: 33px;
  262. }
  263. .mainlinecount{
  264. font-size: 14px;
  265. font-weight: 400;
  266. color: #999999;
  267. line-height: 33px;
  268. padding-left: 16px;
  269. }
  270. .mainlineMore{
  271. font-size: 14px;
  272. color: #333333;
  273. }
  274. .mainwzbox{
  275. display: flex;
  276. padding-top: 30px;
  277. }
  278. .mainwzImg{
  279. width: 276px;
  280. height: 184px;
  281. }
  282. .mainwzImgBox{
  283. border-radius: 15px;
  284. overflow: hidden;
  285. }
  286. .mainwzline{
  287. width: 276px;
  288. height: 260px;
  289. background: #FFFFFF;
  290. }
  291. .mainwzlineR{
  292. margin-right: 32px;
  293. }
  294. .wztitle{
  295. width: 250px;
  296. font-size: 16px;
  297. color: #333333;
  298. line-height: 22px;
  299. height: 44px;
  300. text-overflow: -o-ellipsis-lastline;
  301. overflow: hidden;
  302. text-overflow: ellipsis;
  303. display: -webkit-box;
  304. -webkit-line-clamp: 2;
  305. line-clamp: 2;
  306. -webkit-box-orient: vertical;
  307. padding-top: 16px;
  308. padding:0 13px ;
  309. }
  310. .mainwzline:hover{
  311. background: #FFFFFF;
  312. box-shadow: 0px 0px 16px 0px rgba(153, 153, 153, 0.2);
  313. border-radius: 6px;
  314. cursor: pointer;
  315. }
  316. .mainwzline:hover .wztitle{
  317. color: #FF4F00;
  318. }
  319. .mainlineMore:hover{
  320. color: #FF4F00;
  321. cursor: pointer;
  322. }
  323. .gotopImg{
  324. width: 60px;
  325. height: 60px;
  326. }
  327. .gotop{
  328. position: fixed;
  329. right:15vh ;
  330. bottom: 100px;
  331. cursor: pointer;
  332. }
  333. </style>