detail.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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 relative">
  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" style="display: flow-root;">
  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. .relative{
  143. position: relative;
  144. z-index:2;
  145. }
  146. .class-box {
  147. background: #fff;
  148. border-radius: 20rpx 20rpx 0 0;
  149. margin-top: 20rpx;
  150. padding: 28rpx 20rpx 0 20rpx;
  151. // overflow: overlay;
  152. .class-title {
  153. display: flex;
  154. justify-content: space-between;
  155. .title {
  156. font-size: 32rpx;
  157. color: #222222;
  158. font-weight: bold;
  159. }
  160. .class-length {
  161. font-size: 24rpx;
  162. color: #AAAAAA;
  163. }
  164. }
  165. .class-item {
  166. display: flex;
  167. justify-content: space-between;
  168. .image {
  169. width: 218rpx;
  170. height: 164rpx;
  171. margin-right: 20rpx;
  172. image {
  173. width: 100%;
  174. height: 100%;
  175. border-radius: 16rpx;
  176. }
  177. }
  178. .item-info {
  179. width: 500rpx;
  180. .item-title {
  181. font-size: 28rpx;
  182. color: #222222;
  183. font-weight: bold;
  184. margin-bottom: 16rpx;
  185. }
  186. .item-desc {
  187. font-size: 24rpx;
  188. color: #AAAAAA;
  189. margin-bottom: 40rpx;
  190. }
  191. .item-progress {
  192. font-size: 24rpx;
  193. color: #AAAAAA;
  194. }
  195. }
  196. padding: 20rpx 0;
  197. border-bottom: 1px solid #F0F0F0;
  198. &:last-child {
  199. border-bottom: none;
  200. }
  201. }
  202. .slogan {
  203. font-size: 24rpx;
  204. color: #AAAAAA;
  205. margin-top: 100rpx;
  206. text-align: center;
  207. margin-bottom: 28rpx;
  208. }
  209. .btn {
  210. display: flex;
  211. justify-content: center;
  212. margin-bottom: 168rpx;
  213. padding: 0 184rpx;
  214. }
  215. .community-item {
  216. .community-text {
  217. color: #222222;
  218. font-size: 24rpx;
  219. margin-top: 20rpx;
  220. word-break: break-all;
  221. display: -webkit-box;
  222. -webkit-box-orient: vertical;
  223. -webkit-line-clamp: 5;
  224. /* 显示的最大行数 */
  225. overflow: hidden;
  226. }
  227. .community-img {
  228. margin-top: 22rpx;
  229. display: flex;
  230. overflow-y: scroll;
  231. image {
  232. width: 164rpx;
  233. height: 164rpx;
  234. border-radius: 16rpx;
  235. margin-right: 18rpx;
  236. }
  237. }
  238. }
  239. }
  240. .tab-group {
  241. display: flex;
  242. background: #fff;
  243. margin-top: 20rpx;
  244. .tab {
  245. padding: 28rpx 0;
  246. font-size: 32rpx;
  247. color: #222222;
  248. font-weight: Bold;
  249. margin-left: 20rpx;
  250. }
  251. .tab.active {
  252. font-weight: 600;
  253. }
  254. }
  255. }
  256. </style>
  257. <style lang="scss">
  258. .desc-box {
  259. padding: 0 20rpx 20rpx 20rpx;
  260. .goods-desc {
  261. color: #222222;
  262. font-size: 24rpx;
  263. .img_class {
  264. max-width: 100% !important;
  265. vertical-align: bottom;
  266. }
  267. }
  268. }
  269. </style>