index.vue 13 KB

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