This commit is contained in:
2025-11-21 01:20:28 +08:00
parent d9d7ddc05d
commit ff026c6f32
7 changed files with 822 additions and 824 deletions
+1 -1
View File
@@ -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`
+288 -289
View File
@@ -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"
}
}
}
+146 -155
View File
@@ -1,172 +1,163 @@
<template>
<view class="search_container">
<custom-nav-bar :route="false">
<view slot="left"> </view>
<view class="search_bar" slot="center">
<u-search
actionText="取消"
@change="keywordChange"
@custom="cancel"
@search="startSearch"
shape="square"
:placeholder="getPlaceholder"
v-model="keyword"
/>
</view>
</custom-nav-bar>
<view class="search_container">
<custom-nav-bar :route="false">
<view slot="left"> </view>
<view class="search_bar" slot="center">
<u-search actionText="取消" @change="keywordChange" @custom="cancel" @search="startSearch" shape="square"
:placeholder="getPlaceholder" v-model="keyword" />
</view>
</custom-nav-bar>
<view v-show="!empty && !searching" @click="startSearch(keyword)" class="result_row">
<image class="icon" :src="getIcon" alt="" />
<view class="">
<text>查找</text>
<text>{{ keyword }}</text>
</view>
</view>
<view v-show="!empty && !searching" @click="startSearch(keyword)" class="result_row">
<image class="icon" :src="getIcon" alt="" />
<view class="">
<text>查找</text>
<text>{{ keyword }}</text>
</view>
</view>
<view v-show="searching && !empty" class="result_row result_row_empty">
<u-loading-icon></u-loading-icon>
</view>
<view v-show="searching && !empty" class="result_row result_row_empty">
<u-loading-icon></u-loading-icon>
</view>
<view v-show="empty" class="result_row result_row_empty">
<text>未搜索到相关结果</text>
</view>
</view>
<view v-show="empty" class="result_row result_row_empty">
<text>未搜索到相关结果</text>
</view>
</view>
</template>
<script>
import IMSDK from "openim-uniapp-polyfill";
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import IMSDK from "openim-uniapp-polyfill";
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import searchGroup from "static/images/contact_add_join_group_fill.png";
import searchUser from "static/images/contact_add_search_user_fill.png";
import { businessSearchUserInfo } from "@/api/login";
import searchGroup from "static/images/contact_add_join_group_fill.png";
import searchUser from "static/images/contact_add_search_user_fill.png";
import {
businessSearchUserInfo
} from "@/api/login";
export default {
components: {
CustomNavBar,
},
data() {
return {
keyword: "",
searching: false,
empty: false,
isSearchGroup: false,
};
},
computed: {
getIcon() {
return this.isSearchGroup ? searchGroup : searchUser;
},
getPlaceholder() {
return this.isSearchGroup ? "请输入群聊ID" : "搜索ID或手机号添加好友";
},
},
onLoad(options) {
const { isSearchGroup } = options;
this.isSearchGroup = JSON.parse(isSearchGroup);
},
methods: {
cancel() {
console.log("cancel");
uni.navigateBack();
},
keywordChange() {
if (this.empty) {
this.empty = !this.empty;
}
},
async startSearch(value) {
if (!value) return;
this.searching = true;
try {
if (this.isSearchGroup) {
let info = this.$store.getters.storeGroupList.find(
(item) => item.groupID === value,
);
if (!info) {
const { data } = await IMSDK.asyncApi(
IMSDK.IMMethods.GetSpecifiedGroupsInfo,
IMSDK.uuid(),
[value],
);
info = data[0];
}
if (info) {
uni.navigateTo({
url: `/pages/common/groupCard/index?sourceInfo=${JSON.stringify(
info,
)}`,
});
} else {
this.empty = true;
}
} else {
let info = this.$store.getters.storeFriendList.find(
(item) => item.userID === value,
);
if (!info) {
const { total, users } = await businessSearchUserInfo(value);
if (total > 0) {
const { data } = await IMSDK.asyncApi(
IMSDK.IMMethods.GetUsersInfo,
IMSDK.uuid(),
[users[0].userID],
);
const imData = data[0];
export default {
components: {
CustomNavBar,
},
data() {
return {
keyword: "",
searching: false,
empty: false,
isSearchGroup: false,
};
},
computed: {
getIcon() {
return this.isSearchGroup ? searchGroup : searchUser;
},
getPlaceholder() {
return this.isSearchGroup ? "请输入群聊ID" : "搜索ID或手机号添加好友";
},
},
onLoad(options) {
const {isSearchGroup} = options;
this.isSearchGroup = JSON.parse(isSearchGroup);
},
methods: {
cancel() {
console.log("cancel");
uni.navigateBack();
},
keywordChange() {
if (this.empty) {
this.empty = !this.empty;
}
},
async startSearch(value) {
if (!value) return;
this.searching = true;
try {
if (this.isSearchGroup) {
let info = this.$store.getters.storeGroupList.find(
(item) => item.groupID === value,
);
if (!info) {
const {data} = await IMSDK.asyncApi(
IMSDK.IMMethods.GetSpecifiedGroupsInfo,
IMSDK.uuid(),
[value],
);
info = data[0];
}
if (info) {
uni.navigateTo({
url: `/pages/common/groupCard/index?sourceInfo=${JSON.stringify(info,)}`,
});
} else {
this.empty = true;
}
} else {
let info = this.$store.getters.storeFriendList.find(
(item) => item.userID === value,
);
if (!info) {
const {total,users} = await businessSearchUserInfo(value);
if (total > 0) {
const {data} = await IMSDK.asyncApi(
IMSDK.IMMethods.GetUsersInfo,
IMSDK.uuid(),
[users[0].userID],
);
const imData = data[0];
info = {
...imData,
...users[0],
};
}
}
if (info) {
uni.navigateTo({
url: `/pages/common/userCard/index?sourceInfo=${JSON.stringify(
info,
)}`,
});
} else {
this.empty = true;
}
}
} catch (e) {
//TODO handle the exception
}
this.searching = false;
},
},
};
info = {
...imData,
...users[0],
};
}
}
if (info) {
uni.navigateTo({
url: `/pages/common/userCard/index?sourceInfo=${JSON.stringify(info,)}`,
});
} else {
this.empty = true;
}
}
} catch (e) {
//TODO handle the exception
}
this.searching = false;
},
},
};
</script>
<style lang="scss" scoped>
.search_container {
height: 100vh;
background-color: #f8f8f8;
.search_container {
height: 100vh;
background-color: #f8f8f8;
.search_bar {
width: 100%;
padding: 0 44rpx;
}
.search_bar {
width: 100%;
padding: 0 44rpx;
}
.result_row {
@include vCenterBox();
padding: 24rpx 44rpx;
font-size: 28rpx;
color: $uni-text-color;
background-color: #fff;
.result_row {
@include vCenterBox();
padding: 24rpx 44rpx;
font-size: 28rpx;
color: $uni-text-color;
background-color: #fff;
.icon {
width: 20px;
height: 20px;
margin-right: 24rpx;
}
.icon {
width: 20px;
height: 20px;
margin-right: 24rpx;
}
&_empty {
display: flex;
justify-content: center;
color: #999;
}
}
}
</style>
&_empty {
display: flex;
justify-content: center;
color: #999;
}
}
}
</style>
+2 -1
View File
@@ -5,7 +5,8 @@
<view v-if="!isLoading" style="flex: 1;display: flex;flex-direction: column;">
<view class="base_info">
<my-avatar :desc="sourceUserInfo.remark || sourceUserInfo.nickname" :src="sourceUserInfo.faceURL" size="46" />
<my-avatar :desc="sourceUserInfo.remark || sourceUserInfo.nickname" :src="sourceUserInfo.faceURL"
size="46" />
<view class="user_name">
<text class="text">{{ getShowName }}</text>
<text class="id" @click="copy(sourceUserInfo.userID)">{{sourceUserInfo.userID}}</text>
+207 -215
View File
@@ -1,238 +1,230 @@
<template>
<view class="page_container">
<view class="self_info_row"></view>
<view class="page_container">
<view class="self_info_row"></view>
<view class="info_card">
<my-avatar :src="selfInfo.faceURL" :desc="selfInfo.nickname" size="46" />
<view class="info_card">
<my-avatar :src="selfInfo.faceURL" :desc="selfInfo.nickname" size="46" />
<view class="id_row">
<text class="nickname">{{ selfInfo.nickname }}</text>
<view class="id_row_copy" @click="copy">
<text class="id">{{ selfInfo.userID }}</text>
<image
style="width: 32rpx; height: 32rpx"
src="@/static/images/id_copy.png"
mode=""
/>
</view>
</view>
<view class="id_row">
<text class="nickname">{{ selfInfo.nickname }}</text>
<view class="id_row_copy" @click="copy">
<text class="id">{{ selfInfo.userID }}</text>
<image style="width: 32rpx; height: 32rpx" src="@/static/images/id_copy.png" mode="" />
</view>
</view>
<view class="qr" @click="toSelfQr">
<img src="static/images/self_info_qr.png" alt="" />
<img src="static/images/common_right.png" alt="" />
</view>
</view>
<view class="qr" @click="toSelfQr">
<img src="static/images/self_info_qr.png" alt="" />
<img src="static/images/common_right.png" alt="" />
</view>
</view>
<view class="action_box">
<view
@click="profileMenuClick(item)"
class="profile_menu_item"
v-for="item in profileMenus"
:key="item.idx"
>
<view class="menu_left">
<image style="width: 48rpx; height: 48rpx" :src="item.icon" mode="" />
<text>{{ item.title }}</text>
</view>
<u-icon name="arrow-right" size="16" color="#999"></u-icon>
</view>
</view>
<view class="action_box">
<view @click="profileMenuClick(item)" class="profile_menu_item" v-for="item in profileMenus"
:key="item.idx">
<view class="menu_left">
<image style="width: 48rpx; height: 48rpx" :src="item.icon" mode="" />
<text>{{ item.title }}</text>
</view>
<u-icon name="arrow-right" size="16" color="#999"></u-icon>
</view>
</view>
<u-toast ref="uToast"></u-toast>
</view>
<u-toast ref="uToast"></u-toast>
</view>
</template>
<script>
import IMSDK from "openim-uniapp-polyfill";
import MyAvatar from "@/components/MyAvatar/index.vue";
export default {
components: {
MyAvatar,
},
data() {
return {
profileMenus: [
{
idx: 0,
title: "我的信息",
icon: require("static/images/profile_menu_info.png"),
},
{
idx: 2,
title: "账号设置",
icon: require("static/images/profile_menu_account.png"),
},
{
idx: 3,
title: "关于我们",
icon: require("static/images/profile_menu_about.png"),
},
{
idx: 4,
title: "退出登录",
icon: require("static/images/profile_menu_logout.png"),
},
],
};
},
computed: {
selfInfo() {
return this.$store.getters.storeSelfInfo;
},
},
methods: {
copy() {
uni.setClipboardData({
showToast: false,
data: this.selfInfo.userID,
success: function () {
uni.showToast({
icon: "none",
title: "复制成功",
});
},
});
},
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");
});
},
profileMenuClick({ idx }) {
switch (idx) {
case 0:
uni.navigateTo({
url: "/pages/profile/selfInfo/index",
});
break;
case 1:
uni.navigateTo({
url: "/pages/profile/messageNotification/index",
});
break;
case 2:
uni.navigateTo({
url: "/pages/profile/accountSetting/index",
});
break;
case 3:
uni.navigateTo({
url: "/pages/profile/about/index",
});
break;
case 4:
uni.showModal({
title: "提示",
content: "确定要退出当前账号吗?",
confirmText: "确认",
cancelText: "取消",
success: (res) => {
if (res.confirm) {
this.logoutConfirm();
}
},
});
break;
default:
break;
}
},
toSelfQr() {
uni.navigateTo({
url: `/pages/common/userOrGroupQrCode/index`,
});
},
},
};
import IMSDK from "openim-uniapp-polyfill";
import MyAvatar from "@/components/MyAvatar/index.vue";
export default {
components: {
MyAvatar,
},
data() {
return {
profileMenus: [{
idx: 0,
title: "我的信息",
icon: require("static/images/profile_menu_info.png"),
},
{
idx: 2,
title: "账号设置",
icon: require("static/images/profile_menu_account.png"),
},
{
idx: 3,
title: "关于我们",
icon: require("static/images/profile_menu_about.png"),
},
{
idx: 4,
title: "退出登录",
icon: require("static/images/profile_menu_logout.png"),
},
],
};
},
computed: {
selfInfo() {
return this.$store.getters.storeSelfInfo;
},
},
methods: {
copy() {
console.log(this.selfInfo)
uni.setClipboardData({
showToast: false,
data: this.selfInfo.userID,
success: function() {
uni.showToast({
icon: "none",
title: "复制成功",
});
},
});
},
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");
});
},
profileMenuClick({idx}) {
switch (idx) {
case 0:
uni.navigateTo({
url: "/pages/profile/selfInfo/index",
});
break;
case 1:
uni.navigateTo({
url: "/pages/profile/messageNotification/index",
});
break;
case 2:
uni.navigateTo({
url: "/pages/profile/accountSetting/index",
});
break;
case 3:
uni.navigateTo({
url: "/pages/profile/about/index",
});
break;
case 4:
uni.showModal({
title: "提示",
content: "确定要退出当前账号吗?",
confirmText: "确认",
cancelText: "取消",
success: (res) => {
if (res.confirm) {
this.logoutConfirm();
}
},
});
break;
default:
break;
}
},
toSelfQr() {
uni.navigateTo({
url: `/pages/common/userOrGroupQrCode/index`,
});
},
},
};
</script>
<style lang="scss" scoped>
.page_container {
background-color: #f8f9fa;
.page_container {
background-color: #f8f9fa;
.self_info_row {
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: center;
width: 100%;
height: 276rpx;
background-image: url("@/static/images/profile_top_bg.png");
background-repeat: round;
}
.self_info_row {
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: center;
width: 100%;
height: 276rpx;
background-image: url("@/static/images/profile_top_bg.png");
background-repeat: round;
}
.info_card {
width: 640rpx;
height: 196rpx;
border-radius: 6px;
background: #fff;
margin: -120rpx auto 0 auto;
padding: 0 36rpx;
color: #0c1c33;
display: flex;
align-items: center;
.info_card {
width: 640rpx;
height: 196rpx;
border-radius: 6px;
background: #fff;
margin: -120rpx auto 0 auto;
padding: 0 36rpx;
color: #0c1c33;
display: flex;
align-items: center;
.id_row {
@include vCenterBox();
display: flex;
height: 46px;
margin-left: 16rpx;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
flex: 1;
font-size: 28rpx;
.id_row {
@include vCenterBox();
display: flex;
height: 46px;
margin-left: 16rpx;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
flex: 1;
font-size: 28rpx;
&_copy {
@include vCenterBox();
}
&_copy {
@include vCenterBox();
}
.nickname {
@include nomalEllipsis();
max-width: 400rpx;
font-weight: 500;
font-size: 34rpx;
}
.nickname {
@include nomalEllipsis();
max-width: 400rpx;
font-weight: 500;
font-size: 34rpx;
}
.id {
color: #8e9ab0;
}
}
.id {
color: #8e9ab0;
}
}
img {
width: 18px;
height: 18px;
}
}
img {
width: 18px;
height: 18px;
}
}
.action_box {
margin: 24rpx 24rpx 0 24rpx;
background: #fff;
border-radius: 6px;
}
.action_box {
margin: 24rpx 24rpx 0 24rpx;
background: #fff;
border-radius: 6px;
}
.profile_menu_item {
@include btwBox();
padding: 24rpx 36rpx;
.profile_menu_item {
@include btwBox();
padding: 24rpx 36rpx;
.menu_left {
@include vCenterBox();
color: $uni-text-color;
.menu_left {
@include vCenterBox();
color: $uni-text-color;
image {
margin-right: 24rpx;
}
}
}
}
</style>
image {
margin-right: 24rpx;
}
}
}
}
</style>
+107 -100
View File
@@ -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,
};
+71 -63
View File
@@ -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,
};