解决推送消息点击后,跳转页面读不出数据的问题
This commit is contained in:
parent
92a7d74c6c
commit
8034a303e7
2
components.d.ts
vendored
2
components.d.ts
vendored
@ -30,6 +30,8 @@ declare module 'vue' {
|
||||
LoginMessage: typeof import('./src/components/talk/message/LoginMessage.vue')['default']
|
||||
Message: typeof import('./src/components/x-message/message/index.vue')['default']
|
||||
MixedMessage: typeof import('./src/components/talk/message/MixedMessage.vue')['default']
|
||||
NButton: typeof import('naive-ui')['NButton']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
PageAnimation: typeof import('./src/components/page-animation/index.vue')['default']
|
||||
RevokeMessage: typeof import('./src/components/talk/message/RevokeMessage.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
|
@ -69,6 +69,7 @@ export function createApp() {
|
||||
window.openUniPushMsg = (msg) => {
|
||||
console.log("=====点击通知栏消息")
|
||||
let pushMsg = JSON.parse(decodeURIComponent(msg))
|
||||
console.log("=====pushMsg",pushMsg)
|
||||
//由于弹窗前处理了不该弹窗的场景,因此这里弹窗可以一并处理
|
||||
//也就是都跳转到聊天页面
|
||||
const talkStore = useTalkStore()
|
||||
|
@ -504,8 +504,7 @@ const toSearchByConditionPage = (flag) => {
|
||||
condition = 'link'
|
||||
}
|
||||
uni.navigateTo({
|
||||
url:
|
||||
'/pages/search/searchByCondition/index?condition=' + condition
|
||||
url: '/pages/search/searchByCondition/index?condition=' + condition,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -644,7 +643,8 @@ const toSearchPage = () => {
|
||||
'/pages/search/moreResult/moreResultDetail?talk_type=' +
|
||||
dialogueParams.type +
|
||||
'&receiver_id=' +
|
||||
dialogueParams.receiver_id,
|
||||
dialogueParams.receiver_id +
|
||||
'&hideFirstRecord=1',
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
@ -8,7 +8,11 @@
|
||||
<div class="avatarImg">
|
||||
<tm-badge
|
||||
:count="props.data.is_disturb === 1 ? props.data.unread_num : ''"
|
||||
:dot="props.data.is_disturb === 0 && props.data.unread_num"
|
||||
:dot="
|
||||
props.data.is_disturb === 0 && props.data.unread_num
|
||||
? true
|
||||
: false
|
||||
"
|
||||
:maxCount="99"
|
||||
class="badge"
|
||||
color="#D03050"
|
||||
@ -34,10 +38,13 @@
|
||||
<div class="chatInfo">
|
||||
<div class="chatInfo_1">
|
||||
<div class="name_center">
|
||||
<div class="text-[#000000] text-[32rpx]
|
||||
font-bold opacity-90 name_text">
|
||||
<div
|
||||
class="text-[#000000] text-[32rpx] font-bold opacity-90 name_text"
|
||||
>
|
||||
{{ formatNameText(props.data.name) }}
|
||||
<span v-if="props.data.talk_type === 2">({{props.data.group_member_num}})</span>
|
||||
<span v-if="props.data.talk_type === 2">
|
||||
({{ props.data.group_member_num }})
|
||||
</span>
|
||||
<span v-if="props.data.group_type === 2" class="depTag tag">
|
||||
部门
|
||||
</span>
|
||||
@ -48,9 +55,9 @@
|
||||
公司
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div style="flex-shrink: 0;"
|
||||
<div
|
||||
style="flex-shrink: 0;"
|
||||
class="text-[#000000] text-[28rpx] font-medium opacity-26 ml-[24rpx] time_right"
|
||||
>
|
||||
{{ beautifyTime(props.data.updated_at) }}
|
||||
@ -66,12 +73,12 @@
|
||||
<template #right>
|
||||
<div class="flex flex-row flex-row-center-end">
|
||||
<!-- 样式占位 -->
|
||||
<div style="width: 1px"></div>
|
||||
<div style="width: 1px;"></div>
|
||||
<div
|
||||
@click="handleTop"
|
||||
class="w-[156rpx] h-[154rpx] text-[#ffffff] bg-[#F09F1F] flex items-center justify-center"
|
||||
>
|
||||
{{ props.data.is_top === 1 ? "取消置顶" : "置顶" }}
|
||||
{{ props.data.is_top === 1 ? '取消置顶' : '置顶' }}
|
||||
</div>
|
||||
<div
|
||||
@click="handleDelete"
|
||||
@ -89,17 +96,17 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import avatarModule from "@/components/avatar-module/index.vue";
|
||||
import { ref, reactive, defineProps, computed } from "vue";
|
||||
import dayjs from "dayjs";
|
||||
import { beautifyTime } from "@/utils/datetime";
|
||||
import { ServeClearTalkUnreadNum } from "@/api/chat";
|
||||
import { useTalkStore, useDialogueStore } from "@/store";
|
||||
import { useSessionMenu } from "@/hooks";
|
||||
import avatarModule from '@/components/avatar-module/index.vue'
|
||||
import { ref, reactive, defineProps, computed } from 'vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { beautifyTime } from '@/utils/datetime'
|
||||
import { ServeClearTalkUnreadNum } from '@/api/chat'
|
||||
import { useTalkStore, useDialogueStore } from '@/store'
|
||||
import { useSessionMenu } from '@/hooks'
|
||||
|
||||
const talkStore = useTalkStore();
|
||||
const { onToTopTalk, onRemoveTalk } = useSessionMenu();
|
||||
const dialogueStore = useDialogueStore();
|
||||
const talkStore = useTalkStore()
|
||||
const { onToTopTalk, onRemoveTalk } = useSessionMenu()
|
||||
const dialogueStore = useDialogueStore()
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
@ -111,17 +118,17 @@ const props = defineProps({
|
||||
default: -1,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
// 添加格式化方法
|
||||
const formatNameText = (text, maxLength = 16) => {
|
||||
return text.length > maxLength ? `${text.slice(0, maxLength - 1)}...` : text;
|
||||
};
|
||||
return text.length > maxLength ? `${text.slice(0, maxLength - 1)}...` : text
|
||||
}
|
||||
|
||||
const cellClick = () => {
|
||||
console.log(props.data);
|
||||
console.log(props.data)
|
||||
// 更新编辑信息
|
||||
dialogueStore.setDialogue(props.data);
|
||||
dialogueStore.setDialogue(props.data)
|
||||
|
||||
// 清空消息未读数
|
||||
if (props.data.unread_num > 0) {
|
||||
@ -132,31 +139,31 @@ const cellClick = () => {
|
||||
talkStore.updateItem({
|
||||
index_name: props.data.index_name,
|
||||
unread_num: 0,
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/dialog/index?sessionId=${props.data.id}`,
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
const handleTop = () => {
|
||||
console.log(props.data, 1);
|
||||
onToTopTalk(props.data);
|
||||
};
|
||||
console.log(props.data, 1)
|
||||
onToTopTalk(props.data)
|
||||
}
|
||||
|
||||
//点击删除会话
|
||||
const handleDelete = () => {
|
||||
console.log(props.data);
|
||||
onRemoveTalk(props.data);
|
||||
};
|
||||
console.log(props.data)
|
||||
onRemoveTalk(props.data)
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .swipe_action {
|
||||
// border: 1px solid #fff;
|
||||
// transform: translate3d(1px, 0px, 0px) !important;
|
||||
}
|
||||
::v-deep .badge .round-6{
|
||||
::v-deep .badge .round-6 {
|
||||
min-width: 22rpx;
|
||||
min-height: 22rpx;
|
||||
}
|
||||
@ -194,7 +201,7 @@ const handleDelete = () => {
|
||||
font-size: 28rpx;
|
||||
color: rgba($color: #000000, $alpha: 0.4);
|
||||
}
|
||||
.tag{
|
||||
.tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
@ -220,11 +227,11 @@ const handleDelete = () => {
|
||||
border: 1px solid #c1681c;
|
||||
color: #c1681c;
|
||||
}
|
||||
.name_center{
|
||||
.name_center {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.name_text{
|
||||
.name_text {
|
||||
display: inline-block;
|
||||
max-height: 88rpx; // 两行文字的高度
|
||||
line-height: 44rpx;
|
||||
|
@ -125,6 +125,7 @@ import { ref, watch, computed } from 'vue'
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app'
|
||||
import { useChatList } from '@/store/chatList/index.js'
|
||||
import { useAuth } from '@/store/auth'
|
||||
import { ServeClearTalkUnreadNum } from '@/api/chat'
|
||||
import { useTalkStore, useUserStore, useDialogueStore } from '@/store'
|
||||
import chatItem from './components/chatItem.vue'
|
||||
import addCircle from '@/static/image/chatList/addCircle.png'
|
||||
@ -237,6 +238,7 @@ onLoad((options) => {
|
||||
if (items?.value?.length > 0) {
|
||||
items.value.forEach((openSession) => {
|
||||
if (openSession.index_name === options?.openSessionIndexName) {
|
||||
setTimeout(() => {
|
||||
dialogueStore.setDialogue(openSession)
|
||||
if (openSession.unread_num > 0) {
|
||||
ServeClearTalkUnreadNum({
|
||||
@ -252,6 +254,7 @@ onLoad((options) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/dialog/index?sessionId=${openSession.id}`,
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -36,7 +36,10 @@
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="search-record-detail" v-if="props.searchRecordDetail">
|
||||
<div
|
||||
class="search-record-detail"
|
||||
v-if="props.searchRecordDetail && !props?.hideFirstRecord"
|
||||
>
|
||||
<searchItem
|
||||
@click="
|
||||
clickSearchItem(
|
||||
@ -171,6 +174,10 @@ const props = defineProps({
|
||||
return {}
|
||||
},
|
||||
}, //接受者信息
|
||||
hideFirstRecord: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}, //是否隐藏前缀及搜索群/用户主体信息
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
@ -300,9 +307,9 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
|
||||
)
|
||||
let total = data.count
|
||||
if (props.searchRecordDetail) {
|
||||
if(state?.first_talk_record_infos?.talk_type === 1){
|
||||
if (state?.first_talk_record_infos?.talk_type === 1) {
|
||||
total = data.user_record_count
|
||||
} else if (state?.first_talk_record_infos?.talk_type === 2){
|
||||
} else if (state?.first_talk_record_infos?.talk_type === 2) {
|
||||
total = data.group_record_count
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
:apiRequest="ServeTalkRecord"
|
||||
:apiParams="state.apiParams"
|
||||
:searchText="state.searchText"
|
||||
:hideFirstRecord="state.hideFirstRecord"
|
||||
:isPagination="true"
|
||||
:searchRecordDetail="true"
|
||||
@lastIdChange="lastIdChange"
|
||||
@ -30,6 +31,7 @@ const state = reactive({
|
||||
apiParams: '',
|
||||
searchText: '',
|
||||
uid: computed(() => userStore.uid), //当前用户id
|
||||
hideFirstRecord: false, //是否隐藏前缀及搜索群/用户主体信息
|
||||
})
|
||||
|
||||
onLoad((options) => {
|
||||
@ -55,6 +57,10 @@ onLoad((options) => {
|
||||
}
|
||||
|
||||
console.log(JSON.parse(decodeURIComponent(state.apiParams)))
|
||||
|
||||
if (options.hideFirstRecord) {
|
||||
state.hideFirstRecord = options.hideFirstRecord === '1' ? true : false
|
||||
}
|
||||
})
|
||||
|
||||
//分页查询时,最后一条id变化
|
||||
@ -116,7 +122,7 @@ const clickSearchItem = (
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: '/pages/dialog/index?msgInfo=' + res,
|
||||
url: '/pages/dialog/index?msgInfo=' + res + '&keepDialogInfo=1',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user