123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584 |
- <template>
- <view class="content">
- <view class="patient-cont">
- <view class="chose-patient">
- <view class="patient-box" @click="addPatient()" v-if="patient==null">
- <text class="patient-title">选择体验者</text>
- <view class="right" >
- <text class="value">请点击添加</text>
- <image src="/static/images/arrow_gray.png" mode=""></image>
- </view>
- </view>
- <view class="patient" @click="addPatient()" v-if="patient!=null">
- <view class="left">
- <view class="name">{{patient.patientName}}</view>
- <view class="info">
- <text class="text" v-if="patient.sex==1">男</text>
- <text class="text" v-if="patient.sex==2">女</text>
- <text class="text">{{utils.getAge(patient.birthday)}}岁</text>
- <text class="text">{{utils.parseIdCard(patient.idCard)}}</text>
- </view>
- </view>
- <view class="right" >
- <image src="/static/images/arrow_gray.png" mode=""></image>
- </view>
- </view>
- </view>
- </view>
- <view class="msg-cont">
- <scroll-view
- class="msg-scroll"
- :scroll-top="scrollTop"
- scroll-y="true"
- :scroll-with-animation="true">
- <view class="msgs">
- <view class="msg-item" v-for="(item,index) in msgs" >
- <view class="left" v-if="item.type==1">
- <image class="img" src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/5fd36547a3ca4d0b9935e623d3d8e1c5.png"></image>
- <view class="msg-content">{{item.content}}</view>
- </view>
- <view class="right" v-if="item.type==2">
- <view class="msg-content">{{item.content}}</view>
- <image class="img" src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/d7d49263e2e04f56a7a86fa7bfd35687.jpg"></image>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- <view class="option-cont" v-if="item!=null">
- <view class="option-title" >{{item.title}}</view>
- <view class="options" >
- <view class="option-item" @click="optionClick(item,option)" v-for="(option) in JSON.parse(item.scoreJson)" >{{option.name}}</view>
- </view>
- </view>
-
- <!-- <view class="title">
- 体质测试以当下感受为准作答,人的体质有可能会随季节变化。
- </view>
- <view class="chose-patient">
- <view class="patient-box" @click="addPatient()" v-if="patient==null">
- <text class="patient-title">选择体验者</text>
- <view class="right" >
- <image src="/static/images/arrow_gray.png" mode=""></image>
- </view>
- </view>
- <view class="patient" @click="addPatient()" v-if="patient!=null">
- <view class="left">
- <view class="name">{{patient.patientName}}</view>
- <view class="info">
- <text class="text" v-if="patient.sex==1">男</text>
- <text class="text" v-if="patient.sex==2">女</text>
- <text class="text">{{$getAge(patient.birthday)}}岁</text>
- <text class="text">{{$parseIdCard(patient.idCard)}}</text>
- </view>
- </view>
- <view class="right" >
- <image src="/static/images/arrow_gray.png" mode=""></image>
- </view>
- </view>
- </view>
- <view class="items">
- <view class="item" v-for="(item,index) in items">
- <view class="name">{{index+1}}{{item.title}}?</view>
- <view class="options">
- <view :class="item.option!=null&&item.option==option.name?'option active':'option'" @click="optionClick(item,option)" v-for="(option) in JSON.parse(item.scoreJson)">
- {{option.name}}
- </view>
- </view>
- </view>
-
- </view>
- <view class="btns">
- <view class="btn" @click="submit()">提交</view>
- </view>
- <view class="tips">
- <view class="tip-title">提交代表你已接受以下声明</view>
- <view class="desc">
- 本测试不作为诊断和治疗的依据,对于已经医生确诊的疾病,应按照医嘱积极治疗。所提及的内容仅作为生活保健的咨询建议。如遇不适请及时就医。
- </view>
- </view> -->
- </view>
- </template>
- <script>
- import {getTestTempDetails,getTestDetails ,doReport} from '@/api/test.js'
- export default {
- data() {
- return {
- scrollTop:0,//滚动条位置
- formJson:null,
- tempId:null,
- patient:null,
- items:{},
- msgs:[],
- index:0,
- item:null,
- };
- },
- onLoad(option) {
- this.tempId=option.tempId;
- var that=this;
- uni.$on('refreshOrderPatient', (res) => {
- console.log("qxj data:"+JSON.stringify(res))
- that.patient=res;
- })
-
- },
- onShow() {
- this.getTestTempDetails();
- this.getTestDetails();
-
- },
- //发送给朋友
- onShareAppMessage(res) {
- if(this.utils.isLogin()){
- return {
- title: "健康体质检测",
- path: '/pages_index/test?tempId='+this.tempId,
- imageUrl: 'https://beiliyo-2025.obs.cn-north-4.myhuaweicloud.com/fs/20250115/1736944490230.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
- }
- }
-
- },
- //分享到朋友圈
- onShareTimeline(res) {
- if(this.utils.isLogin()){
- return {
- title: "健康体质检测",
- imageUrl: 'https://beiliyo-2025.obs.cn-north-4.myhuaweicloud.com/fs/20250115/1736944490230.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
- }
- }
-
- },
- methods:{
- getTestDetails(){
- let data = {tempId:this.tempId};
- getTestDetails(data).then(
- res => {
- if(res.code==200){
- uni.setNavigationBarTitle({
- title: res.data.name+"自测"
- });
-
- }else{
- uni.showToast({
- icon:'none',
- title: "请求失败",
- });
- }
- },
- rej => {}
- );
- },
- addMsg(type,content){
- var msg={type:type,content:content}
- this.msgs.push(msg)
- var that=this;
- uni
- .createSelectorQuery()
- .select(".msgs")
- .boundingClientRect((res) => {
- const scrollH = res.height;
- that.scrollTop = scrollH;
- console.log(that.scrollTop)
-
- })
- .exec();
-
-
- },
- optionClick(item,option){
- if(this.patient==null){
- uni.showToast({
- icon:'none',
- title: "请选择体验者",
- });
- return;
- }
- item.option=option.name;
- console.log(item.option);
- this.addMsg(2,option.name);
- this.index++;
- if(this.index<=this.items.length-1){
- this.item=this.items[this.index];
- this.addMsg(1,this.item.title)
- }
- else{
- //提交
- this.submit();
- }
-
- },
- getTestTempDetails(){
- var data={tempId:this.tempId}
- getTestTempDetails(data).then(
- res => {
- if(res.code==200){
- this.items=res.items;
- if(this.items.length>0){
- this.item=this.items[0];
- this.addMsg(1,this.item.title)
- }
- }
- },
- err => {
- }
- );
- },
- addPatient(){
- uni.navigateTo({
- url: '/pages_user/user/patient?isFromTest=true'
- })
- },
- submit(){
- var data={
- tempId:this.tempId,
- patientId:this.patient.patientId,
- formJson:JSON.stringify(this.items),
- }
- var that=this;
- doReport(data).then(res => {
- if(res.code==200){
- uni.redirectTo({
- url:"./testResult?reportId="+res.reportId
- })
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- });
- // uni.showModal({
- // title: '提示',
- // content: '确定提交吗',
- // success: function (res) {
- // if (res.confirm) {
- // doReport(data).then(res => {
- // if(res.code==200){
- // uni.navigateTo({
- // url:"./testResult?reportId="+res.reportId
- // })
- // }else{
- // uni.showToast({
- // icon:'none',
- // title: res.msg,
- // });
- // }
- // });
- // }
- // else if (res.cancel) {
- // }
- // }
- // });
- }
- }
- }
- </script>
- <style lang="scss">
- page{
- height: 100%;
- }
- .content{
- height: 100vh;
- .msg-cont{
- padding-bottom: 550rpx;
- width: 100%;
- height: calc(100vh - 760rpx);
- .msg-scroll{
- height: calc(100vh - 760rpx);
- .msgs{
- overflow: hidden;
- width: 100%;
- .msg-item{
- padding: 10rpx 15rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: flex-start;
- width: 100%;
- .left{
- width: 100%;
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- .img{
- min-width: 100rpx;
- width: 100rpx;
- height:100rpx;
- border-radius: 50%;
- image{
- width: 100%;
- height:100%;
- }
- }
- .msg-content{
- margin-top: 15rpx;
- margin-left: 10rpx;
- border-radius: 15rpx;
- padding: 15rpx;
- background-color: #fff;
- color: #111;
- font-size: 28upx;
- font-family: PingFang SC;
- }
- }
- .right{
- width: 100%;
- display: flex;
- justify-content: flex-end;
- align-items: flex-start;
- .msg-content{
- margin-top: 15rpx;
- margin-right: 10rpx;
- border-radius: 15rpx;
- padding: 15rpx;
- background-color: #d3ad58;
- color: #fff;
- font-size: 28upx;
- font-family: PingFang SC;
- }
- .img{
- min-width: 100rpx;
- width: 100rpx;
- height:100rpx;
- border-radius: 50%;
- image{
- width: 100%;
- height:100%;
- }
- }
- }
- }
- }
- }
-
-
- }
- .option-cont{
- position: fixed;
- bottom: 0rpx;
- height: 550rpx;
- width: 100%;
- box-sizing: border-box;
- background-color: #fff;
- border-radius: 60rpx 60rpx 0rpx 0rpx;
- padding: 30rpx;
- .option-title{
- width: 100%;
- padding-bottom: 15rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 32upx;
- font-family: PingFang SC;
- color: #111;
- }
- .options{
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .option-item{
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- border: 1rpx solid #eee;
- margin-bottom: 10rpx;
- padding: 15rpx;
- border-radius: 5rpx;
- }
- }
- }
- .title{
- padding: 15rpx 30rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- width: 100%;
- background-color: #d3ad58;
- font-size: 24upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #fff;
- }
- .patient-cont{
- padding: 15rpx;
- .chose-patient{
- padding: 30rpx;
- box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
- background-color: #fff;
- border-radius: 15rpx;
- .patient-box{
- display: flex;
- align-items: center;
- justify-content: space-between;
- .patient-title{
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #111111;
- }
- .right{
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- .value{
- font-size: 28upx;
- font-family: PingFang SC;
- color: #999;
- margin-right: 10rpx;
- }
- image{
- width: 15upx;
- height: 30upx;
- }
-
- }
- }
- .patient{
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 110upx;
- .left{
- .name{
- font-size: 30upx;
- line-height: 1;
- font-family: PingFang SC;
- font-weight: bold;
- color: #111111;
- }
- .info{
- margin-top: 30rpx;
- display: flex;
- align-items: center;
- .text{
- font-size: 26upx;
- font-family: PingFang SC;
- line-height: 1;
- font-weight: 500;
- color: #999;
- margin-right: 19upx;
- }
-
- }
- }
- .right{
- display: flex;
- align-items: center;
- image{
- width: 15upx;
- height: 30upx;
- }
- }
- }
- }
- }
-
- .items{
- padding: 15rpx;
- width: 100%;
- padding: 30rpx;
- border-radius: 15rpx;
- background-color: #fff;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: flex-start;
- .item{
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: flex-start;
- width: 100%;
- background-color: #f8f8f8;
- margin-bottom: 15rpx;
- .name{
- font-size: 32upx;
- font-family: PingFang SC;
- color: #2a2b2e;
- font-weight: bold;
- margin-bottom: 15rpx;
- }
- .options{
- margin: 15rpx 0rpx;
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .option{
- margin-right: 10rpx;
- margin-bottom: 10rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 10rpx;
- width:20%;
- height:80rpx;
- border: 1rpx solid #9b9b9b;
- font-size: 28upx;
- font-family: PingFang SC;
- color: #2a2b2e;
- background-color: #fff;
-
- &:last-child{
- margin-right: 0rpx;
- margin-bottom: 0rpx;
- }
- }
- .active{
- border: 1rpx solid #d3ad58;
- background-color: #d3ad58;
- color: #fff;
- }
- }
- }
-
- }
- .btns{
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 100%;
- padding: 30rpx;
- .btn{
- height:80rpx;
- margin: 0rpx 30rpx;
- border-radius: 60rpx;
- width: 100%;
- border: 1rpx solid #d3ad58;
- font-size: 32supx; font-family: PingFang SC; color: #fff;
- font-weight: bold;
- background-color: #d3ad58;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- }
- .tips{
- flex-direction: column;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- padding: 30rpx;
- .tip-title{
- font-size: 26supx;
- font-family: PingFang SC;
- color: #888;
- font-weight: bold;
- }
- .desc{
- margin-top: 15rpx;
- font-size: 24rpx;
- font-family: PingFang SC;
- color: #b8bdb5;
- }
- }
- }
-
- </style>
|