healthCode.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. }
  55. </script>
  56. <style>
  57. .timeBar{
  58. width: 400rpx;
  59. height: 100rpx;
  60. color: white;
  61. display: flex;
  62. align-items: center;
  63. justify-content: center;
  64. font-size: 40rpx;
  65. /* background-color: rgba(255,255,255,0.5); */
  66. }
  67. .code{
  68. background: white;
  69. border-radius: 15rpx;
  70. padding: 5rpx;
  71. width: 400rpx;
  72. height: 400rpx;
  73. }
  74. .codeBox{
  75. width: 100%;
  76. height: 1000rpx;
  77. display: flex;
  78. flex-direction: column;
  79. align-items: center;
  80. justify-content: center;
  81. border-radius: 5rpx;
  82. }
  83. .tips{
  84. height: 300rpx;
  85. width: 90%;
  86. line-height: 50rpx;
  87. text-indent: 2em;
  88. margin: auto;
  89. color: gray;
  90. /* background: #18B566; */
  91. font-size: 30rpx;
  92. display: flex;
  93. align-items: center;
  94. justify-content: center;
  95. }
  96. .link{
  97. height: 100rpx;
  98. width: 100%;
  99. color: #007AFF;
  100. display: flex;
  101. text-decoration: underline;
  102. font-style: italic;
  103. align-items: center;
  104. justify-content: center;
  105. }
  106. </style>