Parcourir la source

修复电子健康证绑卡的一些小问题。

lighter il y a 2 ans
Parent
commit
455308dffa

BIN
src/assets/cross.png


BIN
src/assets/dzjkk-logo.png


+ 2 - 2
src/components/bind-card-method/index.vue

@@ -2,8 +2,8 @@
   <div style="padding: 20px">
     <van-button type="primary" block to="/bindPatientCard">绑定已有的诊疗卡</van-button>
     <div style="height: 10px"></div>
-    <van-button type="primary" plain block to="/createPatientCard">我没有诊疗卡</van-button>
-    <div style="height: 10px"></div>
+<!--    <van-button type="primary" plain block to="/createPatientCard">我没有诊疗卡</van-button>-->
+<!--    <div style="height: 10px"></div>-->
     <van-button type="success" plain block to="/addElectronicHealthCard">通过电子健康证绑卡</van-button>
   </div>
 </template>

+ 32 - 8
src/components/electronic-health-card/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div style="position: relative;width: 86%; margin-left: 7%; margin-top: 12px" @click="handleCardClick">
-    <img src="http://staticweb.hnthyy.cn/images/electronic-health-card.png"
+    <img src="http://staticweb.hnthyy.cn/images/hunan-dzjkk.png"
          style="width: 100%">
     <div style="position: absolute; bottom: 38px; left: 20px">
       <div style="font-size: 24px;">
@@ -70,13 +70,37 @@ export default {
     
     onMounted(() => {
       if (props.cardInfo.healthCardId) {
-        const canvas = qrcanvas({
-          data: props.cardInfo.qrCodeText,
-          size: 90,
-          padding: 5,
-          foreground: 'green',
-        })
-        document.getElementById(props.cardInfo.healthCardId).appendChild(canvas)
+
+        document.getElementById(props.cardInfo.healthCardId).innerHTML=''
+        const image = new Image();
+        image.src = 'http://staticweb.hnthyy.cn/images/dzjkklogo.png';
+        image.onload = () => {
+          const canvas = qrcanvas({
+            size: 90,
+            padding: 5,
+            data: props.cardInfo.qrCodeText,
+            foreground: 'green',
+            logo: {
+              w: 25,
+              h: 25,
+              x: 36,
+              y: 36,
+              image,
+            },
+          });
+          document.getElementById(props.cardInfo.healthCardId).appendChild(canvas)
+        };
+
+
+        // const canvas = qrcanvas({
+        //   data: props.cardInfo.qrCodeText,
+        //   size: 90,
+        //   padding: 5,
+        //   foreground: 'green',
+        // })
+        // document.getElementById(props.cardInfo.healthCardId).appendChild(canvas)
+
+
       }
     })
     

+ 1 - 11
src/components/select-card/index.vue

@@ -15,16 +15,8 @@
     title="添加就诊人"
     :label="addCardText"
     is-link
-    @click="showCreatedCardMethod = true"
+    to="/addElectronicHealthCard"
   ></van-cell>
-  <van-dialog
-    v-model:show="showCreatedCardMethod"
-    title="请选择绑定方式"
-    :show-confirm-button="false"
-    show-cancel-button
-  >
-    <bind-card-method></bind-card-method>
-  </van-dialog>
 </template>
 
 <script>
@@ -52,12 +44,10 @@ export default {
     const addCardText = computed(() => {
       return '还可添加' + (5 - cards.value.length) + '人'
     })
-    const showCreatedCardMethod = ref(false)
     return {
       cards,
       showAddCard,
       addCardText,
-      showCreatedCardMethod,
     }
   },
 }

+ 1 - 15
src/views/hospital-service/appointment/AppointmentConfirm.vue

@@ -39,18 +39,10 @@
       title="添加就诊人"
       :value="addCardText"
       is-link
-      @click="showCreatedCardMethod = true"
+      to="/addElectronicHealthCard"
     ></van-cell>
     <div style="height: 10px"></div>
     <van-button type="primary" block @click="confirmAppointment" :disabled="disableGhBtn">确认挂号</van-button>
-    <van-dialog
-      v-model:show="showCreatedCardMethod"
-      title="请选择绑定方式"
-      :show-confirm-button="false"
-      show-cancel-button
-    >
-      <bind-card-method></bind-card-method>
-    </van-dialog>
   </window-size>
 </template>
 
@@ -60,14 +52,9 @@ import { computed, onMounted, ref, watchEffect } from 'vue'
 import {checkAppointmentRequirements, getGhFee} from '../../../api/appointment'
 import router from '../../../router'
 import { Toast } from 'vant'
-import BindCardMethod from "../../../components/bind-card-method/index.vue";
 export default {
   name: 'AppointConfirm',
-  components: {
-    BindCardMethod,
-  },
   setup() {
-    const showCreatedCardMethod = ref(false)
     const appointment = store.state.appointmentInfo
     const patientCards = computed(() => {
       return store.state.patientCards
@@ -126,7 +113,6 @@ export default {
       fetchGhFee()
     })
     return {
-      showCreatedCardMethod,
       appointment,
       patientCards,
       showAddCard,

+ 1 - 11
src/views/hospital-service/covid-vaccinate/SelectCovidVaccinatePatient.vue

@@ -16,16 +16,8 @@
       title="添加就诊人"
       :label="addCardText"
       is-link
-      @click="showCreatedCardMethod = true"
+      to="/addElectronicHealthCard"
     ></van-cell>
-    <van-dialog
-      v-model:show="showCreatedCardMethod"
-      title="请选择绑定方式"
-      :show-confirm-button="false"
-      show-cancel-button
-    >
-      <bind-card-method></bind-card-method>
-    </van-dialog>
   </window-size>
 </template>
 
@@ -47,7 +39,6 @@ export default {
     const addCardText = computed(() => {
       return '还可添加' + (5 - cards.value.length) + '人'
     })
-    const showCreatedCardMethod = ref(false)
     const toVaccinate = (patientId) => {
       window.open('http://www.hnthyy.cn:8080/covidVaccinate/' + patientId, '_self')
     }
@@ -55,7 +46,6 @@ export default {
       cards,
       showAddCard,
       addCardText,
-      showCreatedCardMethod,
       toVaccinate,
     }
   },

+ 9 - 1
src/views/hospital-service/electronic_health_card/LinkHealthCardResult.vue

@@ -46,6 +46,8 @@
 import {onMounted, ref} from "vue";
 import {useRouter} from "vue-router";
 import {linkHealthCard} from '../../../api/electronic-health-card'
+import {getPatientIdByOpenId} from "../../../api/patient-id-cards";
+import store from "../../../store";
 
 export default {
   setup() {
@@ -68,9 +70,15 @@ export default {
           router.go(-1)
           break;
         default:
-          linkHealthCard(val, localStorage.getItem('openId')).then(res => {
+          const openId = localStorage.getItem('openId')
+          linkHealthCard(val, openId).then(res => {
             if (res.healthCardId) {
               resultCode.value = 0
+              getPatientIdByOpenId(openId).then((cards) => {
+                if (cards.length > 0) {
+                  store.commit('SET_PATIENTCARDS', cards)
+                }
+              })
             }
           }).catch(e => {
             resultCode.value = -1

+ 10 - 1
src/views/hospital-service/electronic_health_card/NewUserReg.vue

@@ -37,6 +37,9 @@ import {onMounted, reactive, ref} from "vue";
 import {register} from '../../../api/electronic-health-card'
 import {analyseIdCard} from "../../../api/electronic-health-card";
 import {resize} from "../../../utils/image";
+import {Toast} from "vant";
+import {getPatientIdByOpenId} from "../../../api/patient-id-cards";
+import store from "../../../store";
 
 export default {
   setup() {
@@ -72,7 +75,13 @@ export default {
 
     const applyHealthCard = () => {
       register(userinfo).then(res => {
-        console.log(res)
+        Toast.success('申领成功。')
+        getPatientIdByOpenId(localStorage.getItem('openId')).then((cards) => {
+          if (cards.length > 0) {
+            store.commit('SET_PATIENTCARDS', cards)
+          }
+          router.push('/electronicHealthCardHome')
+        })
       })
     }
 

+ 19 - 6
src/views/hospital-service/electronic_health_card/ShowCardQrCode.vue

@@ -19,6 +19,7 @@ import {useRouter} from "vue-router";
 import {qrcanvas} from "qrcanvas";
 import {getDateTime} from "../../../utils/date";
 import {getOrderIdByOutAppId} from '../../../api/electronic-health-card'
+import dzjkklogo from '../../../assets/dzjkk-logo.png'
 
 export default {
   setup() {
@@ -36,12 +37,24 @@ export default {
     }
 
     const makeQrCode = () => {
-      const canvas = qrcanvas({
-        data: card.value.qrCodeText,
-        size: 200,
-        foreground: 'green',
-      })
-      document.getElementById('qrCode').appendChild(canvas)
+      document.getElementById('qrCode').innerHTML=''
+      const image = new Image();
+      image.src = 'http://staticweb.hnthyy.cn/images/dzjkklogo.png';
+      image.onload = () => {
+        const canvas = qrcanvas({
+          size: 200,
+          data: card.value.qrCodeText,
+          foreground: 'green',
+          logo: {
+            w: 65,
+            h: 65,
+            x: 90,
+            y: 90,
+            image,
+          },
+        });
+        document.getElementById('qrCode').appendChild(canvas)
+      };
     }
 
     const toHealthCardHome = () => {

+ 7 - 11
src/views/mine/patient-id-cards/MyPatientIdCards.vue

@@ -2,16 +2,8 @@
   <window-size>
     <select-card to="patientCardInfo" v-if="!showEmpty"></select-card>
     <van-empty :image="empty" v-if="showEmpty" description="您还没有添加就诊人">
-      <van-button type="primary" block @click="showCreatedCardMethod = true"> 添加就诊人 </van-button>
+      <van-button type="primary" block @click="toAddCard"> 添加就诊人 </van-button>
     </van-empty>
-    <van-dialog
-      v-model:show="showCreatedCardMethod"
-      title="请选择绑定方式"
-      :show-confirm-button="false"
-      show-cancel-button
-    >
-      <bind-card-method></bind-card-method>
-    </van-dialog>
   </window-size>
 </template>
 
@@ -20,20 +12,24 @@ import store from '../../../store'
 import empty from '../../../assets/empty.png'
 import { computed, ref } from 'vue'
 import BindCardMethod from "../../../components/bind-card-method/index.vue";
+import {useRouter} from "vue-router";
 export default {
   name: 'MyPatientIdCards',
   components: {
     BindCardMethod
   },
   setup() {
+    const router = useRouter()
     const showEmpty = computed(() => {
       return store.state.patientCards.length === 0
     })
-    const showCreatedCardMethod = ref(false)
+    const toAddCard = () => {
+      router.push('/addElectronicHealthCard')
+    }
     return {
       empty,
       showEmpty,
-      showCreatedCardMethod,
+      toAddCard,
     }
   },
 }