Merge branch 'xingyy'

# Conflicts:
#	src/utils/auth.js
This commit is contained in:
Phoenix 2025-05-20 14:26:58 +08:00
commit df80cd031e
22 changed files with 635 additions and 301 deletions

3
components.d.ts vendored
View File

@ -52,8 +52,6 @@ declare module 'vue' {
NAvatar: typeof import('naive-ui')['NAvatar']
NButton: typeof import('naive-ui')['NButton']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NDrawer: typeof import('naive-ui')['NDrawer']
NDrawerContent: typeof import('naive-ui')['NDrawerContent']
NEmpty: typeof import('naive-ui')['NEmpty']
NIcon: typeof import('naive-ui')['NIcon']
NImage: typeof import('naive-ui')['NImage']
@ -65,6 +63,7 @@ declare module 'vue' {
NPopover: typeof import('naive-ui')['NPopover']
NRadio: typeof import('naive-ui')['NRadio']
NSpin: typeof import('naive-ui')['NSpin']
NTag: typeof import('naive-ui')['NTag']
NVirtualList: typeof import('naive-ui')['NVirtualList']
RevokeMessage: typeof import('./src/components/talk/message/RevokeMessage.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']

View File

@ -62,7 +62,7 @@
"unocss": "0.58.0",
"unplugin-auto-import": "^19.2.0",
"unplugin-vue-components": "^28.5.0",
"vite": "^4.5.1",
"vite": "^6.3.5",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-vue-devtools": "^7.7.6",
"vue-tsc": "^1.8.25",

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@ IconProvider({
strokeLinejoin: 'bevel'
})
const { uid: showUserId, isShow: isShowUser } = useProvideUserModal()
const { uid: showUserId, isShow: isShowUser,euid } = useProvideUserModal()
const { getDarkTheme, getThemeOverride } = useThemeMode()
const userStore = useUserStore()
@ -94,6 +94,7 @@ useClickEvent()
<UserCardModal
v-model:show="isShowUser"
v-model:uid="showUserId"
:euid="euid"
@update-remark="onChangeRemark"
/>
</n-layout-content>

View File

@ -16,6 +16,7 @@
body,
html {
margin-right: 0!important;
height: 100%;
min-width: 500px;
color: #333;

View File

@ -1,8 +1,20 @@
<template>
<div class="relative">
<div class="avatar-module" :style="[customStyle, { background: avatar ? '#fff' : '' }]">
<img :src="avatar" v-if="avatar" />
<span v-else :style="customTextStyle">{{ text_avatar }}</span>
</div>
<div
v-if="[2,3,4].includes(groupType)&&showGroupType"
class="absolute border-2px border-solid rounded-3px bg-#fff flex justify-center items-center leading-none"
:style="[
groupLabelStyle,
`color:${labelColor.find(x=>x.group_type===groupType)?.color};border-color:${labelColor.find(x=>x.group_type===groupType)?.color}`
]"
>
{{ labelColor.find(x=>x.group_type===groupType)?.label }}
</div>
</div>
</template>
<script setup>
//
@ -11,13 +23,22 @@ import groupDepartment from '@/assets/image/groupDepartment.png'
import groupProject from '@/assets/image/groupProject.png'
import groupCompany from '@/assets/image/groupCompany.png'
import { computed, defineProps } from 'vue'
//1=2=3=4=/
const labelColor=[
{group_type:2,color:'#377EC6',label:'部门'},
{group_type:3,color:'#C1691C',label:'项目'},
{group_type:4,color:'#7A58DE',label:'公司'},
]
const props = defineProps({
mode: {
//1=2=
type: Number,
default: 0,
},
showGroupType:{
type:Boolean,
default:false
},
avatar: {
//
type: String,
@ -75,6 +96,34 @@ const text_avatar = computed(() => {
? props?.userName.slice(-2)
: props?.userName
})
//
const groupLabelStyle = computed(() => {
//
const avatarWidth = parseInt(props.customStyle.width) || 42
const avatarHeight = parseInt(props.customStyle.height) || 42
// 42px32px18px10px
const widthRatio = avatarWidth / 42
const heightRatio = avatarHeight / 42
//
const labelWidth = Math.round(32 * widthRatio)
const labelHeight = Math.round(18 * heightRatio)
const fontSize = Math.round(10 * widthRatio)
// top-28px
const topPosition = Math.round(28 * heightRatio)
return {
width: `${labelWidth}px`,
height: `${labelHeight}px`,
fontSize: `${fontSize}px`,
top: `${topPosition}px`,
left: '50%',
transform: 'translateX(-50%)'
}
})
</script>
<style lang="less" scoped>
.avatar-module {

View File

@ -159,6 +159,7 @@ const strokeDashoffset = computed(() =>
}
.file-name {
height: 50px;
color: #1A1A1A;
font-size: 14px;
word-break: break-word;

View File

@ -19,31 +19,31 @@ const props = defineProps<{
maxWidth?: Boolean
}>()
const img = (src: string, width = 200) => {
const info: any = getImageInfo(src)
// const img = (src: string, width = 200) => {
// const info: any = getImageInfo(src)
if (info.width == 0 || info.height == 0) {
return {}
}
// if (info.width == 0 || info.height == 0) {
// return {}
// }
if (info.height > 300) {
return {
height: '300px'
}
}
// if (info.height > 300) {
// return {
// height: '300px'
// }
// }
if (info.width < width) {
return {
width: `${info.width}px`,
height: `${info.height}px`
}
}
// if (info.width < width) {
// return {
// width: `${info.width}px`,
// height: `${info.height}px`
// }
// }
return {
width: width + 'px',
height: info.height / (info.width / width) + 'px'
}
}
// return {
// width: width + 'px',
// height: info.height / (info.width / width) + 'px'
// }
// }
const open = ref(false)
const isPaused = ref(false)
@ -64,18 +64,18 @@ const updatePauseStatus = () => {
//
updatePauseStatus()
//
watch(() => props.extra.percentage, (newVal: number | undefined) => {
// UI
// (-1)
if (newVal === -1) {
uploadFailed.value = true
//
message.error('视频发送失败,请点击红色感叹号重试')
} else if (newVal !== undefined && newVal > 0) {
uploadFailed.value = false
}
}, { immediate: true })
// //
// watch(() => props.extra.percentage, (newVal: number | undefined) => {
// // UI
// // (-1)
// if (newVal === -1) {
// uploadFailed.value = true
// //
// message.error('')
// } else if (newVal !== undefined && newVal > 0) {
// uploadFailed.value = false
// }
// }, { immediate: true })
async function onPlay() {
//
@ -116,17 +116,17 @@ function resumeUpload(e) {
}
//
function retryUpload(e) {
e.stopPropagation()
if (props.extra.upload_id) {
//
uploadFailed.value = false
// function retryUpload(e) {
// e.stopPropagation()
// if (props.extra.upload_id) {
// //
// uploadFailed.value = false
//
uploadsStore.resumeUpload(props.extra.upload_id)
message.success('正在重新上传视频...')
}
}
// //
// uploadsStore.resumeUpload(props.extra.upload_id)
// message.success('...')
// }
// }
</script>
<template>
<section

View File

@ -15,6 +15,7 @@ const { showUserInfoModal } = useInject()
<div class="sys-text">
<template v-for="(user, index) in extra.members" :key="index">
{{ data }}
<a @click="showUserInfoModal(user.user_id)">{{ user.nickname }}</a>
<em v-show="index < extra.members.length - 1"></em>
</template>

View File

@ -1,6 +1,6 @@
<script lang="ts" setup>
import { ref, computed, onMounted, watch } from 'vue'
import { ServeGetContacts } from '@/api/contact'
import { ServeGetTalkList } from '@/api/chat.js'
import { ServeGetGroups } from '@/api/group'
import XNModal from '@/components/x-naive-ui/x-n-modal/index.vue'
const emit = defineEmits(['close', 'on-submit'])
@ -26,7 +26,7 @@ const loadGroupStatus = ref(false)
//
const searchFilter = computed(() => {
return items.value.filter((item: Item) => {
return item.keyword.toLowerCase().includes(keywords.value.toLowerCase())
return item.name.toLowerCase().includes(keywords.value.toLowerCase())
})
})
@ -40,24 +40,19 @@ const isCanSubmit = computed(() => {
const onLoad = () => {
onLoadContact()
onLoadGroup()
// onLoadGroup()
}
const onLoadContact = () => {
loading.value = true
ServeGetContacts()
ServeGetTalkList()
.then((res) => {
if (res.code == 200) {
let list = res.data.items || []
items.value = list.map((item: any) => {
return {
id: item.id,
avatar: item.avatar,
type: 1,
name: item.remark || item.nickname,
keyword: (item.remark || '') + item.nickname,
remark: item.remark,
...item,
checked: false
}
})
@ -68,35 +63,35 @@ const onLoadContact = () => {
})
}
const onLoadGroup = async () => {
if (loadGroupStatus.value) {
return
}
// const onLoadGroup = async () => {
// if (loadGroupStatus.value) {
// return
// }
loading.value = true
let { code, data } = await ServeGetGroups()
if (code != 200) {
loading.value = false
return
}
// loading.value = true
// let { code, data } = await ServeGetGroups()
// if (code != 200) {
// loading.value = false
// return
// }
let list = data.items.map((item: any) => {
return {
id: item.id,
avatar: item.avatar,
type: 2,
name: item.group_name,
keyword: item.group_name,
remark: '',
checked: false
}
})
// let list = data.items.map((item: any) => {
// return {
// id: item.id,
// avatar: item.avatar,
// type: 2,
// name: item.group_name,
// keyword: item.group_name,
// remark: '',
// checked: false
// }
// })
items.value.push(...list)
// items.value.push(...list)
loading.value = false
loadGroupStatus.value = true
}
// loading.value = false
// loadGroupStatus.value = true
// }
const onMaskClick = () => {
emit('close')
@ -151,7 +146,13 @@ const changeSelectType = () => {
})
}
onLoad()
watch(()=>{
return isShowBox.value
},(newVal)=>{
if(newVal){
onLoad()
}
})
</script>
<template>
@ -183,7 +184,12 @@ onLoad()
<n-checkbox v-else :checked="item.checked" />
</div>
<div class="mr-10px">
<n-image class="w-42px h-42px rounded-full" :src="item.avatar" />
<avatarModule class="mr-10px" showGroupType :mode="item.talk_type"
:avatar="item.avatar"
:groupType="item.group_type"
:customStyle="{width:'42px',height:'42px'}"></avatarModule>
<!-- <n-image class="w-42px h-42px rounded-full" :src="item.avatar" /> -->
</div>
<div class="flex items-center">
<span class="text-ellipsis">{{ item.name }}</span>
@ -207,7 +213,10 @@ onLoad()
<template #default="{ item }">
<div class="flex items-center border-b-2px border-b-solid h-65px border-b-#FBFBFB pr-20px">
<div class="mr-10px">
<n-image class="w-42px h-42px rounded-full" :src="item.avatar" />
<avatarModule class="mr-10px" showGroupType :mode="item.talk_type"
:avatar="item.avatar"
:groupType="item.group_type"
:customStyle="{width:'42px',height:'42px'}"></avatarModule>
</div>
<div class="flex items-center">
<span class="text-ellipsis">{{ item.name }}</span>
@ -232,8 +241,12 @@ onLoad()
<div class="text-14px text-#999999 mb-23px">
<span>[{{ forwardMode === 2 ? '合并转发' : '逐条转发' }}]</span>
<span v-if="checkedFilter.length > 0">
{{ checkedFilter.map(item => item.name).join('、') }}的会话记录
</span>
{{
checkedFilter.length > 2
? checkedFilter.slice(0, 2).map(item => item.name).join('、') + ' 等'
: checkedFilter.map(item => item.name).join('、')
}}会话记录
</span>
<span v-else>请选择联系人</span>
</div>
<div class="flex justify-center items-center">

View File

@ -19,6 +19,10 @@ const props = defineProps({
uid: {
type: Number,
default: 0
},
euid: {
type: Number,
default: 0
}
})
@ -55,7 +59,7 @@ const options = ref<any>([])
const onLoadData = () => {
ServeSearchUser({
erp_user_id: props.uid
erp_user_id: props.euid
}).then(({ code, data }) => {
if (code == 200) {
userInfo.value = data

View File

@ -3,8 +3,8 @@ import { inject } from 'vue'
export function useInject() {
const user: any = inject('$user')
const showUserInfoModal = (uid: number) => {
user(uid)
const showUserInfoModal = (erp_userid:number,userid?: number,) => {
user(erp_userid,userid)
}
return { showUserInfoModal }

View File

@ -3,8 +3,9 @@ import { ref, provide } from 'vue'
export function useProvideUserModal() {
const isShow = ref(false)
const uid = ref(0)
const show = (id: number) => {
const euid=ref(0)
const show = (eid: number,id:number) => {
euid.value=eid
uid.value = id
isShow.value = true
}
@ -16,5 +17,5 @@ export function useProvideUserModal() {
provide('$user', show)
return { isShow, uid, show, close }
return { isShow, uid, show, close ,euid}
}

View File

@ -119,6 +119,8 @@ export function useSessionMenu() {
}
const onUserInfo = (item: ISession) => {
console.error('item',item)
debugger
user(item.receiver_id)
}

View File

@ -8,7 +8,10 @@ import router from './router'
import App from './App.vue'
import * as plugins from './plugins'
import request from "@/api/index.js";
if (window.__POWERED_BY_WUJIE__) {
// eslint-disable-next-line
window.__webpack_public_path__ = window.__WUJIE_PUBLIC_PATH__;
}
async function bootstrap() {
const app = createApp(App)

View File

@ -19,9 +19,11 @@ export const useDialogueStore = defineStore('dialogue', {
// 对话节点
talk: {
avatar:'',
username: '',
talk_type: 0, // 对话来源[1:私聊;2:群聊]
receiver_id: 0
receiver_id: 0,
group_type:0
},
// 好友是否正在输入文字
@ -73,11 +75,15 @@ export const useDialogueStore = defineStore('dialogue', {
// 更新对话信息
setDialogue(data = {}) {
console.log('data',data)
this.online = data.is_online == 1
this.talk = {
username: data.remark || data.name,
talk_type: data.talk_type,
receiver_id: data.receiver_id
receiver_id: data.receiver_id,
avatar:data.avatar,
group_type:data.group_type
}
this.index_name = `${data.talk_type}_${data.receiver_id}`

View File

@ -18,7 +18,7 @@ export function isLoggedIn() {
*/
export function getAccessToken() {
// return storage.get(AccessToken) || ''
return JSON.parse(localStorage.getItem('token'))||'79b5c732d96d2b27a48a99dfd4a5566c43aaa5796242e854ebe3ffc198d6876b9628e7b764d9af65ab5dbb2d517ced88170491b74b048c0ba827c0d3741462cb89dc59ed46653a449af837a8262941caaef1334d640773710f8cd96473bacfb190cba595a5d6a9c87d70f0999a3ebb41147213b31b4bdccffca66a56acf3baab5af0154f0dce360079f37709f78e13711036899344bddb0fb4cf0f2890287cb62c3fcbe33368caa5e213624577be8b8420ab75b1f50775ee16142a4321c5d56995f37354a66a969da98d95ba6e65d142ed097e04b411c1ebad2f62866d0ec7e1838420530a9941dbbcd00490199f8b8962d32ca9acda2e80272e2558c2a366762349b830b666ec5fa17a2d4304de907fc1e15f4bef1a68f350975080df1c9577b69543e38d63124a06b7b2218b126be05c2669b3dcdb9c8a30daf38c781bfb6a'
return JSON.parse(localStorage.getItem('token'))||'46d71a72d8d845ad7ed23eba9bdde260e635407190c2ce1bf7fd22088e41682ea07773ec65cae8946d2003f264d55961f96e0fc5da10eb96d3a348c1664e9644ce2108c311309f398ae8ea1b8200bfd490e5cb6e8c52c9e5d493cbabb163368f8351420451a631dbfa749829ee4cda49b77b5ed2d3dced5d0f2b7dd9ee76ba5465c84a17c23af040cd92b6b2a4ea48befbb5c729dcdad0a9c9668befe84074cc24f78899c1d947f8e7f94c7eda5325b8ed698df729e76febb98549ef3482ae942fb4f4a1c92d21836fa784728f0c5483aab2760a991b6b36e6b10c84f840a6433a6ecc31dee36e8f1c6158818bc89d22b9b32c043123b3db4f35a7a79e1bbe97875bfa18428a4f5ed561887bfbfcab3bd61f2f9348af8bdb89da8c35a7a681fe828af1502b58ebc4ffb99f28fe91d5ba4b0245d1eb24a5ccda9be0cd9bef4d01'
}
/**

View File

@ -14,6 +14,7 @@ import historyRecord from '@/components/search/searchByCondition.vue'
const userStore = useUserStore()
const dialogueStore = useDialogueStore()
const uploadsStore = useUploadsStore()
console.log('dialogueStore',dialogueStore);
const members = computed(() => dialogueStore.members)
const isShowEditor = computed(() => dialogueStore.isShowEditor)
@ -27,7 +28,8 @@ const talkParams = reactive({
username: computed(() => dialogueStore.talk.username),
online: computed(() => dialogueStore.online),
keyboard: computed(() => dialogueStore.keyboard),
num: computed(() => dialogueStore.members.length)
num: computed(() => dialogueStore.members.length),
avatar:computed(() => dialogueStore.talk.avatar)
})
const state = reactive({
@ -88,12 +90,14 @@ const changeConditionTag = (tag) => {
<section id="drawer-container" class="el-container is-vertical">
<!-- 头部区域 -->
<header class="el-header bdr-b">
<PanelHeader
:type="talkParams.type"
:username="talkParams.username"
:online="talkParams.online"
:keyboard="talkParams.keyboard"
:num="talkParams.num"
:avatar="talkParams.avatar"
@evnet="onPanelHeaderEvent"
/>
</header>

View File

@ -268,9 +268,6 @@ const items = computed((): ISession[] => {
return keyword.toLowerCase().indexOf(searchKeyword.value.toLowerCase()) != -1
})
})
setTimeout(() => {
console.log('items.value', items.value)
}, 1000)
watch(
() => talkStore,
(newValue, oldValue) => {
@ -331,6 +328,8 @@ const indexName = computed(() => dialogueStore.index_name)
//
const onTabTalk = (item: ISession, follow = false) => {
console.log('onTabTalk');
if (item.index_name === indexName.value) return
searchKeyword.value = ''
@ -708,7 +707,7 @@ const handleRecordDetailLastIdChange = (last_id, last_group_id, last_member_id)
</header> -->
<!-- 标题栏目 -->
<header
<!-- <header
v-show="loadStatus == 3 && talkStore.talkItems.length > 0"
class="el-header header-badge"
:class="{ shadow: false }"
@ -717,7 +716,7 @@ const handleRecordDetailLastIdChange = (last_id, last_group_id, last_member_id)
<p>
<span class="badge unread" v-show="unreadNum">{{ unreadNum }}未读</span>
</p>
</header>
</header> -->
<main id="talk-session-list" class="el-main me-scrollbar me-scrollbar-thumb">
<template v-if="loadStatus == 2"><Skeleton /></template>

View File

@ -22,11 +22,11 @@ const labelColor=[
<div class="talk pointer" :class="{ actived: active }" @click="emit('tab-talk', data)">
<div class="avatar-box relative">
<avatarModule :mode="data?.group_type === 0 ? 1 : 2"
<avatarModule showGroupType :mode="data?.group_type === 0 ? 1 : 2"
:avatar="data?.avatar"
:groupType="data?.group_type"
:userName="data?.name" :customStyle="{width:'42px',height:'42px'}"></avatarModule>
<div v-if="[2,3,4].includes(data.group_type)" class="absolute w-32px h-18px border-2px border-solid rounded-3px top-28px bg-#fff text-10px flex justify-center items-center leading-none" :style="`color:${labelColor.find(x=>x.group_type===data.group_type)?.color};border-color:${labelColor.find(x=>x.group_type===data.group_type)?.color}`">{{ labelColor.find(x=>x.group_type===data.group_type)?.label }}</div>
<!-- <div v-if="[2,3,4].includes(data.group_type)" class="absolute w-32px h-18px border-2px border-solid rounded-3px top-28px bg-#fff text-10px flex justify-center items-center leading-none" :style="`color:${labelColor.find(x=>x.group_type===data.group_type)?.color};border-color:${labelColor.find(x=>x.group_type===data.group_type)?.color}`">{{ labelColor.find(x=>x.group_type===data.group_type)?.label }}</div> -->
<!-- <im-avatar :src="avatar" :size="34" :username="data.name" /> -->
<!-- <div class="top-mask" @click.stop="emit('top-talk', data)">
<n-icon :component="data.is_top == 1 ? ArrowDown : ArrowUp" />

View File

@ -320,7 +320,7 @@ onMounted(() => {
<aside class="avatar-column">
<im-avatar class="pointer" :src="item.avatar" :size="42" :username="item.nickname"
@click="showUserInfoModal(item.erp_user_id)" />
@click="showUserInfoModal(item.erp_user_id,item.user_id)" />
</aside>
<!-- 主体信息 -->

View File

@ -19,6 +19,10 @@ defineProps({
type: Boolean,
default: false
},
avatar:{
type: String,
default: ''
},
num: {
type: Number,
default: 0
@ -35,20 +39,26 @@ const onSetMenu = () => {
<template>
<header class="el-header box-header">
<div class="menu bdr-r pointer" @click="onSetMenu">
<!-- <div class="menu bdr-r pointer" @click="onSetMenu">
<n-icon
:component="dialogueStore.isShowSessionList ? MenuUnfoldOne : MenuFoldOne"
:size="22"
/>
</div>
<div class="module left-module">
<span class="tag" :class="{ red: type == 1 }">
</div> -->
<div class="flex items-center">
<avatarModule class="mr-10px" :mode="dialogueStore.talk.talk_type"
:avatar="avatar"
:groupType="dialogueStore.talk?.group_type"
:userName="username" :customStyle="{width:'42px',height:'42px'}"></avatarModule>
<div class="module left-module">
<!-- <span class="tag" :class="{ red: type == 1 }">
{{ type == 1 ? '好友' : '群聊' }}
</span>
</span> -->
<span class="nickname">{{ username }}</span>
<span class="num" v-show="type == 2 && num">({{ num }})</span>
</div>
</div>
<div class="module center-module" v-if="type == 1">
<p class="online">
@ -105,8 +115,8 @@ const onSetMenu = () => {
}
.left-module {
padding-right: 5px;
padding-left: 50px;
// padding-right: 5px;
// padding-left: 50px;
.tag {
background: rgb(81 139 254);
@ -125,6 +135,7 @@ const onSetMenu = () => {
}
.nickname {
font-size: 14px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;