消息
This commit is contained in:
131
unpackage/dist/dev/mp-weixin/TUIKit/components/TUIChat/message-input-toolbar/video-upload/index.js
vendored
Normal file
131
unpackage/dist/dev/mp-weixin/TUIKit/components/TUIChat/message-input-toolbar/video-upload/index.js
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../../common/vendor.js");
|
||||
require("../../../../adapter-vue.js");
|
||||
const TUIKit_utils_env = require("../../../../utils/env.js");
|
||||
const common_assets = require("../../../../../common/assets.js");
|
||||
const TUIKit_components_TUIChat_utils_utils = require("../../utils/utils.js");
|
||||
const TUIKit_components_TUIChat_offlinePushInfoManager_index = require("../../offlinePushInfoManager/index.js");
|
||||
const TUIKit_components_TUIChat_config = require("../../config.js");
|
||||
if (!Math) {
|
||||
ToolbarItemContainer();
|
||||
}
|
||||
const ToolbarItemContainer = () => "../toolbar-item-container/index.js";
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
__name: "index",
|
||||
props: {
|
||||
// Video source, only valid for uni-app version, web version only supports selecting videos from files
|
||||
// album: Select from files
|
||||
// camera: Take a video using the camera
|
||||
videoSourceType: {
|
||||
type: String,
|
||||
default: "album"
|
||||
}
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const inputRef = common_vendor.ref();
|
||||
const currentConversation = common_vendor.ref();
|
||||
common_vendor.Jt.watch(common_vendor.o.CONV, {
|
||||
currentConversation: (conversation) => {
|
||||
currentConversation.value = conversation;
|
||||
}
|
||||
});
|
||||
const handleIcon = () => {
|
||||
if (TUIKit_utils_env.isUniFrameWork) {
|
||||
switch (props.videoSourceType) {
|
||||
case "album":
|
||||
return common_assets.videoUniIcon;
|
||||
case "camera":
|
||||
return common_assets.cameraUniIcon;
|
||||
default:
|
||||
return common_assets.videoUniIcon;
|
||||
}
|
||||
} else {
|
||||
const videoIcon = TUIKit_components_TUIChat_config.ChatConfig.getTheme() === "dark" ? common_assets.videoIconDark : common_assets.videoIconLight;
|
||||
return videoIcon;
|
||||
}
|
||||
};
|
||||
const handleTitle = () => {
|
||||
if (TUIKit_utils_env.isUniFrameWork && props.videoSourceType === "camera") {
|
||||
return "录制";
|
||||
} else {
|
||||
return "视频";
|
||||
}
|
||||
};
|
||||
const onIconClick = () => {
|
||||
var _a, _b, _c, _d, _e;
|
||||
if (TUIKit_utils_env.isUniFrameWork) {
|
||||
if (TUIKit_utils_env.isWeChat && ((_a = common_vendor.i) == null ? void 0 : _a.chooseMedia)) {
|
||||
(_b = common_vendor.i) == null ? void 0 : _b.chooseMedia({
|
||||
mediaType: ["video"],
|
||||
count: 1,
|
||||
sourceType: [props.videoSourceType],
|
||||
maxDuration: 60,
|
||||
success: function(res) {
|
||||
sendVideoMessage(res);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
(_c = common_vendor.i) == null ? void 0 : _c.chooseVideo({
|
||||
count: 1,
|
||||
sourceType: [props.videoSourceType],
|
||||
compressed: false,
|
||||
success: function(res) {
|
||||
sendVideoMessage(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
((_d = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _d.click) && ((_e = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _e.click());
|
||||
}
|
||||
};
|
||||
const sendVideoInWeb = (e) => {
|
||||
var _a, _b;
|
||||
if (((_b = (_a = e == null ? void 0 : e.target) == null ? void 0 : _a.files) == null ? void 0 : _b.length) <= 0) {
|
||||
return;
|
||||
}
|
||||
sendVideoMessage(e == null ? void 0 : e.target);
|
||||
e.target.value = "";
|
||||
};
|
||||
const sendVideoMessage = (file) => {
|
||||
var _a, _b, _c, _d, _e;
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
const options = {
|
||||
to: ((_b = (_a = currentConversation == null ? void 0 : currentConversation.value) == null ? void 0 : _a.groupProfile) == null ? void 0 : _b.groupID) || ((_d = (_c = currentConversation == null ? void 0 : currentConversation.value) == null ? void 0 : _c.userProfile) == null ? void 0 : _d.userID),
|
||||
conversationType: (_e = currentConversation == null ? void 0 : currentConversation.value) == null ? void 0 : _e.type,
|
||||
payload: {
|
||||
file
|
||||
},
|
||||
needReadReceipt: TUIKit_components_TUIChat_utils_utils.isEnabledMessageReadReceiptGlobal()
|
||||
};
|
||||
const offlinePushInfoCreateParams = {
|
||||
conversation: currentConversation.value,
|
||||
payload: options.payload,
|
||||
messageType: common_vendor.qt.TYPES.MSG_VIDEO
|
||||
};
|
||||
const sendMessageOptions = {
|
||||
offlinePushInfo: TUIKit_components_TUIChat_offlinePushInfoManager_index.OfflinePushInfoManager.create(offlinePushInfoCreateParams)
|
||||
};
|
||||
common_vendor.Qt.sendVideoMessage(options, sendMessageOptions);
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.o$1(sendVideoInWeb),
|
||||
b: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "video-upload-h5"),
|
||||
c: common_vendor.o$1(onIconClick),
|
||||
d: common_vendor.p({
|
||||
iconFile: handleIcon(),
|
||||
title: handleTitle(),
|
||||
needDialog: false,
|
||||
iconWidth: common_vendor.unref(TUIKit_utils_env.isUniFrameWork) ? "32px" : "20px",
|
||||
iconHeight: common_vendor.unref(TUIKit_utils_env.isUniFrameWork) ? props.videoSourceType === "album" ? "20px" : "25px" : "18px"
|
||||
})
|
||||
};
|
||||
};
|
||||
}
|
||||
});
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-11a33e36"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIChat/message-input-toolbar/video-upload/index.js.map
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"toolbar-item-container": "../toolbar-item-container/index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<toolbar-item-container wx:if="{{d}}" class="data-v-11a33e36" u-s="{{['d']}}" bindonIconClick="{{c}}" u-i="11a33e36-0" bind:__l="__l" u-p="{{d}}"><view class="{{['data-v-11a33e36', 'video-upload', b]}}"><input class="data-v-11a33e36" ref="inputRef" title="视频" type="file" data-type="video" accept="video/*" bindchange="{{a}}"></input></view></toolbar-item-container>
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
body.data-v-11a33e36, div.data-v-11a33e36, ul.data-v-11a33e36, ol.data-v-11a33e36, dt.data-v-11a33e36, dd.data-v-11a33e36, li.data-v-11a33e36, dl.data-v-11a33e36, h1.data-v-11a33e36, h2.data-v-11a33e36, h3.data-v-11a33e36, h4.data-v-11a33e36, p.data-v-11a33e36 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-style: normal;
|
||||
/* font:12px/22px"\5B8B\4F53",Arial,Helvetica,sans-serif; */
|
||||
}
|
||||
ol.data-v-11a33e36, ul.data-v-11a33e36, li.data-v-11a33e36 {
|
||||
list-style: none;
|
||||
}
|
||||
img.data-v-11a33e36 {
|
||||
border: 0;
|
||||
vertical-align: middle;
|
||||
pointer-events: none;
|
||||
}
|
||||
body.data-v-11a33e36 {
|
||||
color: #000;
|
||||
background: #FFF;
|
||||
}
|
||||
.clear.data-v-11a33e36 {
|
||||
clear: both;
|
||||
height: 1px;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
margin-top: -1px;
|
||||
}
|
||||
a.data-v-11a33e36 {
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
a.data-v-11a33e36:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
input.data-v-11a33e36, textarea.data-v-11a33e36 {
|
||||
-webkit-user-select: auto;
|
||||
user-select: auto;
|
||||
}
|
||||
input.data-v-11a33e36:focus, input.data-v-11a33e36:active, textarea.data-v-11a33e36:focus, textarea.data-v-11a33e36:active {
|
||||
outline: none;
|
||||
}
|
||||
.chat-aside.data-v-11a33e36 {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
right: 0;
|
||||
box-sizing: border-box;
|
||||
width: 360px !important;
|
||||
border-radius: 8px 0 0 8px;
|
||||
z-index: 9999;
|
||||
max-height: calc(100% - 50px);
|
||||
}
|
||||
Reference in New Issue
Block a user