|
@@ -1,23 +1,185 @@
|
|
|
<template>
|
|
|
<div class="report-home">
|
|
|
- <div class="j-main">
|
|
|
- 介绍页面
|
|
|
- </div>
|
|
|
- <div class="j-button-group j-footer">
|
|
|
- <button class="j-button-confirm">立即支付</button>
|
|
|
+ <div v-if="list.length && list.length > 0">
|
|
|
+ <van-list
|
|
|
+ v-model="loading"
|
|
|
+ :finished="finished"
|
|
|
+ :immediate-check="false"
|
|
|
+ finished-text="没有更多了"
|
|
|
+ @load="onLoad"
|
|
|
+ :offset="50"
|
|
|
+ >
|
|
|
+ <ul class="list">
|
|
|
+ <li class="item" v-for="item in list" :key="item.id" @click="$router.push(`/reportdetail/${item.id}`)">
|
|
|
+ <div class="item-img">
|
|
|
+ <img :src="item.img" alt="">
|
|
|
+ </div>
|
|
|
+ <div class="item-cont">
|
|
|
+ <p class="ellipsis-2 title">{{item.title}}</p>
|
|
|
+ <div class="desc">
|
|
|
+ <div class="left">{{item.publishtime* 1000 | dateFormatter('yyyy/MM/dd')}}</div>
|
|
|
+ <div class="right">
|
|
|
+ <span class="before-price">¥ <em>{{item.before_price}}</em></span>
|
|
|
+ <span class="current-price">¥ <em>{{item.price}}</em> </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </van-list>
|
|
|
</div>
|
|
|
+ <Empty v-else>
|
|
|
+ <div class="tip-sub-text">暂无数据</div>
|
|
|
+ </Empty>
|
|
|
</div>
|
|
|
</template>
|
|
|
-<script>
|
|
|
+<script lang="ts">
|
|
|
import { Component, Vue } from 'vue-property-decorator'
|
|
|
-
|
|
|
+import { mapActions } from 'vuex'
|
|
|
+import { List } from 'vant'
|
|
|
+import Empty from '@/components/common/Empty.vue'
|
|
|
@Component({
|
|
|
- name: 'home'
|
|
|
+ name: 'home',
|
|
|
+ components: {
|
|
|
+ [List.name]: List,
|
|
|
+ Empty
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapActions({
|
|
|
+ getList: 'home/getReportList'
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
-export default class Home extends Vue {}
|
|
|
-</script>
|
|
|
+export default class Home extends Vue {
|
|
|
+ protected getList!: any
|
|
|
+ list = []
|
|
|
+ data = [
|
|
|
+ { id: 1, title: '2019-2020年城际高速铁路和城际轨道交通市场研究报告', img: 'https://s1.ax1x.com/2020/05/19/Y5fgl6.png', price: 199, before_price: 299, pushtime: 1577780169 },
|
|
|
+ { id: 2, title: '2019-2020年城际高速铁路和城际轨道交通市场研究报告', img: 'https://s1.ax1x.com/2020/05/19/Y5fROO.png', price: 199, before_price: 299, pushtime: 1577780169 },
|
|
|
+ { id: 3, title: '2019-2020年城际高速铁路和城际轨道交通市场研究报告', img: 'https://s1.ax1x.com/2020/05/19/Y5fcSx.png', price: 199, before_price: 299, pushtime: 1577780169 },
|
|
|
+ { id: 4, title: '2019-2020年城际高速铁路和城际轨道交通市场研究报告', img: 'https://s1.ax1x.com/2020/05/19/Y5fyf1.png', price: 199, before_price: 299, pushtime: 1577780169 },
|
|
|
+ { id: 5, title: '2019-2020年城际高速铁路和城际轨道交通市场研究报告', img: 'https://s1.ax1x.com/2020/05/19/Y5f26K.png', price: 199, before_price: 299, pushtime: 1577780169 },
|
|
|
+ { id: 6, title: '2019-2020年城际高速铁路和城际轨道交通市场研究报告', img: 'https://s1.ax1x.com/2020/05/19/Y5ffmD.png', price: 199, before_price: 299, pushtime: 1577780169 },
|
|
|
+ { id: 7, title: '2019-2020年城际高速铁路和城际轨道交通市场研究报告', img: 'https://s1.ax1x.com/2020/05/19/Y5fh0e.png', price: 199, before_price: 299, pushtime: 1577780169 }
|
|
|
+ ]
|
|
|
+
|
|
|
+ loading = false
|
|
|
+ finished = false
|
|
|
+ currentPage = 1
|
|
|
+ totalPage = 0
|
|
|
|
|
|
+ created () {
|
|
|
+ this.getReportList()
|
|
|
+ }
|
|
|
+
|
|
|
+ getReportList () {
|
|
|
+ this.loading = true
|
|
|
+ this.getList(`page_index=${this.currentPage}`).then((res: any) => {
|
|
|
+ if (res.error_code === 0 && res.data.list) {
|
|
|
+ const rows = res.data.list
|
|
|
+ this.loading = false
|
|
|
+ this.totalPage = res.data.page_count
|
|
|
+ if (rows === null || rows.length === 0) {
|
|
|
+ this.finished = true
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.currentPage >= this.totalPage) {
|
|
|
+ this.finished = true
|
|
|
+ }
|
|
|
+ if (this.currentPage === 1) {
|
|
|
+ this.list = rows
|
|
|
+ } else {
|
|
|
+ this.list = this.list.concat(rows)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.finished = true
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.finished = true
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ onLoad () {
|
|
|
+ this.currentPage++
|
|
|
+ this.getReportList()
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
<style lang="scss">
|
|
|
- .report-home {}
|
|
|
+ .report-home {
|
|
|
+ .list{
|
|
|
+ .item{
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ padding: 20px 16px;
|
|
|
+ background-color: #fff;
|
|
|
+ &:after{
|
|
|
+ position: absolute;
|
|
|
+ box-sizing: border-box;
|
|
|
+ content: ' ';
|
|
|
+ pointer-events: none;
|
|
|
+ right: 16px;
|
|
|
+ bottom: 0;
|
|
|
+ left: 16px;
|
|
|
+ border-bottom: 1px solid #ebedf0;
|
|
|
+ -webkit-transform: scaleY(0.5);
|
|
|
+ transform: scaleY(0.5);
|
|
|
+ }
|
|
|
+ .item-img{
|
|
|
+ width: 80px;
|
|
|
+ height: 80px;
|
|
|
+ margin-right: 16px;
|
|
|
+ img{
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .item-cont{
|
|
|
+ flex: 1;
|
|
|
+ .title{
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 24px;
|
|
|
+ color: #171826;
|
|
|
+ }
|
|
|
+ .desc{
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ margin-top: 13px;
|
|
|
+ .left{
|
|
|
+ font-size: 12px;
|
|
|
+ line-height: 18px;
|
|
|
+ color: #9B9CA3;
|
|
|
+ }
|
|
|
+ .right{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+ .before-price{
|
|
|
+ font-size: 12px;
|
|
|
+ line-height: 18px;
|
|
|
+ color: #9B9CA3;
|
|
|
+ margin-right: 6px;
|
|
|
+ em{
|
|
|
+ text-decoration: line-through;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .current-price{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ color: #FB483D;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 20px;
|
|
|
+ em{
|
|
|
+ margin-left: 2px;
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 24px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|