detail.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <view class="page">
  3. <zs-header color="#000"></zs-header>
  4. <view class="cover">
  5. <image :src="goods.goodsPath" mode="aspectFit"></image>
  6. </view>
  7. <view class="title-box">
  8. <view class="title">
  9. {{ goods.goodsName }}
  10. </view>
  11. <view class="sub-title">
  12. {{ goods.goodsDescribe }}
  13. </view>
  14. </view>
  15. <view class="class-box">
  16. <view class="class-title">
  17. <view class="title">课程目录</view>
  18. <view class="class-length">共{{ courses.length }}节课</view>
  19. </view>
  20. <view v-for="item in courses" class="class-item" @click="goCourse(item.id)">
  21. <view class="image">
  22. <image :src="item.courseImg" mode="aspectFit"></image>
  23. </view>
  24. <view class="item-info">
  25. <view class="item-title">{{ item.courseName }}</view>
  26. <view class="item-desc">{{ item.courseMsg }}</view>
  27. <view class="item-progress">学习进度 {{ item.per }}%</view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="class-box">
  32. <view class="class-title">
  33. <view class="title">研学心得</view>
  34. <view v-if="communityItemDetailVo" @click="edit(communityItemDetailVo)" class="class-length">编辑</view>
  35. </view>
  36. <view v-if="!communityItemDetailVo" class="slogan">
  37. 行走的课堂,心灵的旅行。快来记录你的心路历程吧
  38. </view>
  39. <view v-if="!communityItemDetailVo" class="btn">
  40. <u-button shape="circle" customStyle="keepStudy" @click="toShare">记录研学历程</u-button>
  41. </view>
  42. <view v-if="communityItemDetailVo" class="community-item">
  43. <view class="community-text">
  44. {{ communityItemDetailVo.communityDetail }}
  45. </view>
  46. <view class="community-img" v-if="communityItemDetailVo.urls.length > 0">
  47. <image v-for="url in communityItemDetailVo.urls.filter((e, i) => i <= 3)" :src="url" mode="widthFix"></image>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="tab-group">
  52. <view class="tab active" @click="handleTab(1)">
  53. 商品详情
  54. </view>
  55. </view>
  56. <view class="desc-box">
  57. <rich-text class="goods-desc" :nodes="goods.goodsDetail"></rich-text>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import { getStudyDetail } from '@/api/activity'
  63. export default {
  64. data() {
  65. return {
  66. goods: {
  67. },
  68. communityItemDetailVo: null,
  69. courses: [],
  70. orderNo: null,
  71. };
  72. },
  73. methods: {
  74. toShare() {
  75. uni.navigateTo({
  76. url: '/share/sharePosts?orderNo=' + this.orderNo
  77. });
  78. },
  79. // 去课程详情页
  80. goCourse(id) {
  81. uni.navigateTo({
  82. url: `./courseDetail?id=${id}&orderNo=${this.orderNo}`
  83. })
  84. },
  85. getDetail(orderNo) {
  86. getStudyDetail(orderNo).then(res => {
  87. if (res.success) {
  88. this.orderNo = orderNo
  89. this.goods = res.content.goodsInfoVo
  90. this.courses = res.content.courses
  91. this.communityItemDetailVo = res.content.communityItemDetailVo
  92. this.goods.goodsDetail = res.content.goodsInfoVo.goodsDetail.replace(/<img/gi, '<img class="img_class" ')
  93. }
  94. })
  95. },
  96. edit(row){
  97. uni.navigateTo({
  98. url: `/share/sharePosts?orderNo=${this.orderNo}&id=${row.id}`
  99. });
  100. }
  101. },
  102. onLoad({ orderNo }) {
  103. this.getDetail(orderNo)
  104. },
  105. onShow() {
  106. if (this.orderNo) {
  107. this.getDetail(this.orderNo)
  108. }
  109. }
  110. };
  111. </script>
  112. <style lang="scss" scoped>
  113. .page {
  114. background: #F9F9F9;
  115. min-height: 100vh;
  116. .cover {
  117. height: 750rpx;
  118. width: 750rpx;
  119. image {
  120. width: 100%;
  121. height: 100%;
  122. }
  123. }
  124. .title-box {
  125. margin: -176rpx 20rpx 0 20rpx;
  126. .title {
  127. font-size: 36rpx;
  128. color: #FFFFFF;
  129. font-weight: bold;
  130. margin-bottom: 15rpx;
  131. }
  132. .sub-title {
  133. font-size: 24rpx;
  134. color: #FFFFFF;
  135. font-weight: bold;
  136. }
  137. }
  138. .class-box {
  139. background: #fff;
  140. border-radius: 20rpx 20rpx 0 0;
  141. margin-top: 20rpx;
  142. padding: 28rpx 20rpx 0 20rpx;
  143. overflow: overlay;
  144. .class-title {
  145. display: flex;
  146. justify-content: space-between;
  147. .title {
  148. font-size: 32rpx;
  149. color: #222222;
  150. font-weight: bold;
  151. }
  152. .class-length {
  153. font-size: 24rpx;
  154. color: #AAAAAA;
  155. }
  156. }
  157. .class-item {
  158. display: flex;
  159. justify-content: space-between;
  160. .image {
  161. width: 218rpx;
  162. height: 164rpx;
  163. margin-right: 20rpx;
  164. image {
  165. width: 100%;
  166. height: 100%;
  167. border-radius: 16rpx;
  168. }
  169. }
  170. .item-info {
  171. width: 500rpx;
  172. .item-title {
  173. font-size: 28rpx;
  174. color: #222222;
  175. font-weight: bold;
  176. margin-bottom: 16rpx;
  177. }
  178. .item-desc {
  179. font-size: 24rpx;
  180. color: #AAAAAA;
  181. margin-bottom: 40rpx;
  182. }
  183. .item-progress {
  184. font-size: 24rpx;
  185. color: #AAAAAA;
  186. }
  187. }
  188. padding: 20rpx 0;
  189. border-bottom: 1px solid #F0F0F0;
  190. &:last-child {
  191. border-bottom: none;
  192. }
  193. }
  194. .slogan {
  195. font-size: 24rpx;
  196. color: #AAAAAA;
  197. margin-top: 100rpx;
  198. text-align: center;
  199. margin-bottom: 28rpx;
  200. }
  201. .btn {
  202. display: flex;
  203. justify-content: center;
  204. margin-bottom: 168rpx;
  205. padding: 0 184rpx;
  206. }
  207. .community-item {
  208. .community-text {
  209. color: #222222;
  210. font-size: 24rpx;
  211. margin-top: 20rpx;
  212. word-break: break-all;
  213. display: -webkit-box;
  214. -webkit-box-orient: vertical;
  215. -webkit-line-clamp: 5;
  216. /* 显示的最大行数 */
  217. overflow: hidden;
  218. }
  219. .community-img {
  220. margin-top: 22rpx;
  221. display: flex;
  222. overflow-y: scroll;
  223. image {
  224. width: 164rpx;
  225. height: 164rpx;
  226. border-radius: 16rpx;
  227. margin-right: 18rpx;
  228. }
  229. }
  230. }
  231. }
  232. .tab-group {
  233. display: flex;
  234. background: #fff;
  235. margin-top: 20rpx;
  236. .tab {
  237. padding: 28rpx 0;
  238. font-size: 32rpx;
  239. color: #222222;
  240. font-weight: Bold;
  241. margin-left: 20rpx;
  242. }
  243. .tab.active {
  244. font-weight: 600;
  245. }
  246. }
  247. }
  248. </style>
  249. <style lang="scss">
  250. .desc-box {
  251. padding: 0 20rpx 20rpx 20rpx;
  252. .goods-desc {
  253. color: #222222;
  254. font-size: 24rpx;
  255. .img_class {
  256. max-width: 100% !important;
  257. vertical-align: bottom;
  258. }
  259. }
  260. }
  261. </style>