9
This commit is contained in:
+128
-126
@@ -1,139 +1,141 @@
|
||||
<template>
|
||||
<view class="mark_id_container">
|
||||
<custom-nav-bar :title="getTitle">
|
||||
<view class="nav_right_action" slot="more">
|
||||
<text v-show="!loading" @click="saveOrCopy">{{ getConfirmText }}</text>
|
||||
<u-loading-icon v-show="loading" />
|
||||
</view>
|
||||
</custom-nav-bar>
|
||||
<view class="mark_id_container">
|
||||
<custom-nav-bar :title="getTitle">
|
||||
<view class="nav_right_action" slot="more">
|
||||
<text v-show="!loading" @click="saveOrCopy">{{ getConfirmText }}</text>
|
||||
<u-loading-icon v-show="loading" />
|
||||
</view>
|
||||
</custom-nav-bar>
|
||||
|
||||
<view class="content_row">
|
||||
<u-input
|
||||
:disabled="!isRemark && !isSelfNickname"
|
||||
v-model="content"
|
||||
disabledColor="transparent"
|
||||
maxlength="16"
|
||||
placeholder="请输入内容"
|
||||
clearable
|
||||
>
|
||||
</u-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content_row">
|
||||
<u-input :disabled="!isRemark && !isSelfNickname" v-model="content" disabledColor="transparent"
|
||||
maxlength="16" placeholder="请输入内容" clearable>
|
||||
</u-input>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import { businessInfoUpdate } from "@/api/login";
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
content: "",
|
||||
isRemark: false,
|
||||
isSelfNickname: false,
|
||||
sourceInfo: {},
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
getTitle() {
|
||||
if (this.isRemark) {
|
||||
return "设置备注";
|
||||
}
|
||||
if (this.isSelfNickname) {
|
||||
return "我的姓名";
|
||||
}
|
||||
return "ID号";
|
||||
},
|
||||
getConfirmText() {
|
||||
return this.isRemark || this.isSelfNickname ? "保存" : "复制";
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
const { isRemark, isSelfNickname, sourceInfo } = options;
|
||||
this.sourceInfo = JSON.parse(sourceInfo);
|
||||
this.isRemark = !!isRemark;
|
||||
if (this.isRemark) {
|
||||
this.content = this.sourceInfo.remark;
|
||||
}
|
||||
this.isSelfNickname = !!isSelfNickname;
|
||||
if (this.isSelfNickname) {
|
||||
this.content = this.sourceInfo.nickname;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async saveOrCopy() {
|
||||
if (this.isRemark) {
|
||||
this.loading = true;
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.SetFriendRemark, IMSDK.uuid(), {
|
||||
toUserID: this.sourceInfo.userID,
|
||||
remark: this.content,
|
||||
})
|
||||
.then(() => {
|
||||
uni.$u.toast("设置成功");
|
||||
setTimeout(() => uni.navigateBack(), 1000);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
uni.$u.toast("设置失败");
|
||||
})
|
||||
.finally(() => (this.loading = false));
|
||||
} else if (this.isSelfNickname) {
|
||||
this.loading = true;
|
||||
try {
|
||||
await businessInfoUpdate({
|
||||
userID: this.sourceInfo.userID,
|
||||
nickname: this.content,
|
||||
});
|
||||
await this.$store.dispatch("user/updateBusinessInfo");
|
||||
uni.$u.toast("修改成功");
|
||||
setTimeout(() => uni.navigateBack(), 1000);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
uni.$u.toast("修改失败");
|
||||
}
|
||||
this.loading = false;
|
||||
} else {
|
||||
uni.setClipboardData({
|
||||
data: this.sourceInfo.userID,
|
||||
success: () => {
|
||||
uni.hideToast();
|
||||
this.$nextTick(() => {
|
||||
uni.$u.toast("复制成功");
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import {
|
||||
businessInfoUpdate
|
||||
} from "@/api/login";
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
content: "",
|
||||
isRemark: false,
|
||||
isSelfNickname: false,
|
||||
sourceInfo: {},
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
getTitle() {
|
||||
if (this.isRemark) {
|
||||
return "设置备注";
|
||||
}
|
||||
if (this.isSelfNickname) {
|
||||
return "我的姓名";
|
||||
}
|
||||
return "ID号";
|
||||
},
|
||||
getConfirmText() {
|
||||
return this.isRemark || this.isSelfNickname ? "保存" : "复制";
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
const {
|
||||
isRemark,
|
||||
isSelfNickname,
|
||||
sourceInfo
|
||||
} = options;
|
||||
this.sourceInfo = JSON.parse(sourceInfo);
|
||||
console.log(sourceInfo);
|
||||
console.log(this.sourceInfo);
|
||||
this.isRemark = !!isRemark;
|
||||
if (this.isRemark) {
|
||||
this.content = this.sourceInfo.remark;
|
||||
}
|
||||
this.isSelfNickname = !!isSelfNickname;
|
||||
if (this.isSelfNickname) {
|
||||
this.content = this.sourceInfo.nickname;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async saveOrCopy() {
|
||||
if (this.isRemark) {
|
||||
this.loading = true;
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.SetFriendRemark, IMSDK.uuid(), {
|
||||
toUserID: this.sourceInfo.id+'',
|
||||
remark: this.content,
|
||||
})
|
||||
.then(() => {
|
||||
uni.$u.toast("设置成功");
|
||||
setTimeout(() => uni.navigateBack(), 1000);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
uni.$u.toast("设置失败");
|
||||
})
|
||||
.finally(() => (this.loading = false));
|
||||
} else if (this.isSelfNickname) {
|
||||
this.loading = true;
|
||||
try {
|
||||
await businessInfoUpdate({
|
||||
userID: this.sourceInfo.id,
|
||||
nickname: this.content,
|
||||
});
|
||||
await this.$store.dispatch("user/updateBusinessInfo");
|
||||
uni.$u.toast("修改成功");
|
||||
setTimeout(() => uni.navigateBack(), 1000);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
uni.$u.toast("修改失败");
|
||||
}
|
||||
this.loading = false;
|
||||
} else {
|
||||
uni.setClipboardData({
|
||||
data: this.sourceInfo.id,
|
||||
success: () => {
|
||||
uni.hideToast();
|
||||
this.$nextTick(() => {
|
||||
uni.$u.toast("复制成功");
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mark_id_container {
|
||||
@include colBox(false);
|
||||
height: 100vh;
|
||||
.mark_id_container {
|
||||
@include colBox(false);
|
||||
height: 100vh;
|
||||
|
||||
.nav_right_action {
|
||||
margin-right: 36rpx;
|
||||
}
|
||||
.nav_right_action {
|
||||
margin-right: 36rpx;
|
||||
}
|
||||
|
||||
.content_row {
|
||||
margin-top: 96rpx;
|
||||
margin: 72rpx 44rpx 0;
|
||||
.content_row {
|
||||
margin-top: 96rpx;
|
||||
margin: 72rpx 44rpx 0;
|
||||
|
||||
.u-input {
|
||||
background-color: #e8eaef;
|
||||
}
|
||||
.u-input {
|
||||
background-color: #e8eaef;
|
||||
}
|
||||
|
||||
.u-button {
|
||||
height: 60rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.u-button {
|
||||
height: 60rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<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"
|
||||
<my-avatar :desc="sourceUserInfo.remark || sourceUserInfo.nickname" :src="sourceUserInfo.faceURL || sourceUserInfo.avatar"
|
||||
size="46" />
|
||||
<view class="user_name">
|
||||
<text class="text">{{ getShowName }}</text>
|
||||
|
||||
+112
-144
@@ -1,156 +1,124 @@
|
||||
<template>
|
||||
<view class="user_more_container">
|
||||
<custom-nav-bar title="好友设置" />
|
||||
<view class="user_more_container">
|
||||
<custom-nav-bar title="好友设置" />
|
||||
|
||||
<view class="info_row">
|
||||
<user-info-row-item @click="toMark" lable="设置备注" arrow />
|
||||
<user-info-row-item @click="toMore" lable="个人资料" arrow />
|
||||
</view>
|
||||
<view class="info_row">
|
||||
<user-info-row-item @click="toMark" lable="设置备注" arrow />
|
||||
<user-info-row-item @click="toMore" lable="个人资料" arrow />
|
||||
</view>
|
||||
|
||||
<view class="info_row">
|
||||
<user-info-row-item lable="加入黑名单" arrow>
|
||||
<u-switch
|
||||
asyncChange
|
||||
:loading="blackLoading"
|
||||
size="20"
|
||||
:value="isBlacked"
|
||||
@change="change"
|
||||
></u-switch>
|
||||
</user-info-row-item>
|
||||
</view>
|
||||
<view class="info_row">
|
||||
<user-info-row-item lable="加入黑名单" arrow>
|
||||
<u-switch asyncChange :loading="blackLoading" size="20" :value="isBlacked" @change="change"></u-switch>
|
||||
</user-info-row-item>
|
||||
</view>
|
||||
|
||||
<view v-if="isFriend" class="info_row">
|
||||
<u-button
|
||||
@click="() => (showConfirm = true)"
|
||||
type="error"
|
||||
plain
|
||||
text="解除好友关系"
|
||||
></u-button>
|
||||
</view>
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
<u-modal
|
||||
:content="`确定要解除与${sourceInfo.nickname}的好友关系吗?`"
|
||||
asyncClose
|
||||
:show="showConfirm"
|
||||
showCancelButton
|
||||
@confirm="confirmRemove"
|
||||
@cancel="() => (showConfirm = false)"
|
||||
></u-modal>
|
||||
</view>
|
||||
<view v-if="isFriend" class="info_row">
|
||||
<u-button @click="() => (showConfirm = true)" type="error" plain text="解除好友关系"></u-button>
|
||||
</view>
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
<u-modal :content="`确定要解除与${sourceInfo.nickname}的好友关系吗?`" asyncClose :show="showConfirm" showCancelButton
|
||||
@confirm="confirmRemove" @cancel="() => (showConfirm = false)"></u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import UserInfoRowItem from "../userCard/components/UserInfoRowItem.vue";
|
||||
import { ContactChooseTypes } from "@/constant";
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
UserInfoRowItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
blackLoading: false,
|
||||
sourceInfo: {},
|
||||
showConfirm: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isFriend() {
|
||||
return (
|
||||
this.$store.getters.storeFriendList.findIndex(
|
||||
(friend) => friend.userID === this.sourceInfo.userID,
|
||||
) !== -1
|
||||
);
|
||||
},
|
||||
isBlacked() {
|
||||
return (
|
||||
this.$store.getters.storeBlackList.findIndex(
|
||||
(black) => black.userID === this.sourceInfo.userID,
|
||||
) !== -1
|
||||
);
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
const { sourceInfo } = options;
|
||||
this.sourceInfo = JSON.parse(sourceInfo);
|
||||
},
|
||||
methods: {
|
||||
change(isBlack) {
|
||||
this.blackLoading = true;
|
||||
if (isBlack) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.AddBlack, IMSDK.uuid(), {
|
||||
toUserID: this.sourceInfo.userID,
|
||||
ex: "",
|
||||
})
|
||||
.catch(() => this.showToast("操作失败"))
|
||||
.finally(() => (this.blackLoading = false));
|
||||
return;
|
||||
}
|
||||
IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.RemoveBlack,
|
||||
IMSDK.uuid(),
|
||||
this.sourceInfo.userID
|
||||
)
|
||||
.catch(() => this.showToast("操作失败"))
|
||||
.finally(() => (this.blackLoading = false));
|
||||
},
|
||||
confirmRemove() {
|
||||
IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.DeleteFriend,
|
||||
IMSDK.uuid(),
|
||||
this.sourceInfo.userID,
|
||||
)
|
||||
.then(() => this.showToast("操作成功"))
|
||||
.catch(() => this.showToast("操作失败"))
|
||||
.finally(() => (this.showConfirm = false));
|
||||
},
|
||||
toMore() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/detailsFileds/index?sourceInfo=${JSON.stringify(
|
||||
this.sourceInfo,
|
||||
)}`,
|
||||
});
|
||||
},
|
||||
toMark() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/markOrIDPage/index?isRemark=true&sourceInfo=${JSON.stringify(
|
||||
this.sourceInfo,
|
||||
)}`,
|
||||
});
|
||||
},
|
||||
toShare() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/contactChoose/index?type=${
|
||||
ContactChooseTypes.ShareCard
|
||||
}&cardInfo=${JSON.stringify(this.sourceInfo)}`,
|
||||
});
|
||||
},
|
||||
showToast(message) {
|
||||
this.$refs.uToast.show({
|
||||
message,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import UserInfoRowItem from "../userCard/components/UserInfoRowItem.vue";
|
||||
import {
|
||||
ContactChooseTypes
|
||||
} from "@/constant";
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
UserInfoRowItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
blackLoading: false,
|
||||
sourceInfo: {},
|
||||
showConfirm: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isFriend() {
|
||||
return (
|
||||
this.$store.getters.storeFriendList.findIndex(
|
||||
(friend) => friend.userID === this.sourceInfo.userID,
|
||||
) !== -1
|
||||
);
|
||||
},
|
||||
isBlacked() {
|
||||
return (
|
||||
this.$store.getters.storeBlackList.findIndex(
|
||||
(black) => black.userID === this.sourceInfo.userID,
|
||||
) !== -1
|
||||
);
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
const {sourceInfo} = options;
|
||||
this.sourceInfo = JSON.parse(sourceInfo);
|
||||
},
|
||||
methods: {
|
||||
change(isBlack) {
|
||||
this.blackLoading = true;
|
||||
if (isBlack) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.AddBlack, IMSDK.uuid(), {toUserID: this.sourceInfo.userID,ex: "",})
|
||||
.catch(() => this.showToast("操作失败"))
|
||||
.finally(() => (this.blackLoading = false));
|
||||
return;
|
||||
}
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.RemoveBlack,IMSDK.uuid(),this.sourceInfo.userID)
|
||||
.catch(() => this.showToast("操作失败"))
|
||||
.finally(() => (this.blackLoading = false));
|
||||
},
|
||||
confirmRemove() {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.DeleteFriend,IMSDK.uuid(),this.sourceInfo.userID,)
|
||||
.then(() => this.showToast("操作成功"))
|
||||
.catch(() => this.showToast("操作失败"))
|
||||
.finally(() => (this.showConfirm = false));
|
||||
},
|
||||
toMore() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/detailsFileds/index?sourceInfo=${JSON.stringify(this.sourceInfo,)}`,
|
||||
});
|
||||
},
|
||||
toMark() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/markOrIDPage/index?isRemark=true&sourceInfo=${JSON.stringify(this.sourceInfo,)}`,
|
||||
});
|
||||
},
|
||||
toShare() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/contactChoose/index?type=${ContactChooseTypes.ShareCard}&cardInfo=${JSON.stringify(this.sourceInfo)}`,
|
||||
});
|
||||
},
|
||||
showToast(message) {
|
||||
this.$refs.uToast.show({
|
||||
message,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.user_more_container {
|
||||
@include colBox(false);
|
||||
height: 100vh;
|
||||
background-color: #f6f6f6;
|
||||
.user_more_container {
|
||||
@include colBox(false);
|
||||
height: 100vh;
|
||||
background-color: #f6f6f6;
|
||||
|
||||
.info_row {
|
||||
background-color: #fff;
|
||||
margin: 24rpx;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
.info_row {
|
||||
background-color: #fff;
|
||||
margin: 24rpx;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
|
||||
.u-button {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.u-button {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user