康巴易测肤/伤疤uniapp小程序类
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

index.vue 11KB

1ヶ月前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
1ヶ月前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
1ヶ月前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
1ヶ月前
4週間前
1ヶ月前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
4週間前
4週間前
4週間前
4週間前
4週間前
4週間前
1ヶ月前
1ヶ月前
1ヶ月前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
1ヶ月前
4週間前
1ヶ月前
4週間前
1ヶ月前
1ヶ月前
1ヶ月前
1ヶ月前
1ヶ月前
1ヶ月前
1ヶ月前
1ヶ月前
1ヶ月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <view class="container">
  3. <view class="main">
  4. <!-- 步骤1内容 -->
  5. <view class="steps">
  6. <view class="step-content">
  7. <view class="step-banner">
  8. <text class="title">第<text class="count">{{ currentStep + 1 }}</text>步/共{{details.total}}步</text>
  9. <text class="subtitle">请根据真实感受如实填写资料</text>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="question">
  14. <view class="root">
  15. <u--image :src="aiRootPath" mode="widthFix" shape="circle" width="50px"
  16. height="50px"></u--image>
  17. <view class="question-text">
  18. <text>{{ details.list[currentStep].question}}</text>
  19. <view class="arrow-border"></view>
  20. <view class="arrow-background"></view>
  21. </view>
  22. </view>
  23. <view class="question-content">
  24. <scroll-view :scroll-y="true">
  25. <view class="select-list">
  26. <view class="select-item" :class="{active: details.list[currentStep].answerIndex === index}" v-for="(item, index) in questionList" :key="index" @click="onClick(item, index)">
  27. <text>{{ item }}</text>
  28. </view>
  29. </view>
  30. </scroll-view>
  31. </view>
  32. </view>
  33. <!-- 按钮操作区 -->
  34. <view class="action-buttons">
  35. <u-button @click="handleNext" shape="circle" :color="bgthemeColor" :type="currentStep === 0 ? '' : 'default'"
  36. :custom-style="{ padding: '40rpx', fontWeight: 'bold'}">
  37. <text :style="{color: themeColor, fontSize: '32rpx', fontWeight: 'bold'}"> {{ currentStep === 2 ? '提交测评' : '下一步' }}</text>
  38. </u-button>
  39. <u-button v-if="currentStep > 0" shape="circle" @click="handlePre" class="prev-btn" :custom-style="{ marginTop: '20rpx', color: '#000', fontWeight: 'bold', padding: '40rpx', }">
  40. <text :style="{color: bgthemeColor, fontSize: '32rpx', fontWeight: 'bold'}"> 上一步</text></u-button>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. currentStep: 0, // 当前步骤
  50. steps: [{ name: '步骤1' }, { name: '步骤2' }],
  51. parts: ['面部', '颈部', '胸部', '背部', '四肢', '腹部', '手部','足部', '其它'],
  52. categories: ['烧伤', '割伤', '烫伤', '手术后(含剖腹产)'],
  53. formData: {
  54. part: '',
  55. category: '',
  56. feel: '',
  57. },
  58. aiRootPath: require('../../static/tabbar/ai_root.png'),
  59. selectCurrent: null,
  60. details: {
  61. total: 3,
  62. list: [
  63. {
  64. data: ['面部', '颈部', '胸部', '背部', '四肢', '腹部', '手部和足部', '其它'],
  65. stepIndex: 0,
  66. question: '伤口受伤的部位是?',
  67. answer: '',
  68. answerIndex: null
  69. },
  70. {
  71. data: ['烧伤', '割伤', '烫伤', '手术后(含剖腹产)','跌碰撞伤', '青春痘', '宠物抓伤', '其他'],
  72. stepIndex: 1,
  73. question: '伤口受伤的类别是?',
  74. answer: '',
  75. answerIndex: null
  76. },
  77. {
  78. data: ['红肿程度', '痕痒程度', '其他'],
  79. stepIndex: 2,
  80. question: '伤口受伤的感受是?',
  81. answer: '',
  82. answerIndex: null
  83. },
  84. ]
  85. },
  86. questionList: []
  87. };
  88. },
  89. computed: {
  90. themeColor() {
  91. return this.$themeColor
  92. },
  93. bgthemeColor() {
  94. return '#000'
  95. },
  96. },
  97. onLoad() {
  98. this.questionList = this.details.list[this.currentStep].data
  99. },
  100. methods: {
  101. onClick(item, index) {
  102. console.log("item", item, index);
  103. this.details.list[this.currentStep].answer = item;
  104. this.details.list[this.currentStep].answerIndex = index;
  105. },
  106. handleNext() {
  107. if (this.currentStep === 0) {
  108. if (! this.details.list[this.currentStep].answer) {
  109. return uni.showToast({ title: '请选择伤口部位', icon: 'none' });
  110. }
  111. this.currentStep++;
  112. this.questionList = this.details.list[this.currentStep].data
  113. } else if(this.currentStep === 1){
  114. if (! this.details.list[this.currentStep].answer) {
  115. return uni.showToast({ title: '请选择伤口类别', icon: 'none' });
  116. }
  117. this.currentStep++;
  118. this.questionList = this.details.list[this.currentStep].data
  119. } else if(this.currentStep === 2){
  120. if (! this.details.list[this.currentStep].answer) {
  121. return uni.showToast({ title: '请选择伤口感受', icon: 'none' });
  122. }
  123. // 提交逻辑
  124. this.onSubmit();
  125. }
  126. },
  127. handlePre() {
  128. this.currentStep--;
  129. this.questionList = this.details.list[this.currentStep].data
  130. },
  131. onSubmit() {
  132. let that = this;
  133. uni.showLoading({
  134. title: '提交中',
  135. mask: true,
  136. })
  137. // 模拟提交 TODO
  138. setTimeout(() => {
  139. uni.showToast({ title: '提交成功', icon: 'success' });
  140. console.log('提交数据:', that.formData);
  141. let now = new Date();
  142. // 模拟缓存一个本地数据
  143. let mockList = [
  144. {
  145. date: that.$util.formateDate('mm-dd', now),
  146. time: that.$util.formateDate('HH:MM', now),
  147. day: that.$util.getDayName(),
  148. year: that.$util.formateDate('yyyy', now),
  149. imageSrc: that.$store.state.user.photoPath,
  150. evaluation: '伤口减小,肉芽无增生,皮肤逐渐变浅'
  151. }
  152. ]
  153. that.$store.commit('setResultList', mockList);
  154. that.$store.commit('saveAll');
  155. // 跳转详情
  156. uni.reLaunch({ url: '/pages/details/result' })
  157. }, 1500)
  158. }
  159. }
  160. };
  161. </script>
  162. <style scoped lang="scss">
  163. /* 容器样式 */
  164. .container {
  165. position: relative;
  166. background: #fff;
  167. overflow: hidden;
  168. .main {
  169. .steps {
  170. padding: 24rpx 32rpx;
  171. background: #F3D4A3;
  172. .step-content {
  173. background: #fff;
  174. border-radius: 20rpx;
  175. padding: 30rpx;
  176. .step-banner {
  177. display: flex;
  178. justify-content: flex-start;
  179. align-items: flex-start;
  180. flex-direction: column;
  181. .title {
  182. font-size: 30rpx;
  183. font-family: Source Han Sans CN;
  184. color: #333;
  185. font-weight: bold;
  186. .count {
  187. font-size: 40rpx;
  188. font-family: Source Han Sans CN;
  189. color: $cus-theme-color;
  190. }
  191. }
  192. .subtitle {
  193. margin-top: 10rpx;
  194. font-size: 28rpx;
  195. color: $uni-text-color-grey;
  196. }
  197. }
  198. }
  199. }
  200. .question {
  201. padding: 40rpx;
  202. .root {
  203. display: flex;
  204. justify-content: flex-start;
  205. align-items: center;
  206. .question-text {
  207. position: relative; /* 相对定位 */
  208. margin-left: 40rpx;
  209. padding: 20rpx;
  210. border: 4rpx solid #FDF2D4;
  211. background-color: #FDF2D4;
  212. color: #000000;
  213. border-radius: 20rpx;
  214. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  215. font-weight: b;
  216. text {
  217. font-family: Source Han Sans CN;
  218. font-weight: bold;
  219. font-size: 30rpx;
  220. color: #1F1F1F;
  221. }
  222. /* 外层箭头(作为边框) */
  223. .arrow-border {
  224. position: absolute;
  225. top: 20%;
  226. left: -26rpx;
  227. transform: translateX(-50%);
  228. border-width: 25rpx;
  229. border-style: solid;
  230. border-color: transparent #FDF2D4 transparent transparent; /* 浅紫色边框 */
  231. z-index: 99;
  232. }
  233. /* 内层箭头(作为背景) */
  234. .arrow-background {
  235. position: absolute;
  236. top: 20%;
  237. left: -29rpx;
  238. transform: translateX(-50%);
  239. border-width: 22rpx; /* 小三角形 */
  240. border-style: solid;
  241. border-color: transparent #FDF2D4 transparent transparent; /* 白色背景 */
  242. margin-top: 3rpx; /* 与大三角形重叠 */
  243. margin-left: 10rpx; /* 与大三角形重叠 */
  244. z-index: 999;
  245. }
  246. }
  247. }
  248. .question-content {
  249. margin: 40rpx 0;
  250. padding: 20rpx 0;
  251. max-height: 52vh;
  252. overflow: scroll;
  253. .select-list {
  254. .select-item {
  255. border-radius: 60rpx;
  256. padding: 30rpx 50rpx;
  257. margin: 20rpx 0;
  258. background-color: $uni-bg-color-grey;
  259. font-weight: bold;
  260. &.active {
  261. background-color: $cus-theme-color;
  262. color: #fff;
  263. }
  264. }
  265. }
  266. }
  267. }
  268. }
  269. }
  270. /* 单选项样式 */
  271. .radio-item {
  272. margin-bottom: 32rpx;
  273. padding: 24rpx;
  274. border-radius: 12rpx;
  275. background: #f8f8f8;
  276. }
  277. /* 按钮容器 */
  278. .action-buttons {
  279. position: relative;
  280. padding: 0 40rpx;
  281. margin: 20rpx 0 60rpx 0;
  282. display: flex;
  283. justify-content: space-between;
  284. flex-direction: column;
  285. }
  286. /* 适配不同屏幕尺寸 */
  287. @media (min-width: 768px) {
  288. .container {
  289. max-width: 600px;
  290. margin: 0 auto;
  291. }
  292. }
  293. </style>s