DetailBox.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div class="detailBox-wrap" ref="detailBox">
  3. <div class="head">
  4. <span class="icon" @click="close">
  5. <img src="../images/small-close.png">
  6. </span>
  7. <span class="name">{{data.name+'详情'}}</span>
  8. <span>清空</span>
  9. </div>
  10. <div class="main">
  11. <Detail :datas="data.questionMapping" :id="data.id"/>
  12. </div>
  13. <div class="foot" @click="complete">完成</div>
  14. </div>
  15. </template>
  16. <script type="text/javascript">
  17. import Detail from './Detail.vue';
  18. export default {
  19. name:'DetailBox', //点开详情的盒子
  20. data(){
  21. return{
  22. msg:"胸痛详情"
  23. }
  24. },
  25. mounted(){
  26. const box = this.$refs.detailBox;
  27. const height = document.documentElement.clientHeight;
  28. box.style.height = height - 100 + 'px';
  29. },
  30. methods:{
  31. close(){
  32. this.$emit("close","胸痛");
  33. },
  34. complete(){//拼接value
  35. const id = this.data.id;
  36. const datas = this.$store.state.datas;
  37. const current = datas[id];
  38. const detail = current.questionMapping;
  39. let text = "";
  40. for(let i in detail){
  41. if(detail[i].value){
  42. text += detail[i].value+',';
  43. }
  44. }
  45. let msg = current.name+ ',' + text;
  46. this.$emit("pComplete",msg.substring(0,msg.length-1));
  47. }
  48. },
  49. props:['data'],
  50. components:{
  51. Detail
  52. }
  53. }
  54. </script>
  55. <style lang="less" scoped>
  56. @import '../less/base.less';
  57. .detailBox-wrap{
  58. width: 100%;
  59. // height: 100%;
  60. // height: calc(~"100%-1.15rem");
  61. overflow-y: auto;
  62. position: fixed;
  63. // top: 1.15rem;
  64. bottom: 0;
  65. left: 0;
  66. z-index: 666;
  67. background: #fff;
  68. border-radius: .08rem .08rem 0 0;
  69. font-size: .3rem;
  70. // padding-bottom: .88rem;
  71. .head{
  72. height: .88rem;
  73. line-height: .88rem;
  74. display: flex;
  75. justify-content: space-between;
  76. border-bottom: 1px solid #E6E7EF;
  77. padding: 0 .4rem 0 .32rem;
  78. font-size: .28rem;
  79. color: #7C828E;
  80. .icon{
  81. display: inline-block;
  82. height: 100%;
  83. padding: 0 .1rem;
  84. img{
  85. width:.34rem;
  86. vertical-align: middle;
  87. }
  88. }
  89. .name{
  90. font-size: .32rem;
  91. color: #1A1A1A;
  92. }
  93. }
  94. .main{
  95. }
  96. .foot{
  97. // .footer;
  98. width:100%;
  99. height: .88rem;
  100. line-height: .88rem;
  101. text-align: center;
  102. color:#fff;
  103. font-size: .32rem;
  104. background: linear-gradient(-270deg, #4F4FFF,#4F8BFF);
  105. }
  106. }
  107. </style>