- Fix CImgTitle positioning

- CPreloadImage
This commit is contained in:
Paolo Arena
2019-09-19 22:56:19 +02:00
parent 04f4a83d6c
commit 3459f00a3b
18 changed files with 208 additions and 86 deletions

View File

@@ -341,7 +341,7 @@ namespace Actions {
return
}
if (UserStore.state.userId === undefined) {
if (UserStore.state.userId === undefined || UserStore.state.tokens[0] === undefined) {
return
}

View File

@@ -1728,6 +1728,7 @@ export const tools = {
},
heightgallery() {
if (Screen.width < 400) {
return '200px'
@@ -1738,22 +1739,51 @@ export const tools = {
}
},
myheight_imgtitle(myheight?) {
myheight_imgtitle(myheight?, myheightmobile?) {
let maxheight = 0
if (!!myheight) {
if (myheight > 0)
return myheight
}
if (Screen.width < 400) {
return 350
} else if (Screen.width < 600) {
return 400
} else if (Screen.width < 800) {
return 450
} else if (Screen.width < 1000) {
return 500
maxheight = myheight
if (myheight > 0) {
if (myheight > 1000) {
maxheight = 1000
} else {
maxheight = parseInt(myheight, 10)
}
}
} else {
return 500
maxheight = 500
}
let maxh2 = 0
if (Screen.width < 400) {
maxh2 = 350
} else if (Screen.width < 600) {
maxh2 = 400
} else if (Screen.width < 800) {
maxh2 = 450
} else if (Screen.width < 1000) {
maxh2 = 500
} else {
maxh2 = 500
}
console.log('maxh2', maxh2)
console.log('maxheight', maxheight)
let ris = 0
if (maxh2 < maxheight)
ris = maxh2
else
ris = maxheight
if (!!myheightmobile) {
if (this.isMobile() && maxh2 > myheightmobile)
ris = parseInt(myheightmobile, 10)
}
console.log('ris', ris)
return ris
},
myheight_dialog() {
@@ -1766,11 +1796,15 @@ export const tools = {
}
},
styles_imgtitle() {
if (Screen.width < 400) {
return 'max-height: 250px'
styles_imgtitle(sized?: string) {
if (!!sized) {
return sized
} else {
return 'max-height: 350px'
if (Screen.width < 400) {
return 'max-height: 250px'
} else {
return 'max-height: 350px'
}
}
},
@@ -1808,6 +1842,10 @@ export const tools = {
}
},
isMobile() {
return (Screen.width < 400)
},
mywidth_imgtitle() {
if (Screen.width < 400) {
return '250'
@@ -1922,9 +1960,43 @@ export const tools = {
appid() {
return process.env.APP_ID
},
getLabelByItem(item, mythis) {
if (!!item.name)
return mythis.$t(item.name)
else
return item.text
},
getimgbysize(dir: string, file: string) {
const myimage = dir + file
console.log('includes = ', static_data.preLoadImages.includes(myimage), myimage)
let ris = ''
if (this.isMobile() && (static_data.preLoadImages.includes(myimage))) {
ris = dir + 'mobile/' + file
} else {
ris = myimage
}
console.log('getimgbysize', ris)
return ris
},
getimgFullpathbysize(fileimg: string) {
const ind = fileimg.lastIndexOf('/')
if (ind > 0) {
return { path: fileimg.substring(0, ind + 1) , file: fileimg.substring(ind + 1) }
} else {
return { path: '', file: fileimg }
}
}
// getLocale() {
// if (navigator.languages && navigator.languages.length > 0) {
// return navigator.languages[0]

View File

@@ -22,20 +22,27 @@ export const func_tools = {
},
getDateStr(mydate) {
if (costanti_tools.DateFormatter) {
const DateFormatter = new Intl.DateTimeFormat(func_tools.getLocale() || void 0, {
weekday: 'long',
day: 'numeric',
month: 'long',
year: 'numeric'
// timeZone: 'UTC'
})
if (DateFormatter) {
const date = new Date(mydate)
return costanti_tools.DateFormatter.format(date)
return DateFormatter.format(date)
}
return mydate
}
}
export const costanti_tools = {
DateFormatter: new Intl.DateTimeFormat(func_tools.getLocale() || void 0, {
weekday: 'long',
day: 'numeric',
month: 'long',
year: 'numeric'
// timeZone: 'UTC'
})
}
// export const costanti_tools = {
// DateFormatter: new Intl.DateTimeFormat(func_tools.getLocale() || void 0, {
// weekday: 'long',
// day: 'numeric',
// month: 'long',
// year: 'numeric'
// // timeZone: 'UTC'
// })
// }