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'] LoginMessage: typeof import('./src/components/talk/message/LoginMessage.vue')['default']
Message: typeof import('./src/components/x-message/message/index.vue')['default'] Message: typeof import('./src/components/x-message/message/index.vue')['default']
MixedMessage: typeof import('./src/components/talk/message/MixedMessage.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'] PageAnimation: typeof import('./src/components/page-animation/index.vue')['default']
RevokeMessage: typeof import('./src/components/talk/message/RevokeMessage.vue')['default'] RevokeMessage: typeof import('./src/components/talk/message/RevokeMessage.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']

View File

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

View File

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

View File

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

View File

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

View File

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