index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <template>
  2. <view class="content">
  3. <!-- 首页展示图 -->
  4. <image src="../../static/img/top-bg.jpg" mode="widthFix" style="width: 750rpx;"></image>
  5. <!-- 轮播 -->
  6. <view class="carousel-section">
  7. <swiper class="carousel" :autoplay="true" :interval="3000" :duration="1000" indicator-dots indicator-color="rgba(255,255,255,0.5)" indicator-active-color="#fff">
  8. <swiper-item v-for="item in carouselList" :key="item.id" >
  9. <image :src="baseURL + item.image" @click="navTo(item.h5_url)"></image>
  10. </swiper-item>
  11. </swiper>
  12. </view>
  13. <!-- 间隔 -->
  14. <view class="" style="height: 55rpx;background-color: #fff;"></view>
  15. <!-- 爱心榜 -->
  16. <view class="love">
  17. <view class="love-wrap">
  18. <view class="" style="height: 46rpx;"></view>
  19. <view class="love-top">
  20. 爱心榜
  21. </view>
  22. <view class="tab-tit flex">
  23. <view class="tit">
  24. 捐赠时间
  25. </view>
  26. <view class="tit" style="width: 30%;">
  27. 捐献者/单位
  28. </view>
  29. <view class="tit" style="width: 20%;">
  30. 捐赠金额
  31. </view>
  32. <view class="tit">
  33. 捐赠意向
  34. </view>
  35. </view>
  36. <view class="tab-tit flex tab-val" v-for="item in showLove">
  37. <view class="tit clamp">
  38. {{item.paytime | getTime}}
  39. </view>
  40. <view class="tit clamp" style="width: 30%;">
  41. {{item.name}}
  42. </view>
  43. <view class="tit clamp" style="width: 20%;">
  44. {{item.amount*1}}
  45. </view>
  46. <view class="tit clamp">
  47. {{item.order_name}}
  48. </view>
  49. </view>
  50. <view class="lookmore" @click="navTo('/pages/index/loveList')">
  51. 查看更多
  52. <image src="../../static/icon/lm.png" mode="widthFix"></image>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 分类 -->
  57. <view class="cate-section flex">
  58. <view class="cate-item flex" @click="navTo('/pages/index/aixin')">
  59. <view class="img-wrapper flex">
  60. <image src="../../static/icon/icon1.png" mode="" class="img1"></image>
  61. </view>
  62. <view class="item-title">爱心捐款</view>
  63. </view>
  64. <!-- <view class="cate-item flex" @click="navTo('/pages/form/applicationForm')">
  65. <view class="img-wrapper flex">
  66. <image src="../../static/icon/icon2.png" mode="" class="img1"></image>
  67. </view>
  68. <view class="item-title">遗体器官捐献</view>
  69. </view> -->
  70. <view class="cate-item flex" @click="navTo('/pages/index/ytjz')">
  71. <view class="img-wrapper flex">
  72. <image src="../../static/icon/icon2.png" mode="" class="img1"></image>
  73. </view>
  74. <view class="item-title">遗体器官捐献</view>
  75. </view>
  76. <view class="cate-item flex" @click="navTo('/pages/applic/appliSystem')">
  77. <view class="img-wrapper flex">
  78. <image src="../../static/icon/icon3.png" mode="" class="img1"></image>
  79. </view>
  80. <view class="item-title">造血干细胞捐献</view>
  81. </view>
  82. <view class="cate-item flex" @click="navTo('/pages/fu/axjz')">
  83. <view class="img-wrapper flex">
  84. <image src="../../static/icon/icon4.png" mode="" class="img1"></image>
  85. </view>
  86. <view class="item-title">爱心捐赠</view>
  87. </view>
  88. <view class="cate-item flex" @click="navTo('/pages/train/index')">
  89. <view class="img-wrapper flex">
  90. <image src="../../static/icon/icon5.png" mode="" class="img1"></image>
  91. </view>
  92. <view class="item-title">救护培训</view>
  93. </view>
  94. </view>
  95. <!-- 加入红十字 -->
  96. <view class="join-red">
  97. <image src="../../static/img/join-banner.png" mode="widthFix" @click="navTo('/pages/index/joinus')"></image>
  98. </view>
  99. <!-- 就在身边 -->
  100. <view class="jzsb-wrap">
  101. <!-- 附近救护员 -->
  102. <view class="wrap-tit">
  103. 救在身边
  104. <view class="tit-bg"></view>
  105. </view>
  106. <!-- <view class="fjjhy-wrap" @click="navTo('/pages/applic/location')">
  107. <image src="../../static/img/jzsb-bg.png" mode=""></image>
  108. </view> -->
  109. <!-- 救护站 and Aed -->
  110. <view class="jhz-aed-wrap flex">
  111. <!-- 救护站 -->
  112. <view class="jhz-wrap" @click="navTo('/pages/applic/aid')">
  113. <image src="../../static/img/jhz-bg.png" mode=""></image>
  114. </view>
  115. <!-- aed -->
  116. <view class="aed-wrap" @click="navTo('/pages/applic/aed')">
  117. <image src="../../static/img/aed-bg.png" mode=""></image>
  118. </view>
  119. </view>
  120. </view>
  121. <!-- 少儿基金 -->
  122. <view class="join-red">
  123. <image src="../../static/img/sejj.png" mode="widthFix" @click="navTo('/pages/index/transfer')"></image>
  124. </view>
  125. <!-- 红会科普 -->
  126. <!-- <view class="kp-wrap" v-if="(science.length != 0) && loaded">
  127. <view class="wrap-tit">
  128. 红会科普
  129. <view class="tit-bg"></view>
  130. </view>
  131. <view class="readmore" @click="navTo('/pages/applic/science')">
  132. 更多<image src="../../static/icon/next.png" mode="widthFix"></image>
  133. </view>
  134. <scroll-view scroll-x="true" class="kp-scroll flex">
  135. <view class="kp-item" v-for="sitem in science" @click="navTo('/pages/applic/info?id=' + sitem.id)">
  136. <view class="kp-item-img">
  137. <image src="../../static/img/002.png" mode="heightFix" ></image>
  138. </view>
  139. <view class="kp-item-tit clamp">
  140. {{sitem.title}}
  141. </view>
  142. </view>
  143. </scroll-view>
  144. </view> -->
  145. </view>
  146. </template>
  147. <script>
  148. import {
  149. loadIndexs,
  150. loveList
  151. } from '@/api/index.js';
  152. import { getArticList} from '@/api/index.js';
  153. import {
  154. saveUrl,
  155. interceptor
  156. } from '@/utils/loginUtils.js';
  157. import {
  158. mapState,
  159. mapMutations
  160. } from 'vuex';
  161. import {
  162. userinfo
  163. } from '@/api/user.js';
  164. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  165. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  166. export default {
  167. components: {
  168. uniPopup,
  169. uniLoadMore
  170. },
  171. data() {
  172. return {
  173. carouselList: [], //轮播
  174. science: [], //文章列表
  175. page: 1,
  176. limit: 20,
  177. loaded: false,
  178. loveList: [],
  179. loadingType: 'more',
  180. timer: ''
  181. };
  182. },
  183. filters: {
  184. getTime(val) {
  185. let date = new Date(val * 1000);
  186. let Y = date.getFullYear();
  187. let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
  188. let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
  189. return Y + '/' + M + '/' + D;
  190. },
  191. },
  192. onShow() {
  193. saveUrl();
  194. if (!this.hasLogin) {
  195. // 登录拦截
  196. // interceptor();
  197. uni.showModal({
  198. title: '登录',
  199. content: '您未登录,是否马上登陆?',
  200. success: e => {
  201. if (e.confirm) {
  202. interceptor();
  203. }
  204. },
  205. fail: e => {
  206. console.log(e);
  207. }
  208. });
  209. } else {
  210. }
  211. if(this.timer) {
  212. clearTimeout(this.timer)
  213. }
  214. this.getLoveList()
  215. },
  216. onLoad() {
  217. // this.getPkList()
  218. this.loadIndex()
  219. saveUrl();
  220. },
  221. computed: {
  222. ...mapState('user', ['userInfo', 'hasLogin']),
  223. ...mapState('info',['kpCid']),
  224. ...mapState(['baseURL']),
  225. showLove() {
  226. return this.loveList.slice(0, 5);
  227. }
  228. },
  229. methods: {
  230. ...mapMutations('user', ['setUserInfo']),
  231. gundong() {
  232. let obj = this;
  233. obj.timer = setTimeout(() => {
  234. obj.loveList.push(obj.loveList.shift());
  235. // console.log(obj.moreJxList)
  236. obj.gundong();
  237. }, 2000);
  238. },
  239. //获取红会爱心榜
  240. getLoveList() {
  241. let obj = this
  242. loveList({
  243. page:obj.page,
  244. limit: obj.limit
  245. }).then(res => {
  246. obj.loveList = res.data.data
  247. if(obj.loveList.length > 5) {
  248. obj.gundong();
  249. }
  250. })
  251. },
  252. loadIndex() {
  253. let obj = this;
  254. loadIndexs({}).then(({
  255. data
  256. }) => {
  257. console.log(data, 'index')
  258. //轮播图
  259. this.carouselList = data.banner
  260. console.log(this.carouselList,'this.carouselList++++++++')
  261. });
  262. },
  263. loadData() {
  264. let obj = this;
  265. userinfo({}).then(({
  266. data
  267. }) => {
  268. obj.setUserInfo(data);
  269. });
  270. },
  271. // 处理跳转
  272. navTo(url) {
  273. if(url.indexOf('http') != -1) {
  274. window.location.href = url
  275. }else {
  276. uni.navigateTo({
  277. url:url,
  278. fail() {
  279. uni.switchTab({
  280. url:url
  281. })
  282. }
  283. });
  284. }
  285. },
  286. // 获取科普文章列表
  287. getPkList() {
  288. let obj = this
  289. getArticList({
  290. page: obj.page,
  291. limit: obj.limit,
  292. ifyid: obj.kpCid
  293. }).then(res => {
  294. obj.loaded = true
  295. console.log(res,'获取科普文章列表')
  296. obj.science = res.data.list
  297. })
  298. }
  299. }
  300. };
  301. </script>
  302. <style lang="scss">
  303. a {
  304. text-decoration: none;
  305. color: #5f5f5f;
  306. }
  307. .content {
  308. background-color: #ffabab;
  309. }
  310. .content {
  311. background-color: #f8f8f8;
  312. height: 100%;
  313. /* 头部 轮播图 */
  314. .carousel-section {
  315. // padding-top: 10px;
  316. overflow: hidden;
  317. background-color: #fff;
  318. padding-top: 30rpx;
  319. .carousel {
  320. width: 694rpx;
  321. height: 466rpx;
  322. margin: 0 auto;
  323. overflow: hidden;
  324. .carousel-item {
  325. width: 100%;
  326. height: 100%;
  327. padding-left: 30rpx;
  328. padding-right: 30rpx;
  329. overflow: hidden;
  330. }
  331. image {
  332. width: 100%;
  333. height: 466rpx;
  334. border-radius: 20rpx;
  335. }
  336. }
  337. }
  338. // 分类
  339. .cate-section {
  340. justify-content: space-around;
  341. background-color: #fff;
  342. padding: 46rpx 0 30rpx;
  343. .cate-item {
  344. width:20%;
  345. flex-shrink: 0;
  346. flex-direction: column;
  347. text-align: center;
  348. align-items: center;
  349. justify-content: center;
  350. .img-wrapper {
  351. width: 100rpx;
  352. height: 120rpx;
  353. border-radius: 14rpx;
  354. position: relative;
  355. image {
  356. position: absolute;
  357. left: 50%;
  358. top: 50%;
  359. transform: translate(-50%, -50%);
  360. }
  361. .img1 {
  362. width: 120rpx;
  363. height: 120rpx;
  364. }
  365. }
  366. .item-title {
  367. margin-top: 15rpx;
  368. font-size: 20rpx;
  369. font-weight: 500;
  370. color: #333333;
  371. }
  372. }
  373. }
  374. }
  375. .join-red {
  376. width: 750rpx;
  377. // height: 279rpx;
  378. padding: 20rpx 0;
  379. background-color: #fff;
  380. margin: 20rpx 0;
  381. display: flex;
  382. align-items: center;
  383. justify-content: center;
  384. image {
  385. width: 710rpx;
  386. // height: 203rpx;
  387. }
  388. }
  389. .jzsb-wrap {
  390. width: 750rpx;
  391. // height: 812rpx;
  392. background-color: #fff;
  393. margin: 20rpx 0 0;
  394. padding-bottom: 30rpx;
  395. image {
  396. width: 100%;
  397. height: 100%;
  398. }
  399. .fjjhy-wrap {
  400. width: 694rpx;
  401. height: 417rpx;
  402. margin: 0 auto 20rpx;
  403. border-radius: 20rpx;
  404. }
  405. .jhz-aed-wrap {
  406. width: 694rpx;
  407. height: 210rpx;
  408. margin: 20rpx auto;
  409. justify-content: space-between;
  410. .jhz-wrap {
  411. width: 334rpx;
  412. height: 208rpx;
  413. border-radius: 28rpx;
  414. }
  415. .aed-wrap {
  416. width: 334rpx;
  417. height: 208rpx;
  418. border-radius: 28rpx;
  419. }
  420. }
  421. }
  422. .kp-wrap {
  423. width: 750rpx;
  424. height: 353rpx;
  425. background-color: #fff;
  426. margin: 20rpx auto;
  427. position: relative;
  428. .kp-scroll {
  429. height: 200rpx;
  430. width: 750rpx;
  431. // background-color: red;
  432. // justify-content: ;
  433. padding-left: 23rpx;
  434. white-space: nowrap;
  435. .kp-item {
  436. display: inline-block;
  437. width: 286rpx;
  438. height: 200rpx;
  439. background: #FFFFFF;
  440. border: 1px solid #F5F5F5;
  441. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  442. border-radius: 15rpx;
  443. margin-right:15rpx;
  444. .kp-item-img {
  445. height: 155rpx;
  446. margin-bottom: 5rpx;
  447. image {
  448. display: block;
  449. margin: auto;
  450. height: 155rpx;
  451. max-width: 286rpx;
  452. }
  453. }
  454. .kp-item-tit {
  455. width: 246rpx;
  456. height: 33rpx;
  457. background: #a1a1a1;
  458. border-radius: 17rpx;
  459. color: #fff;
  460. margin: auto;
  461. position: relative;
  462. font-size: 24rpx;
  463. font-weight: 500;
  464. color: #FEFEFE;
  465. line-height: 33rpx;
  466. padding-left: 23rpx;
  467. &::before {
  468. content: '';
  469. width: 4rpx;
  470. height: 4rpx;
  471. background: #F3392C;
  472. border-radius: 50%;
  473. position: absolute;
  474. top: 0;
  475. bottom: 0;
  476. left: 12rpx;
  477. margin: auto;
  478. }
  479. }
  480. }
  481. }
  482. }
  483. .wrap-tit {
  484. display: inline-block;
  485. line-height: 115rpx;
  486. font-size: 40rpx;
  487. font-weight:600;
  488. color: #666666;
  489. padding-left: 24rpx;
  490. position: relative;
  491. .tit-bg {
  492. width: 160rpx;
  493. height: 22rpx;
  494. background: linear-gradient(-330deg, #FFE88B, #FFBA00);
  495. opacity: 0.4;
  496. position: absolute;
  497. bottom: 40rpx;
  498. margin: auto;
  499. }
  500. }
  501. .readmore {
  502. width: 150rpx;
  503. padding-right: 27rpx;
  504. font-size: 28rpx;
  505. font-weight: 500;
  506. color: #999999;
  507. position: absolute;
  508. text-align: right;
  509. top: 0;
  510. right: 0;
  511. line-height: 110rpx;
  512. image {
  513. width: 35rpx;
  514. vertical-align: text-bottom;
  515. }
  516. }
  517. .love {
  518. background: #FFFFFF;
  519. }
  520. .love-wrap {
  521. margin: auto;
  522. width: 694rpx;
  523. // height: 309px;
  524. box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.1000);
  525. border-radius: 30rpx;
  526. position: relative;
  527. text-align: center;
  528. .love-top {
  529. width: 185rpx;
  530. line-height: 55rpx;
  531. background: #FF4C4C;
  532. border-radius: 28rpx;
  533. font-size: 30rpx;
  534. font-weight: bold;
  535. color: #FFFFFF;
  536. text-align: center;
  537. position: absolute;
  538. top: -25rpx;
  539. left: 0;
  540. right: 0;
  541. margin: auto;
  542. }
  543. .tab-tit {
  544. line-height: 65rpx;
  545. border-bottom: 1px solid #F2F2F2;
  546. .tit {
  547. width: 25%;
  548. font-size: 20rpx;
  549. font-weight: bold;
  550. color: #FF4C4C;
  551. }
  552. }
  553. .tab-val {
  554. .tit {
  555. color: #101010;
  556. }
  557. }
  558. }
  559. .lookmore {
  560. padding: 10rpx 0;
  561. font-size: 24rpx;
  562. font-weight: 500;
  563. color: #090909;
  564. image {
  565. display: inline-block;
  566. margin-left: 10rpx;
  567. width: 18rpx;
  568. }
  569. }
  570. </style>