mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Improved modal
This commit is contained in:
parent
f19d46a7c6
commit
04663aa94a
@ -8,8 +8,19 @@
|
|||||||
@confirm="report"
|
@confirm="report"
|
||||||
@cancel="close"
|
@cancel="close"
|
||||||
>
|
>
|
||||||
|
<transition name="ds-transition-fade">
|
||||||
|
<ds-flex
|
||||||
|
v-if="success"
|
||||||
|
class="hc-modal-success"
|
||||||
|
centered
|
||||||
|
>
|
||||||
|
<sweetalert-icon icon="success" />
|
||||||
|
</ds-flex>
|
||||||
|
</transition>
|
||||||
|
|
||||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||||
<p v-html="$t(`report.${data.context}.message`, { name: name })" />
|
<p v-html="$t(`report.${data.context}.message`, { name: name })" />
|
||||||
|
|
||||||
<template
|
<template
|
||||||
slot="footer"
|
slot="footer"
|
||||||
slot-scope="{ cancel, confirm, cancelLabel, confirmLabel }"
|
slot-scope="{ cancel, confirm, cancelLabel, confirmLabel }"
|
||||||
@ -37,11 +48,16 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
|
import { SweetalertIcon } from 'vue-sweetalert-icons'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ReportModal',
|
name: 'ReportModal',
|
||||||
|
components: {
|
||||||
|
SweetalertIcon
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
success: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
disabled: false
|
disabled: false
|
||||||
}
|
}
|
||||||
@ -63,6 +79,7 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
isOpen(open) {
|
isOpen(open) {
|
||||||
if (open) {
|
if (open) {
|
||||||
|
this.success = false
|
||||||
this.disabled = false
|
this.disabled = false
|
||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
}
|
||||||
@ -75,6 +92,7 @@ export default {
|
|||||||
report() {
|
report() {
|
||||||
console.log('')
|
console.log('')
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
this.disabled = true
|
||||||
this.$apollo
|
this.$apollo
|
||||||
.mutate({
|
.mutate({
|
||||||
mutation: gql`
|
mutation: gql`
|
||||||
@ -94,9 +112,9 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
this.success = true
|
||||||
this.$toast.success('Thanks for reporting!')
|
this.$toast.success('Thanks for reporting!')
|
||||||
this.disabled = true
|
setTimeout(this.close, 1500)
|
||||||
this.close()
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
this.$toast.error(err.message)
|
this.$toast.error(err.message)
|
||||||
@ -109,3 +127,18 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.hc-modal-success {
|
||||||
|
pointer-events: none;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
opacity: 1;
|
||||||
|
z-index: $z-index-modal;
|
||||||
|
border-radius: $border-radius-x-large;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -56,6 +56,7 @@
|
|||||||
"v-tooltip": "^2.0.0-rc.33",
|
"v-tooltip": "^2.0.0-rc.33",
|
||||||
"vue-count-to": "^1.0.13",
|
"vue-count-to": "^1.0.13",
|
||||||
"vue-izitoast": "1.1.2",
|
"vue-izitoast": "1.1.2",
|
||||||
|
"vue-sweetalert-icons": "^3.2.0",
|
||||||
"vuex-i18n": "^1.11.0"
|
"vuex-i18n": "^1.11.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@ -11691,6 +11691,11 @@ vue-svg-loader@^0.11.0:
|
|||||||
loader-utils "^1.1.0"
|
loader-utils "^1.1.0"
|
||||||
svg-to-vue "^0.3.0"
|
svg-to-vue "^0.3.0"
|
||||||
|
|
||||||
|
vue-sweetalert-icons@^3.2.0:
|
||||||
|
version "3.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/vue-sweetalert-icons/-/vue-sweetalert-icons-3.2.0.tgz#2926d3af5590b81c0ba3b104212922fc1709396d"
|
||||||
|
integrity sha512-N18uG8++ZfdCnXO0gHNTmwpB2mAE8WWrwjGeWGa8CnHu6l1emn4RG6E8r1P9crVJ+fx3R9gTUezC+cdVu0mN7w==
|
||||||
|
|
||||||
vue-template-compiler@^2.5.17:
|
vue-template-compiler@^2.5.17:
|
||||||
version "2.5.17"
|
version "2.5.17"
|
||||||
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.5.17.tgz#52a4a078c327deb937482a509ae85c06f346c3cb"
|
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.5.17.tgz#52a4a078c327deb937482a509ae85c06f346c3cb"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user