result.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class="result">
  3. <cu-custom class="home-custom" bgColor=".bg-sancolor"
  4. bgImage="https://ahwgh.oss-cn-hangzhou.aliyuncs.com/enterprise/6525f808df760.png" :isBack="true">
  5. <block slot="content">胶体金检测</block>
  6. </cu-custom>
  7. <image :src="tempImage" mode="aspectFit"></image>
  8. <view class="result-icon">
  9. <view class="success-icon" v-if="[1, 2].includes(status)">
  10. <image class="icon" src="../../static/icons/result-icon.svg" mode="aspectFit"></image>
  11. <text>阴性</text>
  12. </view>
  13. <view class="fail-icon" v-else-if="[3, 4].includes(status)">
  14. <image class="icon" src="../../static/icons/fail-icon.svg" mode="aspectFit"></image>
  15. <text>阳性</text>
  16. </view>
  17. <view class="cancel-icon" v-else-if="-1 === status">
  18. <image class="icon" src="../../static/icons/cancel-icon.svg" mode="aspectFit"></image>
  19. <text>无效</text>
  20. </view>
  21. </view>
  22. <view class="padding flex flex-direction padding-bottom-xl fixedFootBtn padding-top-xs">
  23. <button class="cu-btn bg-green lg margin-top-sm shadow-blur" type="" @tap="nextSetp">
  24. 完成
  25. </button>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import { _sampleDetail } from "../sample-detail/sample-detail-model.js";
  31. export default {
  32. data() {
  33. return {
  34. tempImage: '',
  35. status: null,
  36. }
  37. },
  38. onLoad(option) {
  39. if (option.pic) {
  40. uni.showLoading({
  41. title: '识别中'
  42. });
  43. this.tempImage = option.pic
  44. _sampleDetail.submitJTJImage(option.pic, (res) => {
  45. const { data, message, code } = JSON.parse(res);
  46. console.log('code:', data, code)
  47. if (code === 200) {
  48. const { image, jcjg } = data;
  49. this.status = jcjg;
  50. uni.hideLoading()
  51. // 如果检测成功了,需要保存结果,暂时没有接口
  52. // if ([1,2,3,4].includes(jcjg)) {
  53. this.saveResult({
  54. image,
  55. jcjg
  56. })
  57. // }
  58. }
  59. })
  60. }
  61. },
  62. methods: {
  63. saveResult({ jcjg, image }) {
  64. const { unitId: jczbh, name: jczmc } = uni.getStorageSync("userInfo");
  65. const { enterprisesName, qydm } = uni.getStorageSync("enterprisesInfo");
  66. const { batchId, productName, productType } = uni.getStorageSync("sampleInfo");
  67. const { name: jcxm } = uni.getStorageSync("JTJInfo");
  68. _sampleDetail.saveResult({
  69. batchId,
  70. enterprisesName,
  71. image,
  72. "jcbh": "",
  73. jcjg,
  74. jcxm,
  75. jczbh,
  76. jczmc,
  77. productName,
  78. productType,
  79. qydm
  80. }, res => {
  81. })
  82. },
  83. nextSetp() {
  84. uni.redirectTo({
  85. url: '/pages/index/index'
  86. });
  87. }
  88. }
  89. }
  90. </script>
  91. <style>
  92. .result-icon{
  93. position: absolute;
  94. top: 10px;
  95. left: 10px;
  96. z-index: 100;
  97. width: 100vw;
  98. height: 100vh;
  99. display: flex;
  100. justify-content: center;
  101. align-items: center;
  102. }
  103. .result-icon .icon{
  104. width: 200px;
  105. height: 200px;
  106. }
  107. .result image{
  108. width: 100vw;
  109. height: 89vh;
  110. }
  111. .fail-icon,
  112. .success-icon,
  113. .cancel-icon{
  114. display: flex;
  115. justify-content: center;
  116. align-items: center;
  117. }
  118. .success-icon text{
  119. color: #80d185;
  120. font-size: 30px;
  121. font-weight: bold;
  122. position: absolute;
  123. transform: rotate(-35deg);
  124. }
  125. .fail-icon text{
  126. color: #d81e06;
  127. font-size: 30px;
  128. font-weight: bold;
  129. position: absolute;
  130. transform: rotate(-35deg);
  131. }
  132. .cancel-icon text{
  133. color: #515151;
  134. font-size: 30px;
  135. font-weight: bold;
  136. position: absolute;
  137. transform: rotate(-35deg);
  138. }
  139. .fixedFootBtn{
  140. border: none;
  141. z-index: 1000;
  142. }
  143. </style>