bugs fixes
This commit is contained in:
parent
419e6a1a71
commit
46953da4cc
7 changed files with 131 additions and 62 deletions
|
@ -156,7 +156,7 @@ export default {
|
|||
]
|
||||
}
|
||||
}),
|
||||
created () {
|
||||
mounted () {
|
||||
let peoples = this.$store.state.data.contacts.peoples
|
||||
if (!Array.isArray(peoples)) {
|
||||
peoples = []
|
||||
|
|
|
@ -9,14 +9,15 @@
|
|||
<v-card-text>
|
||||
<v-layout justify-center>
|
||||
<croppa
|
||||
ref="croppa"
|
||||
class="canvas-container"
|
||||
v-model="plugin"
|
||||
:show-remove-button="false"
|
||||
canvas-color="white"
|
||||
:width="width"
|
||||
:height="height"
|
||||
accept="image/jpeg,image/png"
|
||||
prevent-white-space
|
||||
:width="width"
|
||||
:height="height"
|
||||
:show-remove-button="false"
|
||||
:initial-image="imageUrl"
|
||||
:placeholder-font-size="22"
|
||||
@file-size-exceed="handleFileSizeExceed"
|
||||
|
@ -108,6 +109,11 @@ export default {
|
|||
methods: {
|
||||
toggle: function () {
|
||||
this.enabled = !this.enabled
|
||||
this.$nextTick(() => {
|
||||
if (this.enabled) {
|
||||
this.$refs.croppa.refresh()
|
||||
}
|
||||
})
|
||||
},
|
||||
clear: function () {
|
||||
this.plugin.remove()
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
</template>
|
||||
|
||||
<v-list>
|
||||
<v-list-item @click="openPreviewModal()">
|
||||
<v-list-item-title>Prévisualiser votre page</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item @click="goToPage()">
|
||||
<v-list-item-title>Ouvrir la page publique</v-list-item-title>
|
||||
</v-list-item>
|
||||
|
@ -205,11 +208,24 @@
|
|||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<Preview
|
||||
ref="preview"
|
||||
:enabled="previewModal"
|
||||
:id="$store.state.delegate._id"
|
||||
:slug="$store.state.delegate.slug"
|
||||
:dialogTitle="'Prévisualiser votre page publique'"
|
||||
@close="previewModal = false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Preview from '../components/Preview'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Preview
|
||||
},
|
||||
data: () => ({
|
||||
enabled: false,
|
||||
loading: true,
|
||||
|
@ -222,7 +238,8 @@ export default {
|
|||
publishModal: false,
|
||||
askingApprovalLoading: false,
|
||||
rejectionDetailsModal: false,
|
||||
showPassword: false
|
||||
showPassword: false,
|
||||
previewModal: false
|
||||
}),
|
||||
created () {
|
||||
this.init()
|
||||
|
@ -252,6 +269,14 @@ export default {
|
|||
// }, 3000)
|
||||
},
|
||||
methods: {
|
||||
openPreviewModal () {
|
||||
this.save(false).then(() => {
|
||||
this.$refs.preview.reload()
|
||||
this.previewModal = true
|
||||
}).catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
selectRoute (route) {
|
||||
const path = route.path.split('/')
|
||||
const name = path[path.length - 1]
|
||||
|
@ -295,8 +320,10 @@ export default {
|
|||
const proposedVersion = res.data.data.organization.proposedVersion
|
||||
const tags = res.data.data.tags
|
||||
this.$store.commit('SET_DELEGATE', {
|
||||
_id: organization._id,
|
||||
adminName: organization.adminName,
|
||||
email: organization.email,
|
||||
slug: organization.slugs[organization.slugs.length - 1],
|
||||
publicUrl: process.env.VUE_APP_BASE_URL + '/association/' + organization.slugs[organization.slugs.length - 1],
|
||||
validationState: organization.validationState,
|
||||
rejectionDescription: organization.rejectionDescription
|
||||
|
@ -326,7 +353,8 @@ export default {
|
|||
window.localStorage.removeItem('delegateToken')
|
||||
this.$router.push('/')
|
||||
},
|
||||
save () {
|
||||
save (showSuccessAlert = true) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.isSaving = true
|
||||
const data = this.$store.state.data
|
||||
data.pricing = data.pricing.map(i => {
|
||||
|
@ -351,10 +379,13 @@ export default {
|
|||
}
|
||||
this.$apitator.put('/delegate', data, { withAuth: true }).then(() => {
|
||||
this.isSaving = false
|
||||
if (showSuccessAlert) {
|
||||
this.$store.commit('ADD_ALERT', {
|
||||
color: 'success',
|
||||
text: 'Vos changements ont été sauvegardés !'
|
||||
})
|
||||
}
|
||||
resolve()
|
||||
}).catch(err => {
|
||||
console.log(err.data)
|
||||
this.isSaving = false
|
||||
|
@ -362,6 +393,8 @@ export default {
|
|||
color: 'error',
|
||||
text: 'Impossible de sauvegarder vos changements'
|
||||
})
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
navigate (routeName) {
|
||||
|
@ -378,11 +411,14 @@ export default {
|
|||
window.open(this.$store.state.delegate.publicUrl, '_blank').focus()
|
||||
},
|
||||
openPublishModal () {
|
||||
const open = () => {
|
||||
// compute if the user can ask approval
|
||||
this.$store.commit('VALIDATE_MAIN', isValid => {
|
||||
if (isValid) {
|
||||
this.publishModal = true
|
||||
this.save()
|
||||
this.save(false).catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
} else {
|
||||
this.$store.commit('ADD_ALERT', {
|
||||
color: 'error',
|
||||
|
@ -392,6 +428,17 @@ export default {
|
|||
}
|
||||
this.canPublish = isValid
|
||||
})
|
||||
}
|
||||
this.$store.state.validateMain = false
|
||||
this.$router.push({ name: 'DelegateMain' }, () => {
|
||||
this.$store.commit('ON_MAIN_READY', () => {
|
||||
open()
|
||||
return true
|
||||
})
|
||||
})
|
||||
if (this.$route.name === 'DelegateMain') {
|
||||
open()
|
||||
}
|
||||
},
|
||||
askApproval () {
|
||||
this.askingApprovalLoading = true
|
||||
|
|
|
@ -18,6 +18,7 @@ interface State {
|
|||
debug: boolean;
|
||||
validateMain: boolean;
|
||||
validateMainCallback: any;
|
||||
onMainReady: any;
|
||||
}
|
||||
|
||||
const defaultState: State = {
|
||||
|
@ -52,6 +53,8 @@ const defaultState: State = {
|
|||
}
|
||||
},
|
||||
delegate: {
|
||||
_id: '',
|
||||
slug: '',
|
||||
validationState: 'unaware',
|
||||
admiName: '',
|
||||
email: '',
|
||||
|
@ -59,6 +62,7 @@ const defaultState: State = {
|
|||
},
|
||||
debug: false,
|
||||
validateMain: false,
|
||||
onMainReady: () => false,
|
||||
validateMainCallback: (d = false) => d
|
||||
}
|
||||
|
||||
|
@ -99,6 +103,9 @@ export default new Vuex.Store({
|
|||
state.validateMain = false
|
||||
return callback(d)
|
||||
}
|
||||
},
|
||||
ON_MAIN_READY (state: State, callback) {
|
||||
state.onMainReady = callback
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
prepend-icon="public"
|
||||
label="Site web"
|
||||
outlined
|
||||
:rules="rules.website"
|
||||
v-model="$store.state.data.contacts.website" />
|
||||
<v-textarea
|
||||
prepend-icon="room"
|
||||
|
@ -94,7 +95,7 @@ export default {
|
|||
data: () => ({
|
||||
rules: {
|
||||
website: [
|
||||
v => v === '' || /.+@.+\..+/.test(v) || "L'email doit être valide"
|
||||
v => v === '' || /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/gm.test(v) || "L'adresse web doit être valide"
|
||||
],
|
||||
address: [
|
||||
v => v.length < 200 || 'Maximum 200 caractères'
|
||||
|
|
|
@ -119,8 +119,7 @@
|
|||
<span>Décaler vers la droite</span>
|
||||
</v-tooltip>
|
||||
<v-spacer />
|
||||
|
||||
<v-tooltip bottom>
|
||||
<v-tooltip bottom v-if="media.contentType.split('/')[0] === 'image'">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn
|
||||
icon
|
||||
|
@ -351,14 +350,14 @@ export default {
|
|||
},
|
||||
clearCover () {
|
||||
this.$store.commit('SET_DATA', {
|
||||
cover: undefined
|
||||
cover: null
|
||||
})
|
||||
},
|
||||
openMedia (item) {
|
||||
window.open(item.location, '_blank').focus()
|
||||
},
|
||||
chooseAsCover (item) {
|
||||
this.coverImage = item.location
|
||||
this.coverImage = process.env.VUE_APP_BASE_URL + '/proxy-s3/' + item.key
|
||||
this.$refs.avatarEditor.toggle()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,20 +127,29 @@ export default {
|
|||
// })
|
||||
// },
|
||||
|
||||
mounted () {
|
||||
if (this.$store.state.onMainReady()) {
|
||||
this.validate()
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'$store.state.validateMain' (val) {
|
||||
if (val) {
|
||||
this.validateLogo = true
|
||||
this.$store.state.validateMainCallback(
|
||||
this.$refs.form.validate() &&
|
||||
this.$store.state.data.thumbnail.location.length > 1
|
||||
)
|
||||
this.validate()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleAvatarEditorSubmitted: function (blob) {
|
||||
validate () {
|
||||
this.validateLogo = true
|
||||
this.$store.state.validateMainCallback(
|
||||
this.$refs.form.validate() &&
|
||||
this.$store.state.data.thumbnail.location.length > 1
|
||||
)
|
||||
},
|
||||
handleAvatarEditorSubmitted (blob) {
|
||||
const form = new FormData()
|
||||
form.append('file', blob, blob.filename)
|
||||
this.logoLoading = true
|
||||
|
|
Loading…
Reference in a new issue