Files
tk-mini-program/unpackage/dist/dev/mp-weixin/TUIKit/plugins/plugin-components/message-call/message-call-c2c.js

96 lines
3.9 KiB
JavaScript
Raw Normal View History

2025-05-13 19:39:53 +08:00
"use strict";
const common_vendor = require("../../../../common/vendor.js");
require("../../../adapter-vue.js");
const TUIKit_utils_typeCheck = require("../../../utils/type-check.js");
const common_assets = require("../../../../common/assets.js");
const TUIKit_components_TUIChat_offlinePushInfoManager_index = require("../../../components/TUIChat/offlinePushInfoManager/index.js");
const TUIKit_components_TUIChat_offlinePushInfoManager_const = require("../../../components/TUIChat/offlinePushInfoManager/const.js");
if (!Math) {
Icon();
}
const Icon = () => "../../../components/common/Icon.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "message-call-c2c",
props: {
message: {
type: Object,
default: () => ({})
},
signalingInfo: {
type: Object,
default: () => ({})
},
customContent: {
type: Object,
default: () => ({})
}
},
setup(__props) {
const props = __props;
const TYPES = common_vendor.ref(common_vendor.qt.TYPES);
const isCallMessage = common_vendor.computed(() => props.signalingInfo != null);
const callInfo = common_vendor.computed(() => {
var _a, _b;
const callType = (_b = TUIKit_utils_typeCheck.JSONToObject((_a = props.signalingInfo) == null ? void 0 : _a.data)) == null ? void 0 : _b.call_type;
switch (callType) {
case 1:
return {
type: 1,
icon: common_assets.callVoiceSVG
};
case 2:
return {
type: 2,
icon: common_assets.callVideoSVG
};
}
return {
type: 0,
icon: ""
};
});
const conversationType = common_vendor.computed(() => {
var _a;
return (_a = props.message) == null ? void 0 : _a.conversationType;
});
const custom = common_vendor.computed(() => {
var _a;
return (_a = props.customContent) == null ? void 0 : _a.custom;
});
const callAgain = () => {
var _a, _b, _c, _d;
if (conversationType.value === common_vendor.qt.TYPES.CONV_C2C) {
const userID = ((_a = props.message) == null ? void 0 : _a.flow) === "out" ? (_b = props.message) == null ? void 0 : _b.to : (_c = props.message) == null ? void 0 : _c.from;
common_vendor.R.callService({
serviceName: common_vendor.E.TUICalling.SERVICE.NAME,
method: common_vendor.E.TUICalling.SERVICE.METHOD.START_CALL,
params: {
userIDList: [userID],
type: (_d = callInfo == null ? void 0 : callInfo.value) == null ? void 0 : _d.type,
callParams: {
offlinePushInfo: TUIKit_components_TUIChat_offlinePushInfoManager_index.OfflinePushInfoManager.getOfflinePushInfo(TUIKit_components_TUIChat_offlinePushInfoManager_const.PUSH_SCENE.CALL)
}
}
});
}
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.unref(isCallMessage) && common_vendor.unref(conversationType) === common_vendor.unref(TYPES).CONV_C2C
}, common_vendor.unref(isCallMessage) && common_vendor.unref(conversationType) === common_vendor.unref(TYPES).CONV_C2C ? {
b: common_vendor.p({
file: common_vendor.unref(callInfo).icon
}),
c: common_vendor.n(__props.message.flow === "out" && common_vendor.unref(callInfo).type === 2 && "icon-reverse"),
d: common_vendor.t(common_vendor.unref(custom)),
e: common_vendor.n("call-" + common_vendor.unref(conversationType)),
f: common_vendor.n(__props.message.flow === "out" && "call-reverse"),
g: common_vendor.o$1(callAgain)
} : {});
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6d96978f"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/plugins/plugin-components/message-call/message-call-c2c.js.map