posture-guide.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <view class="posture-guide">
  3. <view class="guide-content">
  4. <view class="guide-title">体态评估环节</view>
  5. <view class="guide-subtitle">请仔细阅读下方说明,完整展示手臂</view>
  6. <!-- 添加轮播图组件 -->
  7. <swiper
  8. class="guide-swiper"
  9. :indicator-dots="true"
  10. indicator-color="rgba(0, 0, 0, .3)"
  11. indicator-active-color="#000000"
  12. :autoplay="false"
  13. @change="handleSwiperChange"
  14. >
  15. <swiper-item v-for="(item, index) in guideImages" :key="index">
  16. <view class="swiper-item">
  17. <image :src="item.url" mode="aspectFit" class="guide-image"></image>
  18. <view class="image-description">{{item.description}}</view>
  19. </view>
  20. </swiper-item>
  21. </swiper>
  22. <!-- <view class="guide-instructions">
  23. <text>{{currentInstruction}}</text>
  24. </view> -->
  25. <!-- 按钮根据是否是最后一张图片来决定是否禁用 -->
  26. <button
  27. class="confirm-button"
  28. :class="{'button-disabled': !isLastSlide}"
  29. :disabled="!isLastSlide"
  30. @click="handleConfirm"
  31. >
  32. {{isLastSlide ? '我知道了,开始采集' : '请查看完所有说明'}}
  33. </button>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. currentIndex: 0,
  42. isLastSlide: false,
  43. guideImages: [
  44. {
  45. url: 'https://data.qicai321.com/minlong/85fbafbd-1b80-48cd-bcd6-fc4911e9ff54.jpg',
  46. description: '左手手掌'
  47. },
  48. {
  49. url: 'https://data.qicai321.com/minlong/17d141e0-8f99-4a54-a534-f6b954c600f8.png',
  50. description: '左手手背'
  51. },
  52. {
  53. url: 'https://data.qicai321.com/minlong/5c7d7d6f-5e14-4cd6-bb9f-11509473a8bb.png',
  54. description: '左手握拳'
  55. },
  56. {
  57. url: 'https://data.qicai321.com/minlong/148eea00-21b4-49e1-a3b6-712fff08a5a8.png',
  58. description: '右手手掌'
  59. },
  60. {
  61. url: 'https://data.qicai321.com/minlong/c67c303e-91c0-4e79-8e82-84096435481f.png',
  62. description: '右手手背'
  63. },
  64. {
  65. url: 'https://data.qicai321.com/minlong/5a093f70-d397-4a36-9539-a8b4d11e0a13.png',
  66. description: '右手握拳'
  67. },
  68. ],
  69. instructions: [
  70. '第1步:请按图示展示左手手掌',
  71. '第2步:请按图示展示左手手背',
  72. '第3步:请按图示展示左手握拳',
  73. '第4步:请按图示展示右手手掌',
  74. '第5步:请按图示展示右手手背',
  75. '第6步:请按图示展示右手握拳'
  76. ]
  77. }
  78. },
  79. computed: {
  80. currentInstruction() {
  81. return this.instructions[this.currentIndex];
  82. }
  83. },
  84. methods: {
  85. handleSwiperChange(e) {
  86. this.currentIndex = e.detail.current;
  87. // 判断是否是最后一张图片
  88. this.isLastSlide = this.currentIndex === this.guideImages.length - 1;
  89. },
  90. handleConfirm() {
  91. if (this.isLastSlide) {
  92. uni.navigateTo({
  93. url: '/pages/interview/interview'
  94. });
  95. } else {
  96. uni.showToast({
  97. title: '请查看完所有说明',
  98. icon: 'none'
  99. });
  100. }
  101. }
  102. }
  103. }
  104. </script>
  105. <style>
  106. .posture-guide {
  107. min-height: 100vh;
  108. background-color: #fff;
  109. padding: 30rpx;
  110. }
  111. .guide-content {
  112. display: flex;
  113. flex-direction: column;
  114. align-items: center;
  115. }
  116. .guide-title {
  117. font-size: 36rpx;
  118. font-weight: bold;
  119. margin-bottom: 20rpx;
  120. color: #333;
  121. }
  122. .guide-subtitle {
  123. font-size: 28rpx;
  124. color: #666;
  125. margin-bottom: 40rpx;
  126. }
  127. /* 轮播图样式 */
  128. .guide-swiper {
  129. width: 100%;
  130. height: 800rpx;
  131. margin: 30rpx 0;
  132. position: relative;
  133. padding-bottom: 40rpx; /* 添加底部padding为指示点留出空间 */
  134. }
  135. .swiper-item {
  136. display: flex;
  137. flex-direction: column;
  138. align-items: center;
  139. justify-content: center;
  140. height: 100%;
  141. }
  142. .guide-image {
  143. width: 90%;
  144. height: 600rpx;
  145. object-fit: contain;
  146. }
  147. .image-description {
  148. margin-top: 20rpx;
  149. font-size: 28rpx;
  150. color: #333;
  151. text-align: center;
  152. }
  153. .guide-instructions {
  154. padding: 20rpx;
  155. margin: 30rpx 0;
  156. text-align: center;
  157. font-size: 28rpx;
  158. color: #666;
  159. background-color: #f8f8f8;
  160. border-radius: 10rpx;
  161. width: 90%;
  162. margin-top: 60rpx;
  163. }
  164. .confirm-button {
  165. width: 80%;
  166. height: 88rpx;
  167. line-height: 88rpx;
  168. background-color: #0039b3;
  169. color: #fff;
  170. border-radius: 44rpx;
  171. font-size: 32rpx;
  172. margin-top: 40rpx;
  173. }
  174. /* 禁用状态的按钮样式 */
  175. .button-disabled {
  176. background-color: #cccccc;
  177. opacity: 0.8;
  178. }
  179. /* 修改指示点容器样式 */
  180. :deep(.uni-swiper-dots) {
  181. display: flex;
  182. justify-content: center;
  183. position: absolute;
  184. bottom: 0;
  185. left: 0;
  186. right: 0;
  187. }
  188. /* 修改指示点样式 */
  189. :deep(.uni-swiper-dot) {
  190. width: 16rpx !important;
  191. height: 16rpx !important;
  192. margin: 0 8rpx !important;
  193. border-radius: 50%;
  194. background: rgba(0, 0, 0, 0.3) !important;
  195. }
  196. :deep(.uni-swiper-dot-active) {
  197. background: #000000 !important;
  198. }
  199. </style>