- Le immagini uploadate non vengono visualizzate subito... cache... aggiungere la versione dell'immagine: vers_img

- Aggiunto il Server TESTRISO e TEST_PCB.
This commit is contained in:
Surya Paolo
2024-09-17 17:38:57 +02:00
parent 0872afbb39
commit b9a5c54071
86 changed files with 2154 additions and 1532 deletions

View File

@@ -16,6 +16,8 @@ import {
TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField, IAccount, IMyCircuit, ISendCoin, IMovement, IMovVisu, INotif, IMyElem, IMyCard, ILabelValue, ILabelValueStr, IAnim, ILang, IGroupShort, IPagination, IFavorite, IBookmark,
} from '@model'
import MixinBase from '@/mixins/mixin-base'
import { fieldsTable } from '@store/Modules/fieldsTable'
import { addToDate } from '@quasar/quasar-ui-qcalendar'
@@ -4425,9 +4427,13 @@ export const tools = {
getextfile(filename: string) {
if (filename) {
const mystr = filename.split('.')
if (mystr)
return mystr.pop()!.toLowerCase()
try {
const mystr = filename.split('.')
if (mystr)
return mystr.pop()!.toLowerCase()
} catch (e) {
return ''
}
}
return ''
},
@@ -5240,7 +5246,7 @@ export const tools = {
const site = globalStore.site
if (site) {
return site.host!.replace(/^(https?:\/\/)/, '');
return site.host ? site.host!.replace(/^(https?:\/\/)/, '') : '';
}
return ''
},
@@ -7883,19 +7889,33 @@ export const tools = {
getImgFileByElem(elem: IMyElem, reccard?: IMyCard) {
if (elem) {
let addtourl = ''
if (elem && elem.vers_img) {
addtourl = '?v=' + elem.vers_img
}
if (elem.type === shared_consts.ELEMTYPE.CARD) {
if (reccard?.imagefile)
return 'upload/pages/' + elem.path + '/' + reccard.imagefile
else
if (reccard?.imagefile) {
if (reccard.vers_img) {
addtourl = '?v=' + reccard.vers_img
}
return 'upload/pages/' + elem.path + '/' + reccard.imagefile + addtourl
} else
return ''
} else if (elem.type === shared_consts.ELEMTYPE.IMAGE) {
return 'upload/pages/' + elem.path + '/' + elem.container
return 'upload/pages/' + elem.path + '/' + elem.container + addtourl
} else {
return 'upload/pages/' + elem.path + '/' + elem.image
return 'upload/pages/' + elem.path + '/' + elem.image + addtourl
}
}
},
getGenerateVersionImage() {
return 100000 + Math.round(Math.random() * 899999)
},
findFirstElemInCommon(arr1: ILabelValueStr[], arr2: string[]) {
for (let i = 0; i < arr1.length; i++) {
for (let j = 0; j < arr2.length; j++) {
@@ -8584,7 +8604,11 @@ export const tools = {
},
contieneSlash(str: string) {
return str.includes('/');
try {
return str.includes('/');
} catch (e) {
return ''
}
},
refreshPage() {
@@ -8781,8 +8805,68 @@ export const tools = {
// Attualmente se sei loggato puoi inserire Record
return this.isLogged() && this.isUserOk()
}
},
getsrcimg(gallerylist: any, dir: string) {
console.log('getsrcimg', gallerylist)
let addtourl = ''
if (!gallerylist) {
return 'images/noimg.png';
}
if (gallerylist && gallerylist.vers_img) {
addtourl = '?v=' + gallerylist.vers_img
}
if (gallerylist && !gallerylist.imagefile) {
return 'images/noimg.png';
}
if (gallerylist) {
if (this.getextfile(gallerylist.imagefile) === 'pdf')
return 'images/images/pdf.jpg'
else {
if (this.contieneSlash(gallerylist.imagefile)) {
return gallerylist.imagefile + addtourl
} else {
return costanti.DIR_UPLOAD + dir + '/' + gallerylist.imagefile + addtourl
}
}
} else {
return 'images/noimg.png';
}
},
async saveInDBForTypes($q: any, mykey: string, newval: any, type: any, serv: boolean, table?: string, mysubkey: string, id: any, indrec?: number, mysubsubkey: string, specialField: ISpecialField): boolean {
const { setValDb, getValDb } = MixinBase()
let eseguito = false
if (table === 'myelems') {
if (type === costanti.FieldType.image && newval.imagefile) {
let myval = newval.imagefile
setValDb($q, mykey, myval, type, serv, table, mysubkey, id, indrec, mysubsubkey, specialField)
myval = newval.vers_img
let mykey2 = 'vers_img'
setValDb($q, mykey2, myval, type, serv, table, mysubkey, id, indrec, mysubsubkey, specialField)
eseguito = true
}
}
if (!eseguito) {
// if (newval !== valinitial) {
setValDb($q, mykey, newval, type, serv, table, mysubkey, id, indrec, mysubsubkey, specialField)
// }
}
return eseguito
},
// FINE !