123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <template>
- <view class="item">
- <view class="love-item" v-for="item in list" :key="item.id" @click="Jump(item.id)">
- <image :src="item.image_input[0]" mode=""></image>
- <view class="content">
- <view class="title">
- {{item.title}}
- </view>
- <view class="time">
- {{item.add_time | time}}
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { itemList} from '@/api/index.js';
- export default {
- data() {
- return {
- list: []
- }
- },
- onShow() {
- this.loadData()
- },
- filters: {
- time(val) {
- if( val / 1000000000000 < 1){
- val = val*1000
- }
- let date = new Date(val)
- console.log(val,date)
- let Y = date.getFullYear()
- let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth()+1) :( date.getMonth()+1)
- let D = date.getDate()< 10 ? '0' + date.getDate() : date.getDate()
- let h = date.getHours()< 10 ? '0' + date.getHours() : date.getHours()
- let m = date.getMinutes()< 10 ? '0' + date.getMinutes() : date.getMinutes()
- let s = date.getSeconds()< 10 ? '0' + date.getSeconds() : date.getSeconds()
- return Y + '-' + M + '-' + D + ' ' + h +':' + m + ':' + s
- }
- },
- methods:{
- navTo(url) {
- uni.navigateTo({
- url
- })
- },
- // getList() {
- // this.list = [
- // {
- // id: 1, image: '', title: '大爱无疆!71旬老人捐款100W余元给红十字会善行中国', add_time: 1624279338
- // },
- // {
- // id: 2, image: '', title: '大爱无疆!71旬老人捐款100W余元给红十字会善行中国', add_time: 1624279338
- // },
- // {
- // id: 3, image: '', title: '大爱无疆!71旬老人捐款100W余元给红十字会善行中国', add_time: 1624279338
- // }
- // ]
- // },
- loadData(){
- let obj = this;
- itemList().then(({ data }) => {
- console.log(data);
- obj.list = data;
- });
- },
- Jump(id) {
- uni.navigateTo({
- url:"/pages/applic/info?id="+id
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- // .item {}
- .love-item {
- margin: 0 auto;
- width: 702rpx;
- height: 208rpx;
- border-bottom: 1px solid #EEEEEE;
- display: flex;
- justify-content: space-between;
- align-items: center;
- image {
- width: 200rpx;
- height: 160rpx;
- background-color: #eee;
- }
- .content {
- height: 160rpx;
- padding-left: 16rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
-
- .title {
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- // line-height: 39px;
- }
- .time {
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- }
- }
-
- }
- </style>
|