detail.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <view class="page">
  3. <zs-header color="#000"></zs-header>
  4. <view class="cover">
  5. <image :src="goods.goodsPath + '?x-oss-process=image/resize,h_750,w_750,m_fixed'" 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 + '?x-oss-process=image/resize,h_164,w_218,m_fixed'" 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.goods.goodsDetail = res.content.goodsInfoVo.goodsDetail.replace(/<img/gi, '<img class="img_class" ')
  92. this.communityItemDetailVo = res.content.communityItemDetailVo
  93. // 统一处理心得图片大小
  94. if (this.communityItemDetailVo) {
  95. this.communityItemDetailVo.urls = this.communityItemDetailVo.urls.map(url => url + '?x-oss-process=image/resize,h_164,w_164,m_fixed')
  96. }
  97. }
  98. })
  99. },
  100. edit(row) {
  101. uni.navigateTo({
  102. url: `/share/sharePosts?orderNo=${this.orderNo}&id=${row.id}`
  103. });
  104. }
  105. },
  106. onLoad({ orderNo }) {
  107. this.getDetail(orderNo)
  108. },
  109. onShow() {
  110. if (this.orderNo) {
  111. this.getDetail(this.orderNo)
  112. }
  113. }
  114. };
  115. </script>
  116. <style lang="scss" scoped>
  117. .page {
  118. background: #F9F9F9;
  119. min-height: 100vh;
  120. .cover {
  121. height: 750rpx;
  122. width: 750rpx;
  123. image {
  124. width: 100%;
  125. height: 100%;
  126. }
  127. }
  128. .title-box {
  129. margin: -176rpx 20rpx 0 20rpx;
  130. .title {
  131. font-size: 36rpx;
  132. color: #FFFFFF;
  133. font-weight: bold;
  134. margin-bottom: 15rpx;
  135. }
  136. .sub-title {
  137. font-size: 24rpx;
  138. color: #FFFFFF;
  139. font-weight: bold;
  140. }
  141. }
  142. .class-box {
  143. background: #fff;
  144. border-radius: 20rpx 20rpx 0 0;
  145. margin-top: 20rpx;
  146. padding: 28rpx 20rpx 0 20rpx;
  147. // overflow: overlay;
  148. position: relative;
  149. z-index:2;
  150. .class-title {
  151. display: flex;
  152. justify-content: space-between;
  153. .title {
  154. font-size: 32rpx;
  155. color: #222222;
  156. font-weight: bold;
  157. }
  158. .class-length {
  159. font-size: 24rpx;
  160. color: #AAAAAA;
  161. }
  162. }
  163. .class-item {
  164. display: flex;
  165. justify-content: space-between;
  166. .image {
  167. width: 218rpx;
  168. height: 164rpx;
  169. margin-right: 20rpx;
  170. image {
  171. width: 100%;
  172. height: 100%;
  173. border-radius: 16rpx;
  174. }
  175. }
  176. .item-info {
  177. width: 500rpx;
  178. .item-title {
  179. font-size: 28rpx;
  180. color: #222222;
  181. font-weight: bold;
  182. margin-bottom: 16rpx;
  183. }
  184. .item-desc {
  185. font-size: 24rpx;
  186. color: #AAAAAA;
  187. margin-bottom: 40rpx;
  188. }
  189. .item-progress {
  190. font-size: 24rpx;
  191. color: #AAAAAA;
  192. }
  193. }
  194. padding: 20rpx 0;
  195. border-bottom: 1px solid #F0F0F0;
  196. &:last-child {
  197. border-bottom: none;
  198. }
  199. }
  200. .slogan {
  201. font-size: 24rpx;
  202. color: #AAAAAA;
  203. margin-top: 100rpx;
  204. text-align: center;
  205. margin-bottom: 28rpx;
  206. }
  207. .btn {
  208. display: flex;
  209. justify-content: center;
  210. margin-bottom: 168rpx;
  211. padding: 0 184rpx;
  212. }
  213. .community-item {
  214. .community-text {
  215. color: #222222;
  216. font-size: 24rpx;
  217. margin-top: 20rpx;
  218. word-break: break-all;
  219. display: -webkit-box;
  220. -webkit-box-orient: vertical;
  221. -webkit-line-clamp: 5;
  222. /* 显示的最大行数 */
  223. overflow: hidden;
  224. }
  225. .community-img {
  226. margin-top: 22rpx;
  227. display: flex;
  228. overflow-y: scroll;
  229. image {
  230. width: 164rpx;
  231. height: 164rpx;
  232. border-radius: 16rpx;
  233. margin-right: 18rpx;
  234. }
  235. }
  236. }
  237. }
  238. .tab-group {
  239. display: flex;
  240. background: #fff;
  241. margin-top: 20rpx;
  242. .tab {
  243. padding: 28rpx 0;
  244. font-size: 32rpx;
  245. color: #222222;
  246. font-weight: Bold;
  247. margin-left: 20rpx;
  248. }
  249. .tab.active {
  250. font-weight: 600;
  251. }
  252. }
  253. }
  254. </style>
  255. <style lang="scss">
  256. .desc-box {
  257. padding: 0 20rpx 20rpx 20rpx;
  258. .goods-desc {
  259. color: #222222;
  260. font-size: 24rpx;
  261. .img_class {
  262. max-width: 100% !important;
  263. vertical-align: bottom;
  264. }
  265. }
  266. }
  267. </style>