mirror of
https://github.com/jeecgboot/jeecg-uniapp.git
synced 2025-10-13 21:50:23 +00:00
导航组件bug修复及聊天数据停用mock
This commit is contained in:
2
env/.env
vendored
2
env/.env
vendored
@@ -26,4 +26,4 @@ VITE_APP_PROXY= true
|
|||||||
VITE_APP_PROXY_PREFIX = '/api'
|
VITE_APP_PROXY_PREFIX = '/api'
|
||||||
|
|
||||||
# 是否启用mock (1.仅支持h5 2.启用必须要开启代理,否则生效。)
|
# 是否启用mock (1.仅支持h5 2.启用必须要开启代理,否则生效。)
|
||||||
VITE_USE_MOCK = true
|
VITE_USE_MOCK = false
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-if="isMp" #left>
|
<template v-if="isMp" #left>
|
||||||
<!-- 为了在小程序上美观 -->
|
<!-- 为了在小程序上美观 -->
|
||||||
<template v-if="$slots.navRight">
|
<template v-if="$slots.navRight && isShowNavRightTextMp">
|
||||||
<view class="btnGroup">
|
<view class="btnGroup">
|
||||||
<view class="left" @click.stop="handleClickLeft">{{ navLeftText }}</view>
|
<view class="left" @click.stop="handleClickLeft">{{ navLeftText }}</view>
|
||||||
<view class="right" @click.stop="() => emit('navRightMp')">{{ navRightTextMp }}</view>
|
<view class="right" @click.stop="() => emit('navRightMp')">{{ navRightTextMp }}</view>
|
||||||
@@ -57,6 +57,7 @@ import { useSlots } from 'vue'
|
|||||||
import { useRouter } from '@/plugin/uni-mini-router'
|
import { useRouter } from '@/plugin/uni-mini-router'
|
||||||
import { useParamsStore } from '@/store/page-params'
|
import { useParamsStore } from '@/store/page-params'
|
||||||
import { isMp } from '@/utils/platform'
|
import { isMp } from '@/utils/platform'
|
||||||
|
// const isMp = true
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'pageLayout',
|
name: 'pageLayout',
|
||||||
options: {
|
options: {
|
||||||
@@ -120,6 +121,11 @@ const props = defineProps({
|
|||||||
typeof: String,
|
typeof: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
// 当有右侧有slot时,在小程序上不显示slot,显示文字 (默认显示)
|
||||||
|
isShowNavRightTextMp: {
|
||||||
|
typeof: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
// 当有右侧有slot时,在小程序上不显示slot,显示文字
|
// 当有右侧有slot时,在小程序上不显示slot,显示文字
|
||||||
navRightTextMp: {
|
navRightTextMp: {
|
||||||
typeof: String,
|
typeof: String,
|
||||||
|
@@ -30,17 +30,10 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template #bottom>
|
<template #bottom>
|
||||||
<chat-input-bar ref="inputBar" @send="doSend" @image="handleImage" />
|
<chat-input-bar ref="inputBar" @send="doSend" />
|
||||||
</template>
|
</template>
|
||||||
</z-paging>
|
</z-paging>
|
||||||
</view>
|
</view>
|
||||||
<template #navRight>
|
|
||||||
<view
|
|
||||||
v-if="['group', 'discussion'].includes(chatObj.type)"
|
|
||||||
class="cuIcon-friend font-size-16px color-white"
|
|
||||||
@click="handleGoChatSetting"
|
|
||||||
></view>
|
|
||||||
</template>
|
|
||||||
</PageLayout>
|
</PageLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -143,8 +136,8 @@ const creatFriendSession = (userId) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const onSocketOpen = () => {
|
const onSocketOpen = () => {
|
||||||
console.log('启动webSocket')
|
// console.log('启动webSocket')
|
||||||
socket.init('eoaNewChatSocket')
|
// socket.init('eoaNewChatSocket')
|
||||||
}
|
}
|
||||||
const onSocketReceive = () => {
|
const onSocketReceive = () => {
|
||||||
var _this = this
|
var _this = this
|
||||||
@@ -219,23 +212,134 @@ const queryList = (pageNo, pageSize) => {
|
|||||||
// sort: 'DESC',
|
// sort: 'DESC',
|
||||||
}
|
}
|
||||||
console.log('params', params)
|
console.log('params', params)
|
||||||
http
|
const data = [
|
||||||
.get(api.chatlog, params)
|
{
|
||||||
.then((res: any) => {
|
id: 1,
|
||||||
if (res.success && res.result?.records) {
|
fromUserName: '顾平',
|
||||||
const records = analysis(res.result.records)
|
sendTime: '1977-11-13',
|
||||||
paging.value.complete(records)
|
fromAvatar: 'https://dummyimage.com/100x100/000/fff&text=%E6%9D%8E%E5%9B%9B',
|
||||||
if (isFirstLoad) {
|
type: 'friend',
|
||||||
uni.$emit('chatList:unreadClear', chatItemData)
|
izTop: 1,
|
||||||
unreadClear()
|
status: 'offline',
|
||||||
}
|
msgFrom: 4000,
|
||||||
} else {
|
msgTo: 100,
|
||||||
paging.value.complete(false)
|
userId: '1678948772039729154',
|
||||||
}
|
msgType: 'text',
|
||||||
})
|
msgData:
|
||||||
.catch((res) => {
|
'可半达办外将物起算置知空子。上题务点条界思清法导集马为和计。始在形计各强可求开去手先下识极级育专。形子民委想己给号全维精道应。斯适般不拉个世被资提达须之多关。己除约确元则次同风平维音毛听。少验且内果论治量军们活展观情面元越。',
|
||||||
paging.value.complete(false)
|
},
|
||||||
})
|
{
|
||||||
|
id: 2,
|
||||||
|
fromUserName: '熊艳',
|
||||||
|
sendTime: '1977-11-13',
|
||||||
|
fromAvatar: 'https://dummyimage.com/100x100/000/fff&text=%E6%9D%8E%E5%9B%9B',
|
||||||
|
type: 'friend',
|
||||||
|
izTop: 0,
|
||||||
|
status: 'online',
|
||||||
|
msgFrom: 4012,
|
||||||
|
msgTo: 134,
|
||||||
|
userId: '1678948772039729154',
|
||||||
|
msgType: 'text',
|
||||||
|
msgData:
|
||||||
|
'斗取写也展需会于儿次只三自到界民品因。只代装细打三管规这前千器她她入音即准。必象和长使南资几时明因米多交极须空。',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
fromUserName: '康娜',
|
||||||
|
sendTime: '1977-11-13',
|
||||||
|
fromAvatar: 'https://dummyimage.com/100x100/000/fff&text=%E6%9D%8E%E5%9B%9B',
|
||||||
|
type: 'discussion',
|
||||||
|
izTop: 1,
|
||||||
|
status: 'offline',
|
||||||
|
msgFrom: 4024,
|
||||||
|
msgTo: 168,
|
||||||
|
userId: '1678948772039729154',
|
||||||
|
msgType: 'text',
|
||||||
|
msgData:
|
||||||
|
'图步把单增利老何列力道何认象。子各交群容产识一界边先式声。被思务共是圆音少际指王元压没任内共。养作包京何铁历属信战族再线理却来情料。能周内家术向建满思书温音太装。时她切调它论族温中三关且与志千。',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
fromUserName: '石平',
|
||||||
|
sendTime: '1977-11-13',
|
||||||
|
fromAvatar: 'https://dummyimage.com/100x100/000/fff&text=%E6%9D%8E%E5%9B%9B',
|
||||||
|
type: 'group',
|
||||||
|
izTop: 1,
|
||||||
|
status: 'offline',
|
||||||
|
msgFrom: 4036,
|
||||||
|
msgTo: 202,
|
||||||
|
userId: '1678948772039729154',
|
||||||
|
msgType: 'text',
|
||||||
|
msgData:
|
||||||
|
'民高价般直素划达期矿身更价律或支今。争局便工争相算则参调信斯。把清得完别青院阶火老先位包回速变。意温太合为这来物只我非象专型又加军。至取拉方毛眼例着大你这每相亲该元风。',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
fromUserName: '马杰',
|
||||||
|
sendTime: '1977-11-13',
|
||||||
|
fromAvatar: 'https://dummyimage.com/100x100/000/fff&text=%E6%9D%8E%E5%9B%9B',
|
||||||
|
type: 'group',
|
||||||
|
izTop: 1,
|
||||||
|
status: 'offline',
|
||||||
|
msgFrom: 4048,
|
||||||
|
msgTo: 236,
|
||||||
|
userId: '1678948772039729154',
|
||||||
|
msgType: 'text',
|
||||||
|
msgData:
|
||||||
|
'除命市与命成型两口接在及民志提能。需参处空容感学长革段易给分。始真结红型图处技界党非青机山。广直声从老照如写中么省风但。论斗展就积信区北形大报达据把青要。',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 6,
|
||||||
|
fromUserName: '沈艳',
|
||||||
|
sendTime: '1977-11-13',
|
||||||
|
fromAvatar: 'https://dummyimage.com/100x100/000/fff&text=%E6%9D%8E%E5%9B%9B',
|
||||||
|
type: 'friend',
|
||||||
|
izTop: 0,
|
||||||
|
status: 'offline',
|
||||||
|
msgFrom: 4060,
|
||||||
|
msgTo: 270,
|
||||||
|
userId: '1678948772039729154',
|
||||||
|
msgType: 'text',
|
||||||
|
msgData:
|
||||||
|
'规响用其江众器老也成等听节电西。系石教建还厂文气要际长中电今。情素他头资风矿象非这经格老包问过。史期带之走北形历值从所因断八技。红行没众说共史张在任千物今老。传队命做打此无直转术直其门公。',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 7,
|
||||||
|
fromUserName: '崔芳',
|
||||||
|
sendTime: '1977-11-13',
|
||||||
|
fromAvatar: 'https://dummyimage.com/100x100/000/fff&text=%E6%9D%8E%E5%9B%9B',
|
||||||
|
type: 'discussion',
|
||||||
|
izTop: 0,
|
||||||
|
status: 'online',
|
||||||
|
msgFrom: 4072,
|
||||||
|
msgTo: 304,
|
||||||
|
userId: '1678948772039729154',
|
||||||
|
msgType: 'text',
|
||||||
|
msgData:
|
||||||
|
'识保住并非先严间眼马级点叫识只管。写信为每下数集被料前号变很整合。收业后局看并太能决来二府展建片活即体。给史求音很三动作目重因质除提。法关活量管集求公又再时共小明个自确。集提支很也规入并我基照计最要飞院面。',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 8,
|
||||||
|
fromUserName: '郝超',
|
||||||
|
sendTime: '1977-11-13',
|
||||||
|
fromAvatar: 'https://dummyimage.com/100x100/000/fff&text=%E6%9D%8E%E5%9B%9B',
|
||||||
|
type: 'discussion',
|
||||||
|
izTop: 1,
|
||||||
|
status: 'online',
|
||||||
|
msgFrom: 4084,
|
||||||
|
msgTo: 338,
|
||||||
|
userId: '1678948772039729154',
|
||||||
|
msgType: 'text',
|
||||||
|
msgData:
|
||||||
|
'状断只派器新以真业强说部多确料。始矿认要联清才权况况法色式。引办研角且百国路里还计走中细位。或温作经人周复技常位交文共没运。',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
const records = analysis(data)
|
||||||
|
paging.value.complete(records)
|
||||||
|
if (isFirstLoad) {
|
||||||
|
uni.$emit('chatList:unreadClear', chatItemData)
|
||||||
|
unreadClear()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const analysis = (data) => {
|
const analysis = (data) => {
|
||||||
let arr = data
|
let arr = data
|
||||||
@@ -280,19 +384,7 @@ const handleReplyMsg = (item, list) => {
|
|||||||
item.replyContent = replyContent
|
item.replyContent = replyContent
|
||||||
return item
|
return item
|
||||||
}
|
}
|
||||||
const unreadClear = () => {
|
const unreadClear = () => {}
|
||||||
http
|
|
||||||
.post('/eoa/im/newApi/unreadClear', {
|
|
||||||
type: chatObj.value.type,
|
|
||||||
msgTo: chatObj.value.msgTo,
|
|
||||||
msgFrom: chatObj.value.msgFrom,
|
|
||||||
})
|
|
||||||
.then((res: any) => {
|
|
||||||
if (res.success) {
|
|
||||||
// _this.eventChannel.emit('toPrePageData', { data: 'data from chat page' })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// 播放语音
|
// 播放语音
|
||||||
const handlePlayVoice = (item) => {
|
const handlePlayVoice = (item) => {
|
||||||
if (item.id == playMsgid.value) {
|
if (item.id == playMsgid.value) {
|
||||||
@@ -361,12 +453,12 @@ const sendMsg = (content, type) => {
|
|||||||
text: content,
|
text: content,
|
||||||
msgType: 'text',
|
msgType: 'text',
|
||||||
}
|
}
|
||||||
http.post(api.sendMsg, params).then((res: any) => {
|
// http.post(api.sendMsg, params).then((res: any) => {
|
||||||
console.log('消息发送结果:', res)
|
// console.log('消息发送结果:', res)
|
||||||
if (!res.success) {
|
// if (!res.success) {
|
||||||
toast.error(res.message)
|
// toast.error(res.message)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleImage = (type) => {
|
const handleImage = (type) => {
|
||||||
@@ -443,7 +535,7 @@ onMounted(() => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
socket?.closeSocket()
|
// socket?.closeSocket()
|
||||||
uni.$off('chat:updateTile')
|
uni.$off('chat:updateTile')
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@@ -107,7 +107,7 @@ const router = useRouter()
|
|||||||
const paging = ref(null)
|
const paging = ref(null)
|
||||||
const dataList = ref([])
|
const dataList = ref([])
|
||||||
const starFlag = ref('')
|
const starFlag = ref('')
|
||||||
const conditionFilter = reactive({ show: true })
|
const conditionFilter = reactive({ show: false })
|
||||||
const backRouteName = ref('index')
|
const backRouteName = ref('index')
|
||||||
const routeMethod = ref('pushTab')
|
const routeMethod = ref('pushTab')
|
||||||
// 开始时间结束时间
|
// 开始时间结束时间
|
||||||
|
@@ -89,24 +89,114 @@ const bottomOperatePopup = reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const queryList = () => {
|
const queryList = () => {
|
||||||
http
|
const data = [
|
||||||
.get('/eoa/im/newApi/getChatList')
|
{
|
||||||
.then((res: any) => {
|
id: 1,
|
||||||
if (res.success) {
|
fromUserName: '廖秀兰',
|
||||||
paging.value.complete(res.result.logVoList)
|
sendTime: '2018-12-08',
|
||||||
nextTick(() => {
|
type: 'discussion',
|
||||||
setTimeout(() => {
|
izTop: 0,
|
||||||
sortByIzTop(dataList.value)
|
status: 'offline',
|
||||||
dataList.value = [...dataList.value]
|
msgFrom: 4000,
|
||||||
}, 10)
|
msgTo: 100,
|
||||||
})
|
fromAvatar: 'https://random.imagecdn.app/100/100',
|
||||||
} else {
|
},
|
||||||
paging.value.complete(false)
|
{
|
||||||
}
|
id: 2,
|
||||||
})
|
fromUserName: '廖强',
|
||||||
.catch((res) => {
|
sendTime: '2018-12-08',
|
||||||
paging.value.complete(false)
|
type: 'discussion',
|
||||||
})
|
izTop: 1,
|
||||||
|
status: 'online',
|
||||||
|
msgFrom: 4012,
|
||||||
|
msgTo: 134,
|
||||||
|
fromAvatar: 'https://q1.qlogo.cn/g?b=qq&nk=190848757&s=100',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
fromUserName: '许强',
|
||||||
|
sendTime: '2018-12-08',
|
||||||
|
type: 'group',
|
||||||
|
izTop: 0,
|
||||||
|
status: 'online',
|
||||||
|
msgFrom: 4024,
|
||||||
|
msgTo: 168,
|
||||||
|
fromAvatar: 'https://dummyimage.com/100x100/f37b1d/fff&text=%E7%8E%8B%E4%BA%94',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
fromUserName: '孙静',
|
||||||
|
sendTime: '2018-12-08',
|
||||||
|
type: 'friend',
|
||||||
|
izTop: 1,
|
||||||
|
status: 'online',
|
||||||
|
msgFrom: 4036,
|
||||||
|
msgTo: 202,
|
||||||
|
fromAvatar: 'https://random.imagecdn.app/100/100',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
fromUserName: '白艳',
|
||||||
|
sendTime: '2018-12-08',
|
||||||
|
type: 'discussion',
|
||||||
|
izTop: 0,
|
||||||
|
status: 'offline',
|
||||||
|
msgFrom: 4048,
|
||||||
|
msgTo: 236,
|
||||||
|
fromAvatar: 'https://picsum.photos/100/100',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 6,
|
||||||
|
fromUserName: '尹芳',
|
||||||
|
sendTime: '2018-12-08',
|
||||||
|
type: 'discussion',
|
||||||
|
izTop: 0,
|
||||||
|
status: 'offline',
|
||||||
|
msgFrom: 4060,
|
||||||
|
msgTo: 270,
|
||||||
|
fromAvatar: 'https://q1.qlogo.cn/g?b=qq&nk=190848757&s=100',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 7,
|
||||||
|
fromUserName: '侯娜',
|
||||||
|
sendTime: '2018-12-08',
|
||||||
|
type: 'group',
|
||||||
|
izTop: 0,
|
||||||
|
status: 'offline',
|
||||||
|
msgFrom: 4072,
|
||||||
|
msgTo: 304,
|
||||||
|
fromAvatar: 'https://q1.qlogo.cn/g?b=qq&nk=190848757&s=100',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 8,
|
||||||
|
fromUserName: '邹涛',
|
||||||
|
sendTime: '2018-12-08',
|
||||||
|
type: 'group',
|
||||||
|
izTop: 0,
|
||||||
|
status: 'offline',
|
||||||
|
msgFrom: 4084,
|
||||||
|
msgTo: 338,
|
||||||
|
fromAvatar: 'https://dummyimage.com/100x100/59c7b8/fff&text=%E5%85%AD%E5%AD%90',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 9,
|
||||||
|
fromUserName: '吴洋',
|
||||||
|
sendTime: '2018-12-08',
|
||||||
|
type: 'discussion',
|
||||||
|
izTop: 0,
|
||||||
|
status: 'offline',
|
||||||
|
msgFrom: 4096,
|
||||||
|
msgTo: 372,
|
||||||
|
fromAvatar: 'https://random.imagecdn.app/100/100',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
paging.value.complete(data)
|
||||||
|
nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
sortByIzTop(dataList.value)
|
||||||
|
dataList.value = [...dataList.value]
|
||||||
|
}, 10)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
const sortByIzTop = (arr) => {
|
const sortByIzTop = (arr) => {
|
||||||
return arr.sort((a, b) => {
|
return arr.sort((a, b) => {
|
||||||
@@ -200,8 +290,8 @@ const handleGo = (item) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const onSocketOpen = () => {
|
const onSocketOpen = () => {
|
||||||
console.log('启动webSocket')
|
// console.log('启动webSocket')
|
||||||
socket.init('eoaNewChatSocket')
|
// socket.init('eoaNewChatSocket')
|
||||||
}
|
}
|
||||||
const onSocketReceive = () => {
|
const onSocketReceive = () => {
|
||||||
socket.acceptMessage = function (res) {
|
socket.acceptMessage = function (res) {
|
||||||
@@ -245,7 +335,7 @@ onShow(() => {
|
|||||||
onSocketReceive()
|
onSocketReceive()
|
||||||
})
|
})
|
||||||
onHide(() => {
|
onHide(() => {
|
||||||
socket?.closeSocket()
|
// socket?.closeSocket()
|
||||||
})
|
})
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
uni.$on('chatList:unreadClear', (chatItemData) => {
|
uni.$on('chatList:unreadClear', (chatItemData) => {
|
||||||
|
@@ -24,12 +24,6 @@
|
|||||||
<wd-tabs :customClass="getClass()" v-model="tabActive">
|
<wd-tabs :customClass="getClass()" v-model="tabActive">
|
||||||
<template v-for="(item, index) in tabList" :key="index">
|
<template v-for="(item, index) in tabList" :key="index">
|
||||||
<wd-tab :title="item.title" :name="item.key">
|
<wd-tab :title="item.title" :name="item.key">
|
||||||
<view class="flow" @click="handleGo">
|
|
||||||
<view class="content">
|
|
||||||
<view class="cuIcon-roundcheck"></view>
|
|
||||||
<view class="text">流程待办</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="mainContent">
|
<view class="mainContent">
|
||||||
<chatList v-if="item.key === '1'"></chatList>
|
<chatList v-if="item.key === '1'"></chatList>
|
||||||
<addressBookList v-if="item.key === '2'"></addressBookList>
|
<addressBookList v-if="item.key === '2'"></addressBookList>
|
||||||
|
Reference in New Issue
Block a user