healthCode.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view>
  3. <view class="codeBox" :class="{ 'bg-red': healthCode.color=='red', 'bg-blue': healthCode.color=='green'}">
  4. <view class="timeBar">{{name}}</view>
  5. <view class="timeBar">{{nowStr}}</view>
  6. <image class="code" :src="healthCode.code"></image>
  7. <view v-if="healthCode.color=='green'" class="timeBar" style="height: 250rpx;letter-spacing: 20rpx;">
  8. <icon type="success" size="35"/>
  9. 未见异常
  10. </view>
  11. <view v-if="healthCode.color=='red'" class="timeBar" style="height: 250rpx;letter-spacing: 20rpx;">
  12. <icon type="warn" size="35"/>
  13. 体温异常
  14. </view>
  15. </view>
  16. <view class="tips">{{tips}}</view>
  17. <view class="link"> 测温记录</view>
  18. </view>
  19. </template>
  20. <script>
  21. import util from "@/utils/util.js"
  22. export default {
  23. data() {
  24. return {
  25. personInfo: {
  26. name: "梁汉强",
  27. idNumber: "440981199612222852"
  28. },
  29. timer: '',
  30. nowStr: "",
  31. healthCode: {
  32. code: "http://120.92.153.151:3000/public/recog_images/2021-01-09/06d56a9f7fca42c6",
  33. color: "red"
  34. },
  35. tips: "按照目前掌握的防疫相关数据,暂未发现您存在与防疫相关异常健康状况。防疫相关数据会随着疫情发展及时更新。此次查询并不会排除您的防疫相关健康风险。"
  36. }
  37. },
  38. onLoad() {
  39. this.timer = setInterval(() => {
  40. this.nowStr = util.dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss");
  41. }, 1000);
  42. },
  43. beforeDestroy() {
  44. clearInterval(this.timer);
  45. },
  46. computed: {
  47. name() {
  48. let chars = this.personInfo.name.split("");
  49. return "**" + chars[chars.length - 1]
  50. }
  51. },
  52. methods: {}
  53. }
  54. </script>
  55. <style>
  56. .timeBar {
  57. width: 400 rpx;
  58. height: 100 rpx;
  59. color: white;
  60. display: flex;
  61. align-items: center;
  62. justify-content: center;
  63. font-size: 40 rpx;
  64. /* background-color: rgba(255,255,255,0.5); */
  65. }
  66. .code {
  67. background: white;
  68. border-radius: 15 rpx;
  69. padding: 5 rpx;
  70. width: 400 rpx;
  71. height: 400 rpx;
  72. }
  73. .codeBox {
  74. width: 100%;
  75. height: 1000 rpx;
  76. display: flex;
  77. flex-direction: column;
  78. align-items: center;
  79. justify-content: center;
  80. border-radius: 5 rpx;
  81. }
  82. .tips {
  83. height: 300 rpx;
  84. width: 90%;
  85. line-height: 50 rpx;
  86. text-indent: 2em;
  87. margin: auto;
  88. color: gray;
  89. /* background: #18B566; */
  90. font-size: 30 rpx;
  91. display: flex;
  92. align-items: center;
  93. justify-content: center;
  94. }
  95. .link {
  96. height: 100 rpx;
  97. width: 100%;
  98. color: #007AFF;
  99. display: flex;
  100. text-decoration: underline;
  101. font-style: italic;
  102. align-items: center;
  103. justify-content: center;
  104. }
  105. </style>