123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <template>
- <view class="main">
- <view class="container">
- <view class="list">
- <view class="infobox" v-for="(item , index) in articleList" :key="index" @click="articleDetails(item.id)">
- <view class="left">
- <view class="infoname">{{item.title}}</view>
- <view class="infotxt">{{item.gist == null? '': item.gist}}</view>
- <view class="infolook">
- <image src="../../static/index/look.png"></image>
- <view>{{ item.virtual_view + item.view }}</view>
- </view>
- </view>
- <view class="right">
- <image :src="item.image"></image>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'articleList',
- data() {
- return {
- cate_id: null,
- articleList:[],
- }
- },
- onLoad(option) {
- console.log(option)
- this.cate_id = option.cate_id
- },
- mounted(){
- this.articleListData()
- },
- methods: {
- // 下拉刷新数据
- onPullDownRefresh: function(){
- this.articleListData()
- setTimeout(function () {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- articleListData: async function(){
- let res = await this.$request.get('/api/Article/articleList?page=1&size=10&cate_id='+this.cate_id);
- console.log(res.data.data)
- if(res.code == 200){
- this.articleList = res.data.data
- }else{
- uni.showToast({
- icon: 'none',
- title: res.message
- });
- }
- },
- // 跳转到文章详情
- articleDetails(id){
- uni.navigateTo({
- url: '/pages/index/articleDetails?id=' + id
- })
- }
- }
- }
- </script>
- <style>
- page{
- background: #F5F5F5;
- }
- .main{
- width: 100vw;
- height: auto;
- margin-bottom: 20px;
- }
- .container{
- padding: 0 15px;
- }
- .list{
- width: 100%;
- height: auto;
- margin-top: 20px;
- }
- .list .infobox{
- width: 100%;
- height: 200rpx;
- margin: 15px 0;
- padding: 15rpx;
- display: flex;
- justify-content: space-between;
- background: #fff;
- border-radius: 5px;
- }
- .infobox .left{
- width: 54vw;
- }
- .infobox .right{
- width: 34vw;
- }
- .infobox .right .right-img-item{
- border-radius:12rpx;
- }
- .right image{
- width: 100%;
- height: 100%;
- }
- .left .infoname{
- /* width: 100%; */
- height: 80rpx;
- font-size: 32rpx;
- font-weight: 400;
- color: rgba(85,88,100,1);
- font-family: PingFangSC-Regular, sans-serif;
- /* overflow: hidden; */
- }
- .left .infotxt{
- width: 100%;
- height: 50rpx;
- line-height: 50rpx;
- color: #999;
- font-size: 24rpx;
- font-family: PingFangSC-Regular, sans-serif;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .left .infolook{
- width: 100%;
- height: 50rpx;
- display: flex;
- align-items: center;
- }
- .infolook image{
- width: 34rpx;
- height: 34rpx;
- margin: 2px;
- border-radius: 12rpx;
- }
- .infolook view{
- width: auto;
- height: 30px;
- line-height: 30px;
- padding: 0 5px;
- color: #999;
- }
- </style>
|