index.vue 1.7 KB

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