吉光研途前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

226 lines
5.1 KiB

  1. <template>
  2. <view :class="['page__view', hasPoster ? 'with-bottom' : '']">
  3. <!-- 导航栏 -->
  4. <navbar :title="details.title" leftClick @leftClick="$utils.navigateBack" bgColor="#4883F9" color="#FFFFFF" />
  5. <view class="cover-image" :style="{ height: coverImageHeight }">
  6. <image class="img" :src="details.paperImage" mode="scaleToFill" ></image>
  7. </view>
  8. <!-- 学生情况 -->
  9. <view class="section" v-if="details.studentCondition">
  10. <view class="section-header">
  11. <arrow></arrow>
  12. <view>{{ details.titleOne }}</view>
  13. </view>
  14. <view class="section-content">
  15. <uv-parse :content="details.studentCondition"></uv-parse>
  16. </view>
  17. </view>
  18. <!-- 服务项目 -->
  19. <view class="section" v-if="details.serviceItem">
  20. <view class="section-header">
  21. <arrow></arrow>
  22. <view>{{ details.titleTwo }}</view>
  23. </view>
  24. <view class="section-content">
  25. <uv-parse :content="details.serviceItem"></uv-parse>
  26. </view>
  27. </view>
  28. <!-- 服务过程 -->
  29. <view class="section" v-if="details.serviceProcess">
  30. <view class="section-header">
  31. <arrow></arrow>
  32. <view>{{ details.titleThree }}</view>
  33. </view>
  34. <view class="section-content">
  35. <uv-parse :content="details.serviceProcess"></uv-parse>
  36. </view>
  37. </view>
  38. <!-- 服务结果 -->
  39. <view class="section" v-if="details.serviceResult">
  40. <view class="section-header">
  41. <arrow></arrow>
  42. <view>{{ details.titleFour }}</view>
  43. </view>
  44. <view class="section-content">
  45. <uv-parse :content="details.serviceResult"></uv-parse>
  46. </view>
  47. </view>
  48. <!-- 服务感受 -->
  49. <view class="section" v-if="details.serviceFeeling">
  50. <view class="section-header">
  51. <arrow></arrow>
  52. <view>{{ details.titleFive }}</view>
  53. </view>
  54. <view class="section-content">
  55. <uv-parse :content="details.serviceFeeling"></uv-parse>
  56. </view>
  57. </view>
  58. <view class="flex bottom" v-if="hasPoster">
  59. <view class="flex btns">
  60. <button class="btn" @click="jumpToPoster">保存海报</button>
  61. <button class="btn btn-share" open-type="share">分享文章</button>
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. import arrow from '@/components/base/arrow.vue'
  68. export default {
  69. components: {
  70. arrow,
  71. },
  72. data() {
  73. return {
  74. details: {},
  75. coverImageHeight: '890rpx',
  76. }
  77. },
  78. onLoad({ articleId }) {
  79. const windowWidth = uni.getSystemInfoSync().windowWidth
  80. this.coverImageHeight = `${(windowWidth - 18) * 890 / 750}px`
  81. this.getData(articleId)
  82. },
  83. onShareAppMessage(res) {
  84. return {
  85. title: this.posterData.paperDesc,
  86. imageUrl: this.posterData.paperImage,
  87. path: this.posterData.path,
  88. }
  89. },
  90. computed: {
  91. posterData() {
  92. const { id, title, image, paperDesc, paperImage } = this.details || {}
  93. return {
  94. paperDesc: paperDesc || title,
  95. paperImage: paperImage || image || '',
  96. path: `pages_order/case/index?articleId=${id}`
  97. }
  98. },
  99. hasPoster() {
  100. const { paperImage } = this.details || {}
  101. return !!paperImage
  102. },
  103. },
  104. methods: {
  105. async getData(articleId) {
  106. try {
  107. this.details = await this.$fetch('queryAriticleById', { articleId })
  108. } catch (err) {
  109. }
  110. },
  111. jumpToPoster() {
  112. uni.setStorageSync('posterData', this.posterData)
  113. uni.navigateTo({
  114. url: `/pages_order/case/poster`
  115. })
  116. },
  117. },
  118. }
  119. </script>
  120. <style scoped lang="scss">
  121. .page__view {
  122. box-sizing: border-box;
  123. background: #FFFFFF;
  124. padding-bottom: 36rpx;
  125. &.with-bottom {
  126. padding-bottom: calc(36rpx + 110rpx + env(safe-area-inset-bottom));
  127. }
  128. }
  129. .cover-image {
  130. position: relative;
  131. width: calc(100% - 18rpx*2);
  132. background: #FFFFFF;
  133. margin: 20rpx 18rpx 47rpx 18rpx;
  134. border-radius: 25rpx;
  135. overflow: hidden;
  136. .img {
  137. width: 100%;
  138. height: 100%;
  139. }
  140. }
  141. .section {
  142. width: 100%;
  143. padding: 0 18rpx;
  144. box-sizing: border-box;
  145. & + & {
  146. margin-top: 40rpx;
  147. }
  148. &-header {
  149. display: flex;
  150. align-items: center;
  151. justify-content: flex-start;
  152. column-gap: 5rpx;
  153. padding-left: 11rpx;
  154. font-size: 32rpx;
  155. font-weight: 700;
  156. color: #000000;
  157. }
  158. &-content {
  159. margin-top: 24rpx;
  160. padding: 24rpx;
  161. box-sizing: border-box;
  162. white-space: pre-line;
  163. font-size: 28rpx;
  164. color: #000000;
  165. background: #F8F8F8;
  166. border-radius: 15rpx;
  167. }
  168. }
  169. .bottom {
  170. position: fixed;
  171. left: 0;
  172. bottom: 0;
  173. width: 100vw;
  174. height: 110rpx;
  175. padding-bottom: env(safe-area-inset-bottom);
  176. background: #FFFFFF;
  177. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  178. .btns {
  179. column-gap: 34rpx;
  180. }
  181. .btn {
  182. padding: 20rpx 90rpx;
  183. font-size: 28rpx;
  184. color: #FFFFFF;
  185. background: #4883F9;
  186. border-radius: 42rpx;
  187. &-share {
  188. background: #FFD019;
  189. }
  190. }
  191. }
  192. </style>