index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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" @click="goDetail2(wz,item)" 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. uni.navigateTo({
  91. url:'detail?id='+item.id+'&topName='+item.categoryName+"&comment="+item.comment+'&parentCode='+item.code
  92. })
  93. },
  94. goDetail2(wz,item){
  95. /* console.log(item)
  96. console.log(wz) */
  97. uni.navigateTo({
  98. url:'detail?id='+wz.id+'&topName='+item.name+"&comment="+item.comment+'&parentCode='+item.code
  99. })
  100. },
  101. gotoTop(){
  102. uni.pageScrollTo({
  103.    scrollTop: 0, duration: 300
  104. });
  105. },
  106. swpBtnRight(){
  107. var length=this.recommendList.length
  108. var num=Math.ceil(length/2)
  109. if(this.swpIndex<num){
  110. this.swpIndex++
  111. }
  112. },
  113. swpBtnLeft(){
  114. if(this.swpIndex==0){
  115. }else{
  116. this.swpIndex--
  117. }
  118. },
  119. getindexData(){
  120. uni.showLoading({
  121. title: '加载中'
  122. })
  123. this.$http('/trainingOpenApi/indexData', {}, 'GET').then(res => {
  124. uni.hideLoading();
  125. this.indexData = res.data;
  126. this.recommendList=this.indexData.recommendList
  127. })
  128. },
  129. mainMore(item){
  130. console.log(item)
  131. uni.navigateTo({
  132. url:'list?code='+item.code+'&topName='+item.name+'&comment='+item.comment
  133. })
  134. }
  135. }
  136. }
  137. </script>
  138. <style scoped>
  139. .swiperBox{
  140. height: 356px;
  141. background: #F3F8FF;
  142. width: 100%;
  143. }
  144. .swiperCont{
  145. width: 1200px;
  146. margin: 0 auto;
  147. position: relative;
  148. }
  149. .tuijImg{
  150. width: 24px;height: 24px;
  151. }
  152. .tuijbox{
  153. display: flex;padding-top: 44px;padding-bottom: 30px;
  154. }
  155. .tuijTitle{
  156. font-size: 24px;
  157. font-family: PingFangSC-Medium, PingFang SC;
  158. font-weight: 500;
  159. color: #111111;
  160. padding-left: 7px;
  161. line-height: 24px;
  162. }
  163. .swpImgleft{
  164. width: 44px;
  165. height: 44px;
  166. position: absolute;
  167. top: 150px;
  168. left: -50px;
  169. cursor: pointer;
  170. }
  171. .swpImgright{
  172. width: 44px;
  173. height: 44px;
  174. position: absolute;
  175. top: 150px;
  176. right: -50px;
  177. cursor: pointer;
  178. }
  179. .swiper-item{
  180. width: 576px;
  181. height: 184px;
  182. background: #FFFFFF;
  183. box-shadow: 0px 0px 16px 0px rgba(153, 153, 153, 0.2);
  184. border-radius: 9px;
  185. margin-top: 14px;
  186. position: relative;
  187. cursor: pointer;
  188. }
  189. .swpCont{
  190. display: flex;
  191. height: 200px;
  192. justify-content: space-between;
  193. }
  194. .swpimg{
  195. width: 276px;
  196. height: 184px;
  197. }
  198. .swpimgBox{
  199. width: 276px;
  200. height: 184px;
  201. position: absolute;
  202. left: 0;
  203. top: -14px;
  204. }
  205. .swpBr{
  206. width: 276px;
  207. height: 184px;
  208. border-radius: 10px;
  209. overflow: hidden;
  210. }
  211. .swiper{
  212. height: 200px;
  213. }
  214. .swpTitleBox{
  215. padding-left: 296px;
  216. display: flex;
  217. flex-direction: column;
  218. justify-content: space-between;
  219. height: 160px;
  220. padding-top: 10px;
  221. }
  222. .swpTitle{
  223. width: 260px;
  224. height: 44px;
  225. font-size: 16px;
  226. font-weight: 500;
  227. color: #3C3C3C;
  228. line-height: 22px;
  229. text-overflow: -o-ellipsis-lastline;
  230. overflow: hidden;
  231. text-overflow: ellipsis;
  232. display: -webkit-box;
  233. -webkit-line-clamp: 2;
  234. line-clamp: 2;
  235. -webkit-box-orient: vertical;
  236. }
  237. .swpTitleBox:hover .swpTitle{
  238. color: #FF4F00;
  239. }
  240. .categoryName{
  241. line-height: 24px;
  242. width: 84px;
  243. height: 24px;
  244. background: rgba(63, 144, 247, 0.1);
  245. border-radius: 14px;
  246. font-size: 12px;
  247. color: #3F90F7;
  248. text-align: center;
  249. white-space: nowrap;
  250. overflow: hidden;
  251. text-overflow: ellipsis;
  252. }
  253. .mainCont{
  254. width: 1200px;
  255. margin: 0 auto;
  256. }
  257. .mainline{
  258. padding-top: 48px;
  259. }
  260. .mainlineTop{
  261. display: flex;
  262. justify-content: space-between;
  263. }
  264. .mainlineTopleft{
  265. display: flex;
  266. }
  267. .mainlineTitle{
  268. font-size: 24px;
  269. font-weight: 500;
  270. color: #111111;
  271. line-height: 33px;
  272. }
  273. .mainlinecount{
  274. font-size: 14px;
  275. font-weight: 400;
  276. color: #999999;
  277. line-height: 33px;
  278. padding-left: 16px;
  279. }
  280. .mainlineMore{
  281. font-size: 14px;
  282. color: #333333;
  283. }
  284. .mainwzbox{
  285. display: flex;
  286. padding-top: 30px;
  287. }
  288. .mainwzImg{
  289. width: 276px;
  290. height: 184px;
  291. }
  292. .mainwzImgBox{
  293. border-radius: 15px;
  294. overflow: hidden;
  295. }
  296. .mainwzline{
  297. width: 276px;
  298. height: 260px;
  299. background: #FFFFFF;
  300. }
  301. .mainwzlineR{
  302. margin-right: 32px;
  303. }
  304. .wztitle{
  305. width: 250px;
  306. font-size: 16px;
  307. color: #333333;
  308. line-height: 22px;
  309. height: 44px;
  310. text-overflow: -o-ellipsis-lastline;
  311. overflow: hidden;
  312. text-overflow: ellipsis;
  313. display: -webkit-box;
  314. -webkit-line-clamp: 2;
  315. line-clamp: 2;
  316. -webkit-box-orient: vertical;
  317. padding-top: 16px;
  318. padding:0 13px ;
  319. }
  320. .mainwzline:hover{
  321. background: #FFFFFF;
  322. box-shadow: 0px 0px 16px 0px rgba(153, 153, 153, 0.2);
  323. border-radius: 6px;
  324. cursor: pointer;
  325. }
  326. .mainwzline:hover .wztitle{
  327. color: #FF4F00;
  328. }
  329. .mainlineMore:hover{
  330. color: #FF4F00;
  331. cursor: pointer;
  332. }
  333. .gotopImg{
  334. width: 60px;
  335. height: 60px;
  336. }
  337. .gotop{
  338. position: fixed;
  339. right:15vh ;
  340. bottom: 100px;
  341. cursor: pointer;
  342. }
  343. </style>