index.vue 9.2 KB

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