i
This commit is contained in:
61
src/pages/admin/verify/index.vue
Normal file
61
src/pages/admin/verify/index.vue
Normal file
@@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="card">
|
||||
<nut-button block type="primary" @click="scanCode"
|
||||
>扫码核销</nut-button
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Taro from "@tarojs/taro";
|
||||
|
||||
// url参数转对象
|
||||
const urlParse = (url: string) => {
|
||||
const obj: any = {};
|
||||
const reg = /[?&][^?&]+=[^?&]+/g;
|
||||
const arr = url.match(reg);
|
||||
if (arr) {
|
||||
arr.forEach((item) => {
|
||||
const tempArr = item.substring(1).split("=");
|
||||
const key = decodeURIComponent(tempArr[0]);
|
||||
const val = decodeURIComponent(tempArr[1]);
|
||||
obj[key] = val;
|
||||
});
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
|
||||
const scanCode = () => {
|
||||
Taro.scanCode({
|
||||
onlyFromCamera: true,
|
||||
scanType: ["qrCode"],
|
||||
success: (res) => {
|
||||
console.log(urlParse(res.result));
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f5f5f5;
|
||||
background-image: url("../../../static/admin/cancellation-header.png");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 30%;
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 80%;
|
||||
height: 300px;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
margin: 300px auto;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 100px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user