提交 a530a2b0 authored 作者: 劳广强's avatar 劳广强

feat: 文章详情页 接入接口

上级 9c3e144d
......@@ -154,3 +154,7 @@
width: 46rpx;
height: 46rpx;
}
/deep/ img {
display: block;
}
<template>
<view>
<view class="article_head">
<view class="title">{{ $u.getProperty(articleDetail, 'detail.title') }}</view>
<view class="title">{{ $u.getProperty(articleDetail, 'title') }}</view>
<view class="head_buttom">
<view class="left">
<view class="browse">
<image class="browse_icon" mode="aspectFill" src="/static/icon/ic_wz_kanguo@2x.png" />
<view class="browse_number">{{ $u.getProperty(articleDetail, 'detail.views_num') }}</view>
<view class="browse_number">{{ $u.getProperty(articleDetail, 'views_num') }}</view>
</view>
<view class="browse">
<image class="browse_icon" mode="aspectFill" src="/static/icon/ic_wz_dianzan1@2x.png" />
......@@ -17,8 +17,8 @@
</view>
</view>
<!-- <image class="img" mode="aspectFill" src="{{articleDetail.detail.img}}" /> -->
<view class="img_source">{{ $u.getProperty(articleDetail, 'detail.soure') }}</view>
<!-- <image class="img" mode="aspectFill" src="{{articleDetail.img}}" /> -->
<view class="img_source">{{ $u.getProperty(articleDetail, 'soure') }}</view>
<view class="article_detail">
<u-parse :content="content" />
......@@ -38,12 +38,12 @@
<image class="btn_icon" mode="aspectFill" src="/static/icon/ic_fenxiang@2x.png" />
</button>
</view>
<van-action-sheet v-show="showTip" cancel-text="取消" bind:close="close" bind:cancel="cancelShare">
<view class="share_box">
<button open-type="share" class="share_pyq_btn">分享给好友</button>
<view bindtap="sharePYQ" class="share_pyq">分享到朋友圈</view>
</view>
</van-action-sheet>
<!-- <van-action-sheet v-show="showTip" cancel-text="取消" bind:close="close" bind:cancel="cancelShare">-->
<!-- <view class="share_box">-->
<!-- <button open-type="share" class="share_pyq_btn">分享给好友</button>-->
<!-- <view bindtap="sharePYQ" class="share_pyq">分享到朋友圈</view>-->
<!-- </view>-->
<!-- </van-action-sheet>-->
</view>
<view class="share_bg" bindtap="closetipPyq" v-if="tipPyq">
......@@ -60,9 +60,11 @@ import { articleDetail } from '@/pages/article-detail/mock';
export default {
data() {
return {
query: {},
articleDetail: {},
title: '',
likes_num: '',
created: '',
id: null,
follow: false,
content: '',
......@@ -74,22 +76,22 @@ export default {
},
onLoad(query) {
console.log(query);
this.articleDetail = articleDetail;
this.query = query;
this.fetchArticleDetail();
},
methods: {
async fetchArticleDetail() {
const token = uni.getStorageSync('token');
this.ifshare = true;
this.articleDetail = articleDetail;
this.created = articleDetail.detail.created.substring(0, 10);
this.title = articleDetail.detail.title;
this.follow = articleDetail.follow_status;
this.fabulous = articleDetail.like_status;
this.likes_num = articleDetail.detail.likes_num;
this.content = articleDetail.detail.content;
const { detail } = await uni.$u.http.get('/api/article/detail', { params: { id: this.query.id } });
this.articleDetail = detail;
this.created = detail.created.substring(0, 10);
this.title = detail.title;
this.follow = detail.follow_status;
this.fabulous = detail.like_status;
this.likes_num = detail.likes_num;
this.content = detail.content;
},
},
};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论