123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <view class="news">
- <view class="first-box u-flex u-row-between u-col-top">
- <view class="first-item" v-for="(item,index) in list" v-if="index < 2" :key="index" @click="toinfo(item)">
- <image :src="item.logo" class="image" mode=""></image>
- <view class="name u-line-2">
- {{item.title}}
- </view>
- <view class="user u-flex">
- <image :src="item.head_image" class="head" mode=""></image>
- <text class="user-name">{{item.source}}</text>
- </view>
- </view>
- </view>
- <view class="news-item u-flex u-row-between" v-for="(item,index) in list" v-if="index >= 2" :key="index" @click="toinfo(item)">
- <image :src="item.logo" class="image" mode=""></image>
- <view class="item-right">
- <view class="name u-line-2">
- {{item.title}}
- </view>
- <view class="u-flex u-row-between">
- <view class="time u-flex">
- <u-icon name="eye-fill" color="#CCCCCC" size="26"></u-icon>
- <text class="look">{{item.page_view}}人浏览</text>
- <text class="time-text">{{item.create_at}}</text>
- </view>
- <view class="user u-flex">
- <image :src="item.head_image" class="head" mode=""></image>
- <text class="user-name">{{item.source}}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { mapState } from "vuex"
- export default {
- data() {
- return {
- page: 1,
- list: [],
- title: ''
- }
- },
- computed: {
- ...mapState(['defaultcity'])
- },
- onLoad(option) {
- this.title = option.title
- this.getlist()
- },
- onShow() {
- if (this.title) {
- uni.setNavigationBarTitle({
- title: this.title
- })
- }
- },
- onReachBottom() {
- if (this.list.length % 20 == 0) {
- this.page++
- this.getlist()
- }
- },
- methods: {
- getlist() {
- this.$u.post('/api/Headline/headline_list', {
- page: this.page,
- page_num: 20,
- city_id: this.defaultcity.city_id
- }).then(res => {
- this.list = this.list.concat(res.data || [])
- })
- },
- toinfo(item) {
- uni.navigateTo({
- url: "./news-info?id=" + item.id
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .news {
- padding: 0 44rpx;
- .news-item {
- padding: 32rpx 0;
- border-bottom: 2rpx solid #CCCCCC;
- .image {
- width: 140rpx;
- height: 110rpx;
- border-radius: 10rpx;
- }
- .item-right {
- flex: 1;
- margin-left: 14rpx;
- .name {
- font-size: 24rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #333333;
- margin-bottom: 16rpx;
- }
- .user {
- .user-name {
- font-size: 18rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #999999;
- }
- .head {
- width: 24rpx;
- height: 24rpx;
- border-radius: 100rpx;
- margin-right: 10rpx;
- }
- }
- .time {
- font-size: 18rpx;
- font-weight: 400;
- color: #999999;
- .look {
- margin: 0 10rpx;
- }
- }
- }
- }
- .first-box {
- padding: 24rpx 0;
- border-bottom: 2rpx solid #CCCCCC;
- .first-item {
- width: 320rpx;
- .user {
- margin-top: 10rpx;
- .user-name {
- font-size: 18rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #999999;
- }
- .head {
- width: 24rpx;
- height: 24rpx;
- border-radius: 100rpx;
- margin-right: 10rpx;
- }
- }
- .image {
- width: 320rpx;
- height: 220rpx;
- border-radius: 10rpx;
- }
- .name {
- margin-top: 14rpx;
- font-size: 24rpx;
- font-family: PingFangSC-Medium, PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- }
- }
- }
- </style>
|