Files
tk-mini-program/unpackage/dist/dev/mp-weixin/TUIKit/components/TUIGroup/manage-group/manage-profile.js

114 lines
4.8 KiB
JavaScript
Raw Normal View History

2025-06-11 22:16:44 +08:00
"use strict";
const common_vendor = require("../../../../common/vendor.js");
require("../../../adapter-vue.js");
const TUIKit_utils_env = require("../../../utils/env.js");
if (!Math) {
Avatar();
}
const Avatar = () => "../../common/Avatar/index.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "manage-profile",
props: {
userInfo: {
type: Object,
default: () => ({})
}
},
emits: [
"handleSwitchConversation",
"close",
"openConversation"
],
setup(__props, { emit: __emit }) {
const props = __props;
const isFriendShip = common_vendor.ref(false);
const userInfoManager = common_vendor.ref({});
common_vendor.watchEffect(() => {
userInfoManager.value = props.userInfo;
});
const emits = __emit;
common_vendor.watch(
() => props.userInfo,
async (newVal, oldVal) => {
if (newVal === oldVal)
return;
const res = await common_vendor.Zt.getUserProfile({
userIDList: [props.userInfo.userID]
});
userInfoManager.value = res == null ? void 0 : res.data[0];
checkFriend();
},
{
deep: true,
immediate: true
}
);
const enter = async (ID, type) => {
const name = `${type}${ID}`;
common_vendor.Xt.getConversationProfile(name).then((res) => {
common_vendor.Xt.switchConversation(res.data.conversation.conversationID).then(() => {
var _a;
common_vendor.Jt.update(common_vendor.o.GRP, "isShowManageComponent", false);
if (TUIKit_utils_env.isUniFrameWork) {
(_a = common_vendor.i) == null ? void 0 : _a.navigateBack();
}
});
}).catch((err) => {
common_vendor.index.__f__("warn", "at TUIKit/components/TUIGroup/manage-group/manage-profile.vue:147", "获取会话资料失败", err.code, err.msg);
});
};
const checkFriend = async () => {
if (!userInfoManager.value.userID)
return;
common_vendor.ts.checkFriend({
userIDList: [userInfoManager.value.userID],
type: common_vendor.qt.TYPES.SNS_CHECK_TYPE_BOTH
}).then((res) => {
var _a, _b, _c;
const relation = (_c = (_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.successUserIDList) == null ? void 0 : _b[0]) == null ? void 0 : _c.relation;
isFriendShip.value = relation === common_vendor.qt.TYPES.SNS_TYPE_BOTH_WAY;
});
};
const showEnter = () => {
return isFriendShip.value || !common_vendor.Jt.getData(common_vendor.o.APP, "isOfficial");
};
const close = (tabName) => {
emits("close", tabName);
};
return (_ctx, _cache) => {
return common_vendor.e({
a: !common_vendor.unref(TUIKit_utils_env.isUniFrameWork)
}, !common_vendor.unref(TUIKit_utils_env.isUniFrameWork) ? common_vendor.e({
b: common_vendor.unref(userInfoManager).avatar || "https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_21.png",
c: common_vendor.t(common_vendor.unref(userInfoManager).nick || common_vendor.unref(userInfoManager).userID),
d: common_vendor.t(common_vendor.unref(userInfoManager).userID),
e: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUIContact.个性签名")),
f: common_vendor.t(common_vendor.unref(userInfoManager).selfSignature),
g: showEnter()
}, showEnter() ? {
h: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUIContact.发送消息")),
i: common_vendor.o$1(($event) => enter(common_vendor.unref(userInfoManager).userID, "C2C"))
} : {}) : common_vendor.e({
j: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.群成员`)),
k: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`关闭`)),
l: common_vendor.o$1(($event) => close("profile")),
m: common_vendor.p({
url: common_vendor.unref(userInfoManager).avatar,
size: "60px"
}),
n: common_vendor.t(common_vendor.unref(userInfoManager).nick || common_vendor.unref(userInfoManager).userID),
o: common_vendor.t(common_vendor.unref(userInfoManager).userID),
p: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUIContact.个性签名")),
q: common_vendor.t(common_vendor.unref(userInfoManager).selfSignature),
r: showEnter()
}, showEnter() ? {
s: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUIContact.发送消息")),
t: common_vendor.o$1(($event) => enter(common_vendor.unref(userInfoManager).userID, "C2C"))
} : {}));
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c655282f"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIGroup/manage-group/manage-profile.js.map