index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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" @click.stop="goList(item)">{{item.categoryName.substring(0,5)}}</view>
  21. </view>
  22. </view>
  23. <view class="swiper-item" v-if="(index+1)<recommendList.length" @click="goDetail(recommendList[index+1])">
  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.substring(0,5)}}</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" :class="{'mainline1':index==0}" v-for="(item,index) in indexData.categoryList" v-if="item.children.length>0">
  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)">查看更多
  48. <image src="../../static/pcimg/icon_list_arrow_def@2x.png" mode="" class="linegdImg1"></image>
  49. <image src="../../static/pcimg/icon_list_arrow_sel@2x.png" mode="" class="linegdImg2"></image>
  50. </view>
  51. </view>
  52. <view class="mainwzbox" v-if="item.children.length>0">
  53. <view class="mainwzline" v-for="(wz,wzindex) in item.children" @click="goDetail2(wz,item)" v-if="wzindex<4" :class="{'mainwzlineR':wzindex!=3}">
  54. <view class="mainwzImgBox">
  55. <img :src="wz.logoImg" alt="" class="mainwzImg">
  56. </view>
  57. <view class="wztitle">{{wz.title}}</view>
  58. <view class="wztime">2022-3-30</view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="gotop" @click="gotoTop">
  65. <image src="../../static/pcimg/btn_top@2x.png" mode="" class="gotopImg"></image>
  66. </view>
  67. <!-- <view>
  68. <a class="table-btn" href="http://phone.66km.cn:8088/marketing/training/940C4BF0A2E04542A1A1AD244EAFB6E2.xlsx" target='_blank'>下载入口</a>
  69. </view> -->
  70. </view>
  71. </template>
  72. <script>
  73. import pcNav from '../../components/pcNav/pcNav.vue'
  74. export default {
  75. components: {
  76. pcNav,
  77. },
  78. data() {
  79. return {
  80. title: 'Hello',
  81. allCategory:[],
  82. navMoret:false,
  83. swpIndex:0,
  84. indexData:'',
  85. recommendList:[],
  86. }
  87. },
  88. onLoad() {
  89. this.getindexData()
  90. },
  91. methods: {
  92. goList(item){
  93. console.log(item)
  94. uni.navigateTo({
  95. url:'list?code='+item.code+'&topName='+item.categoryName//+'&comment='+item.comment
  96. })
  97. },
  98. goDetail(item){
  99. console.log(item)
  100. uni.navigateTo({
  101. url:'detail?id='+item.id+'&topName='+item.categoryName+"&comment="+item.comment+'&parentCode='+item.code
  102. })
  103. },
  104. goDetail2(wz,item){
  105. /* console.log(item)
  106. console.log(wz) */
  107. uni.navigateTo({
  108. url:'detail?id='+wz.id+'&topName='+item.name+"&comment="+item.comment+'&parentCode='+item.code
  109. })
  110. },
  111. gotoTop(){
  112. uni.pageScrollTo({
  113.    scrollTop: 0, duration: 300
  114. });
  115. },
  116. swpBtnRight(){
  117. var length=this.recommendList.length
  118. var num=Math.ceil(length/2)
  119. if(this.swpIndex<num){
  120. this.swpIndex++
  121. }
  122. },
  123. swpBtnLeft(){
  124. if(this.swpIndex==0){
  125. }else{
  126. this.swpIndex--
  127. }
  128. },
  129. getindexData(){
  130. uni.showLoading({
  131. title: '加载中'
  132. })
  133. this.$http('/trainingOpenApi/indexData', {}, 'GET').then(res => {
  134. uni.hideLoading();
  135. this.indexData = res.data;
  136. this.recommendList=this.indexData.recommendList
  137. })
  138. },
  139. mainMore(item){
  140. console.log(item)
  141. uni.navigateTo({
  142. url:'list?code='+item.code+'&topName='+item.name+'&comment='+item.comment
  143. })
  144. }
  145. }
  146. }
  147. </script>
  148. <style scoped>
  149. .content{
  150. background: #F4F5F7;
  151. min-height: 100vh;
  152. font-family: PingFangSC-Regular, PingFang SC;
  153. }
  154. .swiperBox{
  155. /* height: 280px; */
  156. /* background: #F3F8FF; */
  157. width: 100%;
  158. }
  159. .swiperCont{
  160. width: 1236px;
  161. margin: 0 auto;
  162. position: relative;
  163. }
  164. .tuijImg{
  165. width: 24px;height: 24px;
  166. }
  167. .tuijbox{
  168. display: flex;padding-top: 32px;padding-bottom: 20px;
  169. padding-left: 15px;
  170. }
  171. .tuijTitle{
  172. font-size: 22px;
  173. font-family: PingFangSC-Medium, PingFang SC;
  174. font-weight: 500;
  175. color: #3C3C3C;
  176. padding-left: 7px;
  177. line-height: 24px;
  178. }
  179. .swpImgleft{
  180. width: 44px;
  181. height: 44px;
  182. position: absolute;
  183. top: 165px;
  184. left: -60px;
  185. cursor: pointer;
  186. }
  187. .swpImgright{
  188. width: 44px;
  189. height: 44px;
  190. position: absolute;
  191. top: 165px;
  192. right: -60px;
  193. cursor: pointer;
  194. }
  195. .swiper-item{
  196. width: 590px;
  197. height: 163px;
  198. background: #FFFFFF;
  199. margin-left: 16px;
  200. margin-right: 12px;
  201. border-radius: 6px;
  202. margin-top: 14px;
  203. position: relative;
  204. cursor: pointer;
  205. }
  206. .swiper-item:hover{
  207. box-shadow: 0px 0px 16px 0px rgba(153, 153, 153, 0.25);
  208. }
  209. .swpCont{
  210. display: flex;
  211. height: 210px;
  212. justify-content: space-between;
  213. }
  214. .swpimg{
  215. width: 284px;
  216. height: 160px;
  217. }
  218. .swpimgBox{
  219. width: 284px;
  220. height: 160px;
  221. position: absolute;
  222. left: 0;
  223. top: -14px;
  224. }
  225. .swpBr{
  226. width: 284px;
  227. height: 160px;
  228. border-radius: 7px;
  229. overflow: hidden;
  230. }
  231. .swiper{
  232. height: 190px;
  233. }
  234. .swpTitleBox{
  235. padding-left: 304px;
  236. display: flex;
  237. flex-direction: column;
  238. justify-content: space-between;
  239. height: 140px;
  240. padding-top: 10px;
  241. }
  242. .swpTitle{
  243. width: 240px;
  244. height: 44px;
  245. font-size: 16px;
  246. color: #3C3C3C;
  247. line-height: 22px;
  248. text-overflow: -o-ellipsis-lastline;
  249. overflow: hidden;
  250. text-overflow: ellipsis;
  251. display: -webkit-box;
  252. -webkit-line-clamp: 2;
  253. line-clamp: 2;
  254. -webkit-box-orient: vertical;
  255. }
  256. .swpTitleBox:hover .swpTitle{
  257. color: #FF4F00;
  258. }
  259. .categoryName{
  260. line-height: 24px;
  261. width: 84px;
  262. height: 24px;
  263. background: rgba(63, 144, 247, 0.1);
  264. border-radius: 14px;
  265. font-size: 14px;
  266. color: #3F90F7;
  267. text-align: center;
  268. white-space: nowrap;
  269. overflow: hidden;
  270. text-overflow: ellipsis;
  271. }
  272. .mainCont{
  273. width: 1200px;
  274. margin: 0 auto;
  275. padding-bottom: 20px;
  276. }
  277. .mainline{
  278. padding-top: 34px;
  279. }
  280. .mainlineTop{
  281. display: flex;
  282. justify-content: space-between;
  283. }
  284. .mainlineTopleft{
  285. display: flex;
  286. }
  287. .mainlineTitle{
  288. font-size: 22px;
  289. font-weight: 500;
  290. color: #3C3C3C;
  291. line-height: 33px;
  292. font-family: PingFangSC-Medium, PingFang SC;
  293. }
  294. .mainlinecount{
  295. font-size: 14px;
  296. font-weight: 400;
  297. color: #999999;
  298. line-height: 33px;
  299. padding-left: 16px;
  300. }
  301. .mainlineMore{
  302. font-size: 14px;
  303. color: #999999;
  304. }
  305. .mainwzbox{
  306. display: flex;
  307. padding-top: 20px;
  308. }
  309. .mainwzImg{
  310. width: 284px;
  311. height: 160px;
  312. }
  313. .mainwzImgBox{
  314. border-top-left-radius: 6px;
  315. border-top-right-radius: 6px;
  316. overflow: hidden;
  317. height: 160px;
  318. border: 1px solid #eeeeee;
  319. }
  320. .mainwzline{
  321. width: 284px;
  322. height: 244px;
  323. background: #FFFFFF;
  324. border-radius: 6px;
  325. }
  326. .mainwzlineR{
  327. margin-right: 22px;
  328. }
  329. .wztitle{
  330. width: 256px;
  331. font-size: 16px;
  332. color: #333333;
  333. line-height: 22px;
  334. height: 22px;
  335. text-overflow: -o-ellipsis-lastline;
  336. overflow: hidden;
  337. text-overflow: ellipsis;
  338. display: -webkit-box;
  339. -webkit-line-clamp: 1;
  340. line-clamp: 1;
  341. -webkit-box-orient: vertical;
  342. padding:0 13px ;
  343. padding-top: 16px;
  344. }
  345. .wztime{
  346. font-size: 14px;
  347. color: #999999;
  348. padding-left: 14px;
  349. padding-top: 10px;
  350. }
  351. .mainwzline:hover{
  352. background: #FFFFFF;
  353. box-shadow: 0px 0px 16px 0px rgba(153, 153, 153, 0.2);
  354. border-radius: 6px;
  355. cursor: pointer;
  356. }
  357. .mainwzline:hover .wztitle{
  358. color: #FF4F00;
  359. }
  360. .mainlineMore:hover{
  361. color: #FF4F00;
  362. cursor: pointer;
  363. }
  364. .gotopImg{
  365. width: 60px;
  366. height: 60px;
  367. }
  368. .gotop{
  369. position: fixed;
  370. right:5vh ;
  371. bottom: 60px;
  372. cursor: pointer;
  373. }
  374. .linegdImg1{
  375. width: 6px;
  376. height: 10px;
  377. margin-top: 5px;
  378. margin-left: 4px;
  379. }
  380. .linegdImg2{
  381. width: 6px;
  382. height: 10px;
  383. display: none;
  384. margin-top: 5px;
  385. margin-left: 4px;
  386. }
  387. .mainlineMore{
  388. display: flex;
  389. }
  390. .mainlineMore:hover .linegdImg1{
  391. display: none;
  392. }
  393. .mainlineMore:hover .linegdImg2{
  394. display: block;
  395. }
  396. .mainline1{
  397. padding-top: 20px;
  398. }
  399. </style>