diff --git a/App.vue b/App.vue index d0a0360..18dcf0f 100644 --- a/App.vue +++ b/App.vue @@ -1,29 +1,16 @@ diff --git a/api/login.js b/api/login.js index f6e111f..92c225a 100644 --- a/api/login.js +++ b/api/login.js @@ -1,6 +1,9 @@ // 登录 export const businessConfig = (params) => uni.$u?.http.post("/common/init", JSON.stringify(params)); +// 验证是否升级 +export const checkUpgrade = (params) => + uni.$u?.http.post("/common/checkUpgrade", JSON.stringify(params)); export const businessLogin = (params) => uni.$u?.http.post("/common/login", JSON.stringify(params)); export const businessSendSms = (params) => @@ -28,9 +31,8 @@ export const businessModify = (params) => export const businessInfoUpdate = (params) => uni.$u?.http.post( "/user/profile", - JSON.stringify({ - ...params, - }), { + JSON.stringify({ ...params, }), + { header: { token: uni.getStorageSync("BusinessToken"), }, @@ -39,9 +41,8 @@ export const businessInfoUpdate = (params) => export const businessGetUserInfo = (userID) => uni.$u?.http.post( "/user/find", - JSON.stringify({ - userIDs: [userID], - }), { + JSON.stringify({ userIDs: [userID], }), + { header: { token: uni.getStorageSync("BusinessToken"), }, @@ -76,4 +77,41 @@ export const businessSearchUser = (keyword,searchtype) => token: uni.getStorageSync("BusinessToken"), }, } - ); \ No newline at end of file + ); +export const getArticle = (id,type) => + uni.$u?.http.post( + "/article/detail", + JSON.stringify({ + id, + type:(type? type : 'id') + }), { + header: { + token: uni.getStorageSync("BusinessToken"), + }, + } + ); +export const getFriendCircle = (page=1,limit=10) =>{ + uni.$u?.http.get( + "/friend_circle/list", + JSON.stringify({ + limit:limit, + page:page + }), + { + header: { + token: uni.getStorageSync("BusinessToken"), + }, + } + ); +} +export const getFriendCircleNewcount = () =>{ + uni.$u?.http.get( + "/friend_circle/newcount", + JSON.stringify({}), + { + header: { + token: uni.getStorageSync("BusinessToken"), + }, + } + ); +} \ No newline at end of file diff --git a/common/config.js b/common/config.js index 10448d0..18f46d1 100644 --- a/common/config.js +++ b/common/config.js @@ -7,7 +7,7 @@ const BASE_DOMAIN = 'www.axzc.xyz' // const CHAT_URL = `https://${BASE_DOMAIN}/chat` // const API_URL = `https://${BASE_DOMAIN}/api` // const WS_URL = `wss://${BASE_DOMAIN}/msg_gateway` -const CHAT_URL = `http://${BASE_DOMAIN}:8585/api` +const CHAT_URL = `http://${BASE_DOMAIN}/api` const API_URL = `http://${BASE_DOMAIN}/imapi` const WS_URL = `ws://${BASE_DOMAIN}/ws` diff --git a/components/ChooseIndexFooter/SelectedMember.vue b/components/ChooseIndexFooter/SelectedMember.vue index e611770..4b99d62 100644 --- a/components/ChooseIndexFooter/SelectedMember.vue +++ b/components/ChooseIndexFooter/SelectedMember.vue @@ -1,59 +1,55 @@ + .u-button { + height: 48rpx; + } + } + \ No newline at end of file diff --git a/components/ChooseIndexFooter/index.vue b/components/ChooseIndexFooter/index.vue index 30bdb88..eb095ea 100644 --- a/components/ChooseIndexFooter/index.vue +++ b/components/ChooseIndexFooter/index.vue @@ -1,143 +1,130 @@ + .selected_list { + height: 60vh !important; + overflow-y: auto; + } + } + \ No newline at end of file diff --git a/components/ChooseIndexList/index.vue b/components/ChooseIndexList/index.vue index 0340bbe..618227d 100644 --- a/components/ChooseIndexList/index.vue +++ b/components/ChooseIndexList/index.vue @@ -1,91 +1,77 @@ + ::v-deep uni-scroll-view { + max-height: 100% !important; + } + } + + .user_anchor { + background-color: #f8f8f8 !important; + border: none !important; + } + \ No newline at end of file diff --git a/constant/comp.js b/constant/comp.js index 4419feb..55d7fc3 100644 --- a/constant/comp.js +++ b/constant/comp.js @@ -1,42 +1,46 @@ export const ChatingFooterActionTypes = { - Album: "Album", + Album: "Album", + Camera: "Camera", + Video: "Video", + Voice: "Voice", + Location: "Location", }; export const ContactMenuTypes = { - NewFriend: "NewFriend", - NewGroup: "NewGroup", - MyFriend: "MyFriend", - MyGroup: "MyGroup", + NewFriend: "NewFriend", + NewGroup: "NewGroup", + MyFriend: "MyFriend", + MyGroup: "MyGroup", }; export const GroupMemberListTypes = { - Preview: "Preview", - Transfer: "Transfer", - Kickout: "Kickout", + Preview: "Preview", + Transfer: "Transfer", + Kickout: "Kickout", }; export const ContactChooseTypes = { - Invite: "Invite", - GetList: "GetList", + Invite: "Invite", + GetList: "GetList", }; export const UpdateMessageTypes = { - Overall: "Overall", - KeyWords: "KeyWords", + Overall: "Overall", + KeyWords: "KeyWords", }; export const SmsUserFor = { - Register: 1, - Reset: 2, - Login: 3, + Register: 1, + Reset: 2, + Login: 3, }; export const CustomMessageStatus = { - Success: "success", - Cancel: "cancel", - Canceled: "canceled", - Refuse: "refuse", - Refused: "refused", - Timeout: "timeout", - AccessByOther: "accessByOther", -}; + Success: "success", + Cancel: "cancel", + Canceled: "canceled", + Refuse: "refuse", + Refused: "refused", + Timeout: "timeout", + AccessByOther: "accessByOther", +}; \ No newline at end of file diff --git a/constant/event.js b/constant/event.js index 61efe70..306c8d5 100644 --- a/constant/event.js +++ b/constant/event.js @@ -1,5 +1,5 @@ export const PageEvents = { - GlobalToast: "GlobalToast", - ScrollToBottom: "ScrollToBottom", - RtcCall: "RtcCall" -}; + GlobalToast: "GlobalToast", + ScrollToBottom: "ScrollToBottom", + RtcCall: "RtcCall" +}; \ No newline at end of file diff --git a/constant/im.js b/constant/im.js index 830d2ba..4cea39c 100644 --- a/constant/im.js +++ b/constant/im.js @@ -1,51 +1,51 @@ -import { MessageType } from "openim-uniapp-polyfill"; +import {MessageType} from "openim-uniapp-polyfill"; export const CustomType = { - VideoCall: "c100", - VoiceCall: "c101", - Call: 901, - MassMsg: 903, + VideoCall: "c100", + VoiceCall: "c101", + Call: 901, + MassMsg: 903, }; export const Platform = { - 1: 'iOS', - 2: 'Android', - 3: 'PC', - 4: 'PC', - 5: 'Web' + 1: 'iOS', + 2: 'Android', + 3: 'PC', + 4: 'PC', + 5: 'Web' }; export const noticeMessageTypes = [ - MessageType.RevokeMessage, - MessageType.FriendAdded, - MessageType.GroupCreated, - MessageType.GroupInfoUpdated, - MessageType.MemberQuit, - MessageType.GroupOwnerTransferred, - MessageType.MemberKicked, - MessageType.MemberInvited, - MessageType.MemberEnter, - MessageType.GroupDismissed, - MessageType.GroupMemberMuted, - MessageType.GroupMuted, - MessageType.GroupCancelMuted, - MessageType.GroupMemberCancelMuted, - MessageType.GroupNameUpdated, - MessageType.BurnMessageChange, + MessageType.RevokeMessage, + MessageType.FriendAdded, + MessageType.GroupCreated, + MessageType.GroupInfoUpdated, + MessageType.MemberQuit, + MessageType.GroupOwnerTransferred, + MessageType.MemberKicked, + MessageType.MemberInvited, + MessageType.MemberEnter, + MessageType.GroupDismissed, + MessageType.GroupMemberMuted, + MessageType.GroupMuted, + MessageType.GroupCancelMuted, + MessageType.GroupMemberCancelMuted, + MessageType.GroupNameUpdated, + MessageType.BurnMessageChange, ]; export const GroupSystemMessageTypes = [ - MessageType.GroupCreated, - MessageType.GroupInfoUpdated, - MessageType.MemberQuit, - MessageType.GroupOwnerTransferred, - MessageType.MemberKicked, - MessageType.MemberInvited, - MessageType.MemberEnter, - MessageType.GroupDismissed, - MessageType.GroupMemberMuted, - MessageType.GroupMuted, - MessageType.GroupCancelMuted, - MessageType.GroupMemberCancelMuted, - MessageType.GroupNameUpdated -]; + MessageType.GroupCreated, + MessageType.GroupInfoUpdated, + MessageType.MemberQuit, + MessageType.GroupOwnerTransferred, + MessageType.MemberKicked, + MessageType.MemberInvited, + MessageType.MemberEnter, + MessageType.GroupDismissed, + MessageType.GroupMemberMuted, + MessageType.GroupMuted, + MessageType.GroupCancelMuted, + MessageType.GroupMemberCancelMuted, + MessageType.GroupNameUpdated +]; \ No newline at end of file diff --git a/manifest.json b/manifest.json index 3ee7247..3cea087 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { - "name" : "IM-UCB", + "name" : "探探", "appid" : "__UNI__F0A946D", "description" : "", "versionName" : "3.3.4", @@ -21,7 +21,10 @@ "Camera" : {}, "Record" : {}, "Geolocation" : {}, - "Maps" : {} + "Maps" : {}, + "Fingerprint" : {}, + "Contacts" : {}, + "Barcode" : {} }, "distribute" : { "android" : { @@ -66,8 +69,18 @@ }, "sdkConfigs" : { "ad" : {}, - "geolocation" : {}, - "maps" : {}, + "geolocation" : { + "system" : { + "__platform__" : [ "ios", "android" ] + } + }, + "maps" : { + "amap" : { + "name" : "amap_18926034082bYRO97pz", + "appkey_ios" : "cfc7b531b60382598b4aac7944415fba", + "appkey_android" : "e431515e99e69fc1b6edb674e3487f1a" + } + }, "share" : {}, "statics" : {}, "speech" : {} diff --git a/package.json b/package.json index 47b6932..cd36419 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,12 @@ { "dependencies": { + "@openim/client-sdk": "^0.0.11-ahpha.1", "date-fns": "^2.30.0", "dayjs": "^1.11.6", "image-tools": "^1.4.0", "md5": "^2.3.0", - "@openim/client-sdk": "^0.0.11-ahpha.1", "openim-uniapp-polyfill": "^1.4.1", + "qrcode": "^1.5.4", "uuid": "^9.0.0" } } diff --git a/pages.json b/pages.json index d51abe9..77f7c0e 100644 --- a/pages.json +++ b/pages.json @@ -245,37 +245,61 @@ "navigationBarTitleText": "", "enablePullDownRefresh": false } + }, + { + "path": "pages/common/upgrade", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/common/article", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/common/webview", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/workbench/friend-circle/friend-circle", + "style": { + "navigationBarTitleText": "" + } } ], "tabBar": { - "color": "#8E9AB0", - "selectedColor": "#0089FF", - "borderStyle": "black", - "backgroundColor": "#ffffff", + "color": "#171717", + "selectedColor": "#07c160", + "borderStyle": "#f4f4f4", + "backgroundColor": "#f4f4f4", "height": "55px", "list": [{ "pagePath": "pages/conversation/conversationList/index", - "iconPath": "./static/images/tabbar_conversation.png", - "selectedIconPath": "static/images/tabbar_conversation_active.png", - "text": "OpenIM" + "iconPath": "./static/images/tabbar/conversation.png", + "selectedIconPath": "static/images/tabbar/conversation_active.png", + "text": "消息" }, { "pagePath": "pages/contact/index/index", - "iconPath": "./static/images/tabbar_contacts.png", - "selectedIconPath": "static/images/tabbar_contacts_active.png", + "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", + "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": "我的" + "iconPath": "./static/images/tabbar/profile.png", + "selectedIconPath": "static/images/tabbar/profile_active.png", + "text": "我" } ] }, diff --git a/pages/common/article.nvue b/pages/common/article.nvue new file mode 100644 index 0000000..225acd9 --- /dev/null +++ b/pages/common/article.nvue @@ -0,0 +1,61 @@ + + + + + diff --git a/pages/common/contactChoose/index.vue b/pages/common/contactChoose/index.vue index 2bc6e76..5387eba 100644 --- a/pages/common/contactChoose/index.vue +++ b/pages/common/contactChoose/index.vue @@ -1,281 +1,267 @@ + .member_list { + flex: 1; + height: 80% !important; + + ::v-deepuni-scroll-view { + max-height: 100% !important; + } + } + + .user_list { + height: 100% !important; + } + + .member_anchor { + background-color: #f8f8f8 !important; + border: none !important; + } + } + } + } + \ No newline at end of file diff --git a/pages/common/searchUserOrGroup/index.vue b/pages/common/searchUserOrGroup/index.vue index 437ec24..8caae79 100644 --- a/pages/common/searchUserOrGroup/index.vue +++ b/pages/common/searchUserOrGroup/index.vue @@ -86,6 +86,7 @@ ); info = data[0]; } + console.log(info) if (info) { uni.navigateTo({ url: `/pages/common/groupCard/index?sourceInfo=${JSON.stringify(info,)}`, @@ -103,7 +104,7 @@ const {data} = await IMSDK.asyncApi( IMSDK.IMMethods.GetUsersInfo, IMSDK.uuid(), - [res.data[0].id], + [res.data[0].id+''], ); const imData = data[0]; @@ -111,9 +112,9 @@ ...imData, ...res.data[0], }; - console.log(info) } } + console.log(info) if (info) { uni.navigateTo({ url: `/pages/common/userCard/index?sourceInfo=${JSON.stringify(info,)}`, @@ -123,6 +124,7 @@ } } } catch (e) { + console.log(e); //TODO handle the exception } this.searching = false; diff --git a/pages/common/sendAddRequest/index.vue b/pages/common/sendAddRequest/index.vue index 18d3b17..e992ccc 100644 --- a/pages/common/sendAddRequest/index.vue +++ b/pages/common/sendAddRequest/index.vue @@ -1,125 +1,117 @@ + .input_container { + ::v-deep.u-textarea { + padding: 24rpx 44rpx !important; + } + } + } + \ No newline at end of file diff --git a/pages/common/upgrade.nvue b/pages/common/upgrade.nvue new file mode 100644 index 0000000..9a80f46 --- /dev/null +++ b/pages/common/upgrade.nvue @@ -0,0 +1,110 @@ + + + + + diff --git a/pages/common/userCard/index.vue b/pages/common/userCard/index.vue index 5459586..bf620e8 100644 --- a/pages/common/userCard/index.vue +++ b/pages/common/userCard/index.vue @@ -15,7 +15,11 @@ - + + + + + @@ -31,21 +35,14 @@ + + \ No newline at end of file diff --git a/pages/contact/contactAdd/ActionItem.vue b/pages/contact/contactAdd/ActionItem.vue index 4c5cdb1..d6cf3b0 100644 --- a/pages/contact/contactAdd/ActionItem.vue +++ b/pages/contact/contactAdd/ActionItem.vue @@ -1,74 +1,74 @@ + .bottom_line { + height: 1px; + width: 100%; + background-color: #f0f0f0; + position: absolute; + bottom: -24rpx; + } + } + } + \ No newline at end of file diff --git a/pages/contact/contactAdd/index.vue b/pages/contact/contactAdd/index.vue index 1dfc3f8..df74f5e 100644 --- a/pages/contact/contactAdd/index.vue +++ b/pages/contact/contactAdd/index.vue @@ -1,101 +1,91 @@ + .action_item:last-child { + .bottom_line { + height: 0; + } + } + } + } + \ No newline at end of file diff --git a/pages/conversation/chating/components/ChatingFooter/ChatingActionBar.vue b/pages/conversation/chating/components/ChatingFooter/ChatingActionBar.vue index 1aad331..5915567 100644 --- a/pages/conversation/chating/components/ChatingFooter/ChatingActionBar.vue +++ b/pages/conversation/chating/components/ChatingFooter/ChatingActionBar.vue @@ -1,80 +1,112 @@ + &_title { + font-size: 24rpx; + color: #999; + margin-top: 6rpx; + } + } + } + \ No newline at end of file diff --git a/pages/conversation/chating/components/ChatingFooter/index.vue b/pages/conversation/chating/components/ChatingFooter/index.vue index a52371d..5ad9267 100644 --- a/pages/conversation/chating/components/ChatingFooter/index.vue +++ b/pages/conversation/chating/components/ChatingFooter/index.vue @@ -25,40 +25,26 @@ + image { + width: 24px; + height: 24px; + margin-right: 24rpx; + } + + &:last-child { + border: none; + } + } + } + } + } + \ No newline at end of file diff --git a/pages/conversation/conversationList/components/ConversationItem.vue b/pages/conversation/conversationList/components/ConversationItem.vue index 819bbd0..74a1799 100644 --- a/pages/conversation/conversationList/components/ConversationItem.vue +++ b/pages/conversation/conversationList/components/ConversationItem.vue @@ -1,34 +1,31 @@ + .btn_row { + padding: 0 44rpx; + } + } + \ No newline at end of file diff --git a/pages/profile/index/index.vue b/pages/profile/index/index.vue index 5604be0..9a13227 100644 --- a/pages/profile/index/index.vue +++ b/pages/profile/index/index.vue @@ -86,19 +86,22 @@ }); }, logoutConfirm() { - IMSDK.asyncApi(IMSDK.IMMethods.Logout, IMSDK.uuid()) - .then(() => { - uni.removeStorage({ - key: "IMToken", - }); - uni.removeStorage({ - key: "BusinessToken", - }); - }) - .catch((err) => console.log(err)) - .finally(() => { - uni.$u.route("/pages/login/index"); + console.log(1) + IMSDK.asyncApi(IMSDK.IMMethods.Logout, IMSDK.uuid()).then(() => { + console.log(2) + uni.removeStorage({ + key: "IMToken", }); + uni.removeStorage({ + key: "BusinessToken", + }); + }).catch((err) => { + console.log(3) + console.log(err) + }).finally(() => { + console.log(4) + uni.$u.route("/pages/login/index"); + }); }, profileMenuClick({idx}) { switch (idx) { diff --git a/pages/profile/selfInfo/InfoItem.vue b/pages/profile/selfInfo/InfoItem.vue index 575846c..e298754 100644 --- a/pages/profile/selfInfo/InfoItem.vue +++ b/pages/profile/selfInfo/InfoItem.vue @@ -1,74 +1,71 @@ + .content { + font-size: 28rpx; + color: #999; + } + + .u-icon { + margin-left: 12rpx; + } + } + + .loading_icon { + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + } + } + \ No newline at end of file diff --git a/pages/profile/selfInfo/index.vue b/pages/profile/selfInfo/index.vue index 474e856..98a8c2b 100644 --- a/pages/profile/selfInfo/index.vue +++ b/pages/profile/selfInfo/index.vue @@ -1,216 +1,180 @@ + .qr_icon { + width: 22px; + height: 23px; + } + } + } + \ No newline at end of file diff --git a/pages/workbench/friend-circle/friend-circle.vue b/pages/workbench/friend-circle/friend-circle.vue new file mode 100644 index 0000000..87b6899 --- /dev/null +++ b/pages/workbench/friend-circle/friend-circle.vue @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/pages/workbench/index/index.vue b/pages/workbench/index/index.vue index 171df21..1be9766 100644 --- a/pages/workbench/index/index.vue +++ b/pages/workbench/index/index.vue @@ -1,31 +1,270 @@ - + + diff --git a/static/images/tabbar/contacts.png b/static/images/tabbar/contacts.png new file mode 100644 index 0000000..2f92b58 Binary files /dev/null and b/static/images/tabbar/contacts.png differ diff --git a/static/images/tabbar/contacts_active.png b/static/images/tabbar/contacts_active.png new file mode 100644 index 0000000..621fe92 Binary files /dev/null and b/static/images/tabbar/contacts_active.png differ diff --git a/static/images/tabbar/conversation.png b/static/images/tabbar/conversation.png new file mode 100644 index 0000000..c5fdc55 Binary files /dev/null and b/static/images/tabbar/conversation.png differ diff --git a/static/images/tabbar/conversation_active.png b/static/images/tabbar/conversation_active.png new file mode 100644 index 0000000..8a9f437 Binary files /dev/null and b/static/images/tabbar/conversation_active.png differ diff --git a/static/images/tabbar/profile.png b/static/images/tabbar/profile.png new file mode 100644 index 0000000..ca27407 Binary files /dev/null and b/static/images/tabbar/profile.png differ diff --git a/static/images/tabbar/profile_active.png b/static/images/tabbar/profile_active.png new file mode 100644 index 0000000..46b4be9 Binary files /dev/null and b/static/images/tabbar/profile_active.png differ diff --git a/static/images/tabbar/workbench.png b/static/images/tabbar/workbench.png new file mode 100644 index 0000000..8897297 Binary files /dev/null and b/static/images/tabbar/workbench.png differ diff --git a/static/images/tabbar/workbench_active.png b/static/images/tabbar/workbench_active.png new file mode 100644 index 0000000..dbea18b Binary files /dev/null and b/static/images/tabbar/workbench_active.png differ diff --git a/static/images/tabbar_contacts.png b/static/images/tabbar_contacts.png deleted file mode 100644 index 2db033c..0000000 Binary files a/static/images/tabbar_contacts.png and /dev/null differ diff --git a/static/images/tabbar_contacts_active.png b/static/images/tabbar_contacts_active.png deleted file mode 100644 index 565d55e..0000000 Binary files a/static/images/tabbar_contacts_active.png and /dev/null differ diff --git a/static/images/tabbar_conversation.png b/static/images/tabbar_conversation.png deleted file mode 100644 index a840cf4..0000000 Binary files a/static/images/tabbar_conversation.png and /dev/null differ diff --git a/static/images/tabbar_conversation_active.png b/static/images/tabbar_conversation_active.png deleted file mode 100644 index df20387..0000000 Binary files a/static/images/tabbar_conversation_active.png and /dev/null differ diff --git a/static/images/tabbar_profile.png b/static/images/tabbar_profile.png deleted file mode 100644 index 694c226..0000000 Binary files a/static/images/tabbar_profile.png and /dev/null differ diff --git a/static/images/tabbar_profile_active.png b/static/images/tabbar_profile_active.png deleted file mode 100644 index 83606a2..0000000 Binary files a/static/images/tabbar_profile_active.png and /dev/null differ diff --git a/static/images/tabbar_workbench.png b/static/images/tabbar_workbench.png deleted file mode 100644 index 303d47e..0000000 Binary files a/static/images/tabbar_workbench.png and /dev/null differ diff --git a/static/images/tabbar_workbench_active.png b/static/images/tabbar_workbench_active.png deleted file mode 100644 index cbb9225..0000000 Binary files a/static/images/tabbar_workbench_active.png and /dev/null differ diff --git a/static/images/workbench/01.png b/static/images/workbench/01.png new file mode 100644 index 0000000..3d24308 Binary files /dev/null and b/static/images/workbench/01.png differ diff --git a/static/images/workbench/02.png b/static/images/workbench/02.png new file mode 100644 index 0000000..31ce6e2 Binary files /dev/null and b/static/images/workbench/02.png differ diff --git a/static/images/workbench/03.png b/static/images/workbench/03.png new file mode 100644 index 0000000..e748e4a Binary files /dev/null and b/static/images/workbench/03.png differ diff --git a/static/images/workbench/04.png b/static/images/workbench/04.png new file mode 100644 index 0000000..38948d8 Binary files /dev/null and b/static/images/workbench/04.png differ diff --git a/static/images/workbench/05.png b/static/images/workbench/05.png new file mode 100644 index 0000000..a733724 Binary files /dev/null and b/static/images/workbench/05.png differ diff --git a/static/images/workbench/06.png b/static/images/workbench/06.png new file mode 100644 index 0000000..111a642 Binary files /dev/null and b/static/images/workbench/06.png differ diff --git a/static/images/workbench/07.png b/static/images/workbench/07.png new file mode 100644 index 0000000..b53ad51 Binary files /dev/null and b/static/images/workbench/07.png differ diff --git a/static/images/workbench/08.png b/static/images/workbench/08.png new file mode 100644 index 0000000..75ad7df Binary files /dev/null and b/static/images/workbench/08.png differ diff --git a/static/images/workbench/09.png b/static/images/workbench/09.png new file mode 100644 index 0000000..9ad6b83 Binary files /dev/null and b/static/images/workbench/09.png differ diff --git a/static/images/workbench/10.png b/static/images/workbench/10.png new file mode 100644 index 0000000..122319d Binary files /dev/null and b/static/images/workbench/10.png differ diff --git a/static/images/workbench/11.png b/static/images/workbench/11.png new file mode 100644 index 0000000..b08b752 Binary files /dev/null and b/static/images/workbench/11.png differ diff --git a/static/images/workbench/friendCircleIcon.png b/static/images/workbench/friendCircleIcon.png new file mode 100644 index 0000000..e102cbe Binary files /dev/null and b/static/images/workbench/friendCircleIcon.png differ diff --git a/store/modules/conversation.js b/store/modules/conversation.js index 20bc661..d23c296 100644 --- a/store/modules/conversation.js +++ b/store/modules/conversation.js @@ -1,6 +1,4 @@ -import { - v4 as uuidv4 -} from "uuid"; +import {v4 as uuidv4} from "uuid"; import IMSDK from "openim-uniapp-polyfill"; const state = { @@ -46,14 +44,9 @@ const mutations = { }; const actions = { - async getConversationList({ - state, - commit - }, isFirstPage = true) { + async getConversationList({state,commit}, isFirstPage = true) { try { - const { - data - } = await IMSDK.asyncApi( + const {data} = await IMSDK.asyncApi( IMSDK.IMMethods.GetConversationListSplit, uuidv4(), { offset: isFirstPage ? 0 : state.conversationList.length, @@ -71,9 +64,7 @@ const actions = { return []; } }, - getCurrentGroup({ - commit - }, groupID) { + getCurrentGroup({commit}, groupID) { IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupsInfo, uuidv4(), [ groupID, ]).then(({ @@ -82,10 +73,7 @@ const actions = { commit("SET_CURRENT_GROUP", data[0] ?? {}); }); }, - getCurrentMemberInGroup({ - commit, - rootState - }, groupID) { + getCurrentMemberInGroup({commit,rootState}, groupID) { IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupMembersInfo, uuidv4(), { groupID, userIDList: [rootState.user.selfInfo.userID], @@ -95,20 +83,15 @@ const actions = { commit("SET_CURRENT_MEMBER_IN_GROUP", data[0] ?? {}); }); }, - getUnReadCount({ - commit - }) { + getUnReadCount({commit}) { IMSDK.asyncApi(IMSDK.IMMethods.GetTotalUnreadMsgCount, uuidv4()).then( (res) => { - console.log(res); + //console.log(res); commit("SET_UNREAD_COUNT", res.data); }, ); }, - updateCurrentMemberInGroup({ - commit, - state - }, memberInfo) { + updateCurrentMemberInGroup({commit,state}, memberInfo) { console.log(memberInfo); if ( memberInfo.groupID === state.currentMemberInGroup.groupID && diff --git a/store/modules/user.js b/store/modules/user.js index 705e08d..f1f54b8 100644 --- a/store/modules/user.js +++ b/store/modules/user.js @@ -48,19 +48,13 @@ const actions = { commit }) { try { - const { - data - } = await IMSDK.asyncApi( - IMSDK.IMMethods.GetSelfUserInfo, - uuidv4(), - ); - const res = await businessGetUserInfo(data.userID); - //console.log(res.data); + const result = await IMSDK.asyncApi(IMSDK.IMMethods.GetSelfUserInfo,uuidv4(),); + const res = await businessGetUserInfo(result.data.userID); const businessData = res.data[0] ?? {}; filterEmptyValue(businessData); commit("SET_SELF_INFO", { - ...data, + ...result.data, ...businessData, }); } catch (e) { diff --git a/util/imCommon.js b/util/imCommon.js index 245bd21..b76846b 100644 --- a/util/imCommon.js +++ b/util/imCommon.js @@ -1,17 +1,19 @@ import store from "@/store"; import { - CustomType, - GroupSystemMessageTypes, - AddFriendQrCodePrefix, - AddGroupQrCodePrefix, + CustomType, + GroupSystemMessageTypes, + AddFriendQrCodePrefix, + AddGroupQrCodePrefix, } from "@/constant"; import IMSDK, { - GroupAtType, - MessageType, - SessionType, + GroupAtType, + MessageType, + SessionType, } from "openim-uniapp-polyfill"; import dayjs from "dayjs"; -import { isThisYear } from "date-fns"; +import { + isThisYear +} from "date-fns"; import calendar from "dayjs/plugin/calendar"; import relativeTime from "dayjs/plugin/relativeTime"; @@ -24,338 +26,335 @@ dayjs.extend(updateLocale); dayjs.locale("zh-cn"); dayjs.updateLocale("en", { - calendar: { - sameElse: "YYYY-MM-DD", - }, + calendar: { + sameElse: "YYYY-MM-DD", + }, }); dayjs.updateLocale("zh-cn", { - calendar: { - sameDay: "HH:mm", - nextDay: "[明天]", - nextWeek: "dddd", - lastDay: "[昨天] HH:mm", - lastWeek: "dddd HH:mm", - sameElse: "YYYY年M月D日 HH:mm", - }, + calendar: { + sameDay: "HH:mm", + nextDay: "[明天]", + nextWeek: "dddd", + lastDay: "[昨天] HH:mm", + lastWeek: "dddd HH:mm", + sameElse: "YYYY年M月D日 HH:mm", + }, }); export const formatMessageTime = (timestemp, keepSameYear = false) => { - if (!timestemp) return ""; + if (!timestemp) return ""; - const isRecent = dayjs().diff(timestemp, "day") < 7; - const keepYear = keepSameYear || !isThisYear(timestemp); + const isRecent = dayjs().diff(timestemp, "day") < 7; + const keepYear = keepSameYear || !isThisYear(timestemp); - if (!isRecent && !keepYear) { - return dayjs(timestemp).format("M月D日 HH:mm"); - } + if (!isRecent && !keepYear) { + return dayjs(timestemp).format("M月D日 HH:mm"); + } - return dayjs(timestemp).calendar(); + return dayjs(timestemp).calendar(); }; export const conversationSort = (conversationList) => { - const arr = []; - const filterArr = conversationList.filter( - (c) => !arr.includes(c.conversationID) && arr.push(c.conversationID), - ); - filterArr.sort((a, b) => { - if (a.isPinned === b.isPinned) { - const aCompare = - a.draftTextTime > a.latestMsgSendTime - ? a.draftTextTime - : a.latestMsgSendTime; - const bCompare = - b.draftTextTime > b.latestMsgSendTime - ? b.draftTextTime - : b.latestMsgSendTime; - if (aCompare > bCompare) { - return -1; - } else if (aCompare < bCompare) { - return 1; - } else { - return 0; - } - } else if (a.isPinned && !b.isPinned) { - return -1; - } else { - return 1; - } - }); - return filterArr; + const arr = []; + const filterArr = conversationList.filter( + (c) => !arr.includes(c.conversationID) && arr.push(c.conversationID), + ); + filterArr.sort((a, b) => { + if (a.isPinned === b.isPinned) { + const aCompare = + a.draftTextTime > a.latestMsgSendTime ? + a.draftTextTime : + a.latestMsgSendTime; + const bCompare = + b.draftTextTime > b.latestMsgSendTime ? + b.draftTextTime : + b.latestMsgSendTime; + if (aCompare > bCompare) { + return -1; + } else if (aCompare < bCompare) { + return 1; + } else { + return 0; + } + } else if (a.isPinned && !b.isPinned) { + return -1; + } else { + return 1; + } + }); + return filterArr; }; export const sec2Time = (seconds) => { - var theTime1 = 0; // min - var theTime2 = 0; // hour - var theTime3 = 0; // day - if (seconds > 60) { - theTime1 = parseInt(seconds / 60); - seconds = parseInt(seconds % 60); - if (theTime1 > 60) { - theTime2 = parseInt(theTime1 / 60); - theTime1 = parseInt(theTime1 % 60); - if (theTime2 > 24) { - theTime3 = parseInt(theTime2 / 24); - theTime2 = parseInt(theTime2 % 24); - } - } - } - var result = ""; - if (seconds > 0) { - result = "" + parseInt(seconds) + "秒"; - } - if (theTime1 > 0) { - result = "" + parseInt(theTime1) + "分钟" + result; - } - if (theTime2 > 0) { - result = "" + parseInt(theTime2) + "小时" + result; - } - if (theTime3 > 0) { - result = "" + parseInt(theTime3) + "天" + result; - } - return result; + var theTime1 = 0; // min + var theTime2 = 0; // hour + var theTime3 = 0; // day + if (seconds > 60) { + theTime1 = parseInt(seconds / 60); + seconds = parseInt(seconds % 60); + if (theTime1 > 60) { + theTime2 = parseInt(theTime1 / 60); + theTime1 = parseInt(theTime1 % 60); + if (theTime2 > 24) { + theTime3 = parseInt(theTime2 / 24); + theTime2 = parseInt(theTime2 % 24); + } + } + } + var result = ""; + if (seconds > 0) { + result = "" + parseInt(seconds) + "秒"; + } + if (theTime1 > 0) { + result = "" + parseInt(theTime1) + "分钟" + result; + } + if (theTime2 > 0) { + result = "" + parseInt(theTime2) + "小时" + result; + } + if (theTime3 > 0) { + result = "" + parseInt(theTime3) + "天" + result; + } + return result; }; export const parseMessageByType = (pmsg) => { - const getName = (user) => { - return user.userID === store.getters.storeCurrentUserID - ? "你" - : user.nickname; - }; + const getName = (user) => { + return user.userID === store.getters.storeCurrentUserID ? + "你" : + user.nickname; + }; - switch (pmsg.contentType) { - case MessageType.TextMessage: - return pmsg.textElem.content; - case MessageType.PictureMessage: - return `[图片]`; - case MessageType.FriendAdded: - return "你们已经是好友了,开始聊天吧~"; - case MessageType.MemberEnter: - const enterDetails = JSON.parse(pmsg.notificationElem.detail); - const enterUser = enterDetails.entrantUser; - return `${getName(enterUser)}进入了群聊`; - case MessageType.GroupCreated: - const groupCreatedDetail = JSON.parse(pmsg.notificationElem.detail); - const groupCreatedUser = groupCreatedDetail.opUser; - return `${getName(groupCreatedUser)}创建了群聊`; - case MessageType.MemberInvited: - const inviteDetails = JSON.parse(pmsg.notificationElem.detail); - const inviteOpUser = inviteDetails.opUser; - const invitedUserList = inviteDetails.invitedUserList ?? []; - let inviteStr = ""; - invitedUserList.find( - (user, idx) => (inviteStr += getName(user) + "、") && idx > 3, - ); - inviteStr = inviteStr.slice(0, -1); - return `${getName(inviteOpUser)}邀请了${inviteStr}${ + switch (pmsg.contentType) { + case MessageType.TextMessage: + return pmsg.textElem.content; + case MessageType.PictureMessage: + return `[图片]`; + case MessageType.FriendAdded: + return "你们已经是好友了,开始聊天吧~"; + case MessageType.MemberEnter: + const enterDetails = JSON.parse(pmsg.notificationElem.detail); + const enterUser = enterDetails.entrantUser; + return `${getName(enterUser)}进入了群聊`; + case MessageType.GroupCreated: + const groupCreatedDetail = JSON.parse(pmsg.notificationElem.detail); + const groupCreatedUser = groupCreatedDetail.opUser; + return `${getName(groupCreatedUser)}创建了群聊`; + case MessageType.MemberInvited: + const inviteDetails = JSON.parse(pmsg.notificationElem.detail); + const inviteOpUser = inviteDetails.opUser; + const invitedUserList = inviteDetails.invitedUserList ?? []; + let inviteStr = ""; + invitedUserList.find( + (user, idx) => (inviteStr += getName(user) + "、") && idx > 3, + ); + inviteStr = inviteStr.slice(0, -1); + return `${getName(inviteOpUser)}邀请了${inviteStr}${ invitedUserList.length > 3 ? "..." : "" }进入群聊`; - case MessageType.MemberKicked: - const kickDetails = JSON.parse(pmsg.notificationElem.detail); - const kickOpUser = kickDetails.opUser; - const kickdUserList = kickDetails.kickedUserList ?? []; - let kickStr = ""; - kickdUserList.find( - (user, idx) => (kickStr += getName(user) + "、") && idx > 3, - ); - kickStr = kickStr.slice(0, -1); - return `${getName(kickOpUser)}踢出了${kickStr}${ + case MessageType.MemberKicked: + const kickDetails = JSON.parse(pmsg.notificationElem.detail); + const kickOpUser = kickDetails.opUser; + const kickdUserList = kickDetails.kickedUserList ?? []; + let kickStr = ""; + kickdUserList.find( + (user, idx) => (kickStr += getName(user) + "、") && idx > 3, + ); + kickStr = kickStr.slice(0, -1); + return `${getName(kickOpUser)}踢出了${kickStr}${ kickdUserList.length > 3 ? "..." : "" }`; - case MessageType.MemberQuit: - const quitDetails = JSON.parse(pmsg.notificationElem.detail); - const quitUser = quitDetails.quitUser; - return `${getName(quitUser)}退出了群聊`; - case MessageType.GroupInfoUpdated: - const groupUpdateDetail = JSON.parse(pmsg.notificationElem.detail); - const groupUpdateUser = groupUpdateDetail.opUser; - return `${getName(groupUpdateUser)}修改了群信息`; - case MessageType.GroupOwnerTransferred: - const transferDetails = JSON.parse(pmsg.notificationElem.detail); - const transferOpUser = transferDetails.opUser; - const newOwner = transferDetails.newGroupOwner; - return `${getName(transferOpUser)}将群主转让给${getName(newOwner)}`; - case MessageType.GroupDismissed: - const dismissDetails = JSON.parse(pmsg.notificationElem.detail); - const dismissUser = dismissDetails.opUser; - return `${getName(dismissUser)}解散了群聊`; - case MessageType.GroupNameUpdated: - const groupNameUpdateDetail = JSON.parse(pmsg.notificationElem.detail); - const groupNameUpdateUser = groupNameUpdateDetail.opUser; - return `${getName(groupNameUpdateUser)}修改了群名称为${ + case MessageType.MemberQuit: + const quitDetails = JSON.parse(pmsg.notificationElem.detail); + const quitUser = quitDetails.quitUser; + return `${getName(quitUser)}退出了群聊`; + case MessageType.GroupInfoUpdated: + const groupUpdateDetail = JSON.parse(pmsg.notificationElem.detail); + const groupUpdateUser = groupUpdateDetail.opUser; + return `${getName(groupUpdateUser)}修改了群信息`; + case MessageType.GroupOwnerTransferred: + const transferDetails = JSON.parse(pmsg.notificationElem.detail); + const transferOpUser = transferDetails.opUser; + const newOwner = transferDetails.newGroupOwner; + return `${getName(transferOpUser)}将群主转让给${getName(newOwner)}`; + case MessageType.GroupDismissed: + const dismissDetails = JSON.parse(pmsg.notificationElem.detail); + const dismissUser = dismissDetails.opUser; + return `${getName(dismissUser)}解散了群聊`; + case MessageType.GroupNameUpdated: + const groupNameUpdateDetail = JSON.parse(pmsg.notificationElem.detail); + const groupNameUpdateUser = groupNameUpdateDetail.opUser; + return `${getName(groupNameUpdateUser)}修改了群名称为${ groupNameUpdateDetail.group.groupName }`; - default: - return "[暂未支持的消息类型]"; - } + default: + return "[暂未支持的消息类型]"; + } }; export const formatConversionTime = (timestemp) => { - const fromNowStr = dayjs(timestemp).fromNow(); + const fromNowStr = dayjs(timestemp).fromNow(); - if (fromNowStr.includes("秒")) { - return "刚刚"; - } + if (fromNowStr.includes("秒")) { + return "刚刚"; + } - if (!fromNowStr.includes("秒") && !fromNowStr.includes("分钟")) { - return dayjs(timestemp).calendar(); - } + if (!fromNowStr.includes("秒") && !fromNowStr.includes("分钟")) { + return dayjs(timestemp).calendar(); + } - return fromNowStr; + return fromNowStr; }; export const secFormat = (sec) => { - let h; - let s; - h = Math.floor(sec / 60); - s = sec % 60; - h += ""; - s += ""; - h = h.length === 1 ? "0" + h : h; - s = s.length === 1 ? "0" + s : s; - return h + ":" + s; + let h; + let s; + h = Math.floor(sec / 60); + s = sec % 60; + h += ""; + s += ""; + h = h.length === 1 ? "0" + h : h; + s = s.length === 1 ? "0" + s : s; + return h + ":" + s; }; export const bytesToSize = (bytes) => { - if (bytes === 0) return "0 B"; - var k = 1024, - sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], - i = Math.floor(Math.log(bytes) / Math.log(k)); + if (bytes === 0) return "0 B"; + var k = 1024, + sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], + i = Math.floor(Math.log(bytes) / Math.log(k)); - return (bytes / Math.pow(k, i)).toPrecision(3) + " " + sizes[i]; + return (bytes / Math.pow(k, i)).toPrecision(3) + " " + sizes[i]; }; export const tipMessaggeFormat = (msg, currentUserID) => { - const getName = (user) => - user.userID === currentUserID ? "你" : user.nickname; + const getName = (user) => + user.userID === currentUserID ? "你" : user.nickname; - switch (msg.contentType) { - case MessageType.FriendAdded: - return `你们已经是好友了~`; - case MessageType.GroupCreated: - const groupCreatedDetail = JSON.parse(msg.notificationElem.detail); - const groupCreatedUser = groupCreatedDetail.opUser; - return `${getName(groupCreatedUser)}创建了群聊`; - case MessageType.GroupInfoUpdated: - const groupUpdateDetail = JSON.parse(msg.notificationElem.detail); - const groupUpdateUser = groupUpdateDetail.opUser; - return `${parseInfo(groupUpdateUser)}修改了群信息`; - case MessageType.GroupOwnerTransferred: - const transferDetails = JSON.parse(msg.notificationElem.detail); - const transferOpUser = transferDetails.opUser; - const newOwner = transferDetails.newGroupOwner; - return `${parseInfo(transferOpUser)}转让群主给${parseInfo(newOwner)}`; - case MessageType.MemberQuit: - const quitDetails = JSON.parse(msg.notificationElem.detail); - const quitUser = quitDetails.quitUser; - return `${parseInfo(quitUser)}退出了群组`; - case MessageType.MemberInvited: - const inviteDetails = JSON.parse(msg.notificationElem.detail); - const inviteOpUser = inviteDetails.opUser; - const invitedUserList = inviteDetails.invitedUserList ?? []; - let inviteStr = ""; - invitedUserList.find( - (user, idx) => (inviteStr += parseInfo(user) + "、") && idx > 3, - ); - inviteStr = inviteStr.slice(0, -1); - return `${parseInfo(inviteOpUser)} 邀请了${inviteStr}${ + switch (msg.contentType) { + case MessageType.FriendAdded: + return `你们已经是好友了~`; + case MessageType.GroupCreated: + const groupCreatedDetail = JSON.parse(msg.notificationElem.detail); + const groupCreatedUser = groupCreatedDetail.opUser; + return `${getName(groupCreatedUser)}创建了群聊`; + case MessageType.GroupInfoUpdated: + const groupUpdateDetail = JSON.parse(msg.notificationElem.detail); + const groupUpdateUser = groupUpdateDetail.opUser; + return `${parseInfo(groupUpdateUser)}修改了群信息`; + case MessageType.GroupOwnerTransferred: + const transferDetails = JSON.parse(msg.notificationElem.detail); + const transferOpUser = transferDetails.opUser; + const newOwner = transferDetails.newGroupOwner; + return `${parseInfo(transferOpUser)}转让群主给${parseInfo(newOwner)}`; + case MessageType.MemberQuit: + const quitDetails = JSON.parse(msg.notificationElem.detail); + const quitUser = quitDetails.quitUser; + return `${parseInfo(quitUser)}退出了群组`; + case MessageType.MemberInvited: + const inviteDetails = JSON.parse(msg.notificationElem.detail); + const inviteOpUser = inviteDetails.opUser; + const invitedUserList = inviteDetails.invitedUserList ?? []; + let inviteStr = ""; + invitedUserList.find( + (user, idx) => (inviteStr += parseInfo(user) + "、") && idx > 3, + ); + inviteStr = inviteStr.slice(0, -1); + return `${parseInfo(inviteOpUser)} 邀请了${inviteStr}${ invitedUserList.length > 3 ? "..." : "" }加入群聊`; - case MessageType.MemberKicked: - const kickDetails = JSON.parse(msg.notificationElem.detail); - const kickOpUser = kickDetails.opUser; - const kickdUserList = kickDetails.kickedUserList ?? []; - let kickStr = ""; - kickdUserList.find( - (user, idx) => (kickStr += parseInfo(user) + "、") && idx > 3, - ); - kickStr = kickStr.slice(0, -1); - return `${parseInfo(kickOpUser)} 踢出了${kickStr}${ + case MessageType.MemberKicked: + const kickDetails = JSON.parse(msg.notificationElem.detail); + const kickOpUser = kickDetails.opUser; + const kickdUserList = kickDetails.kickedUserList ?? []; + let kickStr = ""; + kickdUserList.find( + (user, idx) => (kickStr += parseInfo(user) + "、") && idx > 3, + ); + kickStr = kickStr.slice(0, -1); + return `${parseInfo(kickOpUser)} 踢出了${kickStr}${ kickdUserList.length > 3 ? "..." : "" }`; - case MessageType.MemberEnter: - const enterDetails = JSON.parse(msg.notificationElem.detail); - const enterUser = enterDetails.entrantUser; - return `${parseInfo(enterUser)}加入了群聊`; - case MessageType.GroupDismissed: - const dismissDetails = JSON.parse(msg.notificationElem.detail); - const dismissUser = dismissDetails.opUser; - return `${parseInfo(dismissUser)}解散了群聊`; - default: - return ""; - } + case MessageType.MemberEnter: + const enterDetails = JSON.parse(msg.notificationElem.detail); + const enterUser = enterDetails.entrantUser; + return `${parseInfo(enterUser)}加入了群聊`; + case MessageType.GroupDismissed: + const dismissDetails = JSON.parse(msg.notificationElem.detail); + const dismissUser = dismissDetails.opUser; + return `${parseInfo(dismissUser)}解散了群聊`; + default: + return ""; + } }; export const markConversationAsRead = (conversation, fromChating = false) => { - if (conversation.unreadCount !== 0) { - IMSDK.asyncApi( - IMSDK.IMMethods.MarkConversationMessageAsRead, - IMSDK.uuid(), - conversation.conversationID, - ); - } + if (conversation.unreadCount !== 0) { + IMSDK.asyncApi( + IMSDK.IMMethods.MarkConversationMessageAsRead, + IMSDK.uuid(), + conversation.conversationID, + ); + } }; export const prepareConversationState = (conversation, back2Tab = false) => { - markConversationAsRead(conversation); + markConversationAsRead(conversation); - if (conversation.conversationType === SessionType.WorkingGroup) { - store.dispatch("conversation/getCurrentGroup", conversation.groupID); - store.dispatch( - "conversation/getCurrentMemberInGroup", - conversation.groupID, - ); - } - store.dispatch("message/resetMessageState"); - store.commit("conversation/SET_CURRENT_CONVERSATION", conversation); + if (conversation.conversationType === SessionType.WorkingGroup) { + store.dispatch("conversation/getCurrentGroup", conversation.groupID); + store.dispatch( + "conversation/getCurrentMemberInGroup", + conversation.groupID, + ); + } + store.dispatch("message/resetMessageState"); + store.commit("conversation/SET_CURRENT_CONVERSATION", conversation); - let url = `/pages/conversation/chating/index?back2Tab=${back2Tab}`; - setTimeout(() => { - uni.navigateTo({ - url, - }); - }, 300) + let url = `/pages/conversation/chating/index?back2Tab=${back2Tab}`; + setTimeout(() => { + uni.navigateTo({ + url, + }); + }, 300) }; -export const navigateToDesignatedConversation = ( - sourceID, - sessionType, - back2Tab = false, -) => { - return new Promise(async (resolve, reject) => { - try { - const { data } = await IMSDK.asyncApi( - IMSDK.IMMethods.GetOneConversation, - IMSDK.uuid(), - { - sessionType, - sourceID, - }, - ); - prepareConversationState(data, back2Tab); - resolve(); - } catch (e) { - reject(e); - } - }); +export const navigateToDesignatedConversation = (sourceID,sessionType,back2Tab = false,) => { + return new Promise(async (resolve, reject) => { + try { + const { + data + } = await IMSDK.asyncApi( + IMSDK.IMMethods.GetOneConversation, + IMSDK.uuid(), { + sessionType, + sourceID, + }, + ); + prepareConversationState(data, back2Tab); + resolve(); + } catch (e) { + reject(e); + } + }); }; export const offlinePushInfo = { - title: "you have a new message", - desc: "you have a new message", - ex: "", - iOSPushSound: "", - iOSBadgeCount: true, + title: "you have a new message", + desc: "you have a new message", + ex: "", + iOSPushSound: "", + iOSBadgeCount: true, }; export const getConversationContent = (message) => { - if ( - !message.groupID || - message.sendID === store.getters.storeCurrentUserID - ) { - return parseMessageByType(message); - } - return `${message.senderNickname}:${parseMessageByType(message)}`; + if ( + !message.groupID || + message.sendID === store.getters.storeCurrentUserID + ) { + return parseMessageByType(message); + } + return `${message.senderNickname}:${parseMessageByType(message)}`; }; \ No newline at end of file