[add] 人數變化事件

This commit is contained in:
建喵 2022-04-22 13:34:46 +08:00
parent 2c9ec05c86
commit 556c887b58
4 changed files with 20 additions and 8 deletions

File diff suppressed because one or more lines are too long

4
dist/index.html vendored
View File

@ -6,8 +6,8 @@
<link rel="icon" href="./favicon.ico" /> <link rel="icon" href="./favicon.ico" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>HTML5 QR Code with Vue js</title> <title>建喵防疫實聯制</title>
<script type="module" crossorigin src="./assets/index.26e8f481.js"></script> <script type="module" crossorigin src="./assets/index.acdfd36c.js"></script>
<link rel="stylesheet" href="./assets/index.376fffd7.css"> <link rel="stylesheet" href="./assets/index.376fffd7.css">
</head> </head>

View File

@ -6,7 +6,7 @@
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>HTML5 QR Code with Vue js</title> <title>建喵防疫實聯制</title>
</head> </head>
<body> <body>

View File

@ -4,7 +4,7 @@ import QRCodeScanner from './QRCodeScanner.vue';
// defineProps<{ msg: string }>() // defineProps<{ msg: string }>()
let result = ref(''); let result = ref('內容:');
let count = ref(1); let count = ref(1);
let smscontent = ref(''); let smscontent = ref('');
@ -12,7 +12,7 @@ var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
const decodedCode = function (decodedText: string, decodedResult: any) { function decodedCode(decodedText: string, decodedResult: any) {
// console.log(`Scan result ${decodedText}`, decodedResult); // console.log(`Scan result ${decodedText}`, decodedResult);
if (decodedText.includes('1922:')) { if (decodedText.includes('1922:')) {
smsto1922(decodedText); smsto1922(decodedText);
@ -21,11 +21,23 @@ const decodedCode = function (decodedText: string, decodedResult: any) {
} }
} }
function changecount(value: number) {
let addcount = "";
if (count.value > 1) {
addcount = `+${count.value - 1}`;
}
result.value = `內容:${smscontent.value}${addcount}`;
}
function smsto1922(decodedText: string) { function smsto1922(decodedText: string) {
let addcount = "";
if (count.value > 1) {
addcount = `+${count.value - 1}`;
}
let contents = decodedText.split('1922:'); let contents = decodedText.split('1922:');
let sms = contents[1]; let sms = contents[1];
result.value = `內容:${sms}`;
smscontent.value = sms; smscontent.value = sms;
result.value = `內容:${smscontent.value}${addcount}`;
let Btn_Open = document.getElementById("Btn_Open")!; let Btn_Open = document.getElementById("Btn_Open")!;
Btn_Open.style.display = "inline"; Btn_Open.style.display = "inline";
OnclickOpen(); OnclickOpen();
@ -63,7 +75,7 @@ onLoad();
<template> <template>
<div> <div>
人數 人數
<el-input-number v-model="count" :min="1" size="large" /> <el-input-number v-model="count" :min="1" size="large" @change="changecount" />
</div> </div>
<div id="section" class="section" style="width: 70%; margin: auto;"> <div id="section" class="section" style="width: 70%; margin: auto;">
<QRCodeScanner :qrbox="200" :fps="10" @decodedCode="decodedCode"> <QRCodeScanner :qrbox="200" :fps="10" @decodedCode="decodedCode">