tm-drawer show替换

This commit is contained in:
张 元山 2025-03-20 15:29:17 +08:00
parent 9e8e3aeba3
commit 4f66ff8b1d
6 changed files with 84 additions and 86 deletions

2
components.d.ts vendored
View File

@ -30,8 +30,6 @@ 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']

View File

@ -331,7 +331,7 @@
<div class="content-placeholder"></div>
<tm-drawer
placement="bottom"
v-model:show="state.showWin"
v-model:visibleShow="state.showWin"
:hideHeader="true"
:height="416"
:round="6"
@ -363,7 +363,7 @@
</ZPaging>
<tm-drawer
placement="bottom"
v-model:show="state.isShowMentionSelect"
v-model:visibleShow="state.isShowMentionSelect"
:hideHeader="true"
:round="5"
:height="state.mentionSelectHeight"

View File

@ -33,7 +33,7 @@
<div class="flex items-center ml-[48rpx]">
<image
class="w-[72rpx] h-[72rpx]"
style="border-radius: 50%;"
style="border-radius: 50%"
:src="userStore.avatar"
mode="scaleToFill"
/>
@ -47,7 +47,7 @@
<tm-popover position="br" color="#333333" :width="260">
<image
class="w-[48rpx] h-[48rpx]"
style="border-radius: 50%;"
style="border-radius: 50%"
:src="addCircle"
mode="scaleToFill"
/>
@ -120,32 +120,32 @@
</div>
</template>
<script setup>
import customInput from '@/components/custom-input/custom-input.vue'
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'
import cahtPopover from '@/static/image/chatList/cahtPopover.png'
import zu3289 from '@/static/image/chatList/zu3289@2x.png'
import ZPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue'
import { handleSetWebviewStyle } from '@/utils/common'
const paging = ref()
const isEmptyViewShow = ref(false)
const talkStore = useTalkStore()
const userStore = useUserStore()
const dialogueStore = useDialogueStore()
const { userInfo } = useAuth()
import customInput from "@/components/custom-input/custom-input.vue";
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";
import cahtPopover from "@/static/image/chatList/cahtPopover.png";
import zu3289 from "@/static/image/chatList/zu3289@2x.png";
import ZPaging from "@/uni_modules/z-paging/components/z-paging/z-paging.vue";
import { handleSetWebviewStyle } from "@/utils/common";
const paging = ref();
const isEmptyViewShow = ref(false);
const talkStore = useTalkStore();
const userStore = useUserStore();
const dialogueStore = useDialogueStore();
const { userInfo } = useAuth();
const topItems = computed(() => talkStore.topItems)
const items = computed(() => {
const items = ref([]);
const calcitems = computed(() => {
// if (searchKeyword.value.length === 0) {
console.log(talkStore.talkItems)
return talkStore.talkItems
console.log(talkStore.talkItems);
items.value = JSON.parse(JSON.stringify(talkStore.talkItems));
return talkStore.talkItems;
// }
// return talkStore.talkItems.filter((item) => {
@ -153,59 +153,59 @@ const items = computed(() => {
// return keyword.toLowerCase().indexOf(searchKeyword.value.toLowerCase()) != -1
// })
})
});
const queryList = (pageNo, pageSize) => {
// paging.value.complete(res.data.list);
console.log(talkStore)
console.log(talkStore);
talkStore
.loadTalkList()
.then(() => {
isEmptyViewShow.value = talkStore.talkItems.length === 0
isEmptyViewShow.value = talkStore.talkItems.length === 0;
//
paging.value.complete(talkStore.talkItems)
paging.value.complete(talkStore.talkItems);
})
.catch((error) => {
//
console.error('加载失败', error)
paging.value.complete(false)
})
}
console.error("加载失败", error);
paging.value.complete(false);
});
};
//
const onRefresh = () => {
console.log('触发下拉刷新')
console.log("触发下拉刷新");
talkStore
.loadTalkList()
.then(() => {
//
paging.value.complete(talkStore.talkItems)
paging.value.complete(talkStore.talkItems);
})
.catch((error) => {
//
console.error('加载失败', error)
paging.value.complete(false)
})
}
console.error("加载失败", error);
paging.value.complete(false);
});
};
const creatGroupChat = () => {
uni.navigateTo({
url: '/pages/creatGroupChat/index',
})
}
url: "/pages/creatGroupChat/index",
});
};
const toSearchPage = () => {
uni.navigateTo({
url: '/pages/search/index',
})
}
url: "/pages/search/index",
});
};
//
const toAddressBookPage = () => {
uni.navigateTo({
url: '/pages/chooseByDeps/index?chooseMode=3',
})
}
url: "/pages/chooseByDeps/index?chooseMode=3",
});
};
/* watch(
() => talkStore,
@ -216,30 +216,30 @@ const toAddressBookPage = () => {
); */
onShow(() => {
handleSetWebviewStyle(true)
handleSetWebviewStyle(true);
//
talkStore
.loadTalkList()
.then(() => {
// paging
if (paging.value) {
paging.value.reload()
paging.value.reload();
}
})
.catch((error) => {
console.error('页面显示时数据加载失败', error)
})
})
console.error("页面显示时数据加载失败", error);
});
});
onLoad((options) => {
console.log(options)
console.log(options);
if (options?.openSessionIndexName) {
if (items?.value?.length > 0) {
items.value.forEach((openSession) => {
if (openSession.index_name === options?.openSessionIndexName) {
setTimeout(() => {
dialogueStore.setDialogue(openSession)
dialogueStore.setDialogue(openSession);
if (openSession.unread_num > 0) {
ServeClearTalkUnreadNum({
talk_type: openSession.talk_type,
@ -248,24 +248,24 @@ onLoad((options) => {
talkStore.updateItem({
index_name: openSession.index_name,
unread_num: 0,
})
})
});
});
}
uni.navigateTo({
url: `/pages/dialog/index?sessionId=${openSession.id}`,
})
}, 500)
});
}, 500);
}
})
});
}
}
})
});
</script>
<style scoped lang="scss">
uni-page-body,
page {
height: 100vh;
background-image: url('@/static/image/clockIn/z3280@3x.png');
background-image: url("@/static/image/clockIn/z3280@3x.png");
background-size: cover;
flex-direction: column;
}

View File

@ -4,8 +4,8 @@ import { userInfoApi } from "@/api/user";
import {ref} from 'vue'
export const useAuth = createGlobalState(() => {
const token = useStorage('token', '', uniStorage)
// const token = ref("79b5c732d96d2b27a48a99dfd4a5566c43aaa5796242e854ebe3ffc198d6876b9628e7b764d9af65ab5dbb2d517ced88170491b74b048c0ba827c0d3741462cb89dc59ed46653a449af837a8262941caaef1334d640773710f8cd96473bacfb190cba595a5d6a9c87d70f0999a3ebb41147213b31b4bdccffca66a56acf3baab5af0154f0dce360079f37709f78e13711036899344bddb0fb4cf0f2890287cb62c3fcbe33368caa5e213624577be8b8420ab75b1f50775ee16142a4321c5d56995f37354a66a969da98d95ba6e65d142ed097e04b411c1ebad2f62866d0ec7e1838420530a9941dbbcd00490199f8b899eade812a32201a0a025612a7615c43b1ac91d78661c4e9b7d0ca9701e2ea152073ff929e2cc3f2f29c1934a8873a44886758d3cf16439dfda105c00c3c2e0d8748163a63ce7ce8e44f599b42a89d2b6")
// const token = useStorage('token', '', uniStorage)
const token = ref("b66054d4f8a80fd93f603224e16999b7ff9db376a89af5919c99bc45a9c00e760163364c3ef3cd2e1370a90dcac5a68d1af25895841dbe71069a9f4f90445b494b35958bb588441f74cf15932a73ef5f379871fc884982e36a72d3cdc83ad96e085288eecb0df88982aa30cb76469d404f210abe0283e52f2e1b602dfb88a0bb23acaf249ea2aef4b58f4ccaa2ca73dd62be30396431982303995e77d9a0fff14a1c3b27407c19c890687b9a0721ac3d1405981d69f3da64edb0923f73be7ed239757c031c02f8df2c3daa7ffff11bf8e0de37dd627730a14a919bd8c57fca4e8f2d5c6f6f416390fafb030830f2d94a4d62b0b1ba75404c2614491763227f12db5e2abea5f4f82f650e440e4deb5949b23f2eeeb4db28580c5b3483ab5492a161e88f4dd9c2e6ab0d8a73293ba64c5ac594fed6b7c1979cde39ec5f75509b8f")
const refreshToken = useStorage('refreshToken', '', uniStorage)
const userInfo = useStorage('userInfo', {}, uniStorage)
const leaderList = useStorage('leaderList', [], uniStorage)

View File

@ -21,7 +21,7 @@
:align="align_rp"
:teleport="props.teleport"
:overlayClick="false"
v-model:show="_show"
:visibleShow="_show"
>
<tm-translate
:reverse="reverse_rp"
@ -139,7 +139,7 @@ const props = defineProps({
type: String,
default: 'bottom' //top|left|right|bottom|center
},
show: {
visibleShow: {
type: [Boolean],
default: false
},
@ -251,7 +251,7 @@ const props = defineProps({
default: null
}
})
const emits = defineEmits(['click', 'open', 'close', 'update:show', 'ok', 'cancel'])
const emits = defineEmits(['click', 'open', 'close', 'update:visibleShow', 'ok', 'cancel'])
const proxy = getCurrentInstance()?.proxy ?? null
const sysinfo = useWindowInfo();
//
@ -271,7 +271,7 @@ let timerId: any = NaN
let timerIdth: any = NaN
let timerIdth_flas = false
uni.hideKeyboard()
let _show = ref(props.show)
let _show = ref(props.visibleShow)
const isPlaying = ref(false)
function debounce(func: Function, wait = 500, immediate = false) {
//
@ -319,7 +319,7 @@ if (_show.value) {
reverse.value = false
}
watch(
() => props.show,
() => props.visibleShow,
(val) => {
if (val) {
reverse.value = true
@ -327,13 +327,13 @@ watch(
reverse.value = false
overlayAni.value?.close()
}
if (_show.value !== props.show) {
if (_show.value !== props.visibleShow) {
nextTick(() => {
drawerANI.value?.play()
isPlaying.value=true;
})
}
_show.value = props.show
_show.value = props.visibleShow
}
)
onMounted(() => {
@ -452,13 +452,13 @@ function OverLayOpen() {
_beforeOpenFun()
_show.value = true
emits('open')
emits('update:show', true)
emits('update:visibleShow', true)
}
function overclose() {
nextTick(() => {
_show.value = false
emits('close')
emits('update:show', false)
emits('update:visibleShow', false)
})
}
async function overlayClickFun(e: Event) {

View File

@ -117,7 +117,7 @@ const props = defineProps({
type: [Number, String],
default: 999,
},
show: {
visibleShow: {
type: Boolean,
default: false,
},
@ -148,7 +148,7 @@ const props = defineProps({
default: true,
},
});
const emits = defineEmits(["click", "open", "close", "update:show"]);
const emits = defineEmits(["click", "open", "close", "update:visibleShow"]);
const proxy = getCurrentInstance()?.proxy ?? null;
//
const customCSSStyle = computedStyle(props);
@ -179,8 +179,8 @@ isNvue.value = true;
// #endif
let parent: any = null;
onMounted(() => {
if (!props.show) return;
open(props.show);
if (!props.visibleShow) return;
open(props.visibleShow);
});
function throttle(func: Function, wait = 500, immediate = true) {
@ -269,7 +269,7 @@ function fadeInNvue(off: boolean = false) {
() => {
showMask.value = off;
emits("close");
emits("update:show", false);
emits("update:visibleShow", false);
// isAniing.vale = false;
}
);
@ -305,7 +305,7 @@ function fadeInVue(off = false) {
setTimeout(function () {
showMask.value = off;
emits("close");
emits("update:show", false);
emits("update:visibleShow", false);
}, props.duration + 10);
} else {
showMask.value = true;
@ -314,7 +314,7 @@ function fadeInVue(off = false) {
}, 10);
emits("open");
setTimeout(function () {
emits("update:show", true);
emits("update:visibleShow", true);
}, props.duration);
}
},
@ -323,7 +323,7 @@ function fadeInVue(off = false) {
);
}
watch(
() => props.show,
() => props.visibleShow,
(newval) => {
open(newval);
}