This commit is contained in:
2025-11-23 07:58:47 +08:00
parent 0783e46b4b
commit 8e036cc171
4 changed files with 22 additions and 29 deletions
+8 -10
View File
@@ -48,15 +48,14 @@ export const businessGetUserInfo = (userID) =>
} }
); );
export const businessSearchUserInfo = (keyword) => export const businessSearchUserInfo = (keyword,searchtype) =>
uni.$u?.http.post( uni.$u?.http.post(
"/user/search", "/user/search",
JSON.stringify({ JSON.stringify({
keyword, keyword,
pagination: { searchtype:(searchtype? searchtype : 'id'),
pageNumber: 1, page: 1,
showNumber: 10, limit: 10
},
}), { }), {
header: { header: {
token: uni.getStorageSync("BusinessToken"), token: uni.getStorageSync("BusinessToken"),
@@ -64,15 +63,14 @@ export const businessSearchUserInfo = (keyword) =>
} }
); );
export const businessSearchUser = (keyword) => export const businessSearchUser = (keyword,searchtype) =>
uni.$u?.http.post( uni.$u?.http.post(
"/friend/search", "/friend/search",
JSON.stringify({ JSON.stringify({
keyword, keyword,
pagination: { searchtype:(searchtype? searchtype : 'id'),
pageNumber: 1, page: 1,
showNumber: 99, limit: 99,
},
}), { }), {
header: { header: {
token: uni.getStorageSync("BusinessToken"), token: uni.getStorageSync("BusinessToken"),
+5 -4
View File
@@ -98,19 +98,20 @@
(item) => item.userID === value, (item) => item.userID === value,
); );
if (!info) { if (!info) {
const {total,users} = await businessSearchUserInfo(value); const res = await businessSearchUserInfo(value,'kw');
if (total > 0) { if (res.total > 0) {
const {data} = await IMSDK.asyncApi( const {data} = await IMSDK.asyncApi(
IMSDK.IMMethods.GetUsersInfo, IMSDK.IMMethods.GetUsersInfo,
IMSDK.uuid(), IMSDK.uuid(),
[users[0].userID], [res.data[0].id],
); );
const imData = data[0]; const imData = data[0];
info = { info = {
...imData, ...imData,
...users[0], ...res.data[0],
}; };
console.log(info)
} }
} }
if (info) { if (info) {
+3 -6
View File
@@ -135,11 +135,8 @@
} }
this.isLoading = true this.isLoading = true
try { try {
const { const res = await businessSearchUserInfo(this.sourceID);
total, if (res.total > 0) {
users
} = await businessSearchUserInfo(this.sourceID);
if (total > 0) {
const { const {
data data
} = await IMSDK.asyncApi( } = await IMSDK.asyncApi(
@@ -150,7 +147,7 @@
const imData = data[0]?.friendInfo ?? data[0]?.publicInfo ?? {}; const imData = data[0]?.friendInfo ?? data[0]?.publicInfo ?? {};
info = { info = {
...imData, ...imData,
...users[0], ...res.data[0],
}; };
console.log(info) console.log(info)
} }
+6 -9
View File
@@ -54,11 +54,10 @@ const actions = {
IMSDK.IMMethods.GetSelfUserInfo, IMSDK.IMMethods.GetSelfUserInfo,
uuidv4(), uuidv4(),
); );
const { const res = await businessGetUserInfo(data.userID);
users //console.log(res.data);
} = await businessGetUserInfo(data.userID);
console.log(users); const businessData = res.data[0] ?? {};
const businessData = users[0] ?? {};
filterEmptyValue(businessData); filterEmptyValue(businessData);
commit("SET_SELF_INFO", { commit("SET_SELF_INFO", {
...data, ...data,
@@ -74,10 +73,8 @@ const actions = {
state state
}) { }) {
try { try {
const { const res = await businessGetUserInfo(state.selfInfo.userID);
users const businessData = res.data[0] ?? {};
} = await businessGetUserInfo(state.selfInfo.userID);
const businessData = users[0] ?? {};
filterEmptyValue(businessData); filterEmptyValue(businessData);
commit("SET_SELF_INFO", { commit("SET_SELF_INFO", {
...state.selfInfo, ...state.selfInfo,