[add] 防疫簡訊功能
This commit is contained in:
parent
3e7e2df173
commit
47bf06bc03
File diff suppressed because one or more lines are too long
2
dist/index.html
vendored
2
dist/index.html
vendored
@ -7,7 +7,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>HTML5 QR Code with Vue js</title>
|
||||
<script type="module" crossorigin src="./assets/index.42417b10.js"></script>
|
||||
<script type="module" crossorigin src="./assets/index.e641ed81.js"></script>
|
||||
<link rel="stylesheet" href="./assets/index.06d14ce2.css">
|
||||
</head>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"dev": "vite --host",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
|
@ -1,52 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
|
||||
defineProps<{ msg: string }>()
|
||||
|
||||
const count = ref(0)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>{{ msg }}</h1>
|
||||
|
||||
<p>
|
||||
Recommended IDE setup:
|
||||
<a href="https://code.visualstudio.com/" target="_blank">VS Code</a>
|
||||
+
|
||||
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
|
||||
</p>
|
||||
|
||||
<p>See <code>README.md</code> for more information.</p>
|
||||
|
||||
<p>
|
||||
<a href="https://vitejs.dev/guide/features.html" target="_blank">
|
||||
Vite Docs
|
||||
</a>
|
||||
|
|
||||
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Docs</a>
|
||||
</p>
|
||||
|
||||
<button type="button" @click="count++">count is: {{ count }}</button>
|
||||
<p>
|
||||
Edit
|
||||
<code>components/HelloWorld.vue</code> to test hot module replacement.
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
|
||||
label {
|
||||
margin: 0 0.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
code {
|
||||
background-color: #eee;
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
color: #304455;
|
||||
}
|
||||
</style>
|
@ -5,18 +5,37 @@ import QRCodeScanner from './QRCodeScanner.vue';
|
||||
// defineProps<{ msg: string }>()
|
||||
|
||||
let result = ref('')
|
||||
let smscontent = ref('')
|
||||
let isSHowSMS = ref('visibility:hidden')
|
||||
|
||||
const decodedCode = function (decodedText: string, decodedResult: any) {
|
||||
console.log(`Scan result ${decodedText}`, decodedResult);
|
||||
// console.log(`Scan result ${decodedText}`, decodedResult);
|
||||
if (decodedText.includes('smsto:1922:')) {
|
||||
smsto1922(decodedText);
|
||||
} else {
|
||||
result.value = `內容:${decodedText}`;
|
||||
}
|
||||
}
|
||||
|
||||
function smsto1922(decodedText: string) {
|
||||
let contents = decodedText.split('smsto:1922:');
|
||||
let sms = contents[1];
|
||||
result.value = `內容:${sms}`;
|
||||
// smscontent.value = sms;
|
||||
let smsto = document.getElementById("smsto")!;
|
||||
smsto.innerHTML = `<a href="sms:1922&body=${sms}">按我傳送簡訊</a>`;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="section" style="width: 500px; margin: auto;">
|
||||
<QRCodeScanner :qrbox="250" :fps="10" style="width: 500px;" @decodedCode="decodedCode">
|
||||
<QRCodeScanner :qrbox="250" :fps="10" style="width: 100%;" @decodedCode="decodedCode">
|
||||
</QRCodeScanner>
|
||||
</div>
|
||||
<div> {{ result }} </div>
|
||||
<div id="smsto">
|
||||
<!-- <div style="visibility:hidden"> -->
|
||||
<!-- <a href="sms:1922&body={{content}}">Click here to text us!</a> -->
|
||||
</div>
|
||||
</template>
|
Loading…
Reference in New Issue
Block a user