Skip to content

Commit

Permalink
Merge pull request #171 from hibiya-itchief/偽造防止
Browse files Browse the repository at this point in the history
偽造防止
  • Loading branch information
aozoraUS authored Sep 8, 2024
2 parents 9116d72 + 5da0d6e commit adf198d
Show file tree
Hide file tree
Showing 10 changed files with 471 additions and 1 deletion.
11 changes: 11 additions & 0 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,17 @@
>{{ page.text }}</v-list-item-title
>
</v-list-item>
<v-list-item
v-show="$auth.user?.groups?.includes(user_groups.students.id)"
to="/tickets/intoScanner"
>
<v-list-item-icon>
<v-icon color="theme_color">mdi-qrcode-scan</v-icon>
</v-list-item-icon>
<v-list-item-title style="font-family: serif; font-weight: bold">
QRコード
</v-list-item-title>
</v-list-item>
</v-list-item-group>
</v-list>
<template #append>
Expand Down
5 changes: 4 additions & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ const nuxt_config: NuxtConfig = {
css: ['~/assets/css/main.css'],

// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: ['~/plugins/userrole.ts'],
plugins: [
'~/plugins/userrole.ts',
{ src: '~/plugins/vue-qrcode-reader.ts', ssr: false },
],

// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"postinstall-postinstall": "^2.1.0",
"qrcode": "^1.5.1",
"vue": "^2.7.10",
"vue-qrcode-reader": "3.2.0",
"vue-server-renderer": "^2.7.10",
"vue-template-compiler": "^2.7.10",
"vuetify": "^2.6.10"
Expand Down
129 changes: 129 additions & 0 deletions pages/groups/_groupId/data/id.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<template>
<v-app>
<v-row justify="center">
<v-col cols="10">
<h1 class="info-title" style="text-align: left; margin-bottom: 5%">
受付用整理券ID確認ページ
</h1>
<br />
<p>
受付では観客の方に整理券ページ移ってもらいQRコードを表示してもらってください。
</p>
<br />
<v-btn
to="/tickets/intoScanner"
color="theme_color"
style="margin-bottom: 5%"
><span style="color: white">QRコードスキャナー</span></v-btn
><br />
<p>
以下の機能は人力でお客さんの整理券のIDが正しいものかを照らし合わせるためのものです。お客さんの整理券のIDは整理券ページに表示されています。QRコードでの読み取りがうまくいかないときに使用してください。<br />
<br />
<span style="font-weight: bold"><使い方></span><br />
整理券のID一覧を取得したい公演の横に表示されている「取得」ボタンを押してください。その公演で取得されている整理券のID一覧がが下にある「結果」に表示されます。
</p>
<v-card>
<v-card-title>公演を選択してください</v-card-title>
<ul>
<li
v-for="event in events"
:key="event.id"
style="margin-bottom: 5%"
>
<v-row>
<v-col cols="8"> {{ event.eventname }}</v-col
><v-col cols="4" style="text-align: center"
><v-btn
style="text-align: right"
@click="getAllTickets(event)"
>取得</v-btn
></v-col
>
</v-row>
</li>
</ul>
</v-card>
<v-card>
<v-card-title> 結果 </v-card-title>
<v-card-text>
{{ tickets_id }}
</v-card-text>
</v-card>
</v-col>
</v-row>
</v-app>
</template>

<script lang="ts">
import Vue from 'vue'
import { Event } from '~/types/quaint'
type Data = {
events: Event[]
tickets_id: string[]
user_groups: {
students: string
}
}
export default Vue.extend({
data(): Data {
return {
events: [],
tickets_id: [],
user_groups: {
students: process.env.AZURE_AD_GROUPS_QUAINT_STUDENTS as string,
},
}
},
async created() {
if (
!(this.$auth.user?.groups as string[]).includes(this.user_groups.students)
) {
this.$nuxt.error({ statusCode: 403, message: 'Forbidden' })
}
this.events = await this.$axios
.$get('/groups/' + this.$route.params.groupId + '/events')
.then((result) => {
result.sort((x: Event, y: Event) => {
return new Date(x.starts_at) > new Date(y.starts_at) ? 1 : -1
})
return result
})
.catch(() => {
this.$store.commit('ShowInternetErrorSnackbar', {
message: '情報の取得に失敗しました。再読み込みしてください。',
})
return []
})
},
methods: {
async getAllTickets(event: Event) {
await this.$axios
.$get(
'/groups/' +
event.group_id +
'/events/' +
event.id +
'/tickets/active'
)
.then((res) => {
this.tickets_id = res
this.$store.commit('ShowInternetSuccessSnackbar', {
message: '情報の取得に成功しました。',
})
})
.catch((err) => {
this.$store.commit('ShowInternetErrorSnackbar', {
message:
'情報の取得に失敗しました。再読み込みしてください。エラー内容:' +
err,
})
})
},
},
})
</script>
16 changes: 16 additions & 0 deletions pages/groups/_groupId/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@
>
</v-card-actions>
<v-divider></v-divider>
<v-card-actions
v-if="$auth.user?.groups.includes(user_groups.students)"
class="py-1"
>
<v-btn
color="blue-grey"
dark
outlined
rounded
width="100%"
:to="'/groups/' + group?.id + '/data/id'"
>
<v-icon>mdi-cctv</v-icon>
受付用ページ
</v-btn>
</v-card-actions>
<v-card-actions
v-if="
editable == true ||
Expand Down
21 changes: 21 additions & 0 deletions pages/tickets/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@
整理券をキャンセル
</v-btn>
</v-card-actions>
<!-- QR code表示部分 -->
<div class="qrcode-container">
<v-img
class="mx-auto my-0"
style="display: block"
:src="ticket_info.qrcode"
width="90%"
/>
</div>
<v-img
v-if="ticket_info.group.public_thumbnail_image_url != null"
:src="ticket_info.group.public_thumbnail_image_url"
Expand Down Expand Up @@ -293,6 +302,15 @@
取り消し
</v-btn>
</v-card-actions>
<!-- QR code表示部分 -->
<div class="qrcode-container">
<v-img
class="mx-auto my-0"
style="display: block"
:src="ticket_info.qrcode"
width="90%"
/>
</div>
</v-expansion-panel-content>
</div>
</v-expansion-panel>
Expand Down Expand Up @@ -373,6 +391,7 @@ type TicketInfo = {
group: Group
event: Event
ticket: Ticket
qrcode: string
}
type Data = {
nowloading: boolean
Expand Down Expand Up @@ -516,10 +535,12 @@ export default Vue.extend({
const event: Event = await this.$axios.$get(
'/groups/' + ticket.group_id + '/events/' + ticket.event_id
)
const qrcode = await getQRCodeDataUrl(ticket.id as string)
const ticket_info: TicketInfo = {
group,
event,
ticket,
qrcode,
}
ticket_infos.push(ticket_info)
}
Expand Down
47 changes: 47 additions & 0 deletions pages/tickets/intoScanner.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<v-app>
<h1 class="info-title" style="margin-left: 5%; width: 80vw">
整理券スキャナーについて
</h1>
<v-row justify="center">
<v-col cols="11">
<p>
スキャナーを利用するためにカメラへのアクセスを許可してください。<br />
Microsoft Edgeは対応していません。<br />
カメラがすでに使用中の場合やカメラに問題がある場合は動作しません。<br />
<br />

<span style="color: var(--theme-color)"><使い方></span><br />
お客さんに整理券ページに写ってもらいQRコードを表示してもらってください。スキャナーでQRコードを読み取ります。読み取りが終わると下から読み取り結果が表示されます。表示された指示に従って対応してください。
</p>
</v-col>
<v-col style="text-align: center"
><v-btn color="theme_color" to="/tickets/scanner"
><span style="color: white">スキャナーを起動</span></v-btn
></v-col
>
</v-row>
</v-app>
</template>

<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
data() {
return {
user_groups: {
students: process.env.AZURE_AD_GROUPS_QUAINT_STUDENTS as string,
},
}
},
created() {
if (
!(this.$auth.user?.groups as string[]).includes(this.user_groups.students)
) {
this.$nuxt.error({ statusCode: 403, message: 'Forbidden' })
}
},
})
</script>
Loading

0 comments on commit adf198d

Please sign in to comment.