index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. <template>
  2. <view class="">
  3. <view class="bg">
  4. </view>
  5. <view class="content position">
  6. <view class="top_banner">
  7. <u-swiper :list="course_list" height='280' @click="on_banner"></u-swiper>
  8. </view>
  9. <view class="news_wrap">
  10. <view class="news_title first">
  11. <view class="title">资讯中心
  12. <text class="shadow">NEW</text>
  13. </view>
  14. <view class="title_right" @click="to_newList">
  15. <text>前往查看</text>
  16. <image src="../../static/images/arrow-right.png" mode=""></image>
  17. </view>
  18. </view>
  19. <view class="empty" v-if="news_list== undefined||news_list.length == 0">
  20. <u-empty text="没有内容哦!" mode="list">
  21. </u-empty>
  22. </view>
  23. <view class="news_item" v-for="(item,index) in news_list" :key="index" @click="to_new_detail(item.id)">
  24. <view class="item_left">
  25. <!-- <image :src="item.cover_resource==null?url:item.cover_resource.url" mode=""></image> -->
  26. <view class="image"
  27. :style="{backgroundImage:'url('+ (item.cover_resource==null?'':item.cover_resource.url) +')'}">
  28. </view>
  29. </view>
  30. <view class="item_right">
  31. <view class="item_title">
  32. {{item.title}}
  33. </view>
  34. <view class="item_num">
  35. <text>{{item.created_at}}</text>
  36. <text>阅读 {{item.view_count}}</text>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="active">
  42. <view class="news_title">
  43. <view class="title">校友活动
  44. <text class="shadow1">ACTIVITY</text>
  45. </view>
  46. <view class="title_right" @click="to_active">
  47. <text>前往查看</text>
  48. <image src="../../static/images/arrow-right.png" mode=""></image>
  49. </view>
  50. </view>
  51. <view class="active_wrap">
  52. <scroll-view class="scroll-view_H" scroll-x="true">
  53. <view class="empty1" v-if="active_list== undefined||active_list.length == 0">
  54. <u-empty text="没有内容哦!" mode="list">
  55. </u-empty>
  56. </view>
  57. <view class='active_item' v-for="(item,index) in active_list" :key="index"
  58. @click="to_active_detail(item.id)">
  59. <view class="top">
  60. <!-- <image :src="item.cover_resource==null?url:item.cover_resource.url" mode=""></image> -->
  61. <view class="image"
  62. :style="{backgroundImage:'url('+ (item.cover_resource==null?'':item.cover_resource.url) +')'}">
  63. </view>
  64. </view>
  65. <view class="active_item_text">
  66. <text class="title">{{item.title}}</text>
  67. <view class="wrap">
  68. <view class="item_day">
  69. <text>{{item.short}}</text>
  70. <!-- <text>{{item.start_time}}--{{item.end_time}}</text> -->
  71. <text>{{getTime(item.start_time)}}-{{getTime(item.end_time)}}</text>
  72. </view>
  73. <!-- <view class="btn" v-if="item.state.status == 1">
  74. 活动进行中
  75. </view>
  76. <view class="btn_over" v-else-if="item.state.status == 3">
  77. {{item.state.status_text}}
  78. </view>
  79. <view class="btn_check" v-else>
  80. {{item.state.status_text}}
  81. </view> -->
  82. </view>
  83. </view>
  84. </view>
  85. </scroll-view>
  86. </view>
  87. </view>
  88. <view class="student">
  89. <view class="news_title">
  90. <view class="title">校友风采
  91. <text class="shadow2">DEMEANOR</text>
  92. </view>
  93. <view class="title_right" @click="to_style">
  94. <text>前往查看</text>
  95. <image src="../../static/images/arrow-right.png" mode=""></image>
  96. </view>
  97. </view>
  98. <scroll-view class="stu_scroll" scroll-x="true">
  99. <view class="empty1" v-if="stu_list== undefined||stu_list.length == 0">
  100. <u-empty text="没有内容哦!" mode="list">
  101. </u-empty>
  102. </view>
  103. <view class='stu_item' v-for="(item,index) in stu_list" :key="index" @click="to_stu_detail(item)">
  104. <!-- @click="to_stu_detail(item)" -->
  105. <!-- <image :src="item.cover_resource==null?url:item.cover_resource.url" mode=""></image> -->
  106. <view class="image"
  107. :style="{backgroundImage:'url('+ (item.cover_resource==null?'':item.cover_resource.url) +')'}">
  108. </view>
  109. <view class="stu_item_text">
  110. <text>{{item.title}}</text>
  111. </view>
  112. </view>
  113. </scroll-view>
  114. </view>
  115. </view>
  116. </view>
  117. </template>
  118. <script>
  119. export default {
  120. data() {
  121. return {
  122. url: '../../static/images/new_default.png',
  123. start_time: '',
  124. end_time: '',
  125. course_list: [],
  126. news_list: [],
  127. active_list: [],
  128. stu_list: [],
  129. banner_list: []
  130. }
  131. },
  132. computed: {
  133. },
  134. onShow() {
  135. // this.get_all()
  136. },
  137. onLoad() {
  138. this.get_all()
  139. },
  140. methods: {
  141. to_style() {
  142. uni.navigateTo({
  143. // url: '../organization/tabs?index='+3
  144. url: 'stu_list'
  145. })
  146. },
  147. to_newList() {
  148. uni.navigateTo({
  149. // url:'../organization/tabs?index='+0
  150. url: 'new_list?category_id=1'
  151. })
  152. },
  153. to_active() {
  154. console.log(1111111)
  155. // uni.navigateTo({
  156. // url: '../activity/index'
  157. // })
  158. uni.navigateTo({
  159. url: 'new_list?category_id=5'
  160. })
  161. },
  162. to_new_detail(id) {
  163. console.log(id, 'diandenage')
  164. uni.navigateTo({
  165. url: 'news_detail?id=' + id
  166. })
  167. console.log(id, 'diandenage')
  168. },
  169. to_active_detail(id) {
  170. // uni.navigateTo({
  171. // url: '../activity/active_detail?id=' + id
  172. // })
  173. uni.navigateTo({
  174. url: 'news_detail?id=' + id
  175. })
  176. },
  177. to_stu_detail(item) {
  178. // let item = encodeURIComponent(JSON.stringify(item))
  179. uni.navigateTo({
  180. url: 'alumni_detail?id=' + item.id
  181. })
  182. },
  183. // 列表
  184. get_all() {
  185. this.$u.get('/page/home').then(res => {
  186. console.log(res, '首页列表')
  187. this.course_list = []
  188. this.news_list = res.data.news
  189. this.active_list = res.data.activities
  190. // this.active_list = this.active_list.map(item=>{
  191. // item.start_time = item.start_time.slice(0,10)
  192. // item.end_time = item.end_time.slice(0,10)
  193. // return item
  194. // })
  195. this.stu_list = res.data.miens
  196. this.banner_list = res.data.banners
  197. res.data.banners.forEach((item, index) => {
  198. this.course_list.push({
  199. image: item.cover_resource.url
  200. })
  201. })
  202. })
  203. },
  204. getTime(time) {
  205. if (time) {
  206. let time1 = time.split(' ')
  207. // console.log(time1, 'tiome')
  208. let time2 = time1[0]
  209. return time2.replace(/\-/g, '.')
  210. } else {
  211. return 0
  212. }
  213. },
  214. //点击轮播图
  215. on_banner(e) {
  216. console.log(e, 'lunbotu')
  217. if (this.banner_list[e] != undefined) {
  218. if (this.banner_list[e].click_type == "Link") {
  219. //跳转到h5链接
  220. location.href = this.banner_list[e].click_body
  221. }
  222. }
  223. },
  224. }
  225. }
  226. </script>
  227. <style lang="scss">
  228. page {
  229. // background: url(../../static/images/bg.png) no-repeat;
  230. // background-position: top;
  231. // background-position-y: 180px;
  232. padding: 15px 0;
  233. background-color: #F9F9FB;
  234. }
  235. .content {
  236. margin: 10px auto 0;
  237. // font-family: PingFang SC;
  238. .top_banner {
  239. border-radius: 12px;
  240. overflow: hidden;
  241. padding: 0 16px;
  242. }
  243. .news_title {
  244. display: flex;
  245. align-items: center;
  246. justify-content: space-between;
  247. margin-top: 30px;
  248. padding: 0 16px 0 0;
  249. .title {
  250. font-size: 15px;
  251. font-weight: bold;
  252. color: #282828;
  253. position: relative;
  254. }
  255. .shadow {
  256. display: block;
  257. position: absolute;
  258. width: 28px;
  259. height: 17px;
  260. font-size: 12px;
  261. // font-family: PingFang SC;
  262. font-weight: bold;
  263. line-height: 20px;
  264. color: #84705E;
  265. opacity: 0.24;
  266. bottom: -4px;
  267. left: 14px;
  268. }
  269. .shadow1 {
  270. display: block;
  271. position: absolute;
  272. width: 28px;
  273. height: 17px;
  274. font-size: 12px;
  275. // font-family: PingFang SC;
  276. font-weight: bold;
  277. line-height: 20px;
  278. color: #84705E;
  279. opacity: 0.24;
  280. bottom: -4px;
  281. left: 2px;
  282. }
  283. .shadow2 {
  284. display: block;
  285. position: absolute;
  286. width: 28px;
  287. height: 17px;
  288. font-size: 12px;
  289. // font-family: PingFang SC;
  290. font-weight: bold;
  291. line-height: 20px;
  292. color: #84705E;
  293. opacity: 0.24;
  294. bottom: -4px;
  295. left: -5px;
  296. }
  297. .title_right {
  298. text {
  299. font-size: 13px;
  300. // font-family: Graphit;
  301. font-weight: 500;
  302. line-height: 20px;
  303. color: rgba(0, 0, 0, 0.3)
  304. }
  305. image {
  306. width: 7px;
  307. height: 7px;
  308. margin-left: 6px;
  309. margin-bottom: 2px;
  310. }
  311. }
  312. }
  313. .first {
  314. padding: 0;
  315. }
  316. .news_wrap {
  317. padding: 0 16px;
  318. .news_item {
  319. background-color: #fff;
  320. display: flex;
  321. align-items: center;
  322. padding: 10px 8px;
  323. margin-top: 20px;
  324. box-shadow: 0px 8px 12px rgba(12, 20, 61, 0.06);
  325. border-radius: 4px;
  326. .item_left {
  327. width: 92px;
  328. height: 76px;
  329. overflow: hidden;
  330. flex-shrink: 0;
  331. margin-right: 8px;
  332. border-radius: 4px;
  333. .image {
  334. width: 92px;
  335. height: 76px;
  336. background-size: cover;
  337. background-position: center;
  338. background-repeat: no-repeat;
  339. }
  340. }
  341. .item_right {
  342. width: 100%;
  343. .item_title {
  344. height: 40px;
  345. overflow: hidden;
  346. -webkit-line-clamp: 2;
  347. text-overflow: ellipsis;
  348. display: -webkit-box;
  349. -webkit-box-orient: vertical;
  350. font-size: 15px;
  351. font-family: Graphit;
  352. font-weight: 500;
  353. line-height: 20px;
  354. color: #282828;
  355. }
  356. .item_num {
  357. margin-top: 10px;
  358. font-size: 14px;
  359. // font-family: PingFang HK;
  360. font-weight: 400;
  361. color: #B2B2B2;
  362. text {
  363. display: inline-block;
  364. width: 50%;
  365. overflow: hidden;
  366. &:last-child {
  367. text-align: right;
  368. }
  369. }
  370. }
  371. }
  372. }
  373. }
  374. .active {
  375. padding: 0 0 0 16px;
  376. // background-color: #F9F9FB;
  377. .active_wrap {
  378. width: 100%;
  379. margin-top: 20px;
  380. .empty {
  381. margin-top: 45%;
  382. }
  383. .empty1 {
  384. // margin-top: 45%;
  385. }
  386. .scroll-view_H {
  387. width: 100%;
  388. height: 180px;
  389. overflow: hidden;
  390. white-space: nowrap;
  391. margin-bottom: -14px;
  392. .active_item {
  393. background-color: #fff;
  394. width: 234px;
  395. height: 162px;
  396. display: inline-block;
  397. overflow: hidden;
  398. margin-right: 10px;
  399. padding: 8px;
  400. box-shadow: 0px 8px 12px rgba(12, 20, 61, 0.06);
  401. border-radius: 10px;
  402. .top {
  403. width: 217px;
  404. height: 74px;
  405. overflow: hidden;
  406. border-radius: 6px;
  407. .image {
  408. width: 215px;
  409. height: 74px;
  410. background-position: center;
  411. background-repeat: no-repeat;
  412. background-size: cover;
  413. ;
  414. }
  415. }
  416. .active_item_text {
  417. margin-top: 12px;
  418. .title {
  419. display: inline-block;
  420. width: 210px;
  421. font-size: 16px;
  422. // font-family: Graphit;
  423. font-weight: 500;
  424. color: #282828;
  425. // margin-bottom: 8px;
  426. overflow: hidden;
  427. white-space: nowrap;
  428. text-overflow: ellipsis;
  429. }
  430. .wrap {
  431. display: flex;
  432. align-items: center;
  433. .item_day {
  434. text {
  435. display: block;
  436. width: 128px;
  437. overflow: hidden;
  438. white-space: nowrap;
  439. text-overflow: ellipsis;
  440. font-size: 13px;
  441. // font-family: Graphit;
  442. font-weight: 500;
  443. color: rgba(0, 0, 0, 0.26);
  444. &:last-child {
  445. font-size: 12px;
  446. // font-family: Graphit;
  447. font-weight: 300;
  448. color: #B2B2B2;
  449. margin-top: 2px;
  450. }
  451. }
  452. }
  453. .btn {
  454. flex: 0 0 80px;
  455. width: 80px;
  456. height: 26px;
  457. background: #79573D;
  458. border-radius: 6px;
  459. font-size: 12px;
  460. font-family: PingFang HK;
  461. font-weight: 400;
  462. line-height: 26px;
  463. color: #FFFFFF;
  464. text-align: center;
  465. }
  466. .btn_over {
  467. flex: 0 0 80px;
  468. width: 80px;
  469. height: 26px;
  470. background: #A0A0A0;
  471. border-radius: 6px;
  472. font-size: 12px;
  473. font-family: PingFang HK;
  474. font-weight: 400;
  475. line-height: 26px;
  476. color: #FFFFFF;
  477. text-align: center;
  478. }
  479. .btn_check {
  480. flex: 0 0 80px;
  481. width: 80px;
  482. height: 26px;
  483. background: #fff;
  484. border-radius: 6px;
  485. font-size: 12px;
  486. font-family: PingFang HK;
  487. font-weight: 400;
  488. line-height: 26px;
  489. color: #79573D;
  490. text-align: center;
  491. border: 1px solid #79573D;
  492. }
  493. }
  494. }
  495. }
  496. }
  497. }
  498. }
  499. .student {
  500. padding: 0 0 20px 16px;
  501. // background-color: #F9F9FB;
  502. .stu_scroll {
  503. padding-top: 20px;
  504. width: 100%;
  505. overflow: hidden;
  506. white-space: nowrap;
  507. .stu_item {
  508. width: 271px;
  509. height: 133px;
  510. overflow: hidden;
  511. border-radius: 6px;
  512. position: relative;
  513. display: inline-block;
  514. margin-right: 10px;
  515. background-color: #FFFFFF;
  516. .image {
  517. width: 271px;
  518. height: 133px;
  519. background-position: center;
  520. background-repeat: no-repeat;
  521. background-size: cover;
  522. }
  523. .stu_item_text {
  524. position: absolute;
  525. bottom: 0;
  526. width: 100%;
  527. height: 27px;
  528. background-color: rgba(25, 19, 19, 0.53);
  529. font-size: 12px;
  530. // font-family: Graphit;
  531. font-weight: 500;
  532. line-height: 27px;
  533. color: #FFFFFF;
  534. text-align: center;
  535. padding: 0 5px;
  536. text {
  537. width: 100%;
  538. display: inline-block;
  539. padding: 0 5px;
  540. overflow: hidden;
  541. white-space: nowrap;
  542. text-overflow: ellipsis;
  543. }
  544. }
  545. }
  546. }
  547. }
  548. }
  549. </style>