消息
This commit is contained in:
160
unpackage/dist/dev/mp-weixin/TUIKit/components/TUIConversation/actions-menu/index.js
vendored
Normal file
160
unpackage/dist/dev/mp-weixin/TUIKit/components/TUIConversation/actions-menu/index.js
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
require("../../../adapter-vue.js");
|
||||
const TUIKit_constant = require("../../../constant.js");
|
||||
const TUIKit_utils_env = require("../../../utils/env.js");
|
||||
if (!Math) {
|
||||
(Dialog + Overlay)();
|
||||
}
|
||||
const Overlay = () => "../../common/Overlay/index.js";
|
||||
const Dialog = () => "../../common/Dialog/index.js";
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
__name: "index",
|
||||
props: {
|
||||
actionsMenuPosition: {},
|
||||
selectedConversation: {},
|
||||
selectedConversationDomRect: {}
|
||||
},
|
||||
emits: ["closeConversationActionMenu"],
|
||||
setup(__props, { emit: __emit }) {
|
||||
var _a, _b;
|
||||
const emits = __emit;
|
||||
const props = __props;
|
||||
const thisInstance = ((_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.proxy) || common_vendor.getCurrentInstance();
|
||||
const actionsMenuDomRef = common_vendor.ref();
|
||||
const isHiddenActionsMenu = common_vendor.ref(true);
|
||||
const isShowDeleteConversationDialog = common_vendor.ref(false);
|
||||
const currentConversation = common_vendor.Jt.getConversationModel(
|
||||
((_b = props.selectedConversation) == null ? void 0 : _b.conversationID) || ""
|
||||
);
|
||||
const _actionsMenuPosition = common_vendor.ref(props.actionsMenuPosition);
|
||||
common_vendor.onMounted(() => {
|
||||
checkExceedBounds();
|
||||
});
|
||||
const deleteConversationDialogTitle = common_vendor.computed(() => {
|
||||
var _a2, _b2;
|
||||
return ((_a2 = props.selectedConversation) == null ? void 0 : _a2.type) === common_vendor.qt.TYPES.CONV_C2C ? "TUIConversation.删除后,将清空该聊天的消息记录" : ((_b2 = props.selectedConversation) == null ? void 0 : _b2.type) === common_vendor.qt.TYPES.CONV_GROUP ? "TUIConversation.删除后,将清空该群聊的消息记录" : "";
|
||||
});
|
||||
function checkExceedBounds() {
|
||||
common_vendor.nextTick$1(() => {
|
||||
var _a2, _b2;
|
||||
if (TUIKit_utils_env.isUniFrameWork) {
|
||||
const query = (_a2 = common_vendor.i) == null ? void 0 : _a2.createSelectorQuery().in(thisInstance);
|
||||
query.select(`#conversation-actions-menu`).boundingClientRect((data) => {
|
||||
var _a3, _b3;
|
||||
if (data) {
|
||||
if (data.bottom > ((_b3 = (_a3 = common_vendor.i) == null ? void 0 : _a3.getWindowInfo) == null ? void 0 : _b3.call(_a3).windowHeight)) {
|
||||
_actionsMenuPosition.value = {
|
||||
...props.actionsMenuPosition,
|
||||
top: props.actionsMenuPosition.top - (props.actionsMenuPosition.conversationHeight || 0) - data.height
|
||||
};
|
||||
}
|
||||
if (_actionsMenuPosition.value.left + data.width + 5 > common_vendor.i.getWindowInfo().windowWidth) {
|
||||
_actionsMenuPosition.value.left = common_vendor.i.getWindowInfo().windowWidth - data.width - 5;
|
||||
}
|
||||
}
|
||||
isHiddenActionsMenu.value = false;
|
||||
}).exec();
|
||||
} else {
|
||||
const rect = (_b2 = actionsMenuDomRef.value) == null ? void 0 : _b2.getBoundingClientRect();
|
||||
if (TUIKit_utils_env.isPC && typeof props.actionsMenuPosition.left !== "undefined") {
|
||||
_actionsMenuPosition.value.left = props.actionsMenuPosition.left;
|
||||
}
|
||||
if (rect && rect.bottom > window.innerHeight) {
|
||||
_actionsMenuPosition.value.top = props.actionsMenuPosition.top - (props.actionsMenuPosition.conversationHeight || 0) - rect.height;
|
||||
}
|
||||
isHiddenActionsMenu.value = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
const handleItem = (params) => {
|
||||
const { name } = params;
|
||||
const conversationModel = currentConversation;
|
||||
if (!name || !conversationModel || !conversationModel.conversationID) {
|
||||
return;
|
||||
}
|
||||
switch (name) {
|
||||
case TUIKit_constant.CONV_OPERATION.DELETE:
|
||||
conversationModel == null ? void 0 : conversationModel.deleteConversation();
|
||||
break;
|
||||
case TUIKit_constant.CONV_OPERATION.ISPINNED:
|
||||
conversationModel == null ? void 0 : conversationModel.pinConversation();
|
||||
break;
|
||||
case TUIKit_constant.CONV_OPERATION.DISPINNED:
|
||||
conversationModel == null ? void 0 : conversationModel.pinConversation();
|
||||
break;
|
||||
case TUIKit_constant.CONV_OPERATION.MUTE:
|
||||
conversationModel == null ? void 0 : conversationModel.muteConversation();
|
||||
break;
|
||||
case TUIKit_constant.CONV_OPERATION.NOTMUTE:
|
||||
conversationModel == null ? void 0 : conversationModel.muteConversation();
|
||||
break;
|
||||
}
|
||||
emits("closeConversationActionMenu");
|
||||
};
|
||||
const deleteConversation = () => {
|
||||
isShowDeleteConversationDialog.value = true;
|
||||
};
|
||||
const updateShowDeleteConversationDialog = (isShow) => {
|
||||
if (!isShow) {
|
||||
emits("closeConversationActionMenu");
|
||||
}
|
||||
isShowDeleteConversationDialog.value = isShow;
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUIConversation.删除会话")),
|
||||
b: common_vendor.o$1(($event) => deleteConversation()),
|
||||
c: !(props.selectedConversation && props.selectedConversation.isPinned)
|
||||
}, !(props.selectedConversation && props.selectedConversation.isPinned) ? {
|
||||
d: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUIConversation.置顶会话")),
|
||||
e: common_vendor.o$1(($event) => handleItem({
|
||||
name: common_vendor.unref(TUIKit_constant.CONV_OPERATION).ISPINNED
|
||||
}))
|
||||
} : {}, {
|
||||
f: props.selectedConversation && props.selectedConversation.isPinned
|
||||
}, props.selectedConversation && props.selectedConversation.isPinned ? {
|
||||
g: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUIConversation.取消置顶")),
|
||||
h: common_vendor.o$1(($event) => handleItem({
|
||||
name: common_vendor.unref(TUIKit_constant.CONV_OPERATION).DISPINNED
|
||||
}))
|
||||
} : {}, {
|
||||
i: !(props.selectedConversation && props.selectedConversation.isMuted)
|
||||
}, !(props.selectedConversation && props.selectedConversation.isMuted) ? {
|
||||
j: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUIConversation.消息免打扰")),
|
||||
k: common_vendor.o$1(($event) => handleItem({
|
||||
name: common_vendor.unref(TUIKit_constant.CONV_OPERATION).MUTE
|
||||
}))
|
||||
} : {}, {
|
||||
l: props.selectedConversation && props.selectedConversation.isMuted
|
||||
}, props.selectedConversation && props.selectedConversation.isMuted ? {
|
||||
m: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUIConversation.取消免打扰")),
|
||||
n: common_vendor.o$1(($event) => handleItem({
|
||||
name: common_vendor.unref(TUIKit_constant.CONV_OPERATION).NOTMUTE
|
||||
}))
|
||||
} : {}, {
|
||||
o: common_vendor.n(common_vendor.unref(TUIKit_utils_env.isPC) && "actions-menu-pc"),
|
||||
p: common_vendor.n(!common_vendor.unref(isHiddenActionsMenu) && "cancel-hidden"),
|
||||
q: `${common_vendor.unref(_actionsMenuPosition).top}px`,
|
||||
r: `${common_vendor.unref(_actionsMenuPosition).left}px`,
|
||||
s: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(common_vendor.unref(deleteConversationDialogTitle))),
|
||||
t: common_vendor.o$1(($event) => handleItem({
|
||||
name: common_vendor.unref(TUIKit_constant.CONV_OPERATION).DELETE
|
||||
})),
|
||||
v: common_vendor.o$1(updateShowDeleteConversationDialog),
|
||||
w: common_vendor.p({
|
||||
show: common_vendor.unref(isShowDeleteConversationDialog),
|
||||
center: true,
|
||||
isHeaderShow: common_vendor.unref(TUIKit_utils_env.isPC)
|
||||
}),
|
||||
x: common_vendor.o$1(() => emits("closeConversationActionMenu")),
|
||||
y: common_vendor.p({
|
||||
maskColor: "transparent"
|
||||
})
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-63e37304"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIConversation/actions-menu/index.js.map
|
||||
7
unpackage/dist/dev/mp-weixin/TUIKit/components/TUIConversation/actions-menu/index.json
vendored
Normal file
7
unpackage/dist/dev/mp-weixin/TUIKit/components/TUIConversation/actions-menu/index.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"overlay": "../../common/Overlay/index",
|
||||
"dialog": "../../common/Dialog/index"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/TUIKit/components/TUIConversation/actions-menu/index.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/TUIKit/components/TUIConversation/actions-menu/index.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<overlay wx:if="{{y}}" class="data-v-63e37304" u-s="{{['d']}}" bindonOverlayClick="{{x}}" u-i="63e37304-0" bind:__l="__l" u-p="{{y}}"><view id="conversation-actions-menu" ref="actionsMenuDomRef" class="{{['data-v-63e37304', o, 'actions-menu', p]}}" style="{{'top:' + q + ';' + ('left:' + r)}}"><view class="{{['data-v-63e37304', 'actions-menu-item']}}" catchtap="{{b}}">{{a}}</view><view wx:if="{{c}}" class="{{['data-v-63e37304', 'actions-menu-item']}}" catchtap="{{e}}">{{d}}</view><view wx:if="{{f}}" class="{{['data-v-63e37304', 'actions-menu-item']}}" catchtap="{{h}}">{{g}}</view><view wx:if="{{i}}" class="{{['data-v-63e37304', 'actions-menu-item']}}" catchtap="{{k}}">{{j}}</view><view wx:if="{{l}}" class="{{['data-v-63e37304', 'actions-menu-item']}}" catchtap="{{n}}">{{m}}</view></view><dialog wx:if="{{w}}" class="data-v-63e37304" u-s="{{['d']}}" bindsubmit="{{t}}" bindupdateShow="{{v}}" u-i="63e37304-1,63e37304-0" bind:__l="__l" u-p="{{w}}"><view class="delDialog-title data-v-63e37304">{{s}}</view></dialog></overlay>
|
||||
47
unpackage/dist/dev/mp-weixin/TUIKit/components/TUIConversation/actions-menu/index.wxss
vendored
Normal file
47
unpackage/dist/dev/mp-weixin/TUIKit/components/TUIConversation/actions-menu/index.wxss
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.cancel-hidden.data-v-63e37304 {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
.actions-menu.data-v-63e37304 {
|
||||
position: absolute;
|
||||
left: 164px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e0e0e0;
|
||||
box-shadow: 0 -4px 12px 0 rgba(0, 0, 0, 0.06);
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
opacity: 0;
|
||||
}
|
||||
.actions-menu .actions-menu-item.data-v-63e37304 {
|
||||
cursor: pointer;
|
||||
padding: 10px 20px;
|
||||
font-size: 12px;
|
||||
word-break: keep-all;
|
||||
}
|
||||
.actions-menu.actions-menu-pc .actions-menu-item.data-v-63e37304:hover {
|
||||
background-color: #eee;
|
||||
}
|
||||
Reference in New Issue
Block a user