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