4
This commit is contained in:
@@ -1,80 +1,112 @@
|
||||
<template>
|
||||
<view class="chat_action_bar">
|
||||
<u-row class="action_row">
|
||||
<u-col
|
||||
v-for="item in actionList"
|
||||
:key="item.idx"
|
||||
@click="actionClick(item)"
|
||||
span="3"
|
||||
>
|
||||
<view class="action_item">
|
||||
<image :src="item.icon" alt="" srcset="" />
|
||||
<text class="action_item_title">{{ item.title }}</text>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
<view class="chat_action_bar">
|
||||
<u-row class="action_row">
|
||||
<u-col v-for="item in actionList" :key="item.idx" @click="actionClick(item)" span="3">
|
||||
<view class="action_item">
|
||||
<image :src="item.icon" alt="" srcset="" />
|
||||
<text class="action_item_title">{{ item.title }}</text>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
ChatingFooterActionTypes,
|
||||
} from "@/constant";
|
||||
import {ChatingFooterActionTypes,} from "@/constant";
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
actionList: [
|
||||
{
|
||||
idx: 0,
|
||||
type: ChatingFooterActionTypes.Album,
|
||||
title: "相册",
|
||||
icon: require("static/images/chating_action_image.png"),
|
||||
}
|
||||
],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async actionClick(action) {
|
||||
switch (action.type) {
|
||||
case ChatingFooterActionTypes.Album:
|
||||
this.$emit("prepareMediaMessage", action.type);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
actionList: [
|
||||
{
|
||||
idx: 0,
|
||||
type: ChatingFooterActionTypes.Album,
|
||||
title: "照片",
|
||||
icon: require("static/images/chating_action_image.png"),
|
||||
},
|
||||
{
|
||||
idx: 1,
|
||||
type: ChatingFooterActionTypes.Camera,
|
||||
title: "拍摄",
|
||||
icon: require("static/images/chating_action_image.png"),
|
||||
},
|
||||
{
|
||||
idx: 2,
|
||||
type: ChatingFooterActionTypes.Video,
|
||||
title: "视频通话",
|
||||
icon: require("static/images/chating_action_image.png"),
|
||||
},
|
||||
{
|
||||
idx: 3,
|
||||
type: ChatingFooterActionTypes.Location,
|
||||
title: "位置",
|
||||
icon: require("static/images/chating_action_image.png"),
|
||||
},
|
||||
// {
|
||||
// idx: 0,
|
||||
// type: ChatingFooterActionTypes.Album,
|
||||
// title: "红包",
|
||||
// icon: require("static/images/chating_action_image.png"),
|
||||
// },
|
||||
// {
|
||||
// idx: 0,
|
||||
// type: ChatingFooterActionTypes.Album,
|
||||
// title: "转账",
|
||||
// icon: require("static/images/chating_action_image.png"),
|
||||
// }
|
||||
],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async actionClick(action) {
|
||||
switch (action.type) {
|
||||
case ChatingFooterActionTypes.Video:
|
||||
this.$emit("prepareMediaMessage", action.type);
|
||||
break;
|
||||
case ChatingFooterActionTypes.Album:
|
||||
this.$emit("prepareMediaMessage", action.type);
|
||||
break;
|
||||
case ChatingFooterActionTypes.Camera:
|
||||
this.$emit("prepareMediaMessage", action.type);
|
||||
break;
|
||||
case ChatingFooterActionTypes.Location:
|
||||
this.$emit("prepareMediaMessage", action.type);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.chat_action_bar {
|
||||
position: relative;
|
||||
background: #f0f2f6;
|
||||
padding: 24rpx 36rpx;
|
||||
.chat_action_bar {
|
||||
position: relative;
|
||||
background: #f0f2f6;
|
||||
padding: 24rpx 36rpx;
|
||||
|
||||
.action_row {
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
.action_row {
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.action_item {
|
||||
@include centerBox();
|
||||
flex-direction: column;
|
||||
margin-top: 24rpx;
|
||||
.action_item {
|
||||
@include centerBox();
|
||||
flex-direction: column;
|
||||
margin-top: 24rpx;
|
||||
|
||||
image {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
}
|
||||
image {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
}
|
||||
|
||||
&_title {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
&_title {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -25,40 +25,26 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapGetters,
|
||||
mapActions
|
||||
} from "vuex";
|
||||
import {
|
||||
getPurePath,
|
||||
html2Text
|
||||
} from "@/util/common";
|
||||
import {
|
||||
offlinePushInfo
|
||||
} from "@/util/imCommon";
|
||||
import {
|
||||
ChatingFooterActionTypes,
|
||||
UpdateMessageTypes,
|
||||
} from "@/constant";
|
||||
import IMSDK, {
|
||||
IMMethods,
|
||||
MessageStatus,
|
||||
MessageType,
|
||||
} from "openim-uniapp-polyfill";
|
||||
import {mapGetters,mapActions} from "vuex";
|
||||
import {getPurePath,html2Text} from "@/util/common";
|
||||
import {offlinePushInfo} from "@/util/imCommon";
|
||||
import {ChatingFooterActionTypes,UpdateMessageTypes,} from "@/constant";
|
||||
import IMSDK, {IMMethods,MessageStatus,MessageType,} from "openim-uniapp-polyfill";
|
||||
import UParse from "@/components/gaoyia-parse/parse.vue";
|
||||
import CustomEditor from "./CustomEditor.vue";
|
||||
import ChatingActionBar from "./ChatingActionBar.vue";
|
||||
|
||||
const needClearTypes = [MessageType.TextMessage];
|
||||
|
||||
const albumChoose = [{
|
||||
name: "图片",
|
||||
type: ChatingFooterActionTypes.Album,
|
||||
const rtcChoose = [
|
||||
{
|
||||
name: "视频通话",
|
||||
type: ChatingFooterActionTypes.Video,
|
||||
idx: 0,
|
||||
},
|
||||
{
|
||||
name: "拍照",
|
||||
type: ChatingFooterActionTypes.Camera,
|
||||
name: "语言通话",
|
||||
type: ChatingFooterActionTypes.Voice,
|
||||
idx: 1,
|
||||
},
|
||||
];
|
||||
@@ -133,23 +119,19 @@
|
||||
message,
|
||||
offlinePushInfo,
|
||||
})
|
||||
.then(({
|
||||
data
|
||||
}) => {
|
||||
.then(({data}) => {
|
||||
this.updateOneMessage({
|
||||
message: data,
|
||||
isSuccess: true,
|
||||
});
|
||||
})
|
||||
.catch(({
|
||||
data,
|
||||
errCode,
|
||||
errMsg
|
||||
}) => {
|
||||
.catch(({data,errCode,errMsg}) => {
|
||||
uni.$u.toast(errMsg);
|
||||
this.updateOneMessage({
|
||||
message: data,
|
||||
type: UpdateMessageTypes.KeyWords,
|
||||
keyWords: [{
|
||||
keyWords: [
|
||||
{
|
||||
key: "status",
|
||||
value: MessageStatus.Failed,
|
||||
},
|
||||
@@ -186,14 +168,62 @@
|
||||
this.inputHtml = e.detail.html;
|
||||
},
|
||||
prepareMediaMessage(type) {
|
||||
if (type === ChatingFooterActionTypes.Album) {
|
||||
this.actionSheetMenu = [...albumChoose];
|
||||
console.log(type)
|
||||
if (type === ChatingFooterActionTypes.Video) {
|
||||
this.actionSheetMenu = [...rtcChoose];
|
||||
this.showActionSheet = true;
|
||||
}
|
||||
if (type === ChatingFooterActionTypes.Album) {
|
||||
this.chooseOrShotImage(["album"]).then((paths) =>
|
||||
this.batchCreateImageMesage(paths)
|
||||
);
|
||||
}
|
||||
if (type === ChatingFooterActionTypes.Camera) {
|
||||
this.chooseOrShotImage(["camera"]).then((paths) =>
|
||||
this.batchCreateImageMesage(paths)
|
||||
);
|
||||
}
|
||||
if (type === ChatingFooterActionTypes.Location) {
|
||||
uni.chooseLocation({
|
||||
complete(res) {
|
||||
console.log(res);
|
||||
},
|
||||
fail(res) {
|
||||
console.log(res);
|
||||
}
|
||||
//latitude:1,
|
||||
//longitude:1,
|
||||
})
|
||||
}
|
||||
this.showActionSheet = true;
|
||||
},
|
||||
|
||||
// from comp
|
||||
batchCreateImageMesage(paths) {
|
||||
/*
|
||||
createAdvancedTextMessage
|
||||
createTextAtMessage
|
||||
createLocationMessage
|
||||
createTextMessage
|
||||
createCustomMessage
|
||||
createQuoteMessage
|
||||
createAdvancedQuoteMessage
|
||||
createCardMessage
|
||||
createImageMessage
|
||||
createImageMessage
|
||||
createImageMessageByURL
|
||||
createSoundMessage
|
||||
createSoundMessageFromFullPath
|
||||
createSoundMessageByURL
|
||||
createVideoMessage
|
||||
createVideoMessageFromFullPath
|
||||
createVideoMessageByURL
|
||||
createFileMessage
|
||||
createFileMessageFromFullPath
|
||||
createFileMessageByURL
|
||||
createMergerMessage
|
||||
createFaceMessage
|
||||
createForwardMessage
|
||||
*/
|
||||
paths.forEach(async (path) => {
|
||||
const message = await IMSDK.asyncApi(
|
||||
IMMethods.CreateImageMessageFromFullPath,
|
||||
@@ -203,17 +233,19 @@
|
||||
this.sendMessage(message);
|
||||
});
|
||||
},
|
||||
selectClick({
|
||||
idx
|
||||
}) {
|
||||
selectClick({idx}) {
|
||||
if (idx === 0) {
|
||||
this.chooseOrShotImage(["album"]).then((paths) =>
|
||||
this.batchCreateImageMesage(paths)
|
||||
);
|
||||
uni.$u.toast('根据相关政策,暂时禁用视频通话');
|
||||
//发送视频通话
|
||||
// this.chooseOrShotImage(["album"]).then((paths) =>
|
||||
// this.batchCreateImageMesage(paths)
|
||||
// );
|
||||
} else {
|
||||
this.chooseOrShotImage(["camera"]).then((paths) =>
|
||||
this.batchCreateImageMesage(paths)
|
||||
);
|
||||
uni.$u.toast('根据相关政策,暂时禁用音频通话');
|
||||
//发送音频通话
|
||||
// this.chooseOrShotImage(["camera"]).then((paths) =>
|
||||
// this.batchCreateImageMesage(paths)
|
||||
// );
|
||||
}
|
||||
},
|
||||
chooseOrShotImage(sourceType) {
|
||||
@@ -222,9 +254,7 @@
|
||||
count: 9,
|
||||
sizeType: ["compressed"],
|
||||
sourceType,
|
||||
success: function({
|
||||
tempFilePaths
|
||||
}) {
|
||||
success: function({tempFilePaths}) {
|
||||
resolve(tempFilePaths);
|
||||
},
|
||||
fail: function(err) {
|
||||
@@ -236,9 +266,7 @@
|
||||
},
|
||||
|
||||
// keyboard
|
||||
keyboardChangeHander({
|
||||
height
|
||||
}) {
|
||||
keyboardChangeHander({height}) {
|
||||
if (height > 0) {
|
||||
if (this.actionBarVisible) {
|
||||
this.actionBarVisible = false;
|
||||
|
||||
@@ -1,329 +1,301 @@
|
||||
<template>
|
||||
<view class="chat_header">
|
||||
<view class="self_info">
|
||||
<my-avatar
|
||||
:src="storeSelfInfo.faceURL"
|
||||
:desc="storeSelfInfo.nickname"
|
||||
size="46"
|
||||
/>
|
||||
<view class="self_info_desc">
|
||||
<view class="user_state">
|
||||
<text class="nickname">{{ storeSelfInfo.nickname }}</text>
|
||||
<view v-if="!storeReinstall">
|
||||
<view class="tag" v-if="storeIsSyncing">
|
||||
<img
|
||||
class="loading"
|
||||
style="height: 24rpx; width: 24rpx"
|
||||
src="static/images/loading.png"
|
||||
alt=""
|
||||
/>
|
||||
<text class="status">同步中</text>
|
||||
</view>
|
||||
<view class="tag" v-if="connectStart == 0">
|
||||
<img
|
||||
class="loading"
|
||||
style="height: 24rpx; width: 24rpx"
|
||||
src="static/images/loading.png"
|
||||
alt=""
|
||||
/>
|
||||
<text class="status">连接中</text>
|
||||
</view>
|
||||
<view class="err-tag" v-if="connectStart == -1">
|
||||
<img
|
||||
style="height: 24rpx; width: 24rpx"
|
||||
src="static/images/sync_error.png"
|
||||
alt=""
|
||||
/>
|
||||
<text class="status">连接失败</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right_action">
|
||||
<view class="call_icon"> </view>
|
||||
<view @click="showMore" class="more_icon">
|
||||
<image src="@/static/images/common_circle_add.png"></image>
|
||||
</view>
|
||||
<u-overlay
|
||||
:show="moreMenuVisible"
|
||||
@click="moreMenuVisible = false"
|
||||
opacity="0"
|
||||
>
|
||||
<view
|
||||
:style="{ top: popMenuPosition.top, right: popMenuPosition.right }"
|
||||
class="more_menu"
|
||||
>
|
||||
<view
|
||||
@click="clickMenu(item)"
|
||||
v-for="item in moreMenus"
|
||||
:key="item.idx"
|
||||
class="menu_item"
|
||||
>
|
||||
<image :src="item.icon" mode=""></image>
|
||||
<text>{{ item.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</u-overlay>
|
||||
</view>
|
||||
</view>
|
||||
<view class="chat_header">
|
||||
<view class="self_info">
|
||||
<my-avatar :src="storeSelfInfo.faceURL" :desc="storeSelfInfo.nickname" size="46" />
|
||||
<view class="self_info_desc">
|
||||
<view class="user_state">
|
||||
<text class="nickname">{{ storeSelfInfo.nickname }}</text>
|
||||
<view v-if="!storeReinstall">
|
||||
<view class="tag" v-if="storeIsSyncing">
|
||||
<img class="loading" style="height: 24rpx; width: 24rpx" src="static/images/loading.png"
|
||||
alt="" />
|
||||
<text class="status">同步中</text>
|
||||
</view>
|
||||
<view class="tag" v-if="connectStart == 0">
|
||||
<img class="loading" style="height: 24rpx; width: 24rpx" src="static/images/loading.png"
|
||||
alt="" />
|
||||
<text class="status">连接中</text>
|
||||
</view>
|
||||
<view class="err-tag" v-if="connectStart == -1">
|
||||
<img style="height: 24rpx; width: 24rpx" src="static/images/sync_error.png" alt="" />
|
||||
<text class="status">连接失败</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right_action">
|
||||
<view class="call_icon"> </view>
|
||||
<view @click="showMore" class="more_icon">
|
||||
<image src="@/static/images/common_circle_add.png"></image>
|
||||
</view>
|
||||
<u-overlay :show="moreMenuVisible" @click="moreMenuVisible = false" opacity="0">
|
||||
<view :style="{ top: popMenuPosition.top, right: popMenuPosition.right }" class="more_menu">
|
||||
<view @click="clickMenu(item)" v-for="item in moreMenus" :key="item.idx" class="menu_item">
|
||||
<image :src="item.icon" mode=""></image>
|
||||
<text>{{ item.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</u-overlay>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
export default {
|
||||
name: "ChatHeader",
|
||||
components: {
|
||||
MyAvatar,
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
connectStart: -2,
|
||||
moreMenuVisible: false,
|
||||
popMenuPosition: {
|
||||
top: 0,
|
||||
right: 0,
|
||||
},
|
||||
moreMenus: [
|
||||
{
|
||||
idx: 1,
|
||||
title: "添加好友",
|
||||
icon: require("static/images/more_add_friend.png"),
|
||||
},
|
||||
{
|
||||
idx: 2,
|
||||
title: "添加群聊",
|
||||
icon: require("static/images/more_add_group.png"),
|
||||
},
|
||||
{
|
||||
idx: 3,
|
||||
title: "创建群聊",
|
||||
icon: require("static/images/more_create_group.png"),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["storeSelfInfo", "storeIsSyncing", "storeReinstall"]),
|
||||
},
|
||||
mounted() {
|
||||
this.subscribeAll();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.unsubscribeAll();
|
||||
},
|
||||
methods: {
|
||||
setStateStart() {
|
||||
this.connectStart = 0;
|
||||
},
|
||||
setStateSuccess() {
|
||||
this.connectStart = 1;
|
||||
},
|
||||
setStateError() {
|
||||
this.connectStart = -1;
|
||||
},
|
||||
subscribeAll() {
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnConnecting, this.setStateStart);
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnConnectSuccess, this.setStateSuccess);
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnConnectFailed, this.setStateError);
|
||||
},
|
||||
unsubscribeAll() {
|
||||
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnecting, this.setStateStart);
|
||||
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnectSuccess, this.setStateSuccess);
|
||||
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnectFailed, this.setStateError);
|
||||
},
|
||||
clickMenu({ idx }) {
|
||||
switch (idx) {
|
||||
case 1:
|
||||
case 2:
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/searchUserOrGroup/index?isSearchGroup=${
|
||||
idx === 2
|
||||
}`,
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/createGroup/index`,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
async showMore() {
|
||||
const { right, bottom } = await this.getEl(".more_icon");
|
||||
this.popMenuPosition.right =
|
||||
uni.getWindowInfo().windowWidth - right + "px";
|
||||
this.popMenuPosition.top = bottom + "px";
|
||||
this.moreMenuVisible = true;
|
||||
},
|
||||
getEl(el) {
|
||||
return new Promise((resolve) => {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query
|
||||
.select(el)
|
||||
.boundingClientRect((data) => {
|
||||
// 存在data,且存在宽和高,视为渲染完毕
|
||||
resolve(data);
|
||||
})
|
||||
.exec();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
export default {
|
||||
name: "ChatHeader",
|
||||
components: {
|
||||
MyAvatar,
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
connectStart: -2,
|
||||
moreMenuVisible: false,
|
||||
popMenuPosition: {
|
||||
top: 0,
|
||||
right: 0,
|
||||
},
|
||||
moreMenus: [{
|
||||
idx: 1,
|
||||
title: "添加好友",
|
||||
icon: require("static/images/more_add_friend.png"),
|
||||
},
|
||||
{
|
||||
idx: 2,
|
||||
title: "添加群聊",
|
||||
icon: require("static/images/more_add_group.png"),
|
||||
},
|
||||
{
|
||||
idx: 3,
|
||||
title: "创建群聊",
|
||||
icon: require("static/images/more_create_group.png"),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["storeSelfInfo", "storeIsSyncing", "storeReinstall"]),
|
||||
},
|
||||
mounted() {
|
||||
this.subscribeAll();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.unsubscribeAll();
|
||||
},
|
||||
methods: {
|
||||
setStateStart() {
|
||||
this.connectStart = 0;
|
||||
},
|
||||
setStateSuccess() {
|
||||
this.connectStart = 1;
|
||||
},
|
||||
setStateError() {
|
||||
this.connectStart = -1;
|
||||
},
|
||||
subscribeAll() {
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnConnecting, this.setStateStart);
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnConnectSuccess, this.setStateSuccess);
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnConnectFailed, this.setStateError);
|
||||
},
|
||||
unsubscribeAll() {
|
||||
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnecting, this.setStateStart);
|
||||
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnectSuccess, this.setStateSuccess);
|
||||
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnectFailed, this.setStateError);
|
||||
},
|
||||
clickMenu({idx}) {
|
||||
switch (idx) {
|
||||
case 1:
|
||||
case 2:
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/searchUserOrGroup/index?isSearchGroup=${idx === 2}`,
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/createGroup/index`,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
async showMore() {
|
||||
const {right,bottom} = await this.getEl(".more_icon");
|
||||
this.popMenuPosition.right =
|
||||
uni.getWindowInfo().windowWidth - right + "px";
|
||||
this.popMenuPosition.top = bottom + "px";
|
||||
this.moreMenuVisible = true;
|
||||
},
|
||||
getEl(el) {
|
||||
return new Promise((resolve) => {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query
|
||||
.select(el)
|
||||
.boundingClientRect((data) => {
|
||||
// 存在data,且存在宽和高,视为渲染完毕
|
||||
resolve(data);
|
||||
})
|
||||
.exec();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@keyframes loading {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
@keyframes loading {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.chat_header {
|
||||
@include btwBox();
|
||||
padding: 36rpx 44rpx;
|
||||
margin-top: var(--status-bar-height);
|
||||
.chat_header {
|
||||
@include btwBox();
|
||||
padding: 36rpx 44rpx;
|
||||
margin-top: var(--status-bar-height);
|
||||
|
||||
.self_info {
|
||||
@include btwBox();
|
||||
.self_info {
|
||||
@include btwBox();
|
||||
|
||||
&_desc {
|
||||
@include colBox(true);
|
||||
margin-left: 24rpx;
|
||||
color: $uni-text-color;
|
||||
&_desc {
|
||||
@include colBox(true);
|
||||
margin-left: 24rpx;
|
||||
color: $uni-text-color;
|
||||
|
||||
.company {
|
||||
@include nomalEllipsis();
|
||||
font-size: 24rpx;
|
||||
margin-bottom: 10rpx;
|
||||
max-width: 300rpx;
|
||||
}
|
||||
.company {
|
||||
@include nomalEllipsis();
|
||||
font-size: 24rpx;
|
||||
margin-bottom: 10rpx;
|
||||
max-width: 300rpx;
|
||||
}
|
||||
|
||||
.user_state {
|
||||
@include vCenterBox();
|
||||
.user_state {
|
||||
@include vCenterBox();
|
||||
|
||||
.nickname {
|
||||
@include nomalEllipsis();
|
||||
font-size: 26rpx;
|
||||
max-width: 240rpx;
|
||||
}
|
||||
.nickname {
|
||||
@include nomalEllipsis();
|
||||
font-size: 26rpx;
|
||||
max-width: 240rpx;
|
||||
}
|
||||
|
||||
.err-tag {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 152rpx;
|
||||
height: 44rpx;
|
||||
background: #ffe1dd;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
margin-left: 8rpx;
|
||||
.status {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
font-weight: 400;
|
||||
color: #ff381f;
|
||||
}
|
||||
}
|
||||
.err-tag {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 152rpx;
|
||||
height: 44rpx;
|
||||
background: #ffe1dd;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
margin-left: 8rpx;
|
||||
|
||||
.tag {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 152rpx;
|
||||
height: 44rpx;
|
||||
background: #f2f8ff;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
margin-left: 8rpx;
|
||||
.status {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
font-weight: 400;
|
||||
color: #ff381f;
|
||||
}
|
||||
}
|
||||
|
||||
.loading {
|
||||
animation: loading 1.5s infinite;
|
||||
}
|
||||
.tag {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 152rpx;
|
||||
height: 44rpx;
|
||||
background: #f2f8ff;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
margin-left: 8rpx;
|
||||
|
||||
.status {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
font-weight: 400;
|
||||
color: #0089ff;
|
||||
}
|
||||
}
|
||||
.loading {
|
||||
animation: loading 1.5s infinite;
|
||||
}
|
||||
|
||||
.online_state {
|
||||
@include vCenterBox();
|
||||
margin-left: 24rpx;
|
||||
font-size: 24rpx;
|
||||
.status {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
font-weight: 400;
|
||||
color: #0089ff;
|
||||
}
|
||||
}
|
||||
|
||||
.dot {
|
||||
background-color: #10cc64;
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.online_state {
|
||||
@include vCenterBox();
|
||||
margin-left: 24rpx;
|
||||
font-size: 24rpx;
|
||||
|
||||
.right_action {
|
||||
display: flex;
|
||||
position: relative;
|
||||
.dot {
|
||||
background-color: #10cc64;
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.call_icon {
|
||||
margin-right: 24rpx;
|
||||
.right_action {
|
||||
display: flex;
|
||||
position: relative;
|
||||
|
||||
image {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
}
|
||||
.call_icon {
|
||||
margin-right: 24rpx;
|
||||
|
||||
.more_icon {
|
||||
image {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
}
|
||||
image {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.more_menu {
|
||||
position: absolute;
|
||||
// bottom: 0;
|
||||
// left: 100%;
|
||||
z-index: 999;
|
||||
// transform: translate(-100%, 100%);
|
||||
box-shadow: 0px 0px 6px 2px rgba(0, 0, 0, 0.16);
|
||||
width: max-content;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fff;
|
||||
.more_icon {
|
||||
image {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.menu_item {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
padding: 20rpx 24rpx;
|
||||
font-size: 28rpx;
|
||||
color: $uni-text-color;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
.more_menu {
|
||||
position: absolute;
|
||||
// bottom: 0;
|
||||
// left: 100%;
|
||||
z-index: 999;
|
||||
// transform: translate(-100%, 100%);
|
||||
box-shadow: 0px 0px 6px 2px rgba(0, 0, 0, 0.16);
|
||||
width: max-content;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fff;
|
||||
|
||||
image {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
.menu_item {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
padding: 20rpx 24rpx;
|
||||
font-size: 28rpx;
|
||||
color: $uni-text-color;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
|
||||
&:last-child {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
image {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,34 +1,31 @@
|
||||
<template>
|
||||
<view @tap.prevent="clickConversationItem" class="conversation_item">
|
||||
<view class="pinned" v-if="source.isPinned"></view>
|
||||
<view @tap.prevent="clickConversationItem" :class="['conversation_item',source.isPinned?'pinned' : '']">
|
||||
<view class="left_info">
|
||||
<my-avatar :isGroup="isGroup" :isNotify="isNotify" :src="source.faceURL" :desc="source.showName"
|
||||
size="46" />
|
||||
<view class="details">
|
||||
<text class="conversation_name">{{ source.showName }}</text>
|
||||
<view class="title">
|
||||
<text class="conversation_name">
|
||||
{{ source.showName }}
|
||||
</text>
|
||||
<view class="right_desc">
|
||||
<text class="send_time">{{ latestMessageTime }}</text>
|
||||
<u-badge max="99" :value="source.unreadCount"></u-badge>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lastest_msg_wrap">
|
||||
<text class="lastest_msg_content">{{ latestMessage }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right_desc">
|
||||
<text class="send_time">{{ latestMessageTime }}</text>
|
||||
<u-badge max="99" :value="source.unreadCount"></u-badge>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
SessionType,
|
||||
} from "openim-uniapp-polyfill";
|
||||
import {SessionType,} from "openim-uniapp-polyfill";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import UParse from "@/components/gaoyia-parse/parse.vue";
|
||||
import {
|
||||
getConversationContent,
|
||||
formatConversionTime,
|
||||
prepareConversationState,
|
||||
} from "@/util/imCommon";
|
||||
import {getConversationContent,formatConversionTime,prepareConversationState,} from "@/util/imCommon";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -81,6 +78,9 @@
|
||||
flex-direction: row;
|
||||
padding: 12rpx 44rpx 20rpx;
|
||||
position: relative;
|
||||
&.pinned{
|
||||
background-color: #ededed;
|
||||
}
|
||||
|
||||
&_active {
|
||||
background-color: #f3f3f3;
|
||||
@@ -88,17 +88,41 @@
|
||||
|
||||
.left_info {
|
||||
@include btwBox();
|
||||
flex:1;
|
||||
|
||||
.details {
|
||||
@include colBox(true);
|
||||
flex:1;
|
||||
margin-left: 24rpx;
|
||||
height: 46px;
|
||||
color: $uni-text-color;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom:20rpx;
|
||||
.title{
|
||||
@include btwBox();
|
||||
.conversation_name {
|
||||
@include nomalEllipsis();
|
||||
max-width: 40vw;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.conversation_name {
|
||||
@include nomalEllipsis();
|
||||
max-width: 40vw;
|
||||
font-size: 28rpx;
|
||||
.right_desc {
|
||||
@include colBox(true);
|
||||
align-items: flex-end;
|
||||
width: max-content;
|
||||
justify-content: space-between;
|
||||
|
||||
.send_time {
|
||||
width: max-content;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.u-badge {
|
||||
width: fit-content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.lastest_msg_wrap {
|
||||
@@ -125,32 +149,5 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right_desc {
|
||||
@include colBox(true);
|
||||
align-items: flex-end;
|
||||
width: max-content;
|
||||
justify-content: space-between;
|
||||
height: 46px;
|
||||
|
||||
.send_time {
|
||||
width: max-content;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.u-badge {
|
||||
width: fit-content;
|
||||
}
|
||||
}
|
||||
|
||||
.pinned {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 24rpx;
|
||||
width: 17rpx;
|
||||
height: 17rpx;
|
||||
background-image: linear-gradient(to bottom left, #314ffe 50%, white 50%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user