-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathAcceptTermsDialog.vue
95 lines (83 loc) · 2.42 KB
/
AcceptTermsDialog.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<template>
<QDialog
v-model="modelValueComputed"
maximized
transitionShow="jump-up"
transitionHide="jump-down"
class="accept-terms-dialog transparent-backdrop"
>
<QLayout container view="hHh Lpr lff" class="bg-background">
<QHeader class="q-py-sm">
<QToolbar>
<div class="column">
<QToolbarTitle class="text-display">ライセンス情報</QToolbarTitle>
</div>
<QSpace />
<div class="row items-center no-wrap">
<QBtn
outline
label="同意せずに終了"
icon="sym_r_close"
color="toolbar-button"
textColor="toolbar-button-display"
class="text-no-wrap q-mr-md text-bold"
@click="handler(false)"
/>
<QBtn
outline
label="同意してはじめる"
icon="sym_r_power_settings_new"
color="toolbar-button"
textColor="toolbar-button-display"
class="text-no-wrap text-bold"
@click="handler(true)"
/>
</div>
</QToolbar>
</QHeader>
<QPageContainer>
<QPage>
<QCard flat bordered>
<!-- eslint-disable-next-line vue/no-v-html -->
<div class="q-pa-md markdown markdown-body" v-html="terms"></div>
</QCard>
</QPage>
</QPageContainer>
</QLayout>
</QDialog>
</template>
<script setup lang="ts">
import { computed, ref, onMounted } from "vue";
import { useStore } from "@/store";
import { useMarkdownIt } from "@/plugins/markdownItPlugin";
const props = defineProps<{
modelValue: boolean;
}>();
const emit = defineEmits<{
(e: "update:modelValue", value: boolean): void;
}>();
const store = useStore();
const modelValueComputed = computed({
get: () => props.modelValue,
set: (val) => emit("update:modelValue", val),
});
const handler = (acceptTerms: boolean) => {
void store.actions.SET_ACCEPT_TERMS({
acceptTerms: acceptTerms ? "Accepted" : "Rejected",
});
!acceptTerms
? void store.actions.CHECK_EDITED_AND_NOT_SAVE({ closeOrReload: "close" })
: undefined;
modelValueComputed.value = false;
};
const md = useMarkdownIt();
const terms = ref("");
onMounted(async () => {
terms.value = md.render(await store.actions.GET_POLICY_TEXT());
});
</script>
<style scoped lang="scss">
.q-page {
padding: 3rem;
}
</style>