index.vue 13 KB

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