123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <template>
- <view class="main">
- <view class="indexswiper" style="margin-top: 10rpx;">
- <u-swiper :list="configInfo.banners" mode="none"></u-swiper>
- </view>
- <view class="tltleStyle">
- 推荐文章
- </view>
- <u-card :show-head="false" :show-foot="false" margin="0" :border="false">
- <view class="" slot="body" v-for="(item,index) in list" :key="index" @click="bookinfo(item.id,item.title)">
- <view class="u-border-bottom padding-bottom-sm">
- <view class="u-body-item u-flex u-col-between u-p-t-0 justify-between">
- <view class="u-body-item-title u-line-2">{{item.title}}</view>
- <u-image :src="imghost+item.banner_url" width="120" height="120" style="margin-left: 12rpx;"></u-image>
- </view>
- <u-tag :text="item.type==1?'健康科普':item.type==2?'疫苗科普':'常见问题'" size="mini" shape="circle" mode="dark" type="info" />
- </view>
- </view>
- </u-card>
- <view class="margin-tb padding-tb-xs">
- <u-loadmore :status="nomore" :icon-type="flower" />
- </view>
- <u-no-network></u-no-network>
- </view>
- </template>
- <script>
- var user = require('../../common/user.js');
- export default {
- onLoad(options) {
- this.imghost = this.$imgHost
- this.pageindex = 1
- this.list = []
- this.getbook()
- },
- onShow() {
- this.ismaxbook = true
- this.getconfigLsit()
- },
- mounted() {
- },
- data() {
- return {
- list: [],
- configInfo: {},
- pageindex: 1,
- imghost: "",
- ismaxbook: true
- }
- },
- onReachBottom() {
- this.getbook()
- },
- methods: {
- getbook: async function() {
- if (this.ismaxbook) {
- let res = await this.$request.post("/api/v1/article/articleList", {
- page: this.pageindex
- }, false)
- let status = user.islogin(res)
- if (status) {
- if (this.pageindex > res.data.last_page) {
- uni.showToast({
- title: "没有更多了",
- icon: "none"
- })
- this.ismaxbook = false
- return false
- } else {
- this.list = this.list.concat(res.data.data)
- this.pageindex++
- }
- }
- }
- },
- bookinfo(id, title) {
- uni.navigateTo({
- url: "../common_tools/collection/collection_details?id=" + id + "&title=" + title
- })
- },
- getconfigLsit: async function() {
- let res = await this.$request.post("/api/v1/common/configList", {}, false)
- console.log(res)
- if (res.status == 0) {
- this.configInfo = res.data
- }
- }
- }
- };
- </script>
- <style scoped lang="scss">
- .main {
- padding-top: 10rpx;
- padding-left: 20rpx;
- padding-right: 20rpx;
- }
- .tltleStyle {
- padding: 30rpx 30rpx 15rpx 15rpx;
- font-weight: bold;
- font-size: 40rpx;
- background-color: #fff;
- }
- .u-card-wrap {
- background-color: $u-bg-color;
- padding: 1px;
- }
- .u-body-item {
- font-size: 32rpx;
- color: #333;
- padding: 20rpx 10rpx;
- }
- .u-body-item image {
- width: 120rpx;
- flex: 0 0 120rpx;
- height: 120rpx;
- border-radius: 8rpx;
- margin-left: 12rpx;
- }
- </style>
|