Compare commits

..

No commits in common. "main" and "wyfMain-dev-useBase" have entirely different histories.

30 changed files with 1173 additions and 3139 deletions

View File

@ -1,47 +0,0 @@
import request from '@/service/index.js'
// 查询用户是否需要添加好友
export const ServeCheckFriend = (data) => {
return request({
url: '/api/v1/contact/friend/check',
method: 'POST',
data,
})
}
// 主动添加好友(单向好友)
export const ServeAddFriend = (data) => {
return request({
url: '/api/v1/contact/friend/add',
method: 'POST',
data,
})
}
// 查询我的好友列表
export const ServeQueryFriendsList = (data) => {
return request({
url: '/api/v1/contact/friend/list',
method: 'POST',
data,
})
}
// 删除好友(单向好友)
export const ServeDeleteFriend = (data) => {
return request({
url: '/api/v1/contact/friend/delete',
method: 'POST',
data,
})
}
//添加我的好友时候的搜索接口
export const ServeFriendSearch = (data) => {
return request({
url: '/api/v1/contact/friend/search',
method: 'POST',
data,
})
}

View File

@ -1,7 +1,6 @@
import request from '@/service/index.js'
import qs from 'qs'
import { useTalkStore, useDialogueStore } from '@/store'
import { handleFindWebview } from '@/utils/common'
// 获取聊天列表服务接口
export const ServeGetTalkList = (data) => {
@ -47,7 +46,23 @@ export const ServeClearTalkUnreadNum = (data, unReadNum) => {
useTalkStore().findTalkIndex(useDialogueStore().index_name)
]?.is_disturb
) {
handleFindWebview(`updateUnreadMsgNumReduce('${unReadNum}')`)
if (typeof plus !== 'undefined') {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`)
}
})
} else {
document.addEventListener('plusready', () => {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`)
}
})
})
}
}
return request({
url: '/api/v1/talk/unread/clear',
@ -68,7 +83,6 @@ export const ServeTalkRecords = (data) => {
// 获取转发会话记录详情列表服务接口
export const ServeGetForwardRecords = (data) => {
return request({
// url: '/api/v1/talk/records/forward/v2',
url: '/api/v1/talk/records/forward',
method: 'GET',
data,
@ -226,12 +240,3 @@ export const ServeConvertText = (data) => {
data,
})
}
// 获取用户所在群聊列表(我的群聊)
export const ServeUserGroupChatList = (data) => {
return request({
url: '/api/v1/group/user/list',
method: 'POST',
data,
})
}

View File

@ -4,7 +4,6 @@ import qs from 'qs'
// ES搜索聊天记录-主页搜索什么都有
export const ServeSeachQueryAll = (data) => {
return request({
// url: '/api/v1/elasticsearch/query-all/v2',
url: '/api/v1/elasticsearch/query-all',
method: 'POST',
data,
@ -14,7 +13,6 @@ export const ServeSeachQueryAll = (data) => {
// ES搜索用户数据
export const ServeQueryUser = (data) => {
return request({
// url: '/api/v1/elasticsearch/query-user/v2',
url: '/api/v1/elasticsearch/query-user',
method: 'POST',
data,

View File

@ -1,7 +1,6 @@
<template>
<tm-navbar
:hideBack="props.hideBack"
:hideHome="props.hideHome"
:title="props.title"
:shadow="props.shadowNum"
:fontSize="34"
@ -38,10 +37,6 @@ const props = defineProps({
type: Number,
default: 1,
},
hideHome: {
type: Boolean,
default: false,
},
})
</script>

View File

@ -1,155 +1,109 @@
<script lang="ts" setup>
import { ref, reactive, onMounted, onUnmounted, computed } from 'vue'
import { PlayOne, PauseOne } from '@icon-park/vue-next'
import { ITalkRecordExtraAudio, ITalkRecord } from '@/types/chat'
import { onHide } from '@dcloudio/uni-app'
import aTrumpet from '@/uni_modules/a-trumpet/components/a-trumpet/a-trumpet.vue'
import { useUserStore } from '@/store'
import { ref, reactive, onMounted } from "vue";
import { PlayOne, PauseOne } from "@icon-park/vue-next";
import { ITalkRecordExtraAudio, ITalkRecord } from "@/types/chat";
const props = defineProps<{
extra: ITalkRecordExtraAudio
data: ITalkRecord
maxWidth?: Boolean
}>()
extra: ITalkRecordExtraAudio;
data: ITalkRecord;
maxWidth?: Boolean;
}>();
const userStore = useUserStore()
const talkParams = reactive({
uid: computed(() => userStore.uid),
})
const audioRef = ref();
const audioContext = ref<any>(null);
const durationDesc = ref("-");
const audioContext = ref<any>(null)
const durationDesc = ref('-')
const state = reactive({
isAudioPlay: false,
progress: 0,
duration: 0,
currentTime: 0,
loading: true,
})
//
function onOtherAudioPlay(e) {
if (e.detail !== props.data.msg_id && state.isAudioPlay) {
audioContext.value.pause()
state.isAudioPlay = false
}
}
});
onMounted(() => {
audioContext.value = uni.createInnerAudioContext()
audioContext.value.src = props.extra.url
// 使uni-app
audioContext.value = uni.createInnerAudioContext();
audioContext.value.src = props.extra.url;
audioContext.value.onCanplay(() => {
state.duration = audioContext.value.duration
durationDesc.value = formatTime(parseInt(audioContext.value.duration))
state.loading = false
})
state.duration = audioContext.value.duration;
durationDesc.value = formatTime(parseInt(audioContext.value.duration));
state.loading = false;
});
audioContext.value.onTimeUpdate(() => {
if (audioContext.value.duration == 0) {
state.progress = 0
state.progress = 0;
} else {
state.currentTime = audioContext.value.currentTime
state.currentTime = audioContext.value.currentTime;
state.progress =
(audioContext.value.currentTime / audioContext.value.duration) * 100
(audioContext.value.currentTime / audioContext.value.duration) * 100;
}
})
});
audioContext.value.onEnded(() => {
state.isAudioPlay = false
state.progress = 0
})
state.isAudioPlay = false;
state.progress = 0;
});
audioContext.value.onError((e) => {
console.log('音频播放异常===>', e)
})
window.addEventListener('audio-play', onOtherAudioPlay)
})
onUnmounted(() => {
window.removeEventListener('audio-play', onOtherAudioPlay)
audioContext.value &&
audioContext.value.destroy &&
audioContext.value.destroy()
})
onHide(() => {
if (audioContext.value && audioContext.value.pause) {
audioContext.value.pause()
state.isAudioPlay = false
}
})
console.log("音频播放异常===>", e);
});
});
const onPlay = () => {
if (state.isAudioPlay) {
audioContext.value.pause()
state.isAudioPlay = false
audioContext.value.pause();
} else {
//
window.dispatchEvent(
new CustomEvent('audio-play', { detail: props.data.msg_id }),
)
audioContext.value.play()
state.isAudioPlay = true
audioContext.value.play();
}
}
state.isAudioPlay = !state.isAudioPlay;
};
const onPlayEnd = () => {
state.isAudioPlay = false;
state.progress = 0;
};
const formatTime = (value: number = 0) => {
if (value == 0) {
return '-'
return "-";
}
const minutes = Math.floor(value / 60)
let seconds = value
const minutes = Math.floor(value / 60);
let seconds = value;
if (minutes > 0) {
seconds = Math.floor(value - minutes * 60)
seconds = Math.floor(value - minutes * 60);
}
return `${minutes}'${seconds}"`
}
return `${minutes}'${seconds}"`;
};
</script>
<template>
<div
class="audio-message"
@click.stop="onPlay"
:class="
props?.data?.user_id == talkParams.uid
? 'justify-end py-[22rpx] pl-[30rpx] pr-[16rpx]'
: 'justify-start py-[22rpx] pr-[30rpx] pl-[16rpx]'
"
>
<a-trumpet
v-if="props?.data?.user_id != talkParams.uid"
:isPlay="state.isAudioPlay"
color="#C1C1C1"
:size="30"
></a-trumpet>
<div
:class="
props?.data?.user_id == talkParams.uid ? 'mr-[8rpx]' : 'ml-[8rpx]'
"
>
{{ Math.ceil(props?.extra?.duration / 1000) }}s
<div class="im-message-audio">
<div class="play">
<div class="btn pointer" @click.stop="onPlay">
<n-icon
:size="18"
:component="state.isAudioPlay ? PauseOne : PlayOne"
/>
</div>
</div>
<a-trumpet
v-if="props?.data?.user_id == talkParams.uid"
:isPlay="state.isAudioPlay"
color="#C1C1C1"
:size="30"
direction="left"
></a-trumpet>
<div class="desc">
<span class="line" v-for="i in 23" :key="i"></span>
<span
class="indicator"
:style="{ left: state.progress + '%' }"
v-show="state.progress > 0"
></span>
</div>
<div class="time">{{ durationDesc }}</div>
</div>
</template>
<style lang="less" scoped>
.audio-message {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
height: 100%;
background-color: #fff;
border-radius: 10px;
}
.im-message-audio {
--audio-bg-color: #f5f5f5;
--audio-btn-bg-color: #ffffff;
@ -291,7 +245,7 @@ const formatTime = (value: number = 0) => {
}
}
html[theme-mode='dark'] {
html[theme-mode="dark"] {
.im-message-audio {
--audio-bg-color: #2c2c32;
--audio-btn-bg-color: rgb(78, 75, 75);

View File

@ -24,7 +24,7 @@ console.log(props.extra.records)
const onClick = () => {
// isShowRecord.value = true
uni.navigateTo({
url: '/pages/forwardRecord/index?msgId=' + props.data.msg_id + '&created_at=' + props.data?.created_at
url: '/pages/forwardRecord/index?msgId=' + props.data.msg_id
})
}
</script>

View File

@ -101,11 +101,10 @@ export const ForwardableMessageType = [
ChatMsgTypeText,
ChatMsgTypeCode,
ChatMsgTypeImage,
// ChatMsgTypeAudio,
ChatMsgTypeAudio,
ChatMsgTypeVideo,
ChatMsgTypeFile,
ChatMsgTypeLocation,
ChatMsgTypeCard,
ChatMsgTypeLink,
ChatMsgTypeForward
ChatMsgTypeLink
]

View File

@ -15,7 +15,6 @@ import {
useDialogueListStore,
useGroupStore,
} from '@/store'
import { handleFindWebview } from '@/utils/common'
/**
* 好友状态事件
@ -155,7 +154,23 @@ class Talk extends Base {
//更新未读数量+1
updateUnreadMsgNumAdd() {
handleFindWebview(`updateUnreadMsgNumAdd()`)
if (typeof plus !== 'undefined') {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumAdd()`)
}
})
} else {
document.addEventListener('plusready', () => {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumAdd()`)
}
})
})
}
}
/**

View File

@ -16,14 +16,8 @@ import { vLoading } from '@/components/x-loading/index.js'
import messagePopup from '@/components/x-message/useMessagePopup'
import pageAnimation from '@/components/page-animation/index.vue'
import * as plugins from './plugins'
import {
useDialogueStore,
useTalkStore,
useUserStore,
useDialogueListStore,
} from '@/store'
import { uniStorage } from '@/utils/uniStorage.js'
import { handleFindWebview } from '@/utils/common'
import { useDialogueStore, useTalkStore, useUserStore, useDialogueListStore } from '@/store'
import {uniStorage} from "@/utils/uniStorage.js"
const { showMessage } = messagePopup()
dayjs.locale('zh-cn')
@ -73,7 +67,12 @@ export function createApp() {
return
}
console.log('===准备创建本地通知栏消息')
handleFindWebview(`doCreatePushMessage('${msg}')`)
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`doCreatePushMessage('${msg}')`)
}
})
}
//处理聊天推送弹窗点开
@ -91,56 +90,36 @@ export function createApp() {
window.updateUserInfo = () => {
useUserStore().loadSetting()
}
// 通讯录跳转
window.handleContacts = () => {
// 旧版本-按组织架构树的通讯录
uni.navigateTo({
url: '/pages/chooseByDeps/index?chooseMode=3&type=true'
});
// 新版本-按公司别、好友、群组的通讯录
// uni.navigateTo({
// url: '/pages/addressBook/index?type=true',
// })
}
//处理OA、墨册强制刷新时聊天同步强制刷新
window.doLocationRefresh = () => {
uniStorage.removeItem('dialogueList')
uniStorage.removeItem('dialogue')
useUserStore().loadSetting()
//同时先清除聊天记录缓存
useDialogueListStore().dialogueList.value = []
// location.reload(true)
uniStorage.removeItem('dialogueList')
location.reload(true)
}
//检查聊天页面是否可用
window.checkChatWebviewAvailable = () => {
handleFindWebview(`doneCheckChatWebviewAvailable()`)
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`doneCheckChatWebviewAvailable()`)
}
})
}
//获取从base传来的多选视频列表
window.getBaseMulVideo = (videoList) => {
const videos = JSON.parse(decodeURIComponent(videoList))
console.error('=====videos', videos)
if (videos.length > 0) {
if(videos.length > 0){
const videoUri = videos[0]
console.error('=====videoUri', videoUri)
}
}
//检查是否是特殊测试用户,开启控制台
const checkTestUser = () => {
const userStore = useUserStore()
if (
import.meta.env.VITE_SHOW_CONSOLE === 'false' &&
userStore.mobile == '18100591363'
) {
new VConsole()
}
}
checkTestUser()
window.message = ['success', 'error', 'warning'].reduce((acc, type) => {
acc[type] = (message) => {
if (typeof message === 'string') {

View File

@ -193,22 +193,6 @@
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/addressBook/index",
"type": "page",
"style": {
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/addressBook/addFriend/index",
"type": "page",
"style": {
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {

View File

@ -1,398 +0,0 @@
<template>
<div class="add-friend-page">
<zPaging ref="zPaging" :show-scrollbar="false" @scrolltolower="doLoadMore">
<template #top>
<div :class="'top_bg'">
<customNavbar
:class="'index_top_navbar'"
:title="$t('addFriend.pageTitle')"
></customNavbar>
<div class="pl-[32rpx] pr-[32rpx] pt-[32rpx] pb-[32rpx]">
<customInput
:searchText="searchVal"
@inputSearchText="inputSearchText"
></customInput>
</div>
</div>
</template>
<div class="add-friend">
<div class="add-friend-list" v-if="state.friendsList.length > 0">
<div
class="members-list-each"
v-for="(item, index) in state.friendsList"
:key="index"
@click="toUserDetail(item)"
>
<div class="members-info">
<avatarModule
:mode="1"
:avatar="item.avatar"
:groupType="0"
:userName="item.nickname"
:customStyle="{ width: '72rpx', height: '72rpx' }"
:customTextStyle="{
fontSize: '32rpx',
fontWeight: 'bold',
color: '#fff',
lineHeight: '44rpx',
}"
></avatarModule>
<div class="members-info-area">
<div
class="members-info-basic"
:style="{ padding: item.company_name ? 0 : '0 0 24rpx' }"
>
<span class="members-name">
{{ item.nickname }}
</span>
<span class="members-jobNum">
{{ item.job_num }}
</span>
<!-- <span class="members-company">{{ item.company_name }}</span> -->
</div>
<div class="members-positions-area">
<tm-popover position="bc">
<tm-scrolly :refresher="false" :height="84">
<div class="members-positions">
<div
class="members-positions-each"
v-for="(postionItem,
positionIndex) in item.user_position"
:key="positionIndex"
>
{{ postionItem.position_name }}
</div>
</div>
</tm-scrolly>
<template v-slot:label>
<tm-scrolly
:refresher="false"
:height="
item.user_position.length >= 4
? 180
: item.user_position.length === 3
? 140
: item.user_position.length === 2
? 100
: item.user_position.length === 1
? 60
: 0
"
>
<div class="members-positions-popover-box">
<div
class="members-positions-popover"
v-for="(postionItem,
positionIndex) in item.user_position"
:key="positionIndex"
>
{{ postionItem.position_name }}
</div>
</div>
</tm-scrolly>
</template>
</tm-popover>
</div>
</div>
</div>
<div class="company-infos" v-if="item.company_name">
<div class="company-each">
<span>{{ item.company_name }}</span>
</div>
</div>
</div>
</div>
<div class="addressBook-noData" v-if="state.friendsList.length === 0">
<img src="@/static/image/search/search-no-data.png" />
<span>
{{
searchVal
? $t('addFriend.message.notFindData')
: $t('search.hint')
}}
</span>
</div>
</div>
</zPaging>
</div>
</template>
<script setup>
import customInput from '@/components/custom-input/custom-input.vue'
import zPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue'
import avatarModule from '@/components/avatar-module/index.vue'
import { ServeFriendSearch } from '@/api/addressBook/index'
import { handleSetWebviewStyle } from '@/utils/common'
import { ref, onMounted, reactive } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const searchVal = ref('')
const state = reactive({
friendsListPage: 1, //
friendsListPageSize: 10, //
friendsList: [], //
hasMoreFriends: true, //
})
onMounted(() => {
getFriendsList()
handleSetWebviewStyle()
})
//
const inputSearchText = (e) => {
searchVal.value = e
}
//
const getFriendsList = () => {
let params = {
name: searchVal.value,
}
ServeFriendSearch(params)
.then((res) => {
console.error(res)
if (res?.code === 200) {
if (state.friendsListPage === 1) {
state.friendsList = res.data?.user_list || []
} else {
state.friendsList = state.friendsList.concat(
res.data?.user_list || [],
)
}
if (state.friendsList.length < res.data?.count) {
state.hasMoreFriends = true
} else {
state.hasMoreFriends = false
}
}
})
.catch((err) => {
console.log(err)
})
}
//
const toUserDetail = (userInfo) => {
uni.navigateTo({
url:
'/pages/dialog/dialogDetail/userDetail??erpUserId=' +
userInfo.erp_user_id,
})
}
//
const doLoadMore = (e) => {
state.friendsListPage += 1
getFriendsList()
}
watch(
() => searchVal.value,
(newVal) => {
state.friendsListPage = 1
getFriendsList()
},
)
</script>
<style scoped lang="scss">
::v-deep .zp-paging-container-content {
height: 100%;
display: flex;
}
::v-deep .index_top_navbar .tmicon-angle-left {
color: #fff !important;
}
::v-deep .index_top_navbar .text-weight-b {
color: #fff !important;
}
::v-deep .index_top_navbar .statusHeightTop > .noNvueBorder:first-child {
background: transparent !important;
border: none !important;
}
.top_bg {
background: url('@/static/image/mine/page_top.png') no-repeat;
background-size: cover;
background-position: bottom center;
}
:deep(.animateAll_tabs_tmui) {
width: 120rpx !important;
height: 10rpx !important;
}
.add-friend-page {
.add-friend {
flex: 1;
display: flex;
flex-direction: column;
background-image: url('@/static/image/clockIn/z3280@3x.png');
background-size: cover;
background-position: bottom center;
background-attachment: fixed;
width: 100%;
.add-friend-list {
margin: 30rpx 24rpx;
overflow: hidden;
flex: 1;
gap: 30rpx 0;
.members-list-each {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
background-color: #fff;
width: 100%;
border-radius: 8rpx;
.swipe-action {
width: 100%;
overflow: visible !important;
:deep(.wd-swipe-action__right) {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
background-color: #cf3050;
padding: 0 48rpx;
border-radius: 0 8rpx 8rpx 0;
span {
color: #fff;
line-height: 1;
font-size: 30rpx;
font-weight: 400;
}
}
}
.members-info {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
gap: 16rpx;
padding: 24rpx 24rpx 0;
.members-info-area {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
gap: 16rpx;
.members-info-basic {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
.members-name {
font-size: 30rpx;
font-weight: 500;
width: 150rpx;
word-break: break-all;
}
.members-jobNum {
font-size: 26rpx;
font-weight: 400;
color: #999;
word-break: break-all;
margin: 10rpx 0 0;
}
.members-company {
font-size: 24rpx;
font-weight: 400;
line-height: 1;
color: #999;
}
}
.members-positions-area {
.members-positions {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
gap: 10rpx;
padding: 4rpx 0 0;
max-height: 84rpx;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
.members-positions-each {
background-color: #eee9f8;
line-height: 1;
font-size: 24rpx;
padding: 4rpx 16rpx;
color: #46299d;
}
}
.members-positions-popover-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10rpx 0;
.members-positions-popover {
background-color: #eee9f8;
line-height: 1;
font-size: 24rpx;
padding: 8rpx 16rpx;
color: #46299d;
width: 100%;
}
}
}
}
}
.company-infos {
margin: 0 0 0 88rpx;
padding: 0 0 24rpx 24rpx;
.company-each {
span {
font-size: 24rpx;
font-weight: 400;
line-height: 1;
color: #999;
}
}
}
}
}
.addressBook-noData {
margin: 30rpx 24rpx;
overflow: hidden;
flex: 1;
gap: 30rpx 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
img {
width: 500rpx;
}
span {
font-size: 30rpx;
font-weight: 400;
line-height: 1;
color: #999;
}
}
}
}
</style>

View File

@ -1,944 +0,0 @@
<template>
<div class="address-book-page">
<zPaging ref="zPaging" :show-scrollbar="false" @scrolltolower="doLoadMore">
<template #top>
<div :class="'top_bg'">
<customNavbar
:class="'index_top_navbar'"
:title="$t('index.mine.addressBook')"
:hideHome="navshow"
:hideBack="navshow"
>
<template #left>
<tm-icon
@click="goWebHome"
v-if="navshow"
name="tmicon-angle-left"
style="padding-left: 30rpx;"
></tm-icon>
</template>
</customNavbar>
<div class="pl-[32rpx] pr-[32rpx] pt-[32rpx] pb-[32rpx]">
<customInput
:searchText="searchVal"
@inputSearchText="inputSearchText"
></customInput>
</div>
</div>
<tm-tabs
:list="state.addressBookTabs"
align="center"
:width="750"
:height="300"
:itemWidth="250"
default-name="company"
activeColor="#46299d"
activeFontColor="#46299d"
tabs-line-ani-color="#46299d"
:showTabsLineAni="true"
:showTabsLine="false"
:activeFontSize="32"
:itemFontSize="30"
@update:activeName="updateAddressBookTab"
></tm-tabs>
</template>
<div class="address-book">
<div class="address-book-tabs-panes-list">
<div
class="tabs-panes-each address-book-company"
v-if="
state.addressBookActiveTab === 'company' &&
state.myContractList.length > 0
"
>
<div class="address-book-company-name">
<span>{{ state.myCompany }}</span>
</div>
<div
class="members-list-each"
v-for="(item, index) in state.myContractList"
:key="index"
>
<div class="members-info" @click="toUserDetail(item)">
<avatarModule
:mode="1"
:avatar="item.avatar"
:groupType="0"
:userName="item.nickname"
:customStyle="{ width: '72rpx', height: '72rpx' }"
:customTextStyle="{
fontSize: '32rpx',
fontWeight: 'bold',
color: '#fff',
lineHeight: '44rpx',
}"
></avatarModule>
<div class="members-info-area">
<div class="members-info-basic" style="padding: 0 0 24rpx;">
<span class="members-name">
{{ item.nickname }}
</span>
<span class="members-jobNum">
{{ item.job_num }}
</span>
</div>
<div class="members-positions-area">
<tm-popover position="bc">
<tm-scrolly :refresher="false" :height="84">
<div class="members-positions">
<div
class="members-positions-each"
v-for="(postionItem,
positionIndex) in item.user_position"
:key="positionIndex"
>
{{ postionItem.position_name }}
</div>
</div>
</tm-scrolly>
<template v-slot:label>
<tm-scrolly
:refresher="false"
:height="
item.user_position.length >= 4
? 180
: item.user_position.length === 3
? 140
: item.user_position.length === 2
? 100
: item.user_position.length === 1
? 60
: 0
"
>
<div class="members-positions-popover-box">
<div
class="members-positions-popover"
v-for="(postionItem,
positionIndex) in item.user_position"
:key="positionIndex"
>
{{ postionItem.position_name }}
</div>
</div>
</tm-scrolly>
</template>
</tm-popover>
</div>
</div>
</div>
</div>
</div>
<div
class="tabs-panes-each address-book-friends"
v-if="
state.addressBookActiveTab === 'friends' &&
state.myFriendsList.length > 0
"
>
<div
class="members-list-each"
v-for="(item, index) in state.myFriendsList"
:key="index"
>
<wd-swipe-action
class="swipe-action"
@click="showDeleteModal(item, index)"
v-if="
!item.company_name ||
(item.company_name && item.company_name !== state.myCompany)
"
>
<div class="members-info" @click="toUserDetail(item)">
<avatarModule
:mode="1"
:avatar="item.avatar"
:groupType="0"
:userName="item.nickname"
:customStyle="{ width: '72rpx', height: '72rpx' }"
:customTextStyle="{
fontSize: '32rpx',
fontWeight: 'bold',
color: '#fff',
lineHeight: '44rpx',
}"
></avatarModule>
<div class="members-info-area">
<div
class="members-info-basic"
:style="{ padding: item.company_name ? 0 : '0 0 24rpx' }"
>
<span class="members-name">
{{ item.nickname }}
</span>
<span class="members-jobNum">
{{ item.job_num }}
</span>
<!-- <span class="members-company">{{ item.company_name }}</span> -->
</div>
<div class="members-positions-area">
<tm-popover position="bc">
<tm-scrolly :refresher="false" :height="84">
<div class="members-positions">
<div
class="members-positions-each"
v-for="(postionItem,
positionIndex) in item.user_position"
:key="positionIndex"
>
{{ postionItem.position_name }}
</div>
</div>
</tm-scrolly>
<template v-slot:label>
<tm-scrolly
:refresher="false"
:height="
item.user_position.length >= 4
? 180
: item.user_position.length === 3
? 140
: item.user_position.length === 2
? 100
: item.user_position.length === 1
? 60
: 0
"
>
<div class="members-positions-popover-box">
<div
class="members-positions-popover"
v-for="(postionItem,
positionIndex) in item.user_position"
:key="positionIndex"
>
{{ postionItem.position_name }}
</div>
</div>
</tm-scrolly>
</template>
</tm-popover>
</div>
</div>
</div>
<div class="company-infos" v-if="item.company_name">
<div class="company-each">
<span>{{ item.company_name }}</span>
</div>
</div>
<template #right>
<div
v-for="(swipeActionItem,
swipeActionIndex) in state.swipeAction"
:key="swipeActionIndex"
>
<span>{{ swipeActionItem.text }}</span>
</div>
</template>
</wd-swipe-action>
</div>
</div>
<div
class="tabs-panes-each address-book-groups"
v-if="
state.addressBookActiveTab === 'groups' &&
state.myGroupsList.length > 0
"
>
<div
class="groups-list-each"
v-for="(item, index) in state.myGroupsList"
:key="index"
>
<div class="groups-info">
<avatarModule
:mode="2"
:avatar="item?.avatar"
:groupType="Number(item?.group_type)"
:customStyle="{ width: '72rpx', height: '72rpx' }"
></avatarModule>
<span class="groups-name">
{{ item?.group_name }}
</span>
<span
class="groups-type"
:style="{
color:
groupTypeMapping[item?.group_type]?.result_type_color,
border:
'1px solid' +
groupTypeMapping[item?.group_type]?.result_type_color,
}"
>
{{ groupTypeMapping[item?.group_type]?.result_type }}
</span>
</div>
<div class="groups-btns">
<div class="groups-btns-each" @click="toGroupChat(item)">
<span>{{ $t('addressBook.btns.enterGroup') }}</span>
</div>
</div>
</div>
</div>
<div
class="addressBook-noData"
v-if="
!state.isLoadingData &&
((state.addressBookActiveTab === 'company' &&
state.myContractList.length === 0) ||
(state.addressBookActiveTab === 'friends' &&
state.myFriendsList.length === 0) ||
(state.addressBookActiveTab === 'groups' &&
state.myGroupsList.length === 0))
"
>
<img src="@/static/image/search/search-no-data.png" />
<span>
{{
searchVal
? $t('addFriend.message.notFindData')
: $t('search.hint')
}}
</span>
</div>
</div>
</div>
<tm-modal
class="friendDeleteModal"
ref="friendDeleteModalRef"
:mask="true"
:okText="$t('ok')"
okColor="#46299d"
cancelColor="#999"
@ok="doDeleteFriend"
@cancel="hideDeleteModal"
:teleport="false"
titleStyle="font-size: 40rpx;font-weight: 600;line-height: 1;"
:height="300"
:round="4"
>
<div class="friendDeleteModal-content">
<span>{{ $t('addressBook.message.doOrNotDeleteFriend') }}</span>
</div>
</tm-modal>
</zPaging>
</div>
</template>
<script setup>
import customInput from '@/components/custom-input/custom-input.vue'
import zPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue'
import avatarModule from '@/components/avatar-module/index.vue'
import { ref, onMounted, reactive, watch } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { handleSetWebviewStyle, handleFindWebview } from '@/utils/common'
import { ServeUserGroupChatList, ServeCreateTalkList } from '@/api/chat/index'
import { ServeGetSessionId } from '@/api/search/index'
import { formatTalkItem } from '@/utils/talk'
import { useDialogueStore, useTalkStore } from '@/store'
import {
ServeQueryFriendsList,
ServeDeleteFriend,
} from '@/api/addressBook/index'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const navshow = ref(false)
const searchVal = ref('')
const friendDeleteModalRef = ref(null)
const state = reactive({
addressBookTabs: [], //tab
addressBookActiveTab: 'company', //tab
myContractListPage: 1, //
myContractListPageSize: 10, //
myContractList: [], //
hasMoreContracts: true, //
myFriendsListPage: 1, //
myFriendsListPageSize: 10, //
myFriendsList: [], //
hasMoreFriends: true, //
myGroupsListPage: 1, //
myGroupsListPageSize: 10, //
myGroupsList: [], //
hasMoreGroups: true, //
myCompany: '', //
swipeAction: [], //
isLoadingData: true, //
})
onLoad((options) => {
if (options.type) {
navshow.value = true
}
})
const goWebHome = () => {
uni.navigateBack()
handleFindWebview(`handleBackHost()`)
}
onMounted(() => {
state.swipeAction = [
{
text: t('addressBook.btns.delete'), //,
},
]
state.addressBookTabs = [
{
key: 'company',
title: t('addressBook.tabs.company'),
},
{
key: 'friends',
title: t('addressBook.tabs.friends'),
},
{
key: 'groups',
title: t('addressBook.tabs.groups'),
},
]
handleSetWebviewStyle()
getMyContractList()
})
//
const inputSearchText = (e) => {
searchVal.value = e
}
//tab
const updateAddressBookTab = (e) => {
state.addressBookActiveTab = e
}
//
const getMyContractList = () => {
let params = {
type: 'addressBook', //addressBook
page: state.myContractListPage,
page_size: state.myContractListPageSize,
name: searchVal.value,
}
// console.log(params)
state.isLoadingData = true
ServeQueryFriendsList(params)
.then((res) => {
// console.log(res)
state.isLoadingData = false
if (res?.code === 200) {
state.myCompany = res.data?.company_name
if (state.myContractListPage === 1) {
state.myContractList = res.data?.user_list || []
} else {
state.myContractList = state.myContractList.concat(
res.data?.user_list || [],
)
}
if (state.myContractList.length < res.data?.count) {
state.hasMoreContracts = true
} else {
state.hasMoreContracts = false
}
}
})
.catch((err) => {
state.isLoadingData = false
})
}
//
const getMyFriendsList = () => {
let params = {
type: 'myFriends', //myFriends
page: state.myFriendsListPage,
page_size: state.myFriendsListPageSize,
name: searchVal.value,
}
console.error(params)
state.isLoadingData = true
ServeQueryFriendsList(params)
.then((res) => {
console.log(res)
state.isLoadingData = false
if (res?.code === 200) {
if (state.myFriendsListPage === 1) {
state.myFriendsList = res.data?.user_list || []
} else {
state.myFriendsList = state.myFriendsList.concat(
res.data?.user_list || [],
)
}
if (state.myFriendsList.length < res.data?.count) {
state.hasMoreFriends = true
} else {
state.hasMoreFriends = false
}
}
})
.catch((err) => {
state.isLoadingData = false
})
}
//
const toUserDetail = (userInfo) => {
uni.navigateTo({
url:
'/pages/dialog/dialogDetail/userDetail??erpUserId=' +
userInfo.erp_user_id,
})
}
//
const getMyGroupsList = () => {
let params = {
page: state.myGroupsListPage,
page_size: state.myGroupsListPageSize,
group_name: searchVal.value,
}
state.isLoadingData = true
ServeUserGroupChatList(params)
.then((res) => {
console.log(res)
state.isLoadingData = false
if (res?.code === 200) {
if (state.myGroupsListPage === 1) {
state.myGroupsList = res.data?.items || []
} else {
state.myGroupsList = state.myGroupsList.concat(res.data?.items || [])
}
if (state.myGroupsList.length < res.data?.total) {
state.hasMoreGroups = true
} else {
state.hasMoreGroups = false
}
}
})
.catch((err) => {
state.isLoadingData = false
})
}
//
const doLoadMore = (e) => {
if (state.addressBookActiveTab === 'company' && state.hasMoreContracts) {
state.myContractListPage += 1
getMyContractList()
} else if (state.addressBookActiveTab === 'friends' && state.hasMoreFriends) {
state.myFriendsListPage += 1
getMyFriendsList()
} else if (state.addressBookActiveTab === 'groups' && state.hasMoreGroups) {
state.myGroupsListPage += 1
getMyGroupsList()
}
}
//Id
const getSessionId = (talk_type, receiver_id) => {
return new Promise((resolve, reject) => {
let params = {
talkType: talk_type,
receiverId: receiver_id,
}
const resp = ServeGetSessionId(params)
console.log(resp)
resp.then(({ code, data }) => {
console.log(data)
if (code == 200) {
resolve(data?.sessionId)
} else {
}
})
resp.catch(() => {})
})
}
//
const toGroupChat = async (groupInfo) => {
let talk_type = 2
let receiver_id = groupInfo.id
const sessionId = await getSessionId(talk_type, receiver_id)
if (useTalkStore().findTalkIndex(`${talk_type}_${receiver_id}`) === -1) {
ServeCreateTalkList({
talk_type,
receiver_id,
}).then(async ({ code, data }) => {
if (code == 200) {
let item = formatTalkItem(data)
useTalkStore().addItem(item)
}
})
}
useDialogueStore().setDialogue({
name: groupInfo.group_name,
talk_type: 2,
receiver_id: receiver_id,
})
uni.navigateTo({
url: '/pages/dialog/index?sessionId=' + sessionId,
})
}
//
const showDeleteModal = (userInfo, friendIndex) => {
friendDeleteModalRef.value.open({
userInfo,
friendIndex,
})
}
//
const hideDeleteModal = () => {
friendDeleteModalRef.value.close()
}
//
const doDeleteFriend = (args) => {
console.log(args.userInfo, args.friendIndex)
let params = {
receiver_id: args.userInfo.id, //id
talk_type: 1,
}
ServeDeleteFriend(params).then((res) => {
console.log(res)
if (res?.code === 200) {
message.success(t('addressBook.message.deleteSuccess') + ' !')
state.myFriendsList.splice(args.friendIndex, 1)
}
})
}
// -groupType
const groupTypeMapping = {
0: {},
1: {},
2: {
result_type: t('index.mine.department'),
result_type_color: '#377EC6',
},
3: {
result_type: t('index.mine.project'),
result_type_color: '#C1681C',
},
4: {
result_type: t('index.type.company'),
result_type_color: '#7A58DE',
},
}
watch(
() => state.addressBookActiveTab,
(newVal) => {
if (newVal === 'company') {
state.myContractListPage = 1
getMyContractList()
} else if (newVal === 'friends') {
state.myFriendsListPage = 1
getMyFriendsList()
} else if (newVal === 'groups') {
state.myGroupsListPage = 1
getMyGroupsList()
}
},
)
watch(
() => searchVal.value,
(newVal) => {
if (state.addressBookActiveTab === 'company') {
state.myContractListPage = 1
getMyContractList()
} else if (state.addressBookActiveTab === 'friends') {
state.myFriendsListPage = 1
getMyFriendsList()
} else if (state.addressBookActiveTab === 'groups') {
state.myGroupsListPage = 1
getMyGroupsList()
}
},
)
</script>
<style scoped lang="scss">
::v-deep .zp-paging-container-content {
height: 100%;
display: flex;
}
::v-deep .index_top_navbar .tmicon-angle-left {
color: #fff !important;
}
::v-deep .index_top_navbar .text-weight-b {
color: #fff !important;
}
::v-deep .index_top_navbar .statusHeightTop > .noNvueBorder:first-child {
background: transparent !important;
border: none !important;
}
.top_bg {
background: url('@/static/image/mine/page_top.png') no-repeat;
background-size: cover;
background-position: bottom center;
}
:deep(.animateAll_tabs_tmui) {
width: 120rpx !important;
height: 10rpx !important;
}
.address-book-page {
.address-book {
flex: 1;
display: flex;
flex-direction: column;
background-image: url('@/static/image/clockIn/z3280@3x.png');
background-size: cover;
background-position: bottom center;
background-attachment: fixed;
width: 100%;
.address-book-tabs-panes-list {
margin: 30rpx 24rpx;
overflow: hidden;
flex: 1;
display: flex;
flex-direction: column;
.tabs-panes-each {
gap: 30rpx 0;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
}
.address-book-company,
.address-book-friends {
.address-book-company-name {
margin: 0 0 -16rpx;
span {
font-size: 26rpx;
font-weight: 400;
line-height: 1;
color: #999;
}
}
.members-list-each {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
background-color: #fff;
width: 100%;
border-radius: 8rpx;
.swipe-action {
width: 100%;
overflow: visible !important;
:deep(.wd-swipe-action__right) {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
background-color: #cf3050;
padding: 0 48rpx;
border-radius: 0 8rpx 8rpx 0;
span {
color: #fff;
line-height: 1;
font-size: 30rpx;
font-weight: 400;
}
}
}
.members-info {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
gap: 16rpx;
padding: 24rpx 24rpx 0;
width: 100%;
.members-info-area {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
gap: 16rpx;
.members-info-basic {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
.members-name {
font-size: 30rpx;
font-weight: 500;
width: 150rpx;
word-break: break-all;
}
.members-jobNum {
font-size: 26rpx;
font-weight: 400;
color: #999;
word-break: break-all;
margin: 10rpx 0 0;
}
.members-company {
font-size: 24rpx;
font-weight: 400;
line-height: 1;
color: #999;
}
}
.members-positions-area {
.members-positions {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
gap: 10rpx;
padding: 4rpx 0 0;
max-height: 84rpx;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
.members-positions-each {
background-color: #eee9f8;
line-height: 1;
font-size: 24rpx;
padding: 4rpx 16rpx;
color: #46299d;
}
}
.members-positions-popover-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10rpx 0;
.members-positions-popover {
background-color: #eee9f8;
line-height: 1;
font-size: 24rpx;
padding: 8rpx 16rpx;
color: #46299d;
width: 100%;
}
}
}
}
}
.company-infos {
margin: 0 0 0 88rpx;
padding: 0 0 24rpx 24rpx;
.company-each {
span {
font-size: 24rpx;
font-weight: 400;
line-height: 1;
color: #999;
}
}
}
}
}
.address-book-groups {
.groups-list-each {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
background-color: #fff;
width: 100%;
padding: 24rpx;
border-radius: 8rpx;
.groups-info {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
gap: 16rpx;
.groups-name {
font-size: 30rpx;
font-weight: 500;
}
.groups-type {
font-size: 24rpx;
border-radius: 6rpx;
font-weight: bold;
padding: 6rpx 12rpx;
flex-shrink: 0;
}
}
.groups-btns {
flex-shrink: 0;
margin: 0 0 0 16rpx;
.groups-btns-each {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
background-color: #46299d;
padding: 16rpx;
border-radius: 8rpx;
span {
color: #fff;
font-size: 24rpx;
font-weight: 400;
line-height: 1;
}
}
}
}
}
.addressBook-noData {
margin: 30rpx 24rpx;
overflow: hidden;
flex: 1;
gap: 30rpx 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
img {
width: 500rpx;
}
span {
font-size: 30rpx;
font-weight: 400;
line-height: 1;
color: #999;
}
}
}
}
.friendDeleteModal {
:deep(.overlay) {
height: 100vh !important;
}
.friendDeleteModal-content {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -57,7 +57,6 @@ import videoImg from '@/static/image/chatList/video@2x.png'
import folder from '@/static/image/chatList/folder.png'
import { uploadImg } from '@/api/chat'
import { uniqueId } from '@/utils'
import { handleFindWebview } from '@/utils/common'
const props = defineProps({
sendUserInfo: {
@ -163,7 +162,12 @@ const photoActionsSelect = (index) => {
)
}
} else {
// handleFindWebview(`getPlusVideoPicker()`)
// let OAWebView = plus.webview.all()
// OAWebView.forEach((webview, index) => {
// if (webview.id === 'webviewId1') {
// webview.evalJS(`getPlusVideoPicker()`)
// }
// })
// return
uni.chooseVideo({
sourceType: ['album'],

View File

@ -61,17 +61,13 @@
<template #bottom>
<customBtn
:isBottom="true"
:btnText="
state.canSendMsg
? $t('user.detail.sendMsg')
: $t('addressBook.btns.addFriend')
"
:btnText="$t('user.detail.sendMsg')"
:subBtnText="
!state.canSendMsg || state.userInfo.sys_id === state.uid
state.userInfo.sys_id === state.uid
? ''
: $t('user.detail.ringBell')
"
@clickBtn="checkSendPermission"
@clickBtn="toTalkUser"
@clickSubBtn="handleCall"
></customBtn>
</template>
@ -116,7 +112,6 @@ const talkStore = useTalkStore()
const userStore = useUserStore()
import { getUserInfoByClickAvatar } from '@/api/user/index'
import { ServeCheckFriend, ServeAddFriend } from '@/api/addressBook/index'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
@ -128,7 +123,6 @@ const state = reactive({
isShowPhoneCall: false, //
phoneNumber: '', //
uid: computed(() => userStore.uid), //id
canSendMsg: false, //
})
onLoad((options) => {
@ -151,7 +145,6 @@ const getUserInfo = () => {
console.log(data)
if (code == 200) {
state.userInfo = data
checkNeedAddFriend()
let department = ''
let post = ''
if (data?.erp_dept_position?.length > 0) {
@ -244,45 +237,6 @@ const doPhoneCall = () => {
},
})
}
//
const checkSendPermission = () => {
if (state.canSendMsg) {
toTalkUser()
} else {
doAddFriend()
}
}
//
const checkNeedAddFriend = () => {
state.canSendMsg = true
// let params = {
// receiver_id: state.userInfo.sys_id, //id
// talk_type: 1,
// }
// ServeCheckFriend(params).then((res) => {
// console.log(res)
// if (res?.code === 200) {
// state.canSendMsg = res.data?.is_friend || false
// }
// })
}
//
const doAddFriend = () => {
let params = {
receiver_id: state.userInfo.sys_id, //id
talk_type: 1,
}
ServeAddFriend(params).then((res) => {
console.log(res)
if (res?.code === 200) {
message.success(t('addressBook.message.addSuccess') + ' !')
state.canSendMsg = true
}
})
}
</script>
<style scoped lang="scss">
.outer-layer {
@ -325,7 +279,6 @@ const doAddFriend = () => {
flex-direction: row;
align-items: center;
justify-content: center;
flex-shrink: 0;
img {
width: 100%;
height: 100%;

View File

@ -227,21 +227,8 @@
: 'justify-start'
"
>
<div
class="talk-tools voice-content"
v-if="
item?.voiceContent ||
(!item?.voiceContent && item?.isVoiceToTexting)
"
@click="copyVoiceContent(item?.voiceContent || '')"
>
<wd-loading
v-if="item?.isVoiceToTexting && !item?.voiceContent"
color="#46299D"
:size="20"
style="margin: 0 12rpx 0 0;"
/>
<span v-if="item?.voiceContent">{{ item.voiceContent }}</span>
<div class="talk-tools voice-content" v-if="item.voiceContent">
<span>{{ item.voiceContent }}</span>
</div>
</div>
@ -317,10 +304,8 @@
:src="state.isUseSpeech ? keyboardIcon : microphoneIcon"
@click="changeEditorMode"
v-if="
(state.isProd &&
(userStore.mobile == '13580848136' ||
userStore.mobile == '18100591363')) ||
!state.isProd
userStore.mobile === '13580848136' ||
userStore.mobile === '18100591363'
"
></tm-image>
<div class="flex-1 quillBox" style="">
@ -697,21 +682,6 @@
</tm-sheet>
</div>
</tm-drawer>
<tm-alert
:content="state.notFriendOrSameCompanyHint"
color="#fff"
:shadow="2"
:height="96"
:closable="false"
class="notFriendOrSameCompanyHint"
v-if="talkParams.type === 1 && !state.isFriendOrSameCompany"
>
<template #right>
<div class="addFriendBtn" @click="doAddFriend">
<span>{{ $t('addressBook.btns.add') }}</span>
</div>
</template>
</tm-alert>
</div>
</template>
<script setup>
@ -781,8 +751,6 @@ import zu6053 from '@/static/image/chatList/zu6053@2x.png'
import deepBubble from '@/components/deep-bubble/deep-bubble.vue'
import { isRevoke } from './menu'
import useConfirm from '@/components/x-confirm/useConfirm.js'
import { ServeCheckFriend, ServeAddFriend } from '@/api/addressBook/index'
import { clipboard } from '@/utils/common'
import {
onLoad as uniOnload,
onUnload as uniOnUnload,
@ -790,8 +758,6 @@ import {
onHide,
} from '@dcloudio/uni-app'
import ws from '@/connect'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
Quill.register('formats/emoji', EmojiBlot)
import 'quill-mention'
@ -895,13 +861,6 @@ const state = ref({
readDetailHeight: 400, //
isFirstEnter: true, //
isFromHide: false, //hide
isFriendOrSameCompany: false, ///
notFriendOrSameCompanyHint: [
{
content: t('addressBook.message.notFriendsOrSameCompany'),
},
],
isProd: import.meta.env.PROD,
})
// Map
@ -1573,18 +1532,6 @@ const handleMergeForward = () => {
if (selectedMessage.value.length == 0) {
return message.warning('未选择消息')
}
let isForwardAble = true
let notForwardAbleHint = '不支持转发:'
selectedMessage.value.find((selectedItem) => {
if (!ForwardableMessageType.includes(selectedItem.msg_type)) {
notForwardAbleHint += ChatMsgTypeMapping[selectedItem.msg_type] + '、'
isForwardAble = false
}
})
if (!isForwardAble) {
message.warning(notForwardAbleHint.slice(0, notForwardAbleHint.length - 1))
return
}
console.log('合并转发')
dialogueStore.setForwardType(2)
dialogueStore.setForwardMessages(selectedMessage.value)
@ -1600,18 +1547,6 @@ const handleSingleForward = () => {
if (selectedMessage.value.length == 0) {
return message.warning('未选择消息')
}
let isForwardAble = true
let notForwardAbleHint = '不支持转发:'
selectedMessage.value.find((selectedItem) => {
if (!ForwardableMessageType.includes(selectedItem.msg_type)) {
notForwardAbleHint += ChatMsgTypeMapping[selectedItem.msg_type] + '、'
isForwardAble = false
}
})
if (!isForwardAble) {
message.warning(notForwardAbleHint.slice(0, notForwardAbleHint.length - 1))
return
}
console.log('逐条转发')
dialogueStore.setForwardType(1)
dialogueStore.setForwardMessages(selectedMessage.value)
@ -2535,7 +2470,6 @@ onUnmounted(() => {
})
onShow(() => {
checkNeedAddFriend()
if (state.value.isFromHide) {
if (state.value.setMessageReadInterval) {
clearInterval(state.value.setMessageReadInterval)
@ -2719,19 +2653,9 @@ const onProgressFn = (progress, id) => {
// console.log((progress.loaded / progress.total) * 100, 'progress')
}
//
const startRecord = () => {
//
window.dispatchEvent(new CustomEvent('audio-play', { detail: null }))
}
//
const endRecord = (file, url, duration) => {
console.log(file, url, duration)
if (duration < 1000) {
message.error(t('chat_voice_too_short'))
return
}
const form = new FormData()
form.append('file', file)
form.append('source', 'fonchain-chat')
@ -2751,9 +2675,6 @@ const endRecord = (file, url, duration) => {
resp.catch(() => {})
}
//
const cancelRecord = () => {}
//
const sendMediaMessage = (mediaUrl, duration, size) => {
// console.log(mediaUrl, 'mediaUrl')
@ -2782,21 +2703,17 @@ const sendMediaMessage = (mediaUrl, duration, size) => {
//
const convertText = (msgItem) => {
msgItem.isVoiceToTexting = true
const resp = ServeConvertText({
voiceUrl: msgItem.extra.url,
msgId: msgItem.msg_id,
})
// console.log(resp, 'resp')
resp.then(({ code, data }) => {
msgItem.isVoiceToTexting = false
// console.log(code, data, 'data')
if (code === 200) {
console.log(data.convText, 'convText')
msgItem.voiceContent = data.convText
}
}).catch(() => {
msgItem.isVoiceToTexting = false
})
}
//
@ -2804,53 +2721,6 @@ const chatInputHeight = computed(() => {
console.error(rpxToPx(72) + 'px', 'chatInputHeight')
return rpxToPx(72) + 'px'
})
//
const checkNeedAddFriend = () => {
state.value.isFriendOrSameCompany = true
// let params = {
// receiver_id: talkParams.receiver_id, //id
// talk_type: 1,
// }
// ServeCheckFriend(params).then((res) => {
// console.log(res)
// if (res?.code === 200) {
// state.value.isFriendOrSameCompany = res.data?.is_friend || false
// }
// })
}
//
const doAddFriend = () => {
let params = {
receiver_id: talkParams.receiver_id, //id
talk_type: 1,
}
ServeAddFriend(params).then((res) => {
console.log(res)
if (res?.code === 200) {
message.success(t('addressBook.message.addSuccess') + ' !')
state.value.isFriendOrSameCompany = true
}
})
}
//
const copyVoiceContent = (voiceContent) => {
if (!voiceContent) {
return
}
uni.setClipboardData({
data: voiceContent,
showToast: false,
success: () => {
message.success('复制成功')
},
})
// clipboard(voiceContent, () => {
// message.success('')
// })
}
</script>
<style scoped lang="less">
.dialog-page {
@ -2870,32 +2740,6 @@ const copyVoiceContent = (voiceContent) => {
line-height: unset !important;
}
}
.notFriendOrSameCompanyHint {
margin: 120rpx 24rpx;
:deep(.round-2) {
margin: 10rpx !important;
box-shadow: 0 2px 6px 1px rgba(0, 0, 0, 0.2) !important;
}
:deep(.bdcld) {
align-items: center !important;
}
.addFriendBtn {
background-color: #46299d;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding: 10rpx 16rpx;
border-radius: 8rpx;
span {
color: #fff;
font-size: 30rpx;
font-weight: 500;
line-height: 1;
}
}
}
}
.edit-revoked-message {
@ -3067,6 +2911,7 @@ const copyVoiceContent = (voiceContent) => {
}
.voice-content {
text-align: right;
color: #7a58de;
font-size: 22rpx;
font-weight: 400;

View File

@ -6,12 +6,10 @@ import { MessageComponents } from '@/constant/message'
import { ITalkRecord } from '@/types/chat'
import WdLoading from "@/uni_modules/wot-design-uni/components/wd-loading/wd-loading.vue";
import { useInject } from '@/hooks'
import { parseTime } from '@/utils/datetime'
const emit = defineEmits(['close'])
const msgId = ref(null)
const createdAt = ref(null)
const { showUserInfoModal } = useInject()
const isShow = ref(true)
const items = ref<ITalkRecord[]>([])
@ -23,8 +21,7 @@ const onMaskClick = () => {
const onLoadData = () => {
ServeGetForwardRecords({
msg_id: msgId.value,
biz_date: createdAt.value
msg_id: msgId.value
}).then((res) => {
if (res.code == 200) {
items.value = res.data.items || []
@ -44,7 +41,6 @@ onMounted(() => {
const page = pages[pages.length - 1]
const options = page.$page.options
msgId.value = options.msgId
createdAt.value = parseTime(new Date((options.created_at as any)), '{y}{m}')
console.log(msgId.value,'msgId.value');
onLoadData()

View File

@ -66,11 +66,11 @@
/>
<template v-slot:label>
<div
class="w-full px-[14rpx]"
class="w-full h-[208rpx] pt-[22rpx] pb-[32rpx] pl-[14rpx] pr-[12rpx]"
>
<div
@click="creatGroupChat"
class="flex items-center pl-[22rpx] py-[32rpx]"
class="flex items-center pl-[22rpx] mb-[32rpx]"
>
<div class="mr-[26rpx] flex items-center">
<tm-image
@ -86,27 +86,9 @@
</div>
</div>
<div class="divider"></div>
<!-- <div
@click="toAddFriendPage"
class="flex items-center pl-[22rpx] py-[32rpx]"
>
<div class="mr-[26rpx] flex items-center">
<tm-image
:width="40"
:height="44"
:src="addFriend"
></tm-image>
</div>
<div
class="leading-[54rpx] text-[32rpx] text-[#FFFFFF] font-bold"
>
添加好友
</div>
</div>
<div class="divider"></div> -->
<div
@click="toAddressBookPage"
class="flex items-center pl-[22rpx] py-[32rpx]"
class="flex items-center pl-[22rpx] mt-[32rpx]"
>
<div class="mr-[26rpx] flex items-center">
<tm-image
@ -162,7 +144,6 @@ import chatItem from './components/chatItem.vue'
import addCircle from '@/static/image/chatList/addCircle.png'
import cahtPopover from '@/static/image/chatList/cahtPopover.png'
import zu3289 from '@/static/image/chatList/zu3289@2x.png'
import addFriend from '@/static/image/chatList/addFriend.png'
import ZPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue'
import { handleSetWebviewStyle } from '@/utils/common'
const paging = ref()
@ -235,24 +216,11 @@ const toSearchPage = () => {
})
}
//
const toAddFriendPage = () => {
uni.navigateTo({
url: '/pages/addressBook/addFriend/index',
})
}
//
const toAddressBookPage = () => {
// -
uni.navigateTo({
url: '/pages/chooseByDeps/index?chooseMode=3',
})
// -
// uni.navigateTo({
// url: '/pages/addressBook/index',
// })
}
/* watch(

View File

@ -193,12 +193,12 @@ onMounted(() => {
const inputSearchText = (e) => {
if (e.trim() != state.searchText.trim()) {
state.pageNum = 1
state.searchResult = null //
state.searchResult = null //
emits('lastIdChange', 0, 0, 0)
}
state.searchText = e.trim()
if (!e.trim()) {
state.searchResult = null //
state.searchResult = null //
emits('lastIdChange', 0, 0, 0)
}
zPaging.value?.reload()
@ -291,9 +291,7 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
zPaging.value?.complete([])
} else {
//
zPaging.value?.complete(
state.searchResult ? [state.searchResult] : [],
)
zPaging.value?.complete(state.searchResult ? [state.searchResult] : [])
}
} else {
if (props.isPagination) {
@ -305,8 +303,7 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
if (
paginationKey &&
Array.isArray(
(state?.searchResult && state?.searchResult[paginationKey]) ||
[],
(state?.searchResult && state?.searchResult[paginationKey]) || [],
)
) {
data[paginationKey] = state.searchResult[paginationKey].concat(
@ -331,58 +328,8 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
} else if (state?.first_talk_record_infos?.talk_type === 2) {
total = data.group_record_count
}
let noMoreSearchResultRecord = true
if (
Object.keys(data).includes('talk_record_infos') &&
state.searchResult['talk_record_infos']?.length > 0
) {
//
if (state.searchResult['talk_record_infos']?.length < total) {
noMoreSearchResultRecord = false
}
}
zPaging.value?.completeByNoMore([data], noMoreSearchResultRecord)
} else {
let noMoreSearchResultUser = true
let noMoreSearchResultGroup = true
let noMoreSearchResultGeneral = true
if (
Object.keys(data).includes('user_infos') &&
state.searchResult['user_infos']?.length > 0
) {
//
if (state.searchResult['user_infos']?.length < total) {
noMoreSearchResultUser = false
}
}
if (
Object.keys(data).includes(
'group_member_infos' || 'group_infos',
) &&
state.searchResult['combinedGroup']?.length > 0
) {
//
if (state.searchResult['combinedGroup']?.length < total) {
noMoreSearchResultGroup = false
}
}
if (
Object.keys(data).includes('general_infos') &&
state.searchResult['general_infos']?.length > 0
) {
//
if (state.searchResult['general_infos']?.length < total) {
noMoreSearchResultGeneral = false
}
}
// zPaging.value?.completeByTotal([data], total)
zPaging.value?.completeByNoMore(
[data],
noMoreSearchResultUser &&
noMoreSearchResultGroup &&
noMoreSearchResultGeneral,
)
}
zPaging.value?.completeByTotal([data], total)
} else {
state.searchResult = data
zPaging.value?.complete([data])
@ -421,7 +368,7 @@ const cancelSearch = () => {
})
} else {
uni.reLaunch({
url: '/pages/index/index',
url: '/pages/index/index'
})
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 654 B

View File

@ -5,7 +5,7 @@ import { userInfoApi } from "@/api/user";
import {ref} from 'vue'
export const useAuth = createGlobalState(() => {
const token = useStorage('token', '', uniStorage)
// const token = ref("2046c3941ed4959f6d988d3d4a0fe40d4b52f33f3f5fc1001406064554641d9406bb13cacb92939b0ca223c17e2c2f2fe70212ef017dbae8965d5cf86bad48ce4316e605ca187bd9ffd4aa6b56865be4ad4e422701d330b52d60cfe649cd48cf3a21a2a6e9a9cabafff364ee9c311ec634b0afc09db0d3215bedce561e9d50e5a8da6092062e2ebe35f747d77d72a68ad492a4ab218c07887c9cd4867f2c2d28e4ae1fd671144cc20ef0632f9ce067289004d67f6adf41b20d6ef5cdbfb74aadc2d2736ececf07254f1a76552bde4f1161a0fca7bfe32a29685ce1e76366116b81ae2195b3713dbb04285e5ddfd36184fe671c5524d20b4fe74a555db755f8d939b0bc46fb0cb998323d54c9925729d7ca835b7925999a677faa0cbe1cbc67b5203d85317653883aec81d3e71d865b326376bea726cc66d9f7f5a160d43f671c")
// const token = ref("79b5c732d96d2b27a48a99dfd4a5566c43aaa5796242e854ebe3ffc198d6876b9628e7b764d9af65ab5dbb2d517ced88170491b74b048c0ba827c0d3741462cb89dc59ed46653a449af837a8262941caba0afc18e7cb819d125e8c04282beb5d4dd454307169f7eb51cd3dbbee20c1a17784f78ad30c3b3a102bd03c3218080beedae501a95c365d360a7a0d682cba2eca94a2915c13f0bdcb42f2eab9458cb4bd89ae6f3200fe4893d64caf1bce02894aab876f94f7825d23be507733468deba21734b6d666b75fd0bee74753fdd6ca5def7ec42cd7dbb47750e61cac6965f34fd71b52be66a472d3ee5b1e4661e59d4489860c2e1d8c178de5b43853ef9be822f00e0903b5c97efaa9ba0d9c76a1a91a2d6d77c5a19c551906a67fbfd3af69bd6a59310b8b300658e9b7248d9dd51a66be399ef412cb7c83bc81abfc15b65b")
const refreshToken = useStorage('refreshToken', '', uniStorage)
const userInfo = useStorage('userInfo', {}, uniStorage)
const leaderList = useStorage('leaderList', [], uniStorage)

View File

@ -5,7 +5,6 @@ import lodash from 'lodash'
import { ref } from 'vue'
import { createGlobalState, useStorage } from '@vueuse/core'
import { uniStorage } from '@/utils/uniStorage.js'
import { handleFindWebview } from '@/utils/common'
export const useDialogueListStore = createGlobalState(() => {
const testDatabase = async () => {
@ -41,33 +40,19 @@ export const useDialogueListStore = createGlobalState(() => {
}
const content = {
content: '我试试传送文件和图片是不是一个接口',
name: '测试excel1.xlsx',
path:
'https://cdn-test.szjixun.cn/fonchain-chat/chat/file/multipart/20250307/727a2371-ffc4-46da-b953-a7d449ff82ff-测试excel1.xlsx',
content: "我试试传送文件和图片是不是一个接口",
name: "测试excel1.xlsx",
path: "https://cdn-test.szjixun.cn/fonchain-chat/chat/file/multipart/20250307/727a2371-ffc4-46da-b953-a7d449ff82ff-测试excel1.xlsx",
size: 9909,
drive: 3,
}
const extra = JSON.stringify(content)
drive: 3
};
const extra = JSON.stringify(content);
let chatDBexecuteSql2 = {
eventType: 'executeSql',
eventParams: {
name: 'chat',
sql:
'INSERT INTO talk_records (msg_id, sequence, talk_type, msg_type, user_id, receiver_id, is_revoke, is_mark, quote_id, extra, created_at, updated_at, biz_date) VALUES ("' +
'77b715fb30f54f739a255a915ef72445' +
'", 166, 2, 1, 1774, 888890, 0, 0, "' +
'' +
'", "' +
extra +
'", "' +
'2025-03-06T15:57:07.000Z' +
'", "' +
'2025-03-06T15:57:07.000Z' +
'", "' +
'20250306' +
'")',
sql: 'INSERT INTO talk_records (msg_id, sequence, talk_type, msg_type, user_id, receiver_id, is_revoke, is_mark, quote_id, extra, created_at, updated_at, biz_date) VALUES ("'+'77b715fb30f54f739a255a915ef72445'+'", 166, 2, 1, 1774, 888890, 0, 0, "'+''+'", "'+extra+'", "'+'2025-03-06T15:57:07.000Z'+'", "'+'2025-03-06T15:57:07.000Z'+'", "'+'20250306'+'")',
},
}
let chatDBSelectSql = {
@ -84,27 +69,38 @@ export const useDialogueListStore = createGlobalState(() => {
path: '_doc/chat.db',
},
}
// handleFindWebview(
// `operateSQLite('${encodeURIComponent(JSON.stringify(chatDatabase))}')`,
// )
// handleFindWebview(
// `operateSQLite('${encodeURIComponent(
// JSON.stringify(chatDBexecuteSql),
// )}')`,
// )
// handleFindWebview(
// `operateSQLite('${encodeURIComponent(
// JSON.stringify(chatDBexecuteSql2),
// )}')`,
// )
// handleFindWebview(
// `operateSQLite('${encodeURIComponent(JSON.stringify(chatDBSelectSql))}')`,
// )
// handleFindWebview(
// `operateSQLite('${encodeURIComponent(
// JSON.stringify(chatDBIsOpenDatabase),
// )}')`,
// )
document.addEventListener('plusready', () => {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(
`operateSQLite('${encodeURIComponent(
JSON.stringify(chatDatabase),
)}')`,
)
webview.evalJS(
`operateSQLite('${encodeURIComponent(
JSON.stringify(chatDBexecuteSql),
)}')`,
)
webview.evalJS(
`operateSQLite('${encodeURIComponent(
JSON.stringify(chatDBexecuteSql2),
)}')`,
)
webview.evalJS(
`operateSQLite('${encodeURIComponent(
JSON.stringify(chatDBSelectSql),
)}')`,
)
webview.evalJS(
`operateSQLite('${encodeURIComponent(
JSON.stringify(chatDBIsOpenDatabase),
)}')`,
)
}
})
})
}
// testDatabase()

View File

@ -2,7 +2,6 @@ import { defineStore } from 'pinia'
import { ServeGetTalkList, ServeCreateTalkList } from '@/api/chat/index'
import { formatTalkItem, ttime, KEY_INDEX_NAME } from '@/utils/talk'
import { useEditorDraftStore } from './editor-draft'
import { handleFindWebview } from '@/utils/common'
// import { ISession } from '@/types/chat'
export const useTalkStore = defineStore('talk', {
@ -104,7 +103,23 @@ export const useTalkStore = defineStore('talk', {
return resp.then(({ code, data }) => {
if (code == 200) {
//向OA的webview通信改变未读消息数量
handleFindWebview(`doUpdateUnreadNum('${data.unread_num}')`)
if (typeof plus !== 'undefined') {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`doUpdateUnreadNum('${data.unread_num}')`)
}
})
} else {
document.addEventListener('plusready', () => {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`doUpdateUnreadNum('${data.unread_num}')`)
}
})
})
}
this.items = data.items.map((item) => {
const value = formatTalkItem(item)

View File

@ -1,2 +0,0 @@
## 1.0.02023-09-05
实现基础功能

View File

@ -1,130 +0,0 @@
<template>
<view :style="[boxStyel]" class="box">
<view class="audio-style" :style="[audioStyel]" :class="{ 'animation': isPlay }">
<view class="small" :style="{'background-color': color}"></view>
<view class="middle" :style="{'border-right-color': color}"></view>
<view class="large" :style="{'border-right-color': color}"></view>
</view>
</view>
</template>
<script>
export default {
emits: [],
props: {
isPlay: {
type: [Boolean],
default: false
},
direction: {
type: String,
default: 'right'
},
size: {
type: Number,
default: 24
},
color: {
type: String,
default: '#222'
}
},
data() {
return {
};
},
computed: {
audioStyel() {
return {
transform: `scale(${this.size / 24})`
};
},
boxStyel() {
const directDic = { right: '0deg', bottom: '90deg', left: '180deg', top: '270deg' };
const dir = directDic[this.direction || 'left'];
const style = {
transform: `rotate(${dir})`,
width: this.size + 'px',
height: this.size + 'px'
};
return style;
}
},
methods: {}
};
</script>
<style lang="scss" scoped>
view{
box-sizing: border-box;
}
.box {
// border: 1px solid #4c4c4c;
display: inline-flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.audio-style {
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
& > view {
border: 2px solid transparent;
border-radius: 50%;
}
}
.small {
border: 0px solid;
width: 3px;
height: 3px;
}
.middle {
width: 16px;
height: 16px;
margin-left: -11px;
opacity: 1;
}
.large {
width: 24px;
height: 24px;
margin-left: -19px;
opacity: 1;
}
.animation {
.middle {
animation: middle 1.2s ease-in-out infinite;
}
.large {
animation: large 1.2s ease-in-out infinite;
}
}
//
@keyframes middle {
0% {
opacity: 0;
}
10% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes large {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
60% {
opacity: 0;
}
100% {
opacity: 0;
}
}
</style>

View File

@ -1,83 +0,0 @@
{
"id": "a-trumpet",
"displayName": "纯css语音播放语音聊天播放小喇叭动画组件",
"version": "1.0.0",
"description": "纯css语音播放语音聊天播放小喇叭动画组件",
"keywords": [
"a-trumpet",
"语音播报",
"播放小喇叭",
"动画"
],
"repository": "",
"engines": {
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"Vue": {
"vue2": "y",
"vue3": "y"
},
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y",
"钉钉": "y",
"快手": "y",
"飞书": "y",
"京东": "y"
},
"快应用": {
"华为": "y",
"联盟": "y"
}
}
}
}
}

View File

@ -1,18 +0,0 @@
# a-trumpet
## 用法
```html
<a-trumpet :isPlay="isplay"></a-trumpet>
<a-trumpet :isPlay="isplay" color="#1100ff"></a-trumpet>
<a-trumpet :isPlay="isplay" :size="50"></a-trumpet>
<a-trumpet :isPlay="isplay" direction="right"></a-trumpet>
```
## 属性说明:
| 属性名 | 类型 | 默认值 | 说明 |
| ---- | ---- | ---- | ---- |
| isplay | Boolean | false | 是否播放动画 |
| size | Number | 24 | 宽高的尺寸 |
| color | String | #222 | 颜色 |
| direction | String | top、bottom、left、ringt| 方向,上下左右 |

View File

@ -21,19 +21,7 @@
},
]"
>
<wd-loading
v-if="isCheckingPermission"
color="#46299D"
:size="20"
style="margin: 0 12rpx 0 0;"
/>
<text>
{{
isCheckingPermission
? $t('chat_getting_microphone_permission')
: btnTextContent
}}
</text>
<text>{{ btnTextContent }}</text>
</view>
<!-- <view class="record-popup"
:style="{ '--popup-height': popupHeight, '--popup-width': upx2px(popupMaxWidth), '--popup-bottom': upx2px(popupFixBottom), '--popup-bg-color': popupBgColor }">
@ -160,7 +148,7 @@ import 'recorder-core/src/engine/mp3-engine'
import 'recorder-core/src/extensions/waveview'
import recordCancelBg from '@/static/image/record/chat-voice-animation-bg-red.png'
// #endif
import { multiplication, handleFindWebview } from '@/utils/common'
import { multiplication } from '@/utils/common'
export default {
name: 'nbVoiceRecord',
/**
@ -295,7 +283,6 @@ export default {
autoStopRecordCountDown: 0, //
autoStopRecordInterval: null, //
permisionState: false, //
isCheckingPermission: true, //
}
},
mounted() {
@ -313,7 +300,7 @@ export default {
let that = this
//
that.checkPermission(true)
that.checkPermission()
// #ifdef APP-PLUS
recorderManager.onStop((res) => {
@ -355,11 +342,7 @@ export default {
// }, 1000)
if (Number(permissionStatus) === 1) {
that.continueAppMicro()
} else if (
Number(permissionStatus) === -1 ||
(Number(permissionStatus) === 0 &&
uni.getSystemInfoSync().osName === 'ios')
) {
} else if (Number(permissionStatus) === -1) {
uni.showModal({
title: '提示',
content: '检测到您还未授权麦克风哦',
@ -368,10 +351,12 @@ export default {
cancelText: '保持拒绝',
success: ({ confirm, cancel }) => {
if (confirm) {
handleFindWebview(`handleRequestAndroidPermission('settings')`)
}
if (cancel) {
that.isCheckingPermission = false
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`handleRequestAndroidPermission('settings')`)
}
})
}
},
})
@ -393,20 +378,15 @@ export default {
that.permissionInfo = permissionInfo
}
},
continueAppMicro(isFirstRequestPer = false) {
continueAppMicro() {
let that = this
RecordApp.UniWebViewActivate(that) //AppWebView
RecordApp.RequestPermission(
() => {
console.log('已获得录音权限,可以开始录音了')
that.permisionState = true
that.isCheckingPermission = false
if (isFirstRequestPer) {
that.stopRecord()
}
},
(msg, isUserNotAllow) => {
that.isCheckingPermission = false
if (isUserNotAllow) {
//
//
@ -415,7 +395,7 @@ export default {
},
)
},
async checkPermission(isFirstRequestPer = false) {
async checkPermission() {
let that = this
// #ifdef APP-PLUS
// os
@ -453,9 +433,14 @@ export default {
// #endif
// #ifdef H5
if (typeof plus !== 'undefined') {
handleFindWebview(`handleRequestAndroidPermission('micro')`)
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`handleRequestAndroidPermission('micro')`)
}
})
} else {
that.continueAppMicro(isFirstRequestPer)
that.continueAppMicro()
}
// #endif
// #endif

View File

@ -193,33 +193,5 @@
"release_hand_to_send": "松开发送",
"release_hand_to_cancel": "松开取消",
"hold_to": "按住",
"speak": "说话",
"auto_stop_record": "s后自动结束录音",
"chat_voice_too_short": "说话时间太短",
"chat_getting_microphone_permission": "获取麦克风权限中...",
"addressBook": {
"tabs": {
"company": "组织架构",
"friends": "我的好友",
"groups": "我的群组"
},
"btns": {
"enterGroup": "进入群聊",
"addFriend": "添加好友",
"add": "添加",
"delete": "删除"
},
"message": {
"addSuccess": "添加成功",
"notFriendsOrSameCompany": "对方还不是您的好友,请添加到通讯录中吧!",
"deleteSuccess": "删除成功",
"doOrNotDeleteFriend": "是否删除该好友"
}
},
"addFriend": {
"pageTitle": "添加好友",
"message": {
"notFindData": "没有找到哦~"
}
}
"speak": "说话"
}

View File

@ -214,27 +214,6 @@ export function handleSetWebviewStyle(hasTabBar) {
}
}
//遍历所有的webview并通信
export function handleFindWebview(evalJS_) {
const findWebview = () => {
let allWebView = plus.webview.all()
allWebView.forEach((webview) => {
//由于webviewId后面的数字是动态分配的在很小情况下OAWebview的Id并不是webviewId1
//因此不做限制,全局广播,由接收页面自行接收处理
// if (webview.id === 'webviewId1') {//找到OAWebview
webview.evalJS(evalJS_)
// }
})
}
if (typeof plus !== 'undefined') {
findWebview()
} else {
document.addEventListener('plusready', () => {
findWebview()
})
}
}
// 通用运算函数
/*
函数加法函数用来得到精确的加法结果
@ -244,16 +223,16 @@ export function handleFindWebview(evalJS_) {
返回值两数相加的结果
*/
export function addition(arg1, arg2) {
;(arg1 = arg1.toString()), (arg2 = arg2.toString())
var arg1Arr = arg1.split('.'),
arg2Arr = arg2.split('.'),
d1 = arg1Arr.length == 2 ? arg1Arr[1] : '',
d2 = arg2Arr.length == 2 ? arg2Arr[1] : ''
var maxLen = Math.max(d1.length, d2.length)
var m = Math.pow(10, maxLen)
var result = Number(((arg1 * m + arg2 * m) / m).toFixed(maxLen))
var d = arguments[2]
return typeof d === 'number' ? Number(result.toFixed(d)) : result
arg1 = arg1.toString(), arg2 = arg2.toString();
var arg1Arr = arg1.split("."),
arg2Arr = arg2.split("."),
d1 = arg1Arr.length == 2 ? arg1Arr[1] : "",
d2 = arg2Arr.length == 2 ? arg2Arr[1] : "";
var maxLen = Math.max(d1.length, d2.length);
var m = Math.pow(10, maxLen);
var result = Number(((arg1 * m + arg2 * m) / m).toFixed(maxLen));
var d = arguments[2];
return typeof d === "number" ? Number((result).toFixed(d)) : result;
}
/*
@ -272,20 +251,12 @@ export function addition(arg1, arg2) {
返回值两数相乘的结果
*/
export function multiplication(arg1, arg2) {
var r1 = arg1.toString(),
r2 = arg2.toString(),
m,
resultVal,
d = arguments[2]
m =
(r1.split('.')[1] ? r1.split('.')[1].length : 0) +
(r2.split('.')[1] ? r2.split('.')[1].length : 0)
resultVal =
(Number(r1.replace('.', '')) * Number(r2.replace('.', ''))) /
Math.pow(10, m)
return typeof d !== 'number'
? Number(resultVal)
: Number(resultVal.toFixed(parseInt(d)))
var r1 = arg1.toString(),
r2 = arg2.toString(),
m, resultVal, d = arguments[2];
m = (r1.split(".")[1] ? r1.split(".")[1].length : 0) + (r2.split(".")[1] ? r2.split(".")[1].length : 0);
resultVal = Number(r1.replace(".", "")) * Number(r2.replace(".", "")) / Math.pow(10, m);
return typeof d !== "number" ? Number(resultVal) : Number(resultVal.toFixed(parseInt(d)));
}
/*
@ -296,18 +267,10 @@ export function multiplication(arg1, arg2) {
返回值arg1除于arg2的结果
*/
export function division(arg1, arg2) {
var r1 = arg1.toString(),
r2 = arg2.toString(),
m,
resultVal,
d = arguments[2]
m =
(r2.split('.')[1] ? r2.split('.')[1].length : 0) -
(r1.split('.')[1] ? r1.split('.')[1].length : 0)
resultVal =
(Number(r1.replace('.', '')) / Number(r2.replace('.', ''))) *
Math.pow(10, m)
return typeof d !== 'number'
? Number(resultVal)
: Number(resultVal.toFixed(parseInt(d)))
var r1 = arg1.toString(),
r2 = arg2.toString(),
m, resultVal, d = arguments[2];
m = (r2.split(".")[1] ? r2.split(".")[1].length : 0) - (r1.split(".")[1] ? r1.split(".")[1].length : 0);
resultVal = Number(r1.replace(".", "")) / Number(r2.replace(".", "")) * Math.pow(10, m);
return typeof d !== "number" ? Number(resultVal) : Number(resultVal.toFixed(parseInt(d)));
}