Browse Source

feat: 实现健康问卷表单功能,修复年龄选择样式和BOM头问题

1.  修复多个文件的多余BOM头字符问题
2.  重构年龄选择器的选中逻辑
3.  新增工具方法处理数字比较和包含判断
4.  完整实现健康问卷页面,包括分步答题、单选多选切换、其他输入、表单验证和提交功能
5.  更新接口文档,新增健康问卷相关API文档
master
kola-web 8 hours ago
parent
commit
8b196294ea
  1. 2
      src/doc/pages/doc2/index.ts
  2. 2
      src/doctor/pages/d_changeDoctor/index.wxml
  3. 2
      src/doctor/pages/d_patient/index.ts
  4. 2
      src/doctor/pages/d_patientList/index.ts
  5. 2
      src/gift/pages/cutaneous/index.wxml
  6. 2
      src/gift/pages/cutaneousDetail/index.wxml
  7. 2
      src/gift/pages/cutaneousVideo/index.wxml
  8. 2
      src/gift/pages/myHealthRecord/index.wxml
  9. 2
      src/gift/pages/vipCert/index.wxml
  10. 2
      src/gift/pages/vipPending/index.wxml
  11. 2
      src/gift/pages/vipReject/index.wxml
  12. 2
      src/gift/pages/vipStartPending/index.wxml
  13. 2
      src/pages/cancellation/index.wxml
  14. 2
      src/pages/certPending/index.wxml
  15. 2
      src/pages/certReslove/index.wxml
  16. 2
      src/pages/comIns/index.wxml
  17. 2
      src/pages/doctorDetail/index.wxml
  18. 2
      src/pages/doctorDetailBak/index.wxml
  19. 2
      src/pages/drugRecord/index.wxml
  20. 9
      src/pages/enterInfo/index.wxml
  21. 2
      src/pages/family/index.wxml
  22. 2
      src/pages/familyList/index.wxml
  23. 2
      src/pages/familyScan/index.wxml
  24. 2
      src/pages/getUserInfo/index.wxml
  25. 2
      src/pages/infusionCenter/index.wxml
  26. 2
      src/pages/login/index.wxml
  27. 2
      src/pages/publishStoryDetail/index.wxml
  28. 55
      src/pages/qaForm/index.scss
  29. 181
      src/pages/qaForm/index.ts
  30. 51
      src/pages/qaForm/index.wxml
  31. 2
      src/pages/referral/index.wxml
  32. 2
      src/pages/repository/index.ts
  33. 2
      src/pages/repositoryDetail/index.wxml
  34. 2
      src/pages/signIn/index.wxml
  35. 2
      src/pages/smallPage/index.wxml
  36. 2
      src/pages/startPending/index.wxml
  37. 2
      src/pages/startReject/index.wxml
  38. 2
      src/pages/story/index.wxml
  39. 2
      src/pages/storyDetail/index.wxml
  40. 2
      src/pages/storyEnterResult/index.wxml
  41. 2
      src/pages/storyGuide/index.wxml
  42. 2
      src/pages/storyList/index.wxml
  43. 2
      src/pages/taskAgreement/index.wxml
  44. 2
      src/pages/thePublic/index.wxml
  45. 2
      src/pages/uploadCert/index.wxml
  46. 2
      src/pages/vipLogin/index.wxml
  47. 2
      src/pages/vipLoginReject/index.wxml
  48. 2
      src/public/pages/informedStart/index.wxml
  49. 2
      src/utils/page.ts
  50. 8
      src/utils/tools.wxs
  51. 14
      接口文档.md

2
src/doc/pages/doc2/index.ts

@ -1,4 +1,4 @@
const _app = getApp<IAppOption>() const _app = getApp<IAppOption>()
Page({ Page({
data: { data: {

2
src/doctor/pages/d_changeDoctor/index.wxml

@ -1,4 +1,4 @@
<view class="page" style="background: url({{imageUrl}}/bg4.png?t={{Timestamp}}) no-repeat top center / 100% 648rpx"> <view class="page" style="background: url({{imageUrl}}/bg4.png?t={{Timestamp}}) no-repeat top center / 100% 648rpx">
<navBar background="{{background}}" fixed back bind:back="handleBack"></navBar> <navBar background="{{background}}" fixed back bind:back="handleBack"></navBar>
<view class="container"> <view class="container">
<view class="c-title">尊敬的医生您好</view> <view class="c-title">尊敬的医生您好</view>

2
src/doctor/pages/d_patient/index.ts

@ -1,4 +1,4 @@
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { filterColumns } from '@/utils/doctorPatientTask' import { filterColumns } from '@/utils/doctorPatientTask'
const app = getApp<IAppOption>() const app = getApp<IAppOption>()

2
src/doctor/pages/d_patientList/index.ts

@ -1,4 +1,4 @@
import dayjs from 'dayjs' import dayjs from 'dayjs'
const app = getApp<IAppOption>() const app = getApp<IAppOption>()

2
src/gift/pages/cutaneous/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<view <view
class="page1" class="page1"
style="background: url({{imageUrl}}/cutaneous/home1.png?t={{Timestamp}}) no-repeat top center/100%;" style="background: url({{imageUrl}}/cutaneous/home1.png?t={{Timestamp}}) no-repeat top center/100%;"

2
src/gift/pages/cutaneousDetail/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<image <image
class="card" class="card"
mode="widthFix" mode="widthFix"

2
src/gift/pages/cutaneousVideo/index.wxml

@ -1,4 +1,4 @@
<view <view
class="page" class="page"
id="{{theme === 'DRUG' && 'drug-page'}}" id="{{theme === 'DRUG' && 'drug-page'}}"
style="background: url({{imageUrl}}cutaneous/video-bg.png?t={{Timestamp}}) no-repeat 0 60rpx/100% 648rpx;" style="background: url({{imageUrl}}cutaneous/video-bg.png?t={{Timestamp}}) no-repeat 0 60rpx/100% 648rpx;"

2
src/gift/pages/myHealthRecord/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<navBar back background="{{background}}" bind:back="handleBack" title="健康报告"></navBar> <navBar back background="{{background}}" bind:back="handleBack" title="健康报告"></navBar>
<view class="calendar-wrap {{!fold && 'expend'}}"> <view class="calendar-wrap {{!fold && 'expend'}}">
<view class="calendar"> <view class="calendar">

2
src/gift/pages/vipCert/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<image class="bg" mode="widthFix" src="{{imageUrl}}1/login-bg.png?t={{Timestamp}}"></image> <image class="bg" mode="widthFix" src="{{imageUrl}}1/login-bg.png?t={{Timestamp}}"></image>
<view class="page-container"> <view class="page-container">
<navBar title="专属服务用户进入" back="{{true}}" bind:back="handleBack"></navBar> <navBar title="专属服务用户进入" back="{{true}}" bind:back="handleBack"></navBar>

2
src/gift/pages/vipPending/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<image class="bg" mode="widthFix" src="{{imageUrl}}1/login-bg.png?t={{Timestamp}}"></image> <image class="bg" mode="widthFix" src="{{imageUrl}}1/login-bg.png?t={{Timestamp}}"></image>
<view class="page-container"> <view class="page-container">
<navBar title="" back="{{true}}" bind:back="handleBack"></navBar> <navBar title="" back="{{true}}" bind:back="handleBack"></navBar>

2
src/gift/pages/vipReject/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<view class="page-container"> <view class="page-container">
<image class="page-icon" src="{{imageUrl}}icon50.png?t={{Timestamp}}"></image> <image class="page-icon" src="{{imageUrl}}icon50.png?t={{Timestamp}}"></image>
<view class="page-title">审核未通过</view> <view class="page-title">审核未通过</view>

2
src/gift/pages/vipStartPending/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<image class="bg" mode="widthFix" src="{{imageUrl}}1/login-mask-bg.png?t={{Timestamp}}"></image> <image class="bg" mode="widthFix" src="{{imageUrl}}1/login-mask-bg.png?t={{Timestamp}}"></image>
<view class="page-container"> <view class="page-container">
<navBar title="" back="{{true}}" bind:back="handleBack"></navBar> <navBar title="" back="{{true}}" bind:back="handleBack"></navBar>

2
src/pages/cancellation/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<navBar back bind:back="handleBack" color="#fff" icon-theme="white" title="注销帐号"></navBar> <navBar back bind:back="handleBack" color="#fff" icon-theme="white" title="注销帐号"></navBar>
<view class="container"> <view class="container">
<view class="banner"> <view class="banner">

2
src/pages/certPending/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<view class="page-container"> <view class="page-container">
<image class="page-icon" src="{{imageUrl}}icon49.png?t={{Timestamp}}"></image> <image class="page-icon" src="{{imageUrl}}icon49.png?t={{Timestamp}}"></image>
<view class="page-title">提交成功,审核中</view> <view class="page-title">提交成功,审核中</view>

2
src/pages/certReslove/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<image class="bg" src="{{imageUrl}}bg17.png?t={{Timestamp}}"></image> <image class="bg" src="{{imageUrl}}bg17.png?t={{Timestamp}}"></image>
<view class="content"> <view class="content">
功能即将开放 功能即将开放

2
src/pages/comIns/index.wxml

@ -1,4 +1,4 @@
<view <view
class="page" class="page"
id="{{theme === 'DRUG' && 'drug-page'}}" id="{{theme === 'DRUG' && 'drug-page'}}"
style="background: url({{imageUrl}}/1.5/drug-record-bg.png?t={{Timestamp}}) no-repeat top center / 100% ;padding-top:{{bottom+30}}px" style="background: url({{imageUrl}}/1.5/drug-record-bg.png?t={{Timestamp}}) no-repeat top center / 100% ;padding-top:{{bottom+30}}px"

2
src/pages/doctorDetail/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<view class="container"> <view class="container">
<view class="c-header"> <view class="c-header">
<view class="avatar"> <view class="avatar">

2
src/pages/doctorDetailBak/index.wxml

@ -1,4 +1,4 @@
<view <view
class="page" class="page"
id="{{theme === 'DRUG' && 'drug-page'}}" id="{{theme === 'DRUG' && 'drug-page'}}"
style="background: url({{imageUrl}}/1.5/hostipal.png?t={{Timestamp}}) no-repeat top center / 100% 520rpx;padding-top:{{bottom}}px" style="background: url({{imageUrl}}/1.5/hostipal.png?t={{Timestamp}}) no-repeat top center / 100% 520rpx;padding-top:{{bottom}}px"

2
src/pages/drugRecord/index.wxml

@ -1,4 +1,4 @@
<view <view
class="page" class="page"
id="{{theme === 'DRUG' && 'drug-page'}}" id="{{theme === 'DRUG' && 'drug-page'}}"
style="background: url({{imageUrl}}/1.5/drug-record-bg.png?t={{Timestamp}}) no-repeat top center / 100% ;padding-top:{{bottom+30}}px" style="background: url({{imageUrl}}/1.5/drug-record-bg.png?t={{Timestamp}}) no-repeat top center / 100% ;padding-top:{{bottom+30}}px"

9
src/pages/enterInfo/index.wxml

@ -29,10 +29,10 @@
<view class="row row-age"> <view class="row row-age">
<view class="age-item {{ageRange==1 && 'active'}}" data-id="1" bind:tap="handleSelectAge">{{"<40岁"}}</view> <view class="age-item {{ageRange==1 && 'active'}}" data-id="1" bind:tap="handleSelectAge">{{"<40岁"}}</view>
<view class="age-item {{ageRange==2 && 'active'}}" data-id="2" bind:tap="handleSelectAge">{{"40 - 49 岁"}}</view> <view class="age-item {{ageRange==2 && 'active'}}" data-id="2" bind:tap="handleSelectAge">{{"40 - 49 岁"}}</view>
<view class="age-item {{ageRange==2 && 'active'}}" data-id="3" bind:tap="handleSelectAge">{{"50 - 59 岁"}}</view> <view class="age-item {{ageRange==3 && 'active'}}" data-id="3" bind:tap="handleSelectAge">{{"50 - 59 岁"}}</view>
<view class="age-item {{ageRange==2 && 'active'}}" data-id="4" bind:tap="handleSelectAge">{{"60 - 69 岁"}}</view> <view class="age-item {{ageRange==4 && 'active'}}" data-id="4" bind:tap="handleSelectAge">{{"60 - 69 岁"}}</view>
<view class="age-item {{ageRange==2 && 'active'}}" data-id="5" bind:tap="handleSelectAge">{{"70 - 79 岁"}}</view> <view class="age-item {{ageRange==5 && 'active'}}" data-id="5" bind:tap="handleSelectAge">{{"70 - 79 岁"}}</view>
<view class="age-item {{ageRange==2 && 'active'}}" data-id="6" bind:tap="handleSelectAge">{{"≥80 岁"}}</view> <view class="age-item {{ageRange==6 && 'active'}}" data-id="6" bind:tap="handleSelectAge">{{"≥80 岁"}}</view>
</view> </view>
<view class="row-title">从首次确诊IgG4相关性疾病,到现在多久了</view> <view class="row-title">从首次确诊IgG4相关性疾病,到现在多久了</view>
<view class="row row-age"> <view class="row row-age">
@ -63,7 +63,6 @@
<input <input
model:value="{{name}}" model:value="{{name}}"
class="input" class="input"
focus
maxlength="{{8}}" maxlength="{{8}}"
placeholder-style="color:rgba(34,34,34,0.3)" placeholder-style="color:rgba(34,34,34,0.3)"
placeholder="输入真实姓名" placeholder="输入真实姓名"

2
src/pages/family/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<navBar back bind:back="handleBack" fixed title="我的亲友"></navBar> <navBar back bind:back="handleBack" fixed title="我的亲友"></navBar>
<image class="bg" mode="widthFix" src="{{imageUrl}}1/my-bg.png?t={{Timestamp}}"></image> <image class="bg" mode="widthFix" src="{{imageUrl}}1/my-bg.png?t={{Timestamp}}"></image>
<view class="page-container"> <view class="page-container">

2
src/pages/familyList/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<navBar back fixed title="我的亲友" bind:back="handleBack"></navBar> <navBar back fixed title="我的亲友" bind:back="handleBack"></navBar>
<image class="bg" mode="widthFix" src="{{imageUrl}}1/my-bg.png?t={{Timestamp}}"></image> <image class="bg" mode="widthFix" src="{{imageUrl}}1/my-bg.png?t={{Timestamp}}"></image>
<view class="page-container"> <view class="page-container">

2
src/pages/familyScan/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<navBar fixed></navBar> <navBar fixed></navBar>
<image class="bg" mode="aspectFill" src="{{imageUrl}}1/family-scan.png?t={{Timestamp}}"></image> <image class="bg" mode="aspectFill" src="{{imageUrl}}1/family-scan.png?t={{Timestamp}}"></image>
<view class="banner"> <view class="banner">

2
src/pages/getUserInfo/index.wxml

@ -1,4 +1,4 @@
<view <view
class="page" class="page"
id="{{theme === 'DRUG' && 'drug-page'}}" id="{{theme === 'DRUG' && 'drug-page'}}"
style="background: url({{imageUrl}}/1/adl-detail-bg.png?t={{Timestamp}}) no-repeat top center / 100% ;padding-top:{{bottom}}px" style="background: url({{imageUrl}}/1/adl-detail-bg.png?t={{Timestamp}}) no-repeat top center / 100% ;padding-top:{{bottom}}px"

2
src/pages/infusionCenter/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<image class="banner" mode="widthFix" src="{{imageUrl}}/bg6.png"></image> <image class="banner" mode="widthFix" src="{{imageUrl}}/bg6.png"></image>
<view class="container"> <view class="container">
<view class="title">{{detail.Name}}</view> <view class="title">{{detail.Name}}</view>

2
src/pages/login/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<image class="bg" mode="widthFix" src="{{imageUrl}}1/login-bg.png?t={{Timestamp}}"></image> <image class="bg" mode="widthFix" src="{{imageUrl}}1/login-bg.png?t={{Timestamp}}"></image>
<image src="/src{{imageUrl}}bg1.png?t={{Timestamp}}"></image> <image src="/src{{imageUrl}}bg1.png?t={{Timestamp}}"></image>
<view class="container"> <view class="container">

2
src/pages/publishStoryDetail/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<navBar background="{{background}}" title="患者故事" back bind:back="handleBack"></navBar> <navBar background="{{background}}" title="患者故事" back bind:back="handleBack"></navBar>
<image wx:if="{{detail.TitlePicLink}}" mode="aspectFill" class="banner-img" src="{{detail.TitlePicLink}}"></image> <image wx:if="{{detail.TitlePicLink}}" mode="aspectFill" class="banner-img" src="{{detail.TitlePicLink}}"></image>
<view class="page-container"> <view class="page-container">

55
src/pages/qaForm/index.scss

@ -22,6 +22,7 @@ page {
} }
} }
} }
.question-section {
.list-title { .list-title {
margin: 24rpx 40rpx 0; margin: 24rpx 40rpx 0;
font-size: 44rpx; font-size: 44rpx;
@ -29,11 +30,9 @@ page {
} }
.list { .list {
margin: 0 40rpx 0; margin: 0 40rpx 0;
padding-bottom: 200rpx; padding-bottom: 16rpx;
.list-item { .list-item {
margin-top: 24rpx; margin-top: 24rpx;
.check {
width: 100%;
padding: 38rpx 32rpx; padding: 38rpx 32rpx;
background-color: #fff; background-color: #fff;
box-sizing: border-box; box-sizing: border-box;
@ -41,12 +40,54 @@ page {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 20rpx; gap: 20rpx;
border: 2px solid transparent;
&.active {
border-color: #0eb66d;
.check-icon {
border-color: #0eb66d;
background: linear-gradient(94deg, #0eb66d 0%, #00d277 100%);
.icon-inner {
opacity: 1;
}
}
}
.check-icon {
flex-shrink: 0;
width: 44rpx;
height: 44rpx;
border-radius: 8rpx;
border: 2px solid rgba(187, 187, 187, 1);
display: flex;
align-items: center;
justify-content: center;
.icon-inner {
width: 22rpx;
height: 12rpx;
border-left: 4rpx solid #fff;
border-bottom: 4rpx solid #fff;
transform: rotate(-45deg) translate(2rpx, -4rpx);
opacity: 0;
}
}
.content { .content {
font-size: 40rpx; font-size: 40rpx;
color: rgba(34, 34, 34, 1); color: rgba(34, 34, 34, 1);
} }
} }
} }
.other-section {
margin: 24rpx 40rpx 0;
.other-input {
width: 100%;
padding: 24rpx 32rpx;
background-color: #fff;
border-radius: 24rpx;
box-sizing: border-box;
font-size: 36rpx;
color: rgba(34, 34, 34, 1);
min-height: 120rpx;
}
}
} }
.footer { .footer {
position: fixed; position: fixed;
@ -73,7 +114,6 @@ page {
} }
.next { .next {
flex: 1; flex: 1;
flex: 1;
height: 96rpx; height: 96rpx;
box-sizing: border-box; box-sizing: border-box;
font-size: 40rpx; font-size: 40rpx;
@ -91,6 +131,13 @@ page {
.p-item.active { .p-item.active {
background: linear-gradient(270deg, #b384f4 0%, #5956e9 100%); background: linear-gradient(270deg, #b384f4 0%, #5956e9 100%);
} }
.list-item.active {
border-color: rgba(89, 86, 233, 1);
.check-icon {
border-color: rgba(89, 86, 233, 1);
background: linear-gradient(270deg, #5956e9 0%, #b384f4 100%);
}
}
.prev { .prev {
border-color: rgba(89, 86, 233, 1); border-color: rgba(89, 86, 233, 1);
color: rgba(89, 86, 233, 1); color: rgba(89, 86, 233, 1);

181
src/pages/qaForm/index.ts

@ -1,8 +1,181 @@
const _app = getApp<IAppOption>(); const app = getApp<IAppOption>()
interface IOption {
key: string
value: string
}
interface IQuestion {
QuestionNo: number
QuestionContent: string
QuestionType: number
HasOther: number
Options: Record<string, string>
Answer: number[] | number
OtherText: string
optionList: IOption[]
}
Page({ Page({
data: {
currentIndex: 0,
questions: [] as IQuestion[],
hasSubmitted: false,
latestSubmitTime: '',
isSubmitting: false,
},
onLoad() {
app.waitLogin().then(() => {
this.getQuestionnaire()
})
},
getQuestionnaire() {
wx.ajax({
method: 'GET',
url: '?r=igg4/health-question/get-patient-questionnaire',
data: {}, data: {},
onLoad() {}, }).then((res: any) => {
}); const questions: IQuestion[] = (res.questions || []).map((q: any) => {
const optionList: IOption[] = Object.entries(q.Options || {}).map(([key, value]) => ({
key,
value: value as string,
}))
let Answer: number[] | number = q.QuestionType === 2 ? [] : 0
let OtherText = ''
if (q.Answer !== undefined && q.Answer !== null) {
Answer = q.Answer
OtherText = q.OtherText || ''
}
return {
QuestionNo: q.QuestionNo,
QuestionContent: q.QuestionContent,
QuestionType: q.QuestionType,
HasOther: q.HasOther,
Options: q.Options,
Answer,
OtherText,
optionList,
}
})
this.setData({
questions,
hasSubmitted: res.hasSubmitted || false,
latestSubmitTime: res.latestSubmitTime || '',
})
})
},
handleSelect(e: any) {
const { key } = e.currentTarget.dataset
const { currentIndex, questions } = this.data
const question = questions[currentIndex]
const numKey = Number(key)
if (question.QuestionType === 2) {
let answer = [...(question.Answer as number[])]
const idx = answer.indexOf(numKey)
if (idx > -1) {
answer.splice(idx, 1)
} else {
answer.push(numKey)
}
this.setData({
[`questions[${currentIndex}].Answer`]: answer,
})
} else {
this.setData({
[`questions[${currentIndex}].Answer`]: numKey,
})
}
},
handleOtherInput(e: any) {
const { currentIndex } = this.data
this.setData({
[`questions[${currentIndex}].OtherText`]: e.detail.value,
})
},
handlePrev() {
const { currentIndex } = this.data
if (currentIndex > 0) {
this.setData({
currentIndex: currentIndex - 1,
})
}
},
handleNext() {
const { currentIndex, questions } = this.data
const question = questions[currentIndex]
if (!this.validateQuestion(question)) return
if (currentIndex < questions.length - 1) {
this.setData({
currentIndex: currentIndex + 1,
})
} else {
this.handleSubmit()
}
},
validateQuestion(question: IQuestion): boolean {
if (question.QuestionType === 2) {
const answer = question.Answer as number[]
if (!answer || !answer.length) {
wx.showToast({ title: '请至少选择一项', icon: 'none' })
return false
}
if (answer.includes(99) && !question.OtherText.trim()) {
wx.showToast({ title: '请填写其他内容', icon: 'none' })
return false
}
} else {
const answer = question.Answer as number
if (!answer) {
wx.showToast({ title: '请选择一项', icon: 'none' })
return false
}
if (answer === 99 && !question.OtherText.trim()) {
wx.showToast({ title: '请填写其他内容', icon: 'none' })
return false
}
}
return true
},
handleSubmit() {
const { questions, isSubmitting } = this.data
if (isSubmitting) return
const answers = questions.map((q) => {
const item: any = {
questionNo: q.QuestionNo,
answer: q.Answer,
}
if (q.HasOther === 1 && q.OtherText) {
item.otherText = q.OtherText
}
return item
})
export {} this.setData({ isSubmitting: true })
wx.ajax({
method: 'POST',
url: '?r=igg4/health-question/submit-questionnaire',
data: { answers },
loading: true,
})
.then(() => {
wx.showToast({ title: '提交成功', icon: 'success' })
setTimeout(() => {
wx.navigateBack()
}, 1500)
})
.finally(() => {
this.setData({ isSubmitting: false })
})
},
})

51
src/pages/qaForm/index.wxml

@ -1,22 +1,45 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <wxs src="../../utils/tools.wxs" module="tools" />
<view class="page-header">您好!为了更好地了解您的病情,请您完成以下4个简单问题,便于医生评估您的近期状况:</view> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<view class="page-header">您好!为了更好地了解您的病情,请您完成以下{{questions.length}}个简单问题,便于医生评估您的近期状况:</view>
<view class="progress"> <view class="progress">
<view class="p-item"></view> <view
<view class="p-item"></view> class="p-item {{index <= currentIndex && 'active'}}"
<view class="p-item"></view> wx:for="{{questions}}"
<view class="p-item"></view> wx:key="QuestionNo"
></view>
</view> </view>
<view class="list-title">您目前被确诊受累的器官有哪些?(可多选)</view>
<block wx:for="{{questions}}" wx:key="QuestionNo" wx:for-item="question" wx:for-index="qIndex">
<view class="question-section" wx:if="{{qIndex === currentIndex}}">
<view class="list-title">{{question.QuestionContent}}</view>
<view class="list"> <view class="list">
<view class="list-item"> <view
<checkbox class="check"> class="list-item {{(question.QuestionType === 2 && tools.include(item.key, question.Answer)) || (question.QuestionType === 1 && tools.eq(question.Answer, item.key)) ? 'active' : ''}}"
<view class="content">泪腺 / 眼眶</view> wx:for="{{question.optionList}}"
</checkbox> wx:key="key"
bind:tap="handleSelect"
data-key="{{item.key}}"
>
<view class="check-icon">
<view class="icon-inner"></view>
</view> </view>
<view class="content">{{item.value}}</view>
</view> </view>
</view>
<view class="other-section" wx:if="{{question.HasOther === 1 && ((question.QuestionType === 2 && tools.include(99, question.Answer)) || (question.QuestionType === 1 && tools.eq(question.Answer, 99)))}}">
<textarea
class="other-input"
placeholder="请输入其他内容"
value="{{question.OtherText}}"
bindinput="handleOtherInput"
maxlength="200"
></textarea>
</view>
</view>
</block>
<view class="footer"> <view class="footer">
<view class="prev">上一步</view> <view class="prev" wx:if="{{currentIndex > 0}}" bind:tap="handlePrev">上一步</view>
<view class="next" wx:if="{{true}}">继续</view> <view class="next" bind:tap="handleNext">{{currentIndex === questions.length - 1 ? '完成' : '继续'}}</view>
<view class="next" wx:else>完成</view>
</view> </view>
</view> </view>

2
src/pages/referral/index.wxml

@ -1,4 +1,4 @@
<page-meta page-style="{{ referralFromShow ? 'overflow: hidden;' : '' }}" /> <page-meta page-style="{{ referralFromShow ? 'overflow: hidden;' : '' }}" />
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<view class="card" wx:for="{{list}}" wx:key="Id" bind:tap="handleEdit" data-index="{{index}}"> <view class="card" wx:for="{{list}}" wx:key="Id" bind:tap="handleEdit" data-index="{{index}}">

2
src/pages/repository/index.ts

@ -1,4 +1,4 @@
const app = getApp<IAppOption>() const app = getApp<IAppOption>()
Page({ Page({
data: { data: {

2
src/pages/repositoryDetail/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<view class="page-container"> <view class="page-container">
<navBar background="{{background}}" title="知识库详情" back bind:back="handleBack"></navBar> <navBar background="{{background}}" title="知识库详情" back bind:back="handleBack"></navBar>
<view class="banner"> <view class="banner">

2
src/pages/signIn/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<image <image
class="badge" class="badge"
wx:if="{{detail.IsSignIn==1}}" wx:if="{{detail.IsSignIn==1}}"

2
src/pages/smallPage/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<mp-html <mp-html
wx:if="{{dataInfo.WeiContent}}" wx:if="{{dataInfo.WeiContent}}"
content="{{dataInfo.WeiContent}}" content="{{dataInfo.WeiContent}}"

2
src/pages/startPending/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<image class="bg" mode="widthFix" src="{{imageUrl}}1/login-mask-bg.png?t={{Timestamp}}"></image> <image class="bg" mode="widthFix" src="{{imageUrl}}1/login-mask-bg.png?t={{Timestamp}}"></image>
<view class="page-container"> <view class="page-container">
<pageNavbar></pageNavbar> <pageNavbar></pageNavbar>

2
src/pages/startReject/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<image class="bg" mode="widthFix" src="{{imageUrl}}1/login-bg.png?t={{Timestamp}}"></image> <image class="bg" mode="widthFix" src="{{imageUrl}}1/login-bg.png?t={{Timestamp}}"></image>
<view class="page-container"> <view class="page-container">
<pageNavbar></pageNavbar> <pageNavbar></pageNavbar>

2
src/pages/story/index.wxml

@ -1,4 +1,4 @@
<view <view
class="page" class="page"
id="{{theme === 'DRUG' && 'drug-page'}}" id="{{theme === 'DRUG' && 'drug-page'}}"
style="padding-top:{{bottom+30}}px" style="padding-top:{{bottom+30}}px"

2
src/pages/storyDetail/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<navBar back bind:back="handleBack" background="{{background}}" title="提交的故事" fixed></navBar> <navBar back bind:back="handleBack" background="{{background}}" title="提交的故事" fixed></navBar>
<image class="bg" mode="widthFix" src="{{imageUrl}}1/storyDetail-bg.png?t={{Timestamp}}"></image> <image class="bg" mode="widthFix" src="{{imageUrl}}1/storyDetail-bg.png?t={{Timestamp}}"></image>
<view class="page-container" style="margin-top:{{bottom}}px"> <view class="page-container" style="margin-top:{{bottom}}px">

2
src/pages/storyEnterResult/index.wxml

@ -1,4 +1,4 @@
<view <view
class="page" class="page"
id="{{theme === 'DRUG' && 'drug-page'}}" id="{{theme === 'DRUG' && 'drug-page'}}"
style="background: url({{imageUrl}}/1/storyDetail-bg.png?t={{Timestamp}}) no-repeat top center / 100% ;" style="background: url({{imageUrl}}/1/storyDetail-bg.png?t={{Timestamp}}) no-repeat top center / 100% ;"

2
src/pages/storyGuide/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<navBar back bind:back="handleBack" background="{{background}}" title="有奖征文" fixed></navBar> <navBar back bind:back="handleBack" background="{{background}}" title="有奖征文" fixed></navBar>
<image class="bg" mode="widthFix" src="{{imageUrl}}/1/storyGuide-bg.png?t={{Timestamp}}"></image> <image class="bg" mode="widthFix" src="{{imageUrl}}/1/storyGuide-bg.png?t={{Timestamp}}"></image>
<view class="page-container" style="padding-top:{{bottom}}px"> <view class="page-container" style="padding-top:{{bottom}}px">

2
src/pages/storyList/index.wxml

@ -1,4 +1,4 @@
<view <view
class="page" class="page"
id="{{theme === 'DRUG' && 'drug-page'}}" id="{{theme === 'DRUG' && 'drug-page'}}"
style="background: url({{imageUrl}}1/storyDetail-bg.png?t={{Timestamp}}) no-repeat top center / 100% ;padding-top:{{bottom}}px" style="background: url({{imageUrl}}1/storyDetail-bg.png?t={{Timestamp}}) no-repeat top center / 100% ;padding-top:{{bottom}}px"

2
src/pages/taskAgreement/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<image class="bg" mode="widthFix" src="{{imageUrl}}1/login-bg.png?t={{Timestamp}}"></image> <image class="bg" mode="widthFix" src="{{imageUrl}}1/login-bg.png?t={{Timestamp}}"></image>
<view class="page-container"> <view class="page-container">
<loginNavbar wx:if="{{pagePath == '/pages/enterInfo/index'}}" class="navbar" num="{{1}}"></loginNavbar> <loginNavbar wx:if="{{pagePath == '/pages/enterInfo/index'}}" class="navbar" num="{{1}}"></loginNavbar>

2
src/pages/thePublic/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<navBar fixed title="关注公众号" back bind:back="handleBack"></navBar> <navBar fixed title="关注公众号" back bind:back="handleBack"></navBar>
<image class="bg" src="{{imageUrl}}/1/thePublic-bg.png?t={{Timestamp}}"></image> <image class="bg" src="{{imageUrl}}/1/thePublic-bg.png?t={{Timestamp}}"></image>
<view class="page-container" style="margin-top:{{bottom+140}}px"> <view class="page-container" style="margin-top:{{bottom+140}}px">

2
src/pages/uploadCert/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<view class="page-container"> <view class="page-container">
<view class="page-title">需先认证用药身份</view> <view class="page-title">需先认证用药身份</view>
<view class="sub-title">处方证明审核通过后,即可享受平台全部服务</view> <view class="sub-title">处方证明审核通过后,即可享受平台全部服务</view>

2
src/pages/vipLogin/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<navBar <navBar
color="#fff" color="#fff"
ext-class="navBar" ext-class="navBar"

2
src/pages/vipLoginReject/index.wxml

@ -1,4 +1,4 @@
<view class="page" id="{{theme === 'DRUG' && 'drug-page'}}"> <view class="page" id="{{theme === 'DRUG' && 'drug-page'}}">
<navBar back bind:back="handleBack" color="#fff" icon-theme="white" title="扫码失败"></navBar> <navBar back bind:back="handleBack" color="#fff" icon-theme="white" title="扫码失败"></navBar>
<view class="container"> <view class="container">
<view class="banner"> <view class="banner">

2
src/public/pages/informedStart/index.wxml

@ -1,4 +1,4 @@
<view class="page" style="background: url({{imageUrl}}/bg2.png?t={{Timestamp}}) no-repeat top center / 100% 578rpx;"> <view class="page" style="background: url({{imageUrl}}/bg2.png?t={{Timestamp}}) no-repeat top center / 100% 578rpx;">
<navBar <navBar
background="{{background}}" background="{{background}}"
title="知情同意书" title="知情同意书"

2
src/utils/page.ts

@ -1,4 +1,4 @@
/** /**
* 使 * 使
* 1app.js const page = require('xx/xx/page); * 1app.js const page = require('xx/xx/page);
* 2app.js onLaunch Page = page * 2app.js onLaunch Page = page

8
src/utils/tools.wxs

@ -1,12 +1,18 @@
function include(value, arr) { function include(value, arr) {
var numValue = parseInt(value)
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
if (arr[i] === value) { if (arr[i] === numValue) {
return true return true
} }
} }
return false return false
} }
function eq(a, b) {
return parseInt(a) === parseInt(b)
}
module.exports = { module.exports = {
include: include, include: include,
eq: eq,
} }

14
接口文档.md

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save