aggiunto "Seen"
This commit is contained in:
@@ -1613,6 +1613,7 @@ export const shared_consts = {
|
|||||||
'profile.username_telegram': 1,
|
'profile.username_telegram': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.seen': 1,
|
||||||
reported: 1,
|
reported: 1,
|
||||||
date_report: 1,
|
date_report: 1,
|
||||||
username_who_report: 1,
|
username_who_report: 1,
|
||||||
|
|||||||
@@ -1161,6 +1161,7 @@ export default defineComponent({
|
|||||||
'profile.username_telegram': 1,
|
'profile.username_telegram': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.seen': 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
pub_to_share: 1,
|
pub_to_share: 1,
|
||||||
numLevel: 1,
|
numLevel: 1,
|
||||||
@@ -1232,6 +1233,7 @@ export default defineComponent({
|
|||||||
'profile.username_telegram': 1,
|
'profile.username_telegram': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.seen': 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
pub_to_share: 1,
|
pub_to_share: 1,
|
||||||
dateTimeStart: 1,
|
dateTimeStart: 1,
|
||||||
@@ -1311,6 +1313,7 @@ export default defineComponent({
|
|||||||
'profile.username_telegram': 1,
|
'profile.username_telegram': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.seen': 1,
|
||||||
photos: 1,
|
photos: 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
pub_to_share: 1,
|
pub_to_share: 1,
|
||||||
@@ -1360,6 +1363,7 @@ export default defineComponent({
|
|||||||
'profile.username_telegram': 1,
|
'profile.username_telegram': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.seen': 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
pub_to_share: 1,
|
pub_to_share: 1,
|
||||||
numLevel: 1,
|
numLevel: 1,
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ export default defineComponent({
|
|||||||
myrec.value = props.prop_myrec
|
myrec.value = props.prop_myrec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (myrec.value)
|
||||||
|
clicca(costanti.TIPOFAVBOOK.SEEN, true, myrec.value._id)
|
||||||
|
|
||||||
col.value = fieldsTable.getArrColsByTable(props.table)
|
col.value = fieldsTable.getArrColsByTable(props.table)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,6 +151,11 @@ export default defineComponent({
|
|||||||
userStore.setBookmark($q, t, myrec.value._id, props.table, myrec.value);
|
userStore.setBookmark($q, t, myrec.value._id, props.table, myrec.value);
|
||||||
}
|
}
|
||||||
mylist = myrec.value.mybook
|
mylist = myrec.value.mybook
|
||||||
|
} else if (tipo === costanti.TIPOFAVBOOK.SEEN) {
|
||||||
|
if (myset) {
|
||||||
|
userStore.setSeen($q, t, myrec.value._id, props.table, myrec.value);
|
||||||
|
}
|
||||||
|
mylist = myrec.value.myseen
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!myset && mylist && mylist.length > 0) {
|
if (!myset && mylist && mylist.length > 0) {
|
||||||
|
|||||||
@@ -10,6 +10,22 @@
|
|||||||
</CGalleryImages>
|
</CGalleryImages>
|
||||||
|
|
||||||
<q-card-actions align="right">
|
<q-card-actions align="right">
|
||||||
|
<div class="">
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="blue"
|
||||||
|
icon="far fa-eye"
|
||||||
|
>
|
||||||
|
<q-badge
|
||||||
|
v-if="myrec.myseen"
|
||||||
|
color="primary"
|
||||||
|
:label="myrec.myseen.length"
|
||||||
|
floating
|
||||||
|
transparent
|
||||||
|
/>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
<div class="">
|
<div class="">
|
||||||
<q-btn
|
<q-btn
|
||||||
flat
|
flat
|
||||||
@@ -83,6 +99,24 @@
|
|||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
|
<q-item
|
||||||
|
clickable
|
||||||
|
v-close-popup
|
||||||
|
@click="
|
||||||
|
clicca(
|
||||||
|
costanti.TIPOFAVBOOK.SEEN,
|
||||||
|
false,
|
||||||
|
$t('cmd.seen', {num: myrec.myseen ? myrec.myseen.length : 0})
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="blue" name="fas fa-eye" />
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
{{ $t('cmd.seen', {num: myrec.myseen ? myrec.myseen.length : 0}) }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
<q-item
|
<q-item
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
|
|||||||
@@ -106,7 +106,17 @@
|
|||||||
{{ tools.getNameToShow(myrec) }}
|
{{ tools.getNameToShow(myrec) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="q-mx-sm">
|
<div class="q-mx-sm">
|
||||||
(<span class="">{{ myrec.myfav.length }}</span>
|
(
|
||||||
|
<span class="q-mx-xxs">{{ myrec.myseen.length }}</span>
|
||||||
|
<span class="q-mx-xxs"
|
||||||
|
><q-icon
|
||||||
|
dense
|
||||||
|
color="blue"
|
||||||
|
name="far fa-eye"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
<span class="q-mx-xxs"> </span>
|
||||||
|
<span class="">{{ myrec.myfav.length }}</span>
|
||||||
<span class="q-mx-xxs"
|
<span class="q-mx-xxs"
|
||||||
><q-icon
|
><q-icon
|
||||||
dense
|
dense
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ export default defineComponent({
|
|||||||
'profile.username_telegram': 1,
|
'profile.username_telegram': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.seen': 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
pub_to_share: 1,
|
pub_to_share: 1,
|
||||||
numLevel: 1,
|
numLevel: 1,
|
||||||
@@ -159,6 +160,7 @@ export default defineComponent({
|
|||||||
'profile.username_telegram': 1,
|
'profile.username_telegram': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.seen': 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
pub_to_share: 1,
|
pub_to_share: 1,
|
||||||
numLevel: 1,
|
numLevel: 1,
|
||||||
@@ -201,6 +203,7 @@ export default defineComponent({
|
|||||||
'profile.username_telegram': 1,
|
'profile.username_telegram': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.seen': 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
pub_to_share: 1,
|
pub_to_share: 1,
|
||||||
numLevel: 1,
|
numLevel: 1,
|
||||||
@@ -267,6 +270,7 @@ export default defineComponent({
|
|||||||
'profile.username_telegram': 1,
|
'profile.username_telegram': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.seen': 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
pub_to_share: 1,
|
pub_to_share: 1,
|
||||||
numLevel: 1,
|
numLevel: 1,
|
||||||
@@ -310,6 +314,7 @@ export default defineComponent({
|
|||||||
'profile.username_telegram': 1,
|
'profile.username_telegram': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.seen': 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
pub_to_share: 1,
|
pub_to_share: 1,
|
||||||
numLevel: 1,
|
numLevel: 1,
|
||||||
@@ -353,6 +358,7 @@ export default defineComponent({
|
|||||||
'profile.username_telegram': 1,
|
'profile.username_telegram': 1,
|
||||||
'profile.favorite': 1,
|
'profile.favorite': 1,
|
||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
|
'profile.seen': 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
pub_to_share: 1,
|
pub_to_share: 1,
|
||||||
numLevel: 1,
|
numLevel: 1,
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ export interface IFavorite {
|
|||||||
id: string
|
id: string
|
||||||
tab: number
|
tab: number
|
||||||
}
|
}
|
||||||
|
export interface ISeen {
|
||||||
|
id: string
|
||||||
|
tab: number
|
||||||
|
}
|
||||||
|
|
||||||
export interface IFavBook {
|
export interface IFavBook {
|
||||||
username: string
|
username: string
|
||||||
@@ -132,8 +136,10 @@ export interface IUserProfile {
|
|||||||
noFoto: boolean
|
noFoto: boolean
|
||||||
bookmark: IBookmark[]
|
bookmark: IBookmark[]
|
||||||
favorite: IFavorite[]
|
favorite: IFavorite[]
|
||||||
|
seen: ISeen[]
|
||||||
myfav: IFavBook[]
|
myfav: IFavBook[]
|
||||||
mybook: IFavBook[]
|
mybook: IFavBook[]
|
||||||
|
myseen: IFavBook[]
|
||||||
|
|
||||||
// in memory
|
// in memory
|
||||||
asked_friends: any[]
|
asked_friends: any[]
|
||||||
|
|||||||
@@ -1496,6 +1496,7 @@ const msg_it = {
|
|||||||
bookmark_unset: 'Rimosso dai Segnalibri',
|
bookmark_unset: 'Rimosso dai Segnalibri',
|
||||||
favorite: 'Piace a {num} utenti',
|
favorite: 'Piace a {num} utenti',
|
||||||
bookmark: 'Salvato da {num} utenti',
|
bookmark: 'Salvato da {num} utenti',
|
||||||
|
seen: 'Visto da {num} utenti',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export const costanti = {
|
|||||||
TIPOFAVBOOK: {
|
TIPOFAVBOOK: {
|
||||||
FAVORITE: 1,
|
FAVORITE: 1,
|
||||||
BOOKMARK: 2,
|
BOOKMARK: 2,
|
||||||
|
SEEN: 3,
|
||||||
},
|
},
|
||||||
|
|
||||||
ENABLE_FRIENDS: false,
|
ENABLE_FRIENDS: false,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import { Router } from 'vue-router'
|
|||||||
import { useProjectStore } from '@store/Projects'
|
import { useProjectStore } from '@store/Projects'
|
||||||
import { shared_consts } from '@/common/shared_vuejs'
|
import { shared_consts } from '@/common/shared_vuejs'
|
||||||
import { costanti } from '@costanti'
|
import { costanti } from '@costanti'
|
||||||
import { IBookmark, IFavBook, IFavorite, IGroupShort, IMyGroup, IUserAdmins } from '@model/UserStore'
|
import { IBookmark, ISeen, IFavBook, IFavorite, IGroupShort, IMyGroup, IUserAdmins } from '@model/UserStore'
|
||||||
|
|
||||||
import globalroutines from '../globalroutines/index'
|
import globalroutines from '../globalroutines/index'
|
||||||
import { useNotifStore } from '@store/NotifStore'
|
import { useNotifStore } from '@store/NotifStore'
|
||||||
@@ -44,6 +44,7 @@ import { useCircuitStore } from './CircuitStore'
|
|||||||
export const CMD_USER = {
|
export const CMD_USER = {
|
||||||
SET_FAVORITE: 1,
|
SET_FAVORITE: 1,
|
||||||
SET_BOOKMARK: 2,
|
SET_BOOKMARK: 2,
|
||||||
|
SET_SEEN: 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DefaultUser: IUserFields = {
|
export const DefaultUser: IUserFields = {
|
||||||
@@ -83,8 +84,10 @@ export const DefaultUser: IUserFields = {
|
|||||||
notifs: [],
|
notifs: [],
|
||||||
bookmark: [],
|
bookmark: [],
|
||||||
favorite: [],
|
favorite: [],
|
||||||
|
seen: [],
|
||||||
myfav: [],
|
myfav: [],
|
||||||
mybook: [],
|
mybook: [],
|
||||||
|
myseen: [],
|
||||||
notif_idCities: [],
|
notif_idCities: [],
|
||||||
notif_provinces: [],
|
notif_provinces: [],
|
||||||
notif_regions: [],
|
notif_regions: [],
|
||||||
@@ -152,8 +155,10 @@ export const DefaultProfile: IUserProfile = {
|
|||||||
notifs: [],
|
notifs: [],
|
||||||
bookmark: [],
|
bookmark: [],
|
||||||
favorite: [],
|
favorite: [],
|
||||||
|
seen: [],
|
||||||
myfav: [],
|
myfav: [],
|
||||||
mybook: [],
|
mybook: [],
|
||||||
|
myseen: [],
|
||||||
notif_idCities: [],
|
notif_idCities: [],
|
||||||
notif_provinces: [],
|
notif_provinces: [],
|
||||||
notif_regions: [],
|
notif_regions: [],
|
||||||
@@ -1676,6 +1681,12 @@ export const useUserStore = defineStore('UserStore', {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isSeen(id: string, table: string) {
|
||||||
|
const tab = tools.getNumTabByTable(table)
|
||||||
|
const myseen = this.my.profile.seen.find((rec: ISeen) => ((rec.id === id) && (rec.tab === tab)))
|
||||||
|
return myseen
|
||||||
|
},
|
||||||
|
|
||||||
isBookmarked(id: string, table: string) {
|
isBookmarked(id: string, table: string) {
|
||||||
const tab = tools.getNumTabByTable(table)
|
const tab = tools.getNumTabByTable(table)
|
||||||
const mybookmark = this.my.profile.bookmark.find((rec: IBookmark) => ((rec.id === id) && (rec.tab === tab)))
|
const mybookmark = this.my.profile.bookmark.find((rec: IBookmark) => ((rec.id === id) && (rec.tab === tab)))
|
||||||
@@ -1718,5 +1729,28 @@ export const useUserStore = defineStore('UserStore', {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async setSeen($q: any, t: any, id: any, table: string, myrec: any) {
|
||||||
|
let value = false
|
||||||
|
|
||||||
|
const tab = tools.getNumTabByTable(table)
|
||||||
|
|
||||||
|
value = this.isSeen(id, table) ? false : true
|
||||||
|
|
||||||
|
return await Api.SendReq('/users/cmd', 'POST', { cmd: CMD_USER.SET_SEEN, id, tab, value })
|
||||||
|
.then((res) => {
|
||||||
|
if (res && res.data.state === 1) {
|
||||||
|
if (!myrec.myseen)
|
||||||
|
myrec.myseen = []
|
||||||
|
this.my.profile.seen.push({ id, tab })
|
||||||
|
if (myrec)
|
||||||
|
myrec.myseen.push({ username: this.my.username })
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('error', error)
|
||||||
|
return {}
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user