Forráskód Böngészése

二维码组件支持传入url参数

luoaoxuan 1 éve
szülő
commit
a290bc7fd4
1 módosított fájl, 22 hozzáadás és 9 törlés
  1. 22 9
      src/views/component/qrcodeedDialog.vue

+ 22 - 9
src/views/component/qrcodeedDialog.vue

@@ -1,7 +1,7 @@
 <template>
     <div>
         <el-dialog
-            title="扫码签到"
+            :title="title"
             :visible.sync="dialogVisible"
             :close-on-click-modal="false"
             :close-on-press-escape="false"
@@ -36,13 +36,25 @@ export default {
         codeId: {
             type: String,
             default: ''
+        },
+        type: {
+            type: String,
+            default: ''
+        },
+        title: {
+            type: String,
+            default: '扫码签到'
+        },
+        prefixUrl: {
+            type: String,
+            default: ''
         }
     },
     data () {
         return {
             qrCode: '',
             dialogVisible: this.visible,
-            url:'http://192.168.2.16:8080/',
+            url: 'http://192.168.2.16:8080/'
         }
     },
     // mounted () {
@@ -50,18 +62,18 @@ export default {
     //         this.qrcodeRender()
     //     })
     // },
-    watch:{
+    watch: {
         dialogVisible: {
-            handler: function(val, oldVal) {
-                if(val == true){
+            handler: function (val, oldVal) {
+                if (val === true) {
                     this.$nextTick(() => {
                         this.qrcodeRender()
                     })
                 }
             },
-            deep:true,
-            immediate:true
-        },
+            deep: true,
+            immediate: true
+        }
     },
     methods: {
         downloadCode () {
@@ -79,7 +91,8 @@ export default {
                 width: 200,
                 height: 200,
                 // text: `${this.url}h5/#/pages/signin/signin?codeId=${this.codeId}`,
-                text: `${PUBLIC_URL}#/bpmn/siginin/index?codeId=${this.codeId}`,
+                text: `${PUBLIC_URL}#/bpmn${this.prefixUrl || '/siginin/index'}?codeId=${this.codeId}&type=${this.type}`,
+                // text: `http://demo2.local/#/bpmn/siginin/index?codeId=${this.codeId}&type=${this.type}`,
                 colorDark: '#000000', // 前景色
                 colorLight: '#FFFFFF', // 背景色
                 correctLevel: QRCode.CorrectLevel.L