Web Editor home made

This commit is contained in:
Surya Paolo
2022-11-17 08:10:43 +01:00
parent 711f1b515d
commit 495abc33be
77 changed files with 1742 additions and 1771 deletions

View File

@@ -15,6 +15,7 @@ import { tools } from '@store/Modules/tools'
import { useQuasar } from 'quasar'
import { useI18n } from '@/boot/i18n'
import { shared_consts } from '@/common/shared_vuejs'
import objectId from '@src/js/objectId'
export default defineComponent({
name: 'CMyPageElem',
@@ -59,13 +60,14 @@ export default defineComponent({
const $q = useQuasar()
const { t } = useI18n()
const globalStore = useGlobalStore()
const editOn = ref(false)
const addOn = ref(false)
const selElem = ref({} as IMyElem)
const myelemVoid = ref({active: true, type: shared_consts.ELEMTYPE.TEXT, container: '...', path: mypathin.value} as IMyElem)
const myelemVoid = ref({ _id: objectId(), active: true, type: shared_consts.ELEMTYPE.TEXT, container: '...', path: mypathin.value } as IMyElem)
const globalStore = useGlobalStore()
const selElem = ref(globalStore.selElem)
const myelems = computed(() => {
if (mypathin.value)
@@ -74,37 +76,52 @@ export default defineComponent({
return null
})
const load = async (): Promise<void> => {
function load() {
// console.log('load', mypathin.value)
if (mypathin.value !== '') rec.value = await globalStore.loadPage('/' + mypathin.value)
if (mypathin.value !== '') {
globalStore.loadPage('/' + mypathin.value, 'cmypageelem').then(ris => {
rec.value = ris
})
}
editOn.value = tools.getCookie('EDIT_' + mypathin.value) === '-1' ? true : false
if (mypathin.value === 'home')
editOn.value = false
console.log('getcookie: ', editOn.value, mypathin.value)
if (tools.isManager()) {
editOn.value = tools.getCookie('EDITPAGES', '0') === '-1' ? true : false
console.log('getcookie: ', editOn.value, mypathin.value)
}
}
watch(() => props.mypath, async (to: string, from: string) => {
watch(() => props.mypath, (to: string, from: string) => {
console.log('... load', mypathin.value, props.mypath)
await load()
selElem.value = {}
load()
})
watch(
() => editOn.value,
() => {
if (!editOn.value) {
selElem.value = {}
}
})
function selElemClick(myelem: IMyElem) {
console.log('mypageelem selElemClick', myelem)
selElem.value = myelem
}
function mounted() {
load()
}
function saveElem(myelem: IMyElem) {
//
}
function changeVisuDrawer() {
console.log('changeVisuDrawer')
tools.setCookie('EDIT_' + mypathin.value, editOn.value ? '-1' : '0')
function changeVisuDrawer(path: string, edit: boolean) {
globalStore.changeVisuDrawer(path, edit)
}
onMounted(load)
onMounted(mounted)
return {
rec, myelems,