index.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <view class="page-view f-30 p-40 flex-dir-column flex-x-center">
  3. <view class="title">{{detailVO.name}}</view>
  4. <view class="time">发布时间:{{detailVO.createTime?detailVO.createTime.substring(0,10) : ''}}</view>
  5. <view class="col-info-d t-c m-b-30">
  6. <u-parse :content="detailVO.content"></u-parse>
  7. </view>
  8. <detailBottom type="snacks" :articleId.sync="detailVO.id" :liked.sync="detailVO.liked" :collected.sync="detailVO.collected"
  9. :views.sync="detailVO.views" :likeNum.sync="detailVO.likeNum" :collectNum.sync="detailVO.collectNum"
  10. @doRefresh="getDetail"></detailBottom>
  11. </view>
  12. </template>
  13. <script>
  14. import detailBottom from '@/pages/components/detailbottom.vue'
  15. export default {
  16. components: {
  17. detailBottom
  18. },
  19. data() {
  20. return {
  21. detailVO: {},
  22. }
  23. },
  24. methods: {
  25. getDetail() {
  26. this.$u.api.getSnacksDetail(this.detailVO.id).then(res => {
  27. if (res.data.content) {
  28. res.data.content = decodeURIComponent(res.data.content);
  29. }
  30. this.detailVO = res.data || {}
  31. //
  32. uni.setNavigationBarTitle({
  33. title: res.data.name || ''
  34. })
  35. })
  36. }
  37. },
  38. onLoad(options) {
  39. this.detailVO.id = options.id || '';
  40. this.getDetail();
  41. },
  42. }
  43. </script>
  44. <style scoped lang="scss">
  45. .title {
  46. width: 100%;
  47. text-align: center;
  48. font-size: 25px;
  49. color: #65371b;
  50. margin-bottom: 20px;
  51. }
  52. .time {
  53. font-size: 14px;
  54. color: #787878;
  55. font-weight: 300;
  56. padding-bottom: 10px;
  57. }
  58. </style>