index.vue 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="code">
  3. <view class="code_wrap">
  4. <view class="codeBox">
  5. <view class="codeTitle">签到卡</view>
  6. <view class="name">
  7. <!-- <view><span style="letter-spacing: 10rpx;">姓名</span> :{{ patient.name ? patient.name : '爱丽丝' }}</view>
  8. <view><span>透析号</span> :{{ patient.dialysis_no ? patient.dialysis_no : '078' }}</view> -->
  9. <view class="left">
  10. <p>姓名:</p>
  11. <p>透析号:</p>
  12. </view>
  13. <view class="right">
  14. <p>{{ patient.name ? patient.name : '爱丽丝' }}</p>
  15. <p>{{ patient.dialysis_no ? patient.dialysis_no : '078' }}</p>
  16. </view>
  17. </view>
  18. <!-- <img class="imgCode" src="../../static/images/avatar.png" alt=""> -->
  19. <canvas class="imgCode" canvas-id="couponQrcode"></canvas>
  20. <text class="txt">扫一扫测量你的体重和血压</text>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. const qrCode = require('../../static/js/qrcode.js')
  27. export default {
  28. data() {
  29. return {
  30. patient: {}
  31. }
  32. },
  33. onLoad() {
  34. this.patient = this.$store.state.data.userInfo
  35. this.couponQrCode()
  36. },
  37. methods: {
  38. // 二维码生成工具
  39. couponQrCode() {
  40. uni.showLoading({
  41. title: '数据加载中...',
  42. mask: true
  43. });
  44. var patientID = this.patient.id;
  45. var name = this.patient.name;
  46. var gender = this.patient.gender;
  47. if (gender === 1) {
  48. gender = "男";
  49. }
  50. if (gender === 2) {
  51. gender = "女";
  52. }
  53. var idCardNo = this.patient.id_card_no;
  54. var dialysisNo = this.patient.dialysis_no;
  55. var phone = this.patient.phone;
  56. var healthCareNo = this.patient.health_care_no;
  57. new qrCode('couponQrcode', {
  58. text: "user_id:" +
  59. patientID +
  60. "," +
  61. "name:" +
  62. name +
  63. "," +
  64. "dialysis_no:" +
  65. dialysisNo +
  66. "," +
  67. "gender:" +
  68. gender +
  69. "," +
  70. "idcard_no:" +
  71. idCardNo +
  72. "," +
  73. "phone:" +
  74. phone +
  75. "," +
  76. "healthcare_no:" +
  77. healthCareNo,
  78. width: 175,
  79. height: 165,
  80. showLoading: true, // 是否显示loading
  81. loadingText: '二维码生成中', // loading文字
  82. colorDark: "#333333",
  83. colorLight: "#FFFFFF",
  84. correctLevel: qrCode.CorrectLevel.H
  85. })
  86. uni.hideLoading();
  87. }
  88. }
  89. }
  90. </script>
  91. <style>
  92. page {
  93. height: 100%;
  94. }
  95. .code {
  96. background: #f7f7f7;
  97. height: 100%;
  98. overflow: hidden;
  99. }
  100. .code_wrap {
  101. margin: 60rpx;
  102. height: 900rpx;
  103. display: flex;
  104. flex-direction: column;
  105. justify-content: space-around;
  106. background: #c4f0ec;
  107. box-shadow: 0px 0px 24px 0px rgba(0, 0, 0, 0.1);
  108. border-radius: 10px;
  109. text-align: center;
  110. }
  111. .codeBox {
  112. height: 850rpx;
  113. background: #FFFFFF;
  114. box-shadow: 0px 0px 24px 0px rgba(0, 0, 0, 0.1);
  115. border-radius: 10px;
  116. text-align: center;
  117. }
  118. .codeTitle {
  119. font-size: 46rpx;
  120. color: #00c4b3;
  121. text-align: center;
  122. padding-top: 80rpx;
  123. font-weight: 600;
  124. letter-spacing: 4rpx;
  125. }
  126. .name {
  127. display: flex;
  128. justify-content: center;
  129. /* margin: 0 68rpx; */
  130. border-bottom: 1px dashed #D8D8D8;
  131. padding: 44rpx 0 28rpx;
  132. line-height: 45rpx;
  133. font-size: 35rpx;
  134. }
  135. .imgCode {
  136. width: 350rpx;
  137. height: 330rpx;
  138. text-align: center;
  139. margin: 40rpx auto;
  140. display: block;
  141. }
  142. .txt {
  143. font-size: 30rpx;
  144. color: #22ccbd;
  145. }
  146. </style>