123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384 |
- <template>
- <view class="content">
- <!-- 轮播 -->
- <view class="carousel-section">
- <swiper class="carousel" :autoplay="true" :interval="3000" :duration="1000">
- <swiper-item v-for="item in carouselList" :key="item.id">
- <image :src="baseURL + item.image"></image>
- </swiper-item>
- </swiper>
- </view>
- <!-- 分类 -->
- <view class="cate-section flex">
- <view class="cate-item flex" @click="navTo('/pages/applic/love')">
- <view class="img-wrapper flex">
- <image src="../../static/icon/icon1.png" mode="" class="img1"></image>
- </view>
- <view class="item-title">爱心捐赠</view>
- </view>
- <view class="cate-item flex" @click="navTo('/pages/form/applicationForm')">
- <view class="img-wrapper flex">
- <image src="../../static/icon/icon2.png" mode="" class="img2"></image>
- </view>
- <view class="item-title">遗体器官捐献</view>
- </view>
- <view class="cate-item flex" @click="navTo('/pages/applic/appliSystem')">
- <view class="img-wrapper flex">
- <image src="../../static/icon/icon3.png" mode="" class="img3"></image>
- </view>
- <view class="item-title">造血干细胞捐献</view>
- </view>
- <view class="cate-item flex" @click="navTo('/pages/form/tovolApply')">
- <view class="img-wrapper flex">
- <image src="../../static/icon/icon4.png" mode="" class="img4"></image>
- </view>
- <view class="item-title">红十字志愿者</view>
- </view>
- </view>
- <view class="kp-tit">
- <image src="../../static/img/ketit.png" mode="" class="ke-tit-img"></image>
- <view class="red-kp">
- 红会科普
- </view>
- </view>
- <view class="list-box" v-for="(item,index) in science" :key='index' @click="Jump(item)">
- <view class="box-left">
- <image :src="$store.state.baseURL + item.image" mode="" class="left-img"></image>
- </view>
- <view class="box-right">
- <view class="right-top word1_ellipsis">
- {{item.title}}
- </view>
- <view class="right-center">
- {{item.synopsis}}
- </view>
- <view class="right-foot">
- {{item.releasetime | showTime}}
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getAed,
- getAidList,
- getRescuerList,
- sos,
- } from '@/api/category.js'
- import {
- loadIndexs,
- bannerlist,
- getListAED,
- getDistance,
- getListMechanism,
- getdis,
- tocall,
- getArticList
- } from '@/api/index.js';
- import {
- saveUrl,
- interceptor
- } from '@/utils/loginUtils.js';
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import {
- userinfo
- } from '@/api/user.js';
- import uniPopup from '@/components/uni-popup/uni-popup.vue';
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import {
- getLoca
- } from '@/utils/wxAuthorized.js';
- import {
- getcomAddress
- } from '@/api/index.js';
- import topTitle from '../../components/top-title/top-title.vue';
- export default {
- components: {
- uniPopup,
- uniLoadMore,
- topTitle
- },
- filters: {
- showTime(val) {
- let str = ''
- if(val) {
- let arr = val.split(' ')
- str = arr[0]
- }
- return str
- }
- },
- data() {
- return {
- carouselList: [], //轮播
- science: [], //文章列表
- page: 1,
- limit: 10,
- loadingType: 'more',
- };
- },
- onShow() {
- saveUrl();
- console.log(11, this);
- if (!this.hasLogin) {
- // 登录拦截
- // interceptor();
- uni.showModal({
- title: '登录',
- content: '您未登录,是否马上登陆?',
- success: e => {
- if (e.confirm) {
- interceptor();
- }
- },
- fail: e => {
- console.log(e);
- }
- });
- } else {
-
- // this.loadData();
- }
- },
- onLoad() {
- this.loadIndex()
- this.getRedKpList()
- saveUrl();
- },
- computed: {
- ...mapState('user', ['userInfo', 'baseURL', 'hasLogin']),
- ...mapState(['baseURL']),
- },
- //下拉加载
- onReachBottom() {
- this.getRedKpList()
- },
- methods: {
- ...mapMutations('user', ['setUserInfo']),
- // 获取红会科普
- getRedKpList() {
- let obj = this
- if(obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
- return
- }
- obj.loadingType = 'loading'
- getArticList({
- page: obj.page,
- limit: obj.limit
- },61).then(({data}) => {
- obj.science = obj.science.concat(data.list);
- obj.page++
- if(data.list.length == obj.limit) {
- obj.loadingType = 'more'
- }else {
- obj.loadingType = 'noMore'
- }
- })
- },
- // 跳转红会科普详情
- Jump(item) {
- uni.navigateTo({
- url:"/pages/applic/info?id="+item.id
- })
- },
- //轮播图
- loadIndex() {
- loadIndexs({}).then(({
- data
- }) => {
- console.log(data,'index')
- this.carouselList = data.banner; //轮播图
- });
- },
- navTo(url) {
- uni.navigateTo({
- url: url
- });
- }
- }
- };
- </script>
- <style lang="scss">
- a {
- text-decoration: none;
- color: #5f5f5f;
- }
- .content {
- background-color: #f8f8f8;
- height: 100%;
- /* 头部 轮播图 */
- .carousel-section {
- // padding-top: 10px;
- overflow: hidden;
- background-color: #fff;
- .carousel {
- width: 705rpx;
- height: 375rpx;
- margin: 0 auto;
- border-radius: 20rpx;
- overflow: hidden;
- .carousel-item {
- width: 100%;
- height: 100%;
- padding-left: 30rpx;
- padding-right: 30rpx;
- overflow: hidden;
- }
- image {
- width: 100%;
- height: 375rpx;
- border-radius: 20rpx;
- }
- }
- }
- // 分类
- .cate-section {
- justify-content: space-around;
- background-color: #fff;
- padding: 46rpx 0 30rpx;
-
- .cate-item {
- width: 25%;
- flex-direction: column;
- text-align: center;
- align-items: center;
- justify-content: center;
-
- .img-wrapper {
- width: 100rpx;
- height: 88rpx;
- background: #fff;
- border-radius: 14rpx;
- position: relative;
-
- image {
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- }
-
- .img1 {
- width: 100rpx;
- height: 84rpx;
- }
-
- .img2 {
- width: 100rpx;
- height: 85rpx;
- }
-
- .img3 {
- width: 100rpx;
- height: 84rpx;
-
- }
-
- .img4 {
- width: 100rpx;
- height: 88rpx;
- }
-
- }
-
- .item-title {
- margin-top: 15rpx;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- }
- }
- }
- .kp-tit {
- margin-top: 20rpx;
- position: relative;
- height: 100rpx;
- background-color: #fff;
- .red-kp {
- line-height: 100rpx;
- text-align: center;
- font-size: 33rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #CB131C;
- }
- .ke-tit-img {
- position: absolute;
- top: 0;
- bottom: 0;
- right: 0;
- left: 0;
- margin: auto;
- width: 222rpx;
- height: 22rpx;
- }
- }
- .list-box{
- width: 725rpx;
- height: 200rpx;
- margin:0 auto 20rpx;
- background: #FFFFFF;
- box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
- border-radius: 7rpx;
- padding:0 20rpx;
- display: flex;
- align-items: center;
- .box-left{
- width: 230rpx;
- height: 145rpx;
- margin-right: 20rpx;
- .left-img{
- width: 230rpx;
- height: 145rpx;
- }
- }
- .box-right{
- width: 430rpx;
- height: 145rpx;
- position: relative;
- .right-top{
- font-size: 25rpx;
- font-weight: bold;
- color: #333333;
- margin-bottom: 24rpx;
- }
- .right-center{
- width: 362rpx;
- // height: 53rpx;
- font-size: 21rpx;
- font-weight: bold;
- color: #999999;
- line-height: 33rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;//在第几行显示...
- -webkit-box-orient: vertical;
- }
- .right-foot{
- font-size: 21rpx;
- font-weight: bold;
- color: #999999;
- line-height: 31rpx;
- text-align: right;
- // margin-top: 13rpx;
- position: absolute;
- right: 0;
- bottom: -10rpx;
- }
- }
- }
- </style>
|