cyl/master-apply
parent
0ea2edd1b8
commit
3912e7a63f
File diff suppressed because it is too large
Load Diff
@ -1,88 +0,0 @@
|
|||||||
<template>
|
|
||||||
<span
|
|
||||||
class="appellation"
|
|
||||||
:style="{ color: color, fontSize: fontSize + 'px' }"
|
|
||||||
>
|
|
||||||
{{ appellation }}
|
|
||||||
<span v-if="subtitle" style="color: orange;font-size:13px">{{ subtitle }}</span>
|
|
||||||
</span
|
|
||||||
>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { autorun } from 'mobx'
|
|
||||||
import {
|
|
||||||
onUnmounted,
|
|
||||||
ref,
|
|
||||||
defineProps,
|
|
||||||
withDefaults,
|
|
||||||
} from '../utils/transformVue'
|
|
||||||
|
|
||||||
import { deepClone } from '../utils'
|
|
||||||
|
|
||||||
const appellation = ref('-')
|
|
||||||
const appType = ref(uni.getStorageSync("requestComeFrom"));
|
|
||||||
|
|
||||||
const { pid,account, teamId, ignoreAlias, nickFromMsg } = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
account: string
|
|
||||||
teamId?: string
|
|
||||||
ignoreAlias?: boolean
|
|
||||||
nickFromMsg?: string
|
|
||||||
color?: string
|
|
||||||
fontSize?: number
|
|
||||||
pid?: number
|
|
||||||
}>(),
|
|
||||||
{
|
|
||||||
teamId: undefined,
|
|
||||||
ignoreAlias: false,
|
|
||||||
nickFromMsg: '-',
|
|
||||||
color: '#333',
|
|
||||||
fontSize: 16,
|
|
||||||
pid:0
|
|
||||||
}
|
|
||||||
)
|
|
||||||
const subtitle = ref('');
|
|
||||||
const uninstallAppellationWatch = autorun(() => {
|
|
||||||
if(pid){
|
|
||||||
async function getUserInfo() {
|
|
||||||
try {
|
|
||||||
const res = await uni.$UIKitStore.userStore.getUserActive(pid.split('|')[2])
|
|
||||||
return res
|
|
||||||
} catch (error) {
|
|
||||||
console.error('getUserInfo error:', error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getUserInfo().then(res => {
|
|
||||||
if(res.serverExtension && appType.value == 'isToB'){
|
|
||||||
subtitle.value = '@' + JSON.parse(res.serverExtension).fullName;
|
|
||||||
}else{
|
|
||||||
subtitle.value = '';
|
|
||||||
}
|
|
||||||
appellation.value = res.name;
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
appellation.value = deepClone(
|
|
||||||
uni.$UIKitStore.uiStore.getAppellation({
|
|
||||||
account,
|
|
||||||
teamId,
|
|
||||||
ignoreAlias,
|
|
||||||
nickFromMsg,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
onUnmounted(() => {
|
|
||||||
uninstallAppellationWatch()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.appellation {
|
|
||||||
color: #333;
|
|
||||||
font-size: 16px;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<div class="dot" v-if="dot" :style="customStyle"></div>
|
|
||||||
<div class="badge" v-else-if="text" :style="customStyle">{{ text }}</div>
|
|
||||||
<div class="hidden">{{ props.num }}</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import {
|
|
||||||
StyleValue,
|
|
||||||
computed,
|
|
||||||
defineProps,
|
|
||||||
withDefaults,
|
|
||||||
} from '../utils/transformVue'
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
num: number
|
|
||||||
max?: number
|
|
||||||
dot?: boolean
|
|
||||||
customStyle?: StyleValue
|
|
||||||
}>(),
|
|
||||||
{
|
|
||||||
max: 99,
|
|
||||||
dot: false,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
const max = props.max || 99
|
|
||||||
const text = computed(() => {
|
|
||||||
return props.num > 0 ? (props.num > max ? `${max}+` : props.num + '') : ''
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.dot {
|
|
||||||
background-color: #ff4d4f;
|
|
||||||
color: #fff;
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
z-index: 99;
|
|
||||||
}
|
|
||||||
|
|
||||||
.badge {
|
|
||||||
background-color: #ff4d4f;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 12px;
|
|
||||||
min-width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
line-height: 19px;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 0 5px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
text-align: center;
|
|
||||||
z-index: 99;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="empty-wrapper">
|
|
||||||
<image
|
|
||||||
class="empty-img"
|
|
||||||
src="https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/dailibaoming/noData.svg"
|
|
||||||
/>
|
|
||||||
<div class="empty-text">{{ text }}</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { defineProps, withDefaults } from '../utils/transformVue'
|
|
||||||
withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
text?: string
|
|
||||||
}>(),
|
|
||||||
{
|
|
||||||
text: '',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
</script>
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.empty-wrapper {
|
|
||||||
margin: 75px 10px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.empty-img {
|
|
||||||
display: block;
|
|
||||||
width: 66px;
|
|
||||||
height: 66px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-text {
|
|
||||||
display: block;
|
|
||||||
color: #a6adb6;
|
|
||||||
margin: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"messageText": "Message",
|
|
||||||
"cantactsText": "Cantact",
|
|
||||||
"mineText": "Me"
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"messageText": "消息",
|
|
||||||
"cantactsText": "通讯录",
|
|
||||||
"mineText": "我的"
|
|
||||||
}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
// zn.js
|
|
||||||
export default {
|
|
||||||
appText: '云信IM',
|
|
||||||
deleteStickTopText: '取消置顶',
|
|
||||||
contactText: '通讯录',
|
|
||||||
addFriendText: '添加好友',
|
|
||||||
addStickTopText: '置顶消息',
|
|
||||||
deleteSessionText: '不显示',
|
|
||||||
createTeamText: '创建群聊',
|
|
||||||
validMsgText: '验证消息',
|
|
||||||
blacklistText: '黑名单',
|
|
||||||
teamMenuText: '我的群组',
|
|
||||||
someoneText: '有人',
|
|
||||||
meText: '我',
|
|
||||||
recall: '撤回了一条消息',
|
|
||||||
conversationSendFailText: '[发送失败]',
|
|
||||||
conversationNotificationText: '[通知消息]',
|
|
||||||
noFriendText: '暂无好友',
|
|
||||||
}
|
|
||||||
@ -1,208 +0,0 @@
|
|||||||
<template>
|
|
||||||
<!-- :style="{ height: `calc(100vh - ${43 + tabbarHeight}px)` }" -->
|
|
||||||
<view class="g_bg_f_5">
|
|
||||||
<div style="height: 10px"></div>
|
|
||||||
<div class="g_bg_f_5" style="width: calc(100% - 40rpx); margin: 0px auto 10px">
|
|
||||||
<div class="">
|
|
||||||
<view style="background-color: #ededed; padding: 0 12px">
|
|
||||||
<u-search placeholder="请输入手机号" :show-action="false" bg-color="#fff" placeholder-class="g_c_c" :input-style="{ fontSize: '16px' }" height="80" search-icon-color="#999999" v-model="wxyx_tel" @search="handleSearch" @custom="handleCustom"></u-search>
|
|
||||||
</view>
|
|
||||||
</div>
|
|
||||||
<div class="g_flex_row_between g_pl_10 g_pr_10" v-if="receiverUserData && receiverUserData.userId" style="background-color: #fff; border-radius: 8px; padding: 12px 10px; margin-top: 10px">
|
|
||||||
<div class="g_flex_1">
|
|
||||||
<div style="font-size: 16px; font-weight: 600">
|
|
||||||
{{ receiverUserData.tel || "-" }}
|
|
||||||
</div>
|
|
||||||
<div style="color: #a1a1a1; font-size: 14px; margin-top: 8px">
|
|
||||||
{{ receiverUserData.userName || "-" }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="g_flex_none g_ml_12 g_flex_column_center">
|
|
||||||
<div>
|
|
||||||
<u-button :loading="isStart" type="primary" size="mini" @click="startChat">开始聊天</u-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="nei-box g_mt_10" style="background-color: #fff; border-radius: 8px" v-if="allUser && allUser.length > 0">
|
|
||||||
<!-- <div class="label-title" style="font-size: 16px; font-weight: 600; padding: 12px 16px; border-bottom: 1px solid #eee">内部通讯录</div> -->
|
|
||||||
<div v-for="(item, index) in allUser" :key="index" @click="startCopyChat(item)" class="g_flex_row_between g_pt_12 g_pb_12 g_pl_16 g_pr_16 border_bottom">
|
|
||||||
<div class="g_flex_1 g_flex_row_start g_fs_16">
|
|
||||||
<div class="g_flex_none g_mr_12">
|
|
||||||
<image :src="item.imgSrc || 'https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/1shoudan/defaultAva.svg'" style="width: 48px; height: 48px; border-radius: 50px"></image>
|
|
||||||
</div>
|
|
||||||
<div class="g_flex_1 g_flex_column_between">
|
|
||||||
<div class="g_c_3 g_fs_17" style="line-height: 24px">
|
|
||||||
{{ item.userName }}
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="g_c_3 g_fs_14 g_ell_1"
|
|
||||||
style="line-height: 20px"
|
|
||||||
:style="{
|
|
||||||
color: '#999',
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
{{ item.tel }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <div class="g_flex_1">
|
|
||||||
<div style="font-size: 16px; font-weight: 600">
|
|
||||||
{{ item.userName || "-" }}
|
|
||||||
</div>
|
|
||||||
<div style="color: #a1a1a1; font-size: 14px; margin-top: 8px">
|
|
||||||
{{ item.tel || "-" }}
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
<!-- <div class="g_flex_none g_ml_12 g_flex_column_center">
|
|
||||||
<div>
|
|
||||||
<u-button :loading="item.isStart" type="primary" size="mini" @click="startCopyChat(item)">开始聊天</u-button>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="height: 100rpx"></div>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { customRedirectTo, customReLaunch, customSwitchTab, customNavigateTo } from "../../utils/customNavigate";
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
allUser: [],
|
|
||||||
isStart: false,
|
|
||||||
isSend: false,
|
|
||||||
wxyx_tel: "",
|
|
||||||
receiverUserData: {},
|
|
||||||
tabbarHeight: uni.getStorageSync("TABBAR_HEIGHT"),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
let that = this;
|
|
||||||
that.getCopyUserList();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getCopyUserList() {
|
|
||||||
let that = this;
|
|
||||||
that.F.wyyxGet(that.api.wyyx_getCorpUserList, {}, (res) => {
|
|
||||||
console.log("获取通讯录:", res);
|
|
||||||
if (res && res.length > 0) {
|
|
||||||
res.forEach((item) => {
|
|
||||||
item.isStart = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
that.allUser = res;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleSearch(e) {
|
|
||||||
this.getUserList(e);
|
|
||||||
},
|
|
||||||
handleCustom(e) {
|
|
||||||
this.getUserList(e);
|
|
||||||
},
|
|
||||||
getUserList(e) {
|
|
||||||
let that = this;
|
|
||||||
that.F.wyyxGet(
|
|
||||||
this.api.wyyx_getCorpUserList,
|
|
||||||
{
|
|
||||||
key: e,
|
|
||||||
},
|
|
||||||
(res) => {
|
|
||||||
console.log("搜索手机号", res);
|
|
||||||
that.receiverUserData = res[0];
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
sendPointMessage() {
|
|
||||||
let that = this;
|
|
||||||
that.isSend = true;
|
|
||||||
|
|
||||||
that.F.wyyxPost(
|
|
||||||
that.api.wyyx_sendMessage,
|
|
||||||
{
|
|
||||||
conversationType: 1,
|
|
||||||
senderUserId: uni.getStorageSync("apply-uid"), // 发送者id 即当前登录用户id
|
|
||||||
receiverUserId: that.receiverUserData.userId, // 接收方用户id
|
|
||||||
text: "我是招呼语" + that.G.getPointTime(),
|
|
||||||
},
|
|
||||||
(res) => {
|
|
||||||
that.isSend = false;
|
|
||||||
that.receiverUserData = {};
|
|
||||||
that.goYunxin();
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
that.isSend = false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
async startCopyChat($item) {
|
|
||||||
let that = this;
|
|
||||||
$item.isStart = true;
|
|
||||||
that.F.wyyxPost(
|
|
||||||
that.api.wyyx_create,
|
|
||||||
{
|
|
||||||
senderUserId: uni.getStorageSync("apply-uid"),
|
|
||||||
receiverUserId: $item.userId,
|
|
||||||
},
|
|
||||||
(res) => {
|
|
||||||
$item.isStart = false;
|
|
||||||
uni.$UIKitStore.uiStore.selectConversation(res.conversationId);
|
|
||||||
customNavigateTo({
|
|
||||||
url: "/pages/Chat/index",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
$item.isStart = false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
async startChat() {
|
|
||||||
let that = this;
|
|
||||||
that.isStart = true;
|
|
||||||
that.F.wyyxPost(
|
|
||||||
that.api.wyyx_create,
|
|
||||||
{
|
|
||||||
senderUserId: uni.getStorageSync("apply-uid"),
|
|
||||||
receiverUserId: that.receiverUserData.userId,
|
|
||||||
},
|
|
||||||
(res) => {
|
|
||||||
that.isStart = false;
|
|
||||||
uni.$UIKitStore.uiStore.selectConversation(res.conversationId);
|
|
||||||
that.receiverUserData = {};
|
|
||||||
customNavigateTo({
|
|
||||||
url: "/pages/Chat/index",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
that.isStart = false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
goYunxin() {
|
|
||||||
customNavigateTo({
|
|
||||||
url: "/pages/Conversation/index",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less">
|
|
||||||
page {
|
|
||||||
background-color: #ededed;
|
|
||||||
}
|
|
||||||
.border_bottom {
|
|
||||||
position: relative;
|
|
||||||
&:not(:last-child):after {
|
|
||||||
content: "";
|
|
||||||
display: block;
|
|
||||||
height: 1rpx;
|
|
||||||
width: calc(100% - 80px);
|
|
||||||
background: #eee;
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,111 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="friend-list-container g_bg_f_5">
|
|
||||||
<div class="friend-group-list">
|
|
||||||
<Empty v-if="friendGroupList.length === 0" :text="t('noFriendText')" />
|
|
||||||
<div
|
|
||||||
class="friend-group-item"
|
|
||||||
v-for="friendGroup in friendGroupList"
|
|
||||||
:key="friendGroup.key"
|
|
||||||
>
|
|
||||||
<div class="friend-group-title">
|
|
||||||
{{ friendGroup.key }}
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="friend-item"
|
|
||||||
v-for="friend in friendGroup.data"
|
|
||||||
:key="friend.accountId"
|
|
||||||
@click="handleFriendItemClick(friend)"
|
|
||||||
>
|
|
||||||
<Avatar :account="friend.accountId" />
|
|
||||||
<div class="friend-name">{{ friend.appellation }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import Avatar from '../../../components/Avatar.vue'
|
|
||||||
import { autorun } from 'mobx'
|
|
||||||
import { onUnmounted, ref } from '../../../utils/transformVue'
|
|
||||||
import { friendGroupByPy } from '../../../utils/friend'
|
|
||||||
import { customNavigateTo } from '../../../utils/customNavigate'
|
|
||||||
import Empty from '../../../components/Empty.vue'
|
|
||||||
|
|
||||||
import { deepClone } from '../../../utils'
|
|
||||||
import { t } from '../../../utils/i18n'
|
|
||||||
import { V2NIMFriend } from 'nim-web-sdk-ng/dist/v2/NIM_UNIAPP_SDK/V2NIMFriendService'
|
|
||||||
|
|
||||||
type FriendItem = V2NIMFriend & { appellation: string }
|
|
||||||
|
|
||||||
const friendGroupList = ref<
|
|
||||||
{ key: string; data: { accountId: string; appellation: string }[] }[]
|
|
||||||
>([])
|
|
||||||
|
|
||||||
function handleFriendItemClick(friend: FriendItem) {
|
|
||||||
customNavigateTo({
|
|
||||||
url: `/pages/user-card/friend/index?account=${friend.accountId}`,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const uninstallFriendListWatch = autorun(() => {
|
|
||||||
const data = uni.$UIKitStore.uiStore.friends
|
|
||||||
.filter(
|
|
||||||
(item) =>
|
|
||||||
!uni.$UIKitStore.relationStore.blacklist.includes(item.accountId)
|
|
||||||
)
|
|
||||||
.map((item) => ({
|
|
||||||
accountId: item.accountId,
|
|
||||||
appellation: uni.$UIKitStore.uiStore.getAppellation({
|
|
||||||
account: item.accountId,
|
|
||||||
}),
|
|
||||||
}))
|
|
||||||
|
|
||||||
friendGroupList.value = deepClone(
|
|
||||||
friendGroupByPy(
|
|
||||||
data,
|
|
||||||
{
|
|
||||||
firstKey: 'appellation',
|
|
||||||
},
|
|
||||||
false
|
|
||||||
)
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
uninstallFriendListWatch()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
|
|
||||||
|
|
||||||
.friend-group-item {
|
|
||||||
padding-left: 20px;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.friend-group-title {
|
|
||||||
height: 40px;
|
|
||||||
line-height: 40px;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #b3b7bc;
|
|
||||||
border-bottom: 1rpx solid #dbe0e8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.friend-item {
|
|
||||||
// margin-top: 16px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 12px 0;
|
|
||||||
.friend-name {
|
|
||||||
margin-left: 12px;
|
|
||||||
padding-right: 20px;
|
|
||||||
color: #333333;
|
|
||||||
flex: 1;
|
|
||||||
overflow: hidden; //超出的文本隐藏
|
|
||||||
text-overflow: ellipsis; //溢出用省略号显示
|
|
||||||
white-space: nowrap; //溢出不换行
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,276 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="contact-list-container g_bg_f_5">
|
|
||||||
<!-- <div
|
|
||||||
class="dropdown-mark"
|
|
||||||
v-if="addDropdownVisible"
|
|
||||||
@touchstart="hideAddDropdown"
|
|
||||||
/> -->
|
|
||||||
<div class="navigation-bar">
|
|
||||||
<div class="logo-box" v-if="false">
|
|
||||||
<div>{{ t("contactText") }}</div>
|
|
||||||
</div>
|
|
||||||
<div :class="buttonClass" v-if="false">
|
|
||||||
<image src="https://yx-web-nosdn.netease.im/common/9ae07d276ba2833b678a4077960e2d1e/Group 1899.png" class="button-icon" @tap="showAddDropdown" style="width: 40px !important; height: 40px !important; border-radius: 50%" />
|
|
||||||
<div v-if="addDropdownVisible" class="dropdown-container">
|
|
||||||
<div class="add-menu-list">
|
|
||||||
<div class="add-menu-item" @tap="onDropdownClick('addFriend')">
|
|
||||||
<div :style="{ marginRight: '5px' }">
|
|
||||||
<Icon type="icon-tianjiahaoyou" />
|
|
||||||
</div>
|
|
||||||
{{ t("addFriendText") }}
|
|
||||||
</div>
|
|
||||||
<div class="add-menu-item" @tap="onDropdownClick('createGroup')" v-if="false">
|
|
||||||
<div :style="{ marginRight: '5px' }">
|
|
||||||
<Icon type="icon-chuangjianqunzu" />
|
|
||||||
</div>
|
|
||||||
{{ t("createTeamText") }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="contact-list">
|
|
||||||
<div class="contact-item-content g_bg_f_5">
|
|
||||||
<div class="contact-item" @click="onDropdownClick('addFriend')">
|
|
||||||
<img src="https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/bocaigongyinglian/add_friend.svg" alt="" style="width: 48px; height: 48px; vertical-align: middle" />
|
|
||||||
<!-- <Badge :num="unreadSysMsgCount" :style="{ position: 'absolute', top: '5px', left: '51px' }" /> -->
|
|
||||||
<span class="contact-item-title">添加好友</span>
|
|
||||||
<Icon iconClassName="more-icon" color="#999" type="icon-jiantou" />
|
|
||||||
</div>
|
|
||||||
<div class="contact-item" @click="handleValidMsgClick">
|
|
||||||
<Icon iconClassName="contact-item-icon contact-valid-icon" :size="48" type="icon-yanzheng" color="#fff" />
|
|
||||||
<Badge :num="unreadSysMsgCount" :style="{ position: 'absolute', top: '5px', left: '51px' }" />
|
|
||||||
<span class="contact-item-title"> {{ t("validMsgText") }}</span>
|
|
||||||
<Icon iconClassName="more-icon" color="#999" type="icon-jiantou" />
|
|
||||||
</div>
|
|
||||||
<div class="contact-item" @click="handleBlacklistClick">
|
|
||||||
<Icon iconClassName="contact-item-icon contact-blacklist-icon" :size="48" type="icon-lahei2" color="#fff" />
|
|
||||||
<span class="contact-item-title"> {{ t("blacklistText") }}</span>
|
|
||||||
<Icon iconClassName="more-icon" color="#999" type="icon-jiantou" />
|
|
||||||
</div>
|
|
||||||
<div class="contact-item" @click="onDropdownClick('innerAddress')" v-if="corpUserFlag && false">
|
|
||||||
<img src="https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/bocaigongyinglian/inner.svg" alt="" style="width: 48px; height: 48px; border-radius: 50%" />
|
|
||||||
<!-- <Badge :num="unreadSysMsgCount" :style="{ position: 'absolute', top: '5px', left: '51px' }" /> -->
|
|
||||||
<span class="contact-item-title">公司内部成员</span>
|
|
||||||
<Icon iconClassName="more-icon" color="#999" type="icon-jiantou" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <div class="contact-item" @click="handleGroupContactClick">
|
|
||||||
<Icon
|
|
||||||
iconClassName="contact-item-icon contact-group-icon"
|
|
||||||
:size="48"
|
|
||||||
type="icon-team2"
|
|
||||||
color="#fff"
|
|
||||||
/>
|
|
||||||
<span class="contact-item-title"> {{ t('teamMenuText') }}</span>
|
|
||||||
<Icon iconClassName="more-icon" color="#999" type="icon-jiantou" />
|
|
||||||
</div> -->
|
|
||||||
</div>
|
|
||||||
<FriendList />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import Icon from "../../../components/Icon.vue";
|
|
||||||
import Badge from "../../../components/Badge.vue";
|
|
||||||
import FriendList from "./friend-list.vue";
|
|
||||||
import { onUnmounted, ref } from "../../../utils/transformVue";
|
|
||||||
import { onHide } from "@dcloudio/uni-app";
|
|
||||||
import { customNavigateTo } from "../../../utils/customNavigate";
|
|
||||||
import { autorun } from "mobx";
|
|
||||||
import { t } from "../../../utils/i18n";
|
|
||||||
|
|
||||||
const addDropdownVisible = ref(false);
|
|
||||||
const unreadSysMsgCount = ref(0);
|
|
||||||
|
|
||||||
const uninstallUnreadWatch = autorun(() => {
|
|
||||||
unreadSysMsgCount.value = uni.$UIKitStore.sysMsgStore.getTotalUnreadMsgsCount();
|
|
||||||
});
|
|
||||||
const corpUserFlag = ref(uni.getStorageSync("apply-userinfo").corpUserFlag);
|
|
||||||
|
|
||||||
const onDropdownClick = (urlType: "addFriend" | "createGroup") => {
|
|
||||||
const urlMap = {
|
|
||||||
// 添加好友
|
|
||||||
addFriend: "/pages/Friend/add-friend/index",
|
|
||||||
// 创建群聊
|
|
||||||
createGroup: "/pages/Group/group-create/index",
|
|
||||||
// 内部通讯录
|
|
||||||
innerAddress: "/pages/Contact/BcFriend",
|
|
||||||
};
|
|
||||||
addDropdownVisible.value = false;
|
|
||||||
customNavigateTo({
|
|
||||||
url: urlMap[urlType],
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleValidMsgClick = () => {
|
|
||||||
uni.$UIKitStore.sysMsgStore.setAllApplyMsgRead();
|
|
||||||
customNavigateTo({
|
|
||||||
url: `/pages/Contact/contact-list/valid-list`,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleBlacklistClick = () => {
|
|
||||||
customNavigateTo({
|
|
||||||
url: `/pages/Contact/contact-list/black-list`,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleGroupContactClick = () => {
|
|
||||||
customNavigateTo({
|
|
||||||
url: `/pages/Contact/contact-list/group-list`,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const showAddDropdown = () => {
|
|
||||||
addDropdownVisible.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const hideAddDropdown = () => {
|
|
||||||
addDropdownVisible.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
let buttonClass = "button-box";
|
|
||||||
// #ifdef MP
|
|
||||||
buttonClass = "button-box-mp";
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
uninstallUnreadWatch();
|
|
||||||
});
|
|
||||||
|
|
||||||
onHide(() => {
|
|
||||||
addDropdownVisible.value = false;
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
|
|
||||||
|
|
||||||
page {
|
|
||||||
height: 100vh;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.contact-list-container {
|
|
||||||
height: 100vh;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navigation-bar {
|
|
||||||
// height: 60px;
|
|
||||||
// border-bottom: 1rpx solid #e9eff5;
|
|
||||||
padding: 0 20px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
// padding-top: var(--status-bar-height);
|
|
||||||
|
|
||||||
.logo-box {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 20px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.contact-list {
|
|
||||||
height: calc(100% - 60px - var(--status-bar-height));
|
|
||||||
box-sizing: border-box;
|
|
||||||
width: 100%;
|
|
||||||
overflow-y: auto;
|
|
||||||
overflow-x: hidden;
|
|
||||||
|
|
||||||
.contact-item-content {
|
|
||||||
padding-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.contact-item {
|
|
||||||
height: 72px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 0 16px;
|
|
||||||
background: #fff;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&:not(:last-child) {
|
|
||||||
border-bottom: 1px solid #f5f8fc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.contact-item-icon {
|
|
||||||
height: 42px;
|
|
||||||
width: 42px;
|
|
||||||
border-radius: 50%;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 39px;
|
|
||||||
font-size: 20px;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.contact-valid-icon {
|
|
||||||
background-color: #60cfa7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.contact-blacklist-icon {
|
|
||||||
background-color: #53c3f4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.contact-group-icon {
|
|
||||||
background-color: #be65d9;
|
|
||||||
}
|
|
||||||
|
|
||||||
.contact-item-title {
|
|
||||||
margin-left: 12px;
|
|
||||||
font-size: 17px;
|
|
||||||
color: #333333;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.more-icon {
|
|
||||||
margin: 0 16px;
|
|
||||||
color: #999999;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.dropdown-mark {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-container {
|
|
||||||
position: absolute;
|
|
||||||
top: -70px;
|
|
||||||
right: 30px;
|
|
||||||
min-width: 122px;
|
|
||||||
min-height: 40px;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #e6e6e6;
|
|
||||||
box-shadow: 0px 4px 7px rgba(133, 136, 140, 0.25);
|
|
||||||
border-radius: 8px;
|
|
||||||
z-index: 99;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-menu-list {
|
|
||||||
padding: 15px 10px;
|
|
||||||
|
|
||||||
.add-menu-item {
|
|
||||||
white-space: nowrap;
|
|
||||||
font-size: 16px;
|
|
||||||
padding-left: 5px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
height: 30px;
|
|
||||||
line-height: 30px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
<template>
|
|
||||||
<ContactList />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import ContactList from './contact-list/index.vue'
|
|
||||||
import { onShow } from '@dcloudio/uni-app'
|
|
||||||
import { setContactTabUnread, setTabUnread } from '../utils/msg';
|
|
||||||
import { trackInit } from '../utils/reporter'
|
|
||||||
|
|
||||||
trackInit('ContactUIKit')
|
|
||||||
|
|
||||||
onShow(() => {
|
|
||||||
setTabUnread()
|
|
||||||
setContactTabUnread()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
|
|
||||||
page {
|
|
||||||
height: 100vh;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "esnext",
|
|
||||||
"module": "esnext",
|
|
||||||
"strict": true,
|
|
||||||
"jsx": "preserve",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"useDefineForClassFields": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"strictFunctionTypes": false,
|
|
||||||
"preserveValueImports": false,
|
|
||||||
"isolatedModules": false,
|
|
||||||
"baseUrl": ".",
|
|
||||||
"types": ["node", "webpack-env", "vue/types", "vue-router/types"],
|
|
||||||
"paths": {
|
|
||||||
"@/*": ["src/*"]
|
|
||||||
},
|
|
||||||
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
|
|
||||||
},
|
|
||||||
"files": ["*.d.ts", "**/*.ts", "**/*.tsx", "**/*.vue", "**/*.ts", "**/*.tsx"],
|
|
||||||
"include": [
|
|
||||||
"*.d.ts",
|
|
||||||
"**/*.ts",
|
|
||||||
"**/*.tsx",
|
|
||||||
"**/*.vue",
|
|
||||||
"**/*.ts",
|
|
||||||
"**/*.tsx"
|
|
||||||
],
|
|
||||||
"exclude": ["node_modules"]
|
|
||||||
}
|
|
||||||
@ -1,90 +0,0 @@
|
|||||||
import { t } from './i18n'
|
|
||||||
import { V2NIMConst } from 'nim-web-sdk-ng/dist/v2/NIM_UNIAPP_SDK'
|
|
||||||
|
|
||||||
// 自定义的一些事件常量
|
|
||||||
export const events = {
|
|
||||||
// 自己发出一条消息
|
|
||||||
SEND_MSG: 'sendMsg',
|
|
||||||
// 发送消息失败
|
|
||||||
SEND_MSG_FAILED: 'sendMsgFailed',
|
|
||||||
// 收到一条消息
|
|
||||||
ON_MSG: 'onMsg',
|
|
||||||
// 加载更多
|
|
||||||
ON_LOAD_MORE: 'onLoadMore',
|
|
||||||
// 首次进入聊天页并获取历史记录
|
|
||||||
ON_CHAT_MOUNTED: 'onChatMounted',
|
|
||||||
// 重新编辑撤回消息
|
|
||||||
ON_REEDIT_MSG: 'onReEditMsg',
|
|
||||||
// 页面触底
|
|
||||||
ON_REACH_BOTTOM: 'onReachBottom',
|
|
||||||
// 页面触顶
|
|
||||||
ON_REACH_TOP: 'onReactTop',
|
|
||||||
// 回复消息
|
|
||||||
REPLY_MSG: 'replyMsg',
|
|
||||||
// input框聚焦
|
|
||||||
ON_INPUT_FOCUS_CHANGE: 'onInputFocusChange',
|
|
||||||
// input框失焦
|
|
||||||
ON_INPUT_BLUR: 'onInputBlur',
|
|
||||||
// 滚动到底部
|
|
||||||
ON_SCROLL_BOTTOM: 'onScrollBottom',
|
|
||||||
// @群成员
|
|
||||||
AIT_TEAM_MEMBER: 'aitTeamMember',
|
|
||||||
// 表情框弹起与收起变化
|
|
||||||
EMOJI_AREA_CHANGE: 'emojiAreaChange',
|
|
||||||
// 获取历史消息
|
|
||||||
GET_HISTORY_MSG: 'getHistoryMsg',
|
|
||||||
// 取消转发消息
|
|
||||||
CANCEL_FORWARD_MSG: 'cancelForwardMsg',
|
|
||||||
// 确认转发消息
|
|
||||||
CONFIRM_FORWARD_MSG: 'confirmForwardMsg',
|
|
||||||
// @消息 @群成员
|
|
||||||
HANDLE_AIT_MEMBER: 'handleAitMember',
|
|
||||||
// 关闭@弹窗
|
|
||||||
CLOSE_AIT_POPUP: 'closeAitPopup',
|
|
||||||
// 表情点击
|
|
||||||
EMOJI_CLICK: 'emojiClick',
|
|
||||||
// 表情删除
|
|
||||||
EMOJI_DELETE: 'emojiDelete',
|
|
||||||
// 表情发送
|
|
||||||
EMOJI_SEND: 'emojiSend',
|
|
||||||
// 好友选择
|
|
||||||
FRIEND_SELECT: 'friendSelect',
|
|
||||||
// 处理滚动穿透
|
|
||||||
HANDLE_MOVE_THROUGH: 'handleMoveThrough',
|
|
||||||
// 关闭表情、语音面板
|
|
||||||
CLOSE_PANEL: 'closePanel',
|
|
||||||
// 语音消息url改变
|
|
||||||
AUDIO_URL_CHANGE: 'audioUrlChange',
|
|
||||||
}
|
|
||||||
|
|
||||||
export const HISTORY_LIMIT = 15
|
|
||||||
|
|
||||||
export const MSG_ID_FLAG = 'message-item-'
|
|
||||||
|
|
||||||
export const AT_ALL_ACCOUNT = 'ait_all'
|
|
||||||
|
|
||||||
export const ALLOW_AT = 'yxAllowAt'
|
|
||||||
|
|
||||||
export const REPLY_MSG_TYPE_MAP: { [key: number]: string } = {
|
|
||||||
[V2NIMConst.V2NIMMessageType.V2NIM_MESSAGE_TYPE_IMAGE]: t('imgMsgText'),
|
|
||||||
[V2NIMConst.V2NIMMessageType.V2NIM_MESSAGE_TYPE_AUDIO]: t('audioMsgText'),
|
|
||||||
[V2NIMConst.V2NIMMessageType.V2NIM_MESSAGE_TYPE_VIDEO]: t('videoMsgText'),
|
|
||||||
[V2NIMConst.V2NIMMessageType.V2NIM_MESSAGE_TYPE_FILE]: t('fileMsgText'),
|
|
||||||
}
|
|
||||||
|
|
||||||
export const STORAGE_KEY = '__yx_im_options__'
|
|
||||||
|
|
||||||
export const callTypeMap = {
|
|
||||||
audio: '1',
|
|
||||||
video: '2',
|
|
||||||
}
|
|
||||||
|
|
||||||
export const g2StatusMap: any = {
|
|
||||||
1: t('callDurationText'),
|
|
||||||
2: t('callCancelText'),
|
|
||||||
3: t('callRejectedText'),
|
|
||||||
4: t('callTimeoutText'),
|
|
||||||
5: t('callBusyText'),
|
|
||||||
}
|
|
||||||
|
|
||||||
export const msgRecallTime = 2 * 60 * 1000
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
const preUrl = '/root/NEUIKit'
|
|
||||||
|
|
||||||
export function customNavigateTo(options: { url: string }) {
|
|
||||||
uni.navigateTo({ ...options, url: preUrl + options.url })
|
|
||||||
}
|
|
||||||
|
|
||||||
export function customRedirectTo(options: { url: string }) {
|
|
||||||
uni.redirectTo({ ...options, url: preUrl + options.url })
|
|
||||||
}
|
|
||||||
|
|
||||||
export function customSwitchTab(options: { url: string }) {
|
|
||||||
uni.switchTab({ ...options, url: preUrl + options.url })
|
|
||||||
}
|
|
||||||
|
|
||||||
export function customReLaunch(options: { url: string }) {
|
|
||||||
uni.reLaunch({ ...options, url: preUrl + options.url })
|
|
||||||
}
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
import { t } from './i18n'
|
|
||||||
|
|
||||||
export function caculateTimeago(dateTimeStamp: number): string {
|
|
||||||
const minute = 1000 * 60 // 把分,时,天,周,半个月,一个月用毫秒表示
|
|
||||||
const hour = minute * 60
|
|
||||||
const day = hour * 24
|
|
||||||
const week = day * 7
|
|
||||||
const now = new Date().getTime() // 获取当前时间毫秒
|
|
||||||
const diffValue = now - dateTimeStamp // 时间差
|
|
||||||
let result = ''
|
|
||||||
|
|
||||||
if (diffValue < 0) {
|
|
||||||
return t('nowText')
|
|
||||||
}
|
|
||||||
const minC = Math.floor(diffValue / minute) // 计算时间差的分,时,天,周,月
|
|
||||||
const hourC = Math.floor(diffValue / hour)
|
|
||||||
const dayC = Math.floor(diffValue / day)
|
|
||||||
const weekC = Math.floor(diffValue / week)
|
|
||||||
if (weekC >= 1 && weekC <= 4) {
|
|
||||||
result = ` ${weekC}${t('weekText')}`
|
|
||||||
} else if (dayC >= 1 && dayC <= 6) {
|
|
||||||
result = ` ${dayC}${t('dayText')}`
|
|
||||||
} else if (hourC >= 1 && hourC <= 23) {
|
|
||||||
result = ` ${hourC}${t('hourText')}`
|
|
||||||
} else if (minC >= 1 && minC <= 59) {
|
|
||||||
result = ` ${minC}${t('minuteText')}`
|
|
||||||
} else if (diffValue >= 0 && diffValue <= minute) {
|
|
||||||
result = t('nowText')
|
|
||||||
} else {
|
|
||||||
const datetime = new Date()
|
|
||||||
datetime.setTime(dateTimeStamp)
|
|
||||||
const Nyear = datetime.getFullYear()
|
|
||||||
const Nmonth =
|
|
||||||
datetime.getMonth() + 1 < 10
|
|
||||||
? `0${datetime.getMonth() + 1}`
|
|
||||||
: datetime.getMonth() + 1
|
|
||||||
const Ndate =
|
|
||||||
datetime.getDate() < 10 ? `0${datetime.getDate()}` : datetime.getDate()
|
|
||||||
result = `${Nyear}-${Nmonth}-${Ndate}`
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
export const formatDateRange = (type) => {
|
|
||||||
const date = new Date()
|
|
||||||
let year = date.getFullYear()
|
|
||||||
let month: string | number = date.getMonth() + 1
|
|
||||||
let day: string | number = date.getDate()
|
|
||||||
|
|
||||||
if (type === 'start') {
|
|
||||||
year = year - 100
|
|
||||||
} else if (type === 'end') {
|
|
||||||
year = year
|
|
||||||
}
|
|
||||||
month = month > 9 ? month : '0' + month
|
|
||||||
day = day > 9 ? day : '0' + day
|
|
||||||
return `${year}-${month}-${day}`
|
|
||||||
}
|
|
||||||
@ -1,79 +0,0 @@
|
|||||||
// #ifdef APP-PLUS
|
|
||||||
import pinyin from 'pinyin'
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
export const friendGroupByPy = <
|
|
||||||
T extends {
|
|
||||||
[key: string]: any
|
|
||||||
}
|
|
||||||
>(
|
|
||||||
arr: T[],
|
|
||||||
keys: {
|
|
||||||
firstKey: string
|
|
||||||
secondKey?: string
|
|
||||||
thirdKey?: string
|
|
||||||
},
|
|
||||||
isLowerCase = true
|
|
||||||
): { key: string; data: T[] }[] => {
|
|
||||||
const res: { [key: string]: T[] } = {}
|
|
||||||
const OTHER_TAG = '#'
|
|
||||||
|
|
||||||
const add = (k: string, v: T) => {
|
|
||||||
const _k = isLowerCase ? k.toLowerCase() : k.toUpperCase()
|
|
||||||
if (!res[_k]) {
|
|
||||||
res[_k] = [v]
|
|
||||||
} else {
|
|
||||||
res[_k].push(v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
arr.forEach((item) => {
|
|
||||||
const v =
|
|
||||||
item[keys.firstKey] ||
|
|
||||||
item[keys.secondKey || ''] ||
|
|
||||||
item[keys.thirdKey || '']
|
|
||||||
if (!!v && typeof v === 'string') {
|
|
||||||
const str = v[0]
|
|
||||||
if (/^[a-zA-Z]$/.test(str)) {
|
|
||||||
add(str.toLowerCase(), item)
|
|
||||||
} else if (/^[\u4e00-\u9fa5]$/.test(str)) {
|
|
||||||
const en = '*abcdefghjklmnopqrstwxyz'.split('')
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
// @ts-ignore
|
|
||||||
const k = en.find((k) => {
|
|
||||||
const py = pinyin(str, {
|
|
||||||
style: 'FIRST_LETTER',
|
|
||||||
})
|
|
||||||
return py[0][0] === k
|
|
||||||
})
|
|
||||||
// #endif
|
|
||||||
// #ifndef APP-PLUS
|
|
||||||
const zh = '阿八嚓哒妸发旮哈讥咔垃痳拏噢妑七呥扨它穵夕丫帀'.split('')
|
|
||||||
// @ts-ignore
|
|
||||||
const k = en.find(
|
|
||||||
(k, ki) =>
|
|
||||||
(!zh[ki - 1] || zh[ki - 1].localeCompare(str, 'zh') <= 0) &&
|
|
||||||
str.localeCompare(zh[ki], 'zh') == -1
|
|
||||||
)
|
|
||||||
// #endif
|
|
||||||
if (k && k !== '*') {
|
|
||||||
add(k, item)
|
|
||||||
} else {
|
|
||||||
add(OTHER_TAG, item)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
add(OTHER_TAG, item)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
add(OTHER_TAG, item)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const data = Object.keys(res).map((k) => ({ key: k, data: res[k] }))
|
|
||||||
const sortData = data
|
|
||||||
.filter((item) => item.key !== OTHER_TAG)
|
|
||||||
.sort((a, b) => a.key.localeCompare(b.key, 'en'))
|
|
||||||
const otherData = data.filter((item) => item.key === OTHER_TAG)
|
|
||||||
|
|
||||||
return sortData.concat(otherData)
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
import zh from '../locale/zh-Hans'
|
|
||||||
const messages = {
|
|
||||||
zh,
|
|
||||||
}
|
|
||||||
const localeMap = {
|
|
||||||
'zh-Hans': 'zh',
|
|
||||||
'zh-Hant': 'zh',
|
|
||||||
}
|
|
||||||
|
|
||||||
export const t = (key: string) => {
|
|
||||||
return zh[key]
|
|
||||||
}
|
|
||||||
@ -1,151 +0,0 @@
|
|||||||
import { events } from './constants'
|
|
||||||
|
|
||||||
export const getUniPlatform = () => {
|
|
||||||
// @ts-ignore
|
|
||||||
return uni.getSystemInfoSync().uniPlatform
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getPlatform = () => {
|
|
||||||
// @ts-ignore
|
|
||||||
return uni.getSystemInfoSync().platform
|
|
||||||
}
|
|
||||||
// 是否是android app
|
|
||||||
export const isAndroidApp =
|
|
||||||
uni.getSystemInfoSync().platform == 'android' &&
|
|
||||||
uni.getSystemInfoSync().uniPlatform == 'app'
|
|
||||||
|
|
||||||
// 是否是Ios app
|
|
||||||
export const isIosApp =
|
|
||||||
uni.getSystemInfoSync().platform == 'ios' &&
|
|
||||||
uni.getSystemInfoSync().uniPlatform == 'app'
|
|
||||||
|
|
||||||
// 是否是Ios web
|
|
||||||
export const isIosWeb =
|
|
||||||
uni.getSystemInfoSync().uniPlatform === 'web' &&
|
|
||||||
uni.getSystemInfoSync().platform === 'ios'
|
|
||||||
|
|
||||||
// 是否是App
|
|
||||||
export const isApp = uni.getSystemInfoSync().uniPlatform == 'app'
|
|
||||||
|
|
||||||
// 是否是微信小程序
|
|
||||||
export const isWxApp = uni.getSystemInfoSync().uniPlatform == 'mp-weixin'
|
|
||||||
|
|
||||||
// 是否是web
|
|
||||||
export const isWeb = uni.getSystemInfoSync().uniPlatform === 'web'
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
export function deepClone(source: any, visited = new WeakMap()) {
|
|
||||||
if (source === null || typeof source !== 'object') {
|
|
||||||
return source
|
|
||||||
}
|
|
||||||
|
|
||||||
if (visited.has(source)) {
|
|
||||||
return visited.get(source)
|
|
||||||
}
|
|
||||||
// @ts-ignore
|
|
||||||
let clone
|
|
||||||
|
|
||||||
if (source instanceof Date) {
|
|
||||||
clone = new Date(source.getTime())
|
|
||||||
} else if (source instanceof RegExp) {
|
|
||||||
clone = new RegExp(source)
|
|
||||||
} else if (source instanceof Map) {
|
|
||||||
clone = new Map()
|
|
||||||
visited.set(source, clone)
|
|
||||||
source.forEach((value, key) => {
|
|
||||||
// @ts-ignore
|
|
||||||
clone.set(key, deepClone(value, visited))
|
|
||||||
})
|
|
||||||
} else if (source instanceof Set) {
|
|
||||||
clone = new Set()
|
|
||||||
visited.set(source, clone)
|
|
||||||
source.forEach((value) => {
|
|
||||||
// @ts-ignore
|
|
||||||
clone.add(deepClone(value, visited))
|
|
||||||
})
|
|
||||||
} else if (Array.isArray(source)) {
|
|
||||||
clone = []
|
|
||||||
// @ts-ignore
|
|
||||||
visited.set(source, clone)
|
|
||||||
for (let i = 0; i < source.length; i++) {
|
|
||||||
clone[i] = deepClone(source[i], visited)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
clone = Object.create(Object.getPrototypeOf(source))
|
|
||||||
visited.set(source, clone)
|
|
||||||
for (const prop in source) {
|
|
||||||
if (source.hasOwnProperty(prop)) {
|
|
||||||
clone[prop] = deepClone(source[prop], visited)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return clone
|
|
||||||
}
|
|
||||||
|
|
||||||
export function stopAllAudio() {
|
|
||||||
uni.$emit(events.AUDIO_URL_CHANGE, '')
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 秒转换为时分秒
|
|
||||||
*/
|
|
||||||
export const convertSecondsToTime = (seconds: number): string | null => {
|
|
||||||
if (!seconds) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
const hours: number = Math.floor(seconds / 3600)
|
|
||||||
const minutes: number = Math.floor((seconds - hours * 3600) / 60)
|
|
||||||
const remainingSeconds: number = seconds - hours * 3600 - minutes * 60
|
|
||||||
|
|
||||||
let timeString = ''
|
|
||||||
|
|
||||||
const includeHours = seconds >= 3600
|
|
||||||
if (includeHours) {
|
|
||||||
if (hours < 10) {
|
|
||||||
timeString += '0'
|
|
||||||
}
|
|
||||||
timeString += hours.toString() + ':'
|
|
||||||
}
|
|
||||||
|
|
||||||
if (minutes < 10) {
|
|
||||||
timeString += '0'
|
|
||||||
}
|
|
||||||
timeString += minutes.toString() + ':'
|
|
||||||
|
|
||||||
if (remainingSeconds < 10) {
|
|
||||||
timeString += '0'
|
|
||||||
}
|
|
||||||
timeString += remainingSeconds.toString()
|
|
||||||
|
|
||||||
return timeString
|
|
||||||
}
|
|
||||||
|
|
||||||
export const startCall = (options: {
|
|
||||||
remoteUserAccid: string
|
|
||||||
currentUserAccid: string
|
|
||||||
type: number
|
|
||||||
remoteShowName: string
|
|
||||||
}) => {
|
|
||||||
try {
|
|
||||||
// @ts-ignore
|
|
||||||
uni.$UIKitCallKit.toCallPage(
|
|
||||||
{
|
|
||||||
calledAccount: options.remoteUserAccid,
|
|
||||||
// currentUserAccid: options.currentUserAccid,
|
|
||||||
type: options.type,
|
|
||||||
calledShowName: options.remoteShowName,
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
console.log('toCallPage: ', {
|
|
||||||
remoteUserAccid: options.remoteUserAccid,
|
|
||||||
currentUserAccid: options.currentUserAccid,
|
|
||||||
type: options.type,
|
|
||||||
remoteShowName: options.remoteShowName,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
)
|
|
||||||
} catch (error) {
|
|
||||||
console.log('handleVideoCall error', error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
import { t } from './i18n'
|
|
||||||
|
|
||||||
export const handleNoPermission = (res: any): void => {
|
|
||||||
if (
|
|
||||||
uni.getSystemInfoSync().platform == 'android' ||
|
|
||||||
uni.getSystemInfoSync().platform == 'ios'
|
|
||||||
) {
|
|
||||||
const appAuthorizeSetting = uni.getAppAuthorizeSetting()
|
|
||||||
//点击取消时不出现弹窗
|
|
||||||
const isCameraDenied = appAuthorizeSetting.cameraAuthorized === 'denied'
|
|
||||||
const isUserCancelled =
|
|
||||||
res.errMsg === 'chooseImage:fail User cancelled' ||
|
|
||||||
res.errMsg === 'chooseImage:fail cancel' ||
|
|
||||||
res.errMsg === 'chooseVideo:fail cancel' ||
|
|
||||||
res.errMsg === 'chooseVideo:fail User cancelled'
|
|
||||||
if (
|
|
||||||
(res.code === 11 && isCameraDenied && !isUserCancelled) ||
|
|
||||||
(res.code === 12 && isCameraDenied && !isUserCancelled) ||
|
|
||||||
(res.code === 2 && !isUserCancelled)
|
|
||||||
) {
|
|
||||||
uni.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: t('addPermissionText'),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
import { EventTracking } from '@xkit-yx/utils/dist/uniapp'
|
|
||||||
import imPkg from 'nim-web-sdk-ng/package.json'
|
|
||||||
|
|
||||||
export const trackInit = (
|
|
||||||
component: 'ChatUIKit' | 'ContactUIKit' | 'ConversationUIKit' | 'SearchUIKit'
|
|
||||||
): void => {
|
|
||||||
console.log('js init');
|
|
||||||
if (uni.$UIKitNIM && uni.$UIKitNIM.options.appkey) {
|
|
||||||
const eventTracking = new EventTracking({
|
|
||||||
appKey: uni.$UIKitNIM.options.appkey,
|
|
||||||
version: '10.2.0',
|
|
||||||
component,
|
|
||||||
imVersion: imPkg.version,
|
|
||||||
platform: 'UniApp',
|
|
||||||
})
|
|
||||||
eventTracking.track('init', '')
|
|
||||||
}else{
|
|
||||||
console.log('js 异常')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
let vueVersion: number
|
|
||||||
// #ifndef VUE3
|
|
||||||
export * from '@vue/composition-api'
|
|
||||||
vueVersion = 2
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifdef VUE3
|
|
||||||
export * from 'vue'
|
|
||||||
vueVersion = 3
|
|
||||||
// #endif
|
|
||||||
console.log(`vue version is ${vueVersion}`)
|
|
||||||
export { vueVersion }
|
|
||||||
Loading…
Reference in New Issue