康巴易测肤/伤疤uniapp小程序类
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1 个月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view class="container">
  3. <view class="main">
  4. <!-- 步骤1内容 -->
  5. <view class="steps">
  6. <view v-show="currentStep === 0" class="step-content">
  7. <view class="step-banner">
  8. <text class="title">第<text class="count">1</text>步/共2步</text>
  9. <text class="subtitle">请根据真实感受如实填写资料</text>
  10. </view>
  11. </view>
  12. <!-- 步骤2内容 -->
  13. <!-- <view v-show="currentStep === 1" class="step-content">
  14. <view class="question">
  15. <text class="title">第2步/共2步</text>
  16. <text class="subtitle">请根据真实感受如实填写资料</text>
  17. <text class="question-text">伤口受伤的类别是?</text>
  18. <u-radio-group v-model="formData.category">
  19. <u-radio v-for="(item, index) in categories" :key="index" :name="item" class="radio-item">{{
  20. item
  21. }}</u-radio>
  22. </u-radio-group>
  23. </view>
  24. </view> -->
  25. </view>
  26. <view class="question">
  27. <view class="root">
  28. <u--image src="https://uviewui.com/album/1.jpg" mode="widthFix" shape="circle" width="50px"
  29. height="50px"></u--image>
  30. <view class="question-text">
  31. <text>伤口受伤的部位是?</text>
  32. <view class="arrow-border"></view>
  33. <view class="arrow-background"></view>
  34. </view>
  35. </view>
  36. <view class="question-content">
  37. <scroll-view :scroll-y="true">
  38. <view class="select-list">
  39. <view class="select-item" :class="{active: selectCurrent === index}" v-for="(item, index) in list" :key="index" @click="onClick(item, index)">
  40. <text>{{ item.name }}</text>
  41. </view>
  42. </view>
  43. </scroll-view>
  44. </view>
  45. </view>
  46. <!-- 按钮操作区 -->
  47. <view class="action-buttons">
  48. <u-button @click="handleNext" shape="circle" color="#6049a9" :type="currentStep === 0 ? '' : 'default'"
  49. :custom-style="{ padding: '40rpx', fontWeight: 'bold'}">
  50. {{ currentStep === 0 ? '下一步' : '提交测评' }}
  51. </u-button>
  52. <u-button v-if="currentStep > 0" shape="circle" @click="currentStep--" class="prev-btn"
  53. :custom-style="{ marginTop: '20rpx', color: '#6049a9', fontWeight: 'bold', padding: '40rpx', }">上一步</u-button>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. data() {
  61. return {
  62. currentStep: 0, // 当前步骤
  63. steps: [{ name: '步骤1' }, { name: '步骤2' }],
  64. parts: ['面部', '颈部', '胸部', '背部', '四肢', '腹部', '手部和足部', '其它'],
  65. categories: ['烧伤', '割伤', '烫伤', '手术后(含剖腹产)'],
  66. formData: {
  67. part: '',
  68. category: ''
  69. },
  70. selectCurrent: null,
  71. list: [
  72. { name: '面部', value: 1, },
  73. { name: '面部', value: 1, },
  74. { name: '面部', value: 1, },
  75. { name: '面部', value: 1, },
  76. { name: '面部', value: 1, },
  77. { name: '面部', value: 1, },
  78. { name: '面部', value: 1, },
  79. ]
  80. };
  81. },
  82. methods: {
  83. onClick(item, index) {
  84. this.selectCurrent = index;
  85. this.formData.part = item.name
  86. },
  87. handleNext() {
  88. if (this.currentStep === 0) {
  89. if (!this.formData.part) {
  90. return uni.showToast({ title: '请选择受伤部位', icon: 'none' });
  91. }
  92. this.currentStep++;
  93. } else {
  94. if (!this.formData.category) {
  95. return uni.showToast({ title: '请选择受伤类别', icon: 'none' });
  96. }
  97. // 提交逻辑
  98. uni.showToast({ title: '提交成功', icon: 'success' });
  99. console.log('提交数据:', this.formData);
  100. }
  101. }
  102. }
  103. };
  104. </script>
  105. <style scoped lang="scss">
  106. /* 容器样式 */
  107. .container {
  108. position: relative;
  109. background: #fff;
  110. overflow: hidden;
  111. .main {
  112. .steps {
  113. padding: 24rpx 32rpx;
  114. background: $cus-theme-color;
  115. .step-content {
  116. background: #fff;
  117. border-radius: 20rpx;
  118. padding: 30rpx;
  119. .step-banner {
  120. display: flex;
  121. justify-content: flex-start;
  122. align-items: flex-start;
  123. flex-direction: column;
  124. .title {
  125. font-size: 36rpx;
  126. color: #333;
  127. font-weight: bold;
  128. .count {
  129. font-size: 40rpx;
  130. color: $cus-theme-color;
  131. }
  132. }
  133. .subtitle {
  134. margin-top: 10rpx;
  135. font-size: 28rpx;
  136. color: $uni-text-color-grey;
  137. }
  138. }
  139. }
  140. }
  141. .question {
  142. padding: 40rpx;
  143. .root {
  144. display: flex;
  145. justify-content: flex-start;
  146. align-items: center;
  147. .question-text {
  148. position: relative; /* 相对定位 */
  149. margin-left: 40rpx;
  150. padding: 20rpx;
  151. border: 4rpx solid $cus-theme-color;
  152. background-color: #e6e6fa;
  153. color: #000000;
  154. border-radius: 20rpx;
  155. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  156. font-weight: b;
  157. /* 外层箭头(作为边框) */
  158. .arrow-border {
  159. position: absolute;
  160. top: 20%;
  161. left: -26rpx;
  162. transform: translateX(-50%);
  163. border-width: 25rpx;
  164. border-style: solid;
  165. border-color: transparent $cus-theme-color transparent transparent; /* 浅紫色边框 */
  166. z-index: 99;
  167. }
  168. /* 内层箭头(作为背景) */
  169. .arrow-background {
  170. position: absolute;
  171. top: 20%;
  172. left: -29rpx;
  173. transform: translateX(-50%);
  174. border-width: 22rpx; /* 小三角形 */
  175. border-style: solid;
  176. border-color: transparent #e6e6fa transparent transparent; /* 白色背景 */
  177. margin-top: 3rpx; /* 与大三角形重叠 */
  178. margin-left: 10rpx; /* 与大三角形重叠 */
  179. z-index: 999;
  180. }
  181. }
  182. }
  183. .question-content {
  184. margin: 40rpx 0;
  185. padding: 20rpx 0;
  186. max-height: 65vh;
  187. overflow: scroll;
  188. .select-list {
  189. .select-item {
  190. border-radius: 60rpx;
  191. padding: 30rpx 50rpx;
  192. margin: 20rpx 0;
  193. background-color: $uni-bg-color-grey;
  194. font-weight: bold;
  195. &.active {
  196. background-color: $cus-theme-color;
  197. color: #fff;
  198. }
  199. }
  200. }
  201. }
  202. }
  203. }
  204. }
  205. /* 单选项样式 */
  206. .radio-item {
  207. margin-bottom: 32rpx;
  208. padding: 24rpx;
  209. border-radius: 12rpx;
  210. background: #f8f8f8;
  211. }
  212. /* 按钮容器 */
  213. .action-buttons {
  214. position: relative;
  215. padding: 0 40rpx;
  216. margin: 20rpx 0 60rpx 0;
  217. display: flex;
  218. justify-content: space-between;
  219. flex-direction: column;
  220. }
  221. /* 适配不同屏幕尺寸 */
  222. @media (min-width: 768px) {
  223. .container {
  224. max-width: 600px;
  225. margin: 0 auto;
  226. }
  227. }
  228. </style>s