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

feat: 文章详情页 接入接口

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