diff --git a/uniapp/common/config.js b/uniapp/common/config.js
index 586be15..d79970b 100644
--- a/uniapp/common/config.js
+++ b/uniapp/common/config.js
@@ -3,7 +3,7 @@
// const API_URL = `http://${BASE_HOST}:10002`
// const WS_URL = `ws://${BASE_HOST}:10001`
-const BASE_DOMAIN = '110.42.52.196'
+const BASE_DOMAIN = '156.238.245.175'
// const CHAT_URL = `https://${BASE_DOMAIN}/chat`
// const API_URL = `https://${BASE_DOMAIN}/api`
// const WS_URL = `wss://${BASE_DOMAIN}/msg_gateway`
diff --git a/uniapp/pages.json b/uniapp/pages.json
index c0395f9..d51abe9 100644
--- a/uniapp/pages.json
+++ b/uniapp/pages.json
@@ -1,290 +1,289 @@
{
- "pages": [
- //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
- {
- "path": "pages/login/index"
- },
- {
- "path": "pages/login/registerOrForget/index"
- },
- {
- "path": "pages/login/setSelfInfo/index"
- },
- {
- "path": "pages/login/setPassword/index"
- },
- {
- "path": "pages/login/verifyCode/index"
- },
- {
- "path": "pages/profile/index/index"
- },
- {
- "path": "pages/conversation/conversationList/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false,
- "disableScroll": true,
- "app-plus": {
- "bounce": "none"
- }
- }
- },
- {
- "path": "pages/contact/index/index",
- "style": {
- "navigationBarTitleText": "",
- "disableScroll": true,
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/conversation/chating/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false,
- "disableScroll": true,
- "app-plus": {
- "softinputMode": "adjustResize"
- }
- }
- },
- {
- "path": "pages/conversation/singleSettings/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/conversation/groupSettings/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/conversation/groupManage/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/conversation/groupMemberList/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/common/userCard/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/common/searchUserOrGroup/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/common/groupCard/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/common/userCardMore/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/common/markOrIDPage/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/common/detailsFileds/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/common/contactChoose/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false,
- "disableScroll": true
- }
- },
- {
- "path": "pages/common/createGroup/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/contact/contactAdd/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/contact/switchJoinGroup/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/contact/friendList/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/contact/groupList/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/contact/searchUserOrGroup/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/contact/applicationList/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/contact/applicationListDetails/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/contact/applicationDetails/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/profile/selfInfo/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/profile/accountSetting/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/profile/blockList/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/conversation/updateGroupOrNickname/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/common/sendAddRequest/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/common/webviewWrapper/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/profile/about/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- },
- {
- "path": "pages/workbench/index/index",
- "style": {
- "navigationBarTitleText": "",
- "enablePullDownRefresh": false
- }
- }
- ],
- "tabBar": {
- "color": "#8E9AB0",
- "selectedColor": "#0089FF",
- "borderStyle": "black",
- "backgroundColor": "#ffffff",
- "height": "55px",
- "list": [
- {
- "pagePath": "pages/conversation/conversationList/index",
- "iconPath": "./static/images/tabbar_conversation.png",
- "selectedIconPath": "static/images/tabbar_conversation_active.png",
- "text": "OpenIM"
- },
- {
- "pagePath": "pages/contact/index/index",
- "iconPath": "./static/images/tabbar_contacts.png",
- "selectedIconPath": "static/images/tabbar_contacts_active.png",
- "text": "通讯录"
- },
- {
- "pagePath": "pages/workbench/index/index",
- "iconPath": "./static/images/tabbar_workbench.png",
- "selectedIconPath": "static/images/tabbar_workbench_active.png",
- "text": "发现"
- },
- {
- "pagePath": "pages/profile/index/index",
- "iconPath": "./static/images/tabbar_profile.png",
- "selectedIconPath": "static/images/tabbar_profile_active.png",
- "text": "我的"
- }
- ]
- },
- "globalStyle": {
- "navigationStyle": "custom",
- "navigationBarTextStyle": "black",
- "app-plus": {
- "bounce": "none"
- }
- }
-}
+ "pages": [
+ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+ {
+ "path": "pages/login/index"
+ },
+ {
+ "path": "pages/login/registerOrForget/index"
+ },
+ {
+ "path": "pages/login/setSelfInfo/index"
+ },
+ {
+ "path": "pages/login/setPassword/index"
+ },
+ {
+ "path": "pages/login/verifyCode/index"
+ },
+ {
+ "path": "pages/profile/index/index"
+ },
+ {
+ "path": "pages/conversation/conversationList/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false,
+ "disableScroll": true,
+ "app-plus": {
+ "bounce": "none"
+ }
+ }
+ },
+ {
+ "path": "pages/contact/index/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "disableScroll": true,
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/conversation/chating/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false,
+ "disableScroll": true,
+ "app-plus": {
+ "softinputMode": "adjustResize"
+ }
+ }
+ },
+ {
+ "path": "pages/conversation/singleSettings/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/conversation/groupSettings/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/conversation/groupManage/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/conversation/groupMemberList/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/common/userCard/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/common/searchUserOrGroup/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/common/groupCard/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/common/userCardMore/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/common/markOrIDPage/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/common/detailsFileds/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/common/contactChoose/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false,
+ "disableScroll": true
+ }
+ },
+ {
+ "path": "pages/common/createGroup/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/contact/contactAdd/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/contact/switchJoinGroup/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/contact/friendList/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/contact/groupList/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/contact/searchUserOrGroup/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/contact/applicationList/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/contact/applicationListDetails/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/contact/applicationDetails/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/profile/selfInfo/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/profile/accountSetting/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/profile/blockList/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/conversation/updateGroupOrNickname/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/common/sendAddRequest/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/common/webviewWrapper/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/profile/about/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
+ "path": "pages/workbench/index/index",
+ "style": {
+ "navigationBarTitleText": "",
+ "enablePullDownRefresh": false
+ }
+ }
+ ],
+ "tabBar": {
+ "color": "#8E9AB0",
+ "selectedColor": "#0089FF",
+ "borderStyle": "black",
+ "backgroundColor": "#ffffff",
+ "height": "55px",
+ "list": [{
+ "pagePath": "pages/conversation/conversationList/index",
+ "iconPath": "./static/images/tabbar_conversation.png",
+ "selectedIconPath": "static/images/tabbar_conversation_active.png",
+ "text": "OpenIM"
+ },
+ {
+ "pagePath": "pages/contact/index/index",
+ "iconPath": "./static/images/tabbar_contacts.png",
+ "selectedIconPath": "static/images/tabbar_contacts_active.png",
+ "text": "通讯录"
+ },
+ {
+ "pagePath": "pages/workbench/index/index",
+ "iconPath": "./static/images/tabbar_workbench.png",
+ "selectedIconPath": "static/images/tabbar_workbench_active.png",
+ "text": "发现"
+ },
+ {
+ "pagePath": "pages/profile/index/index",
+ "iconPath": "./static/images/tabbar_profile.png",
+ "selectedIconPath": "static/images/tabbar_profile_active.png",
+ "text": "我的"
+ }
+ ]
+ },
+ "globalStyle": {
+ "navigationStyle": "custom",
+ "navigationBarTextStyle": "black",
+ "app-plus": {
+ "bounce": "none"
+ }
+ }
+}
\ No newline at end of file
diff --git a/uniapp/pages/common/searchUserOrGroup/index.vue b/uniapp/pages/common/searchUserOrGroup/index.vue
index 3f0fd11..90acd5a 100644
--- a/uniapp/pages/common/searchUserOrGroup/index.vue
+++ b/uniapp/pages/common/searchUserOrGroup/index.vue
@@ -1,172 +1,163 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
- 查找:
- {{ keyword }}
-
-
+
+
+
+ 查找:
+ {{ keyword }}
+
+
-
-
-
+
+
+
-
- 未搜索到相关结果
-
-
+
+ 未搜索到相关结果
+
+
+ &_empty {
+ display: flex;
+ justify-content: center;
+ color: #999;
+ }
+ }
+ }
+
\ No newline at end of file
diff --git a/uniapp/pages/common/userCard/index.vue b/uniapp/pages/common/userCard/index.vue
index 1ad4947..5c6b697 100644
--- a/uniapp/pages/common/userCard/index.vue
+++ b/uniapp/pages/common/userCard/index.vue
@@ -5,7 +5,8 @@
-
+
{{ getShowName }}
{{sourceUserInfo.userID}}
diff --git a/uniapp/pages/profile/index/index.vue b/uniapp/pages/profile/index/index.vue
index 3813d40..5604be0 100644
--- a/uniapp/pages/profile/index/index.vue
+++ b/uniapp/pages/profile/index/index.vue
@@ -1,238 +1,230 @@
-
-
+
+
-
-
+
+
-
- {{ selfInfo.nickname }}
-
- {{ selfInfo.userID }}
-
-
-
+
+ {{ selfInfo.nickname }}
+
+ {{ selfInfo.userID }}
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
-
-
+
+
+ image {
+ margin-right: 24rpx;
+ }
+ }
+ }
+ }
+
\ No newline at end of file
diff --git a/uniapp/store/modules/conversation.js b/uniapp/store/modules/conversation.js
index baa8e31..a12dbee 100644
--- a/uniapp/store/modules/conversation.js
+++ b/uniapp/store/modules/conversation.js
@@ -1,112 +1,119 @@
-import { v4 as uuidv4 } from "uuid";
+import {
+ v4 as uuidv4
+} from "uuid";
import IMSDK from "openim-uniapp-polyfill";
const state = {
- conversationList: [],
- currentConversation: {},
- unReadCount: 0,
- currentGroup: {},
- currentMemberInGroup: {},
+ conversationList: [],
+ currentConversation: {},
+ unReadCount: 0,
+ currentGroup: {},
+ currentMemberInGroup: {},
};
const mutations = {
- SET_CONVERSATION_LIST(state, list) {
- state.conversationList = [...list];
- },
- SET_CURRENT_CONVERSATION(state, conversation) {
- state.currentConversation = {
- ...conversation,
- };
- },
- SET_UNREAD_COUNT(state, count) {
- if (count) {
- uni.setTabBarBadge({
- index: 0,
- text: count < 99 ? count + "" : "99+",
- });
- } else {
- uni.removeTabBarBadge({
- index: 0,
- });
- }
- state.unReadCount = count;
- },
- SET_CURRENT_GROUP(state, group) {
- state.currentGroup = {
- ...group,
- };
- },
- SET_CURRENT_MEMBER_IN_GROUP(state, member) {
- state.currentMemberInGroup = {
- ...member,
- };
- },
+ SET_CONVERSATION_LIST(state, list) {
+ state.conversationList = [...list];
+ },
+ SET_CURRENT_CONVERSATION(state, conversation) {
+ state.currentConversation = {
+ ...conversation,
+ };
+ },
+ SET_UNREAD_COUNT(state, count) {
+ if (count) {
+ uni.setTabBarBadge({
+ index: 0,
+ text: count < 99 ? count + "" : "99+",
+ });
+ } else {
+ uni.removeTabBarBadge({
+ index: 0,
+ });
+ }
+ state.unReadCount = count;
+ },
+ SET_CURRENT_GROUP(state, group) {
+ state.currentGroup = {
+ ...group,
+ };
+ },
+ SET_CURRENT_MEMBER_IN_GROUP(state, member) {
+ state.currentMemberInGroup = {
+ ...member,
+ };
+ },
};
const actions = {
- async getConversationList({ state, commit }, isFirstPage = true) {
- try {
- const { data } = await IMSDK.asyncApi(
- IMSDK.IMMethods.GetConversationListSplit,
- uuidv4(),
- {
- offset: isFirstPage ? 0 : state.conversationList.length,
- count: 500,
- },
- );
- commit("SET_CONVERSATION_LIST", [
- ...(isFirstPage ? [] : state.conversationList),
- ...data,
- ]);
- return [...data];
- } catch (e) {
- console.log(e);
- commit("SET_CONVERSATION_LIST", []);
- return [];
- }
- },
- getCurrentGroup({ commit }, groupID) {
- IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupsInfo, uuidv4(), [
- groupID,
- ]).then(({ data }) => {
- commit("SET_CURRENT_GROUP", data[0] ?? {});
- });
- },
- getCurrentMemberInGroup({ commit, rootState }, groupID) {
- IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupMembersInfo, uuidv4(), {
- groupID,
- userIDList: [rootState.user.selfInfo.userID],
- }).then(({ data }) => {
- commit("SET_CURRENT_MEMBER_IN_GROUP", data[0] ?? {});
- });
- },
- getUnReadCount({ commit }) {
- IMSDK.asyncApi(IMSDK.IMMethods.GetTotalUnreadMsgCount, uuidv4()).then(
- (res) => {
- console.log(res);
- commit("SET_UNREAD_COUNT", res.data);
- },
- );
- },
- updateCurrentMemberInGroup({ commit, state }, memberInfo) {
- console.log(memberInfo);
- if (
- memberInfo.groupID === state.currentMemberInGroup.groupID &&
- memberInfo.userID === state.currentMemberInGroup.userID
- ) {
- commit("SET_CURRENT_MEMBER_IN_GROUP", memberInfo);
- }
- },
- resetConversationState({ commit }) {
- commit("SET_CURRENT_MEMBER_IN_GROUP", {});
- commit("SET_CURRENT_GROUP", {});
- commit("SET_CURRENT_CONVERSATION", {});
- },
+ async getConversationList({ state, commit }, isFirstPage = true) {
+ try {
+ const {
+ data
+ } = await IMSDK.asyncApi(
+ IMSDK.IMMethods.GetConversationListSplit,
+ uuidv4(), {
+ offset: isFirstPage ? 0 : state.conversationList.length,
+ count: 500,
+ },
+ );
+ commit("SET_CONVERSATION_LIST", [
+ ...(isFirstPage ? [] : state.conversationList),
+ ...data,
+ ]);
+ return [...data];
+ } catch (e) {
+ console.log(e);
+ commit("SET_CONVERSATION_LIST", []);
+ return [];
+ }
+ },
+ getCurrentGroup({ commit }, groupID) {
+ IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupsInfo, uuidv4(), [
+ groupID,
+ ]).then(({
+ data
+ }) => {
+ commit("SET_CURRENT_GROUP", data[0] ?? {});
+ });
+ },
+ getCurrentMemberInGroup({ commit, rootState }, groupID) {
+ IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupMembersInfo, uuidv4(), {
+ groupID,
+ userIDList: [rootState.user.selfInfo.userID],
+ }).then(({
+ data
+ }) => {
+ commit("SET_CURRENT_MEMBER_IN_GROUP", data[0] ?? {});
+ });
+ },
+ getUnReadCount({ commit }) {
+ IMSDK.asyncApi(IMSDK.IMMethods.GetTotalUnreadMsgCount, uuidv4()).then(
+ (res) => {
+ console.log(res);
+ commit("SET_UNREAD_COUNT", res.data);
+ },
+ );
+ },
+ updateCurrentMemberInGroup({ commit, state }, memberInfo) {
+ console.log(memberInfo);
+ if (
+ memberInfo.groupID === state.currentMemberInGroup.groupID &&
+ memberInfo.userID === state.currentMemberInGroup.userID
+ ) {
+ commit("SET_CURRENT_MEMBER_IN_GROUP", memberInfo);
+ }
+ },
+ resetConversationState({ commit }) {
+ commit("SET_CURRENT_MEMBER_IN_GROUP", {});
+ commit("SET_CURRENT_GROUP", {});
+ commit("SET_CURRENT_CONVERSATION", {});
+ },
};
export default {
- namespaced: true,
- state,
- mutations,
- actions,
-};
+ namespaced: true,
+ state,
+ mutations,
+ actions,
+};
\ No newline at end of file
diff --git a/uniapp/store/modules/user.js b/uniapp/store/modules/user.js
index 6ff1f8d..a812e7b 100644
--- a/uniapp/store/modules/user.js
+++ b/uniapp/store/modules/user.js
@@ -1,75 +1,83 @@
-import { v4 as uuidv4 } from "uuid";
+import { v4 as uuidv4} from "uuid";
import IMSDK from "openim-uniapp-polyfill";
-import { businessGetUserInfo } from "@/api/login";
-import { filterEmptyValue } from "@/util/common";
+import { businessGetUserInfo} from "@/api/login";
+import { filterEmptyValue} from "@/util/common";
const state = {
- selfInfo: {},
- authData: {},
- isSyncing: false,
- reinstall: false,
- progress: 0,
+ selfInfo: {},
+ authData: {},
+ isSyncing: false,
+ reinstall: false,
+ progress: 0,
};
const mutations = {
- SET_SELF_INFO(state, info) {
- state.selfInfo = {
- ...info,
- };
- },
- SET_AUTH_DATA(state, data) {
- state.authData = {
- ...data,
- };
- },
- SET_IS_SYNCING(state, data) {
- state.isSyncing = data;
- },
- SET_REINSTALL(state, data) {
- state.reinstall = data;
- },
- SET_PROGRESS(state, data) {
- state.progress = data;
- },
+ SET_SELF_INFO(state, info) {
+ state.selfInfo = {
+ ...info,
+ };
+ },
+ SET_AUTH_DATA(state, data) {
+ state.authData = {
+ ...data,
+ };
+ },
+ SET_IS_SYNCING(state, data) {
+ state.isSyncing = data;
+ },
+ SET_REINSTALL(state, data) {
+ state.reinstall = data;
+ },
+ SET_PROGRESS(state, data) {
+ state.progress = data;
+ },
};
const actions = {
- async getSelfInfo({ commit }) {
- try {
- const { data } = await IMSDK.asyncApi(
- IMSDK.IMMethods.GetSelfUserInfo,
- uuidv4(),
- );
- const { users } = await businessGetUserInfo(data.userID);
- const businessData = users[0] ?? {};
- filterEmptyValue(businessData);
- commit("SET_SELF_INFO", {
- ...data,
- ...businessData,
- });
- } catch (e) {
- console.log(e);
- uni.$u.toast("获取个人信息失败");
- }
- },
- async updateBusinessInfo({ commit, state }) {
- try {
- const { users } = await businessGetUserInfo(state.selfInfo.userID);
- const businessData = users[0] ?? {};
- filterEmptyValue(businessData);
- commit("SET_SELF_INFO", {
- ...state.selfInfo,
- ...businessData,
- });
- } catch (e) {
- console.log(e);
- }
- },
+ async getSelfInfo({ commit }) {
+ try {
+ const {
+ data
+ } = await IMSDK.asyncApi(
+ IMSDK.IMMethods.GetSelfUserInfo,
+ uuidv4(),
+ );
+ const {users} = await businessGetUserInfo(data.userID);
+ console.log(users);
+ const businessData = users[0] ?? {};
+ filterEmptyValue(businessData);
+ commit("SET_SELF_INFO", {
+ ...data,
+ ...businessData,
+ });
+ } catch (e) {
+ console.log(e);
+ uni.$u.toast("获取个人信息失败");
+ }
+ },
+ async updateBusinessInfo({
+ commit,
+ state
+ }) {
+ try {
+ const {
+ users
+ } = await businessGetUserInfo(state.selfInfo.userID);
+ const businessData = users[0] ?? {};
+ filterEmptyValue(businessData);
+ commit("SET_SELF_INFO", {
+ ...state.selfInfo,
+ ...businessData,
+ });
+ } catch (e) {
+ console.log(e);
+ }
+ },
};
export default {
- namespaced: true,
- state,
- mutations,
- actions,
-};
+ namespaced: true,
+ state,
+ mutations,
+ actions,
+};
\ No newline at end of file