备注:
diff --git a/src/stores/index.js b/src/stores/index.js
index 00c0a06..37e99ca 100644
--- a/src/stores/index.js
+++ b/src/stores/index.js
@@ -10,3 +10,4 @@ export * from './group'
export * from './setting'
export * from './message'
export * from './search'
+export * from './userCard'
diff --git a/src/stores/userCard.js b/src/stores/userCard.js
new file mode 100644
index 0000000..c71356f
--- /dev/null
+++ b/src/stores/userCard.js
@@ -0,0 +1,26 @@
+import { defineStore } from 'pinia'
+import { ref } from 'vue'
+import {} from '@/api/group'
+
+// userCard用户详情卡片相关的缓存数据,不持久化存储
+export const userCardStore = defineStore('anyim-userCard', () => {
+ const isShow = ref(false)
+
+ const userInfo = ref({})
+
+ const setIsShow = (flag) => {
+ isShow.value = flag
+ }
+
+ const setUserInfo = (info) => {
+ userInfo.value = info
+ }
+
+ return {
+ isShow,
+ userInfo,
+
+ setIsShow,
+ setUserInfo
+ }
+})
diff --git a/src/views/contactList/group/components/SubCommon.vue b/src/views/contactList/group/components/SubCommon.vue
index 8492ad2..cdfbdd5 100644
--- a/src/views/contactList/group/components/SubCommon.vue
+++ b/src/views/contactList/group/components/SubCommon.vue
@@ -3,9 +3,8 @@ import { ref, onMounted, computed } from 'vue'
import { Search } from '@element-plus/icons-vue'
import AddButton from '@/components/common/AddButton.vue'
import HashNoData from '@/components/common/HasNoData.vue'
-import UserCard from '@/components/card/UserCard.vue'
import SelectDialog from '@/components/common/SelectDialog.vue'
-import { groupStore, userStore, messageStore } from '@/stores'
+import { groupStore, userStore, messageStore, userCardStore } from '@/stores'
import { combineId } from '@/js/utils/common'
import { userQueryService } from '@/api/user'
import { ElLoading, ElMessage } from 'element-plus'
@@ -19,6 +18,7 @@ const props = defineProps(['tab'])
const groupData = groupStore()
const userData = userStore()
const messageData = messageStore()
+const userCardData = userCardStore()
const searchKey = ref('')
const isShowSelectDialog = ref(false)
const showData = ref({})
@@ -145,8 +145,6 @@ const onCreateGroup = () => {
isShowSelectDialog.value = true
}
-const isShowUserCard = ref(false)
-const userInfo = ref()
const onShowUserCard = (account) => {
const sessionId = combineId(account, userData.user.account)
const loadingInstance = ElLoading.service(el_loading_options)
@@ -166,11 +164,11 @@ const onShowUserCard = (account) => {
}
})
}
- userInfo.value = res.data.data
+ userCardData.setUserInfo(res.data.data)
})
.finally(() => {
loadingInstance.close()
- isShowUserCard.value = true
+ userCardData.setIsShow(true)
})
}
@@ -258,11 +256,6 @@ const onGroupCardClose = () => {
创建群组
-
import { ref, onMounted, computed } from 'vue'
import { userQueryService } from '@/api/user'
-import { messageStore } from '@/stores'
+import { messageStore, userCardStore } from '@/stores'
import ContactListUserItem from '@/views/contactList/user/components/ContactListUserItem.vue'
-import UserCard from '@/components/card/UserCard.vue'
import { ElLoading } from 'element-plus'
import { el_loading_options } from '@/const/commonConst'
import { Search } from '@element-plus/icons-vue'
@@ -11,6 +10,7 @@ import HashNoData from '@/components/common/HasNoData.vue'
import { MsgType } from '@/proto/msg'
const messageData = messageStore()
+const userCardData = userCardStore()
const totalCount = computed(() => {
return Object.keys(allData.value).length
@@ -51,8 +51,6 @@ const allData = computed(() => {
}
})
-const isShowUserCard = ref(false)
-const userInfo = ref()
const onShowUserCard = ({ sessionId, account }) => {
const loadingInstance = ElLoading.service(el_loading_options)
userQueryService({ account: account })
@@ -69,11 +67,11 @@ const onShowUserCard = ({ sessionId, account }) => {
email: res.data.data.email
}
})
- userInfo.value = messageData.sessionList[sessionId].objectInfo
+ userCardData.setUserInfo(messageData.sessionList[sessionId].objectInfo)
})
.finally(() => {
loadingInstance.close()
- isShowUserCard.value = true
+ userCardData.setIsShow(true)
})
}
@@ -103,11 +101,6 @@ const onShowUserCard = ({ sessionId, account }) => {
-