mirror of
https://gitee.com/lijingbo-2021/open-anylink-web.git
synced 2025-12-30 11:02:25 +00:00
imageInSession的结构重构
This commit is contained in:
@@ -17,7 +17,12 @@ export const useImageStore = defineStore('anylink-image', () => {
|
||||
const image = ref({})
|
||||
|
||||
/**
|
||||
* 在同一个session中的需要渲染的image对象数组
|
||||
* 在同一个session中的需要渲染的image对象
|
||||
*
|
||||
* {
|
||||
* sessionId_01: {objectId_x: {objectId: objectId_x, originUrl: xxx, thumbUrl: xxx}...},
|
||||
* sessionId_02: {objectId_x: {objectId: objectId_x, originUrl: xxx, thumbUrl: xxx}...},
|
||||
* }
|
||||
*/
|
||||
const imageInSession = ref({})
|
||||
|
||||
@@ -27,14 +32,14 @@ export const useImageStore = defineStore('anylink-image', () => {
|
||||
|
||||
const setImageInSession = (sessionId, obj) => {
|
||||
if (!imageInSession.value[sessionId]) {
|
||||
imageInSession.value[sessionId] = []
|
||||
imageInSession.value[sessionId] = {}
|
||||
}
|
||||
imageInSession.value[sessionId].push(obj)
|
||||
imageInSession.value[sessionId][obj.objectId] = obj
|
||||
}
|
||||
|
||||
const clearImageInSession = (sessionId) => {
|
||||
if (imageInSession.value[sessionId]) {
|
||||
imageInSession.value[sessionId] = []
|
||||
imageInSession.value[sessionId] = {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ const url = computed(() => {
|
||||
})
|
||||
|
||||
const imageInSessionSort = computed(() => {
|
||||
const imageList = imageData.imageInSession[props.sessionId]
|
||||
const imageList = Object.values(imageData.imageInSession[props.sessionId])
|
||||
return imageList.sort((a, b) => {
|
||||
const bTime = new Date(b.createdTime).getTime()
|
||||
const aTime = new Date(a.createdTime).getTime()
|
||||
|
||||
Reference in New Issue
Block a user