articleDetail.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view>
  3. <u-navbar back-text="文章详情" back-icon-size="28" back-icon-color="#ffffff"
  4. :background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
  5. <view class="main">
  6. <!-- 标题 -->
  7. <view class="title">
  8. {{form.title}}
  9. </view>
  10. <!-- 其他信息 -->
  11. <view class="infos">
  12. <view class="photo">
  13. <u-avatar class="avatar"
  14. :src="photo != null ? photo : '@/assets/img/headPortrait.png'" size="48">
  15. </u-avatar>
  16. </view>
  17. <view class="name">
  18. {{form.author}}
  19. </view>
  20. <view class="date" v-if="form.createTime != null">
  21. {{form.createTime.slice(0,10)}}
  22. </view>
  23. <view class="tag1" v-if="form.type == '1'">
  24. 急需用工
  25. </view>
  26. <view class="tag2" v-if="form.type == '2'">
  27. 资源共享
  28. </view>
  29. </view>
  30. <u-line color="#CFD2D5" />
  31. <!-- 文章内容 -->
  32. <view class="content">
  33. {{form.content}}
  34. </view>
  35. <!-- 图片 -->
  36. <view class="picture">
  37. <!-- <img src="@/assets/img/articlePicture.png" alt=""> -->
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import * as API_packages from '@/apis/pagejs/packages.js'
  44. export default {
  45. data() {
  46. return {
  47. form: {
  48. id: ''
  49. },
  50. photo: ''
  51. }
  52. },
  53. onLoad(op) {
  54. if(op.id) {
  55. this.form.id = op.id;
  56. this.getShareWorksDetail();
  57. }
  58. },
  59. methods: {
  60. getShareWorksDetail() {
  61. uni.showLoading({
  62. title: "加载中",
  63. mask: true,
  64. })
  65. API_packages.shareWorksDetail({id: this.form.id}).then((res) => {
  66. this.form = res.data.shareWorksInfo;
  67. this.photo = res.data.personInfo.photo;
  68. uni.hideLoading();
  69. }).catch(error => {
  70. uni.showToast({icon: 'none',
  71. title: error,
  72. icon: "none"
  73. })
  74. })
  75. },
  76. }
  77. }
  78. </script>
  79. <style scoped lang="scss">
  80. .main {
  81. padding: 40rpx 32rpx;
  82. // 标题
  83. .title {
  84. color: rgba(16, 16, 16, 1);
  85. font-size: 36rpx;
  86. }
  87. // 其他信息
  88. .infos {
  89. display: flex;
  90. align-items: center;
  91. margin-top: 24rpx;
  92. margin-bottom: 36rpx;
  93. .photo {
  94. width: 48rpx;
  95. height: 48rpx;
  96. border-radius: 50px;
  97. img {
  98. width: 48rpx;
  99. height: 48rpx;
  100. }
  101. }
  102. .name {
  103. color: rgba(16, 16, 16, 1);
  104. margin-left: 8rpx;
  105. }
  106. .date {
  107. color: rgba(119, 119, 119, 1);
  108. margin-left: 32rpx;
  109. }
  110. .tag1 {
  111. flex: 1;
  112. color: rgba(39, 149, 253, 1);
  113. text-align: right;
  114. }
  115. .tag2 {
  116. flex: 1;
  117. color: rgba(0, 185, 98, 1);
  118. text-align: right;
  119. }
  120. }
  121. // 文章内容
  122. .content{
  123. color: rgba(16, 16, 16, 1);
  124. line-height: 56rpx;
  125. // text-align: j;
  126. }
  127. // 图片
  128. .picture{
  129. margin-top: 24rpx;
  130. border-radius: 4px;
  131. width: 100%;
  132. height: 400rpx;
  133. img{
  134. width: 100%;
  135. height: 100%;
  136. }
  137. }
  138. }
  139. </style>
  140. r