chat-app/src/pages/index/index.vue

89 lines
2.3 KiB
Vue
Raw Normal View History

2024-11-19 05:57:36 +00:00
<template>
<div class="outer-layer">
<div>
2024-11-22 01:06:37 +00:00
<tm-navbar :hideBack="false" hideHome title="" :leftWidth="320" >
<template v-slot:left>
<div class="flex items-center ml-[48rpx]" >
<tm-image :width="72" :height="72" :round="12" :src="userStore.avatar"></tm-image>
<div class="ml-[24rpx] text-[36rpx] font-bold">{{ userStore.nickname }}</div>
</div>
</template>
<template v-slot:right>
<div class="mr-[48rpx]">
<tm-image :width="41" :height="41" :round="12" :src="addCircle"></tm-image>
</div>
</template>
</tm-navbar>
2024-11-19 05:57:36 +00:00
</div>
<div class="root">
<div class="searchRoot">
<tm-input placeholder="请输入…" color="#F9F9FD" :round="1" prefix="tmicon-search" prefixColor="#46299D" ></tm-input>
</div>
<div class="contentRoot">
2024-11-22 01:06:37 +00:00
<chatItem
v-for="(item,index) in items"
:key="item.index_name"
:index="index"
:data="item"
/>
2024-11-19 05:57:36 +00:00
</div>
</div>
</div>
</template>
2024-11-11 06:46:14 +00:00
<script setup>
2024-11-22 01:06:37 +00:00
import { ref,watch,computed } from 'vue';
2024-11-19 05:57:36 +00:00
import { useChatList } from "@/store/chatList/index.js";
import {useAuth} from "@/store/auth";
2024-11-22 01:06:37 +00:00
import { useTalkStore,useUserStore } from '@/store'
import chatItem from './components/chatItem.vue';
import addCircle from "@/static/image/chatList/addCircle.png";
2024-11-11 06:46:14 +00:00
2024-11-22 01:06:37 +00:00
const talkStore = useTalkStore()
const userStore = useUserStore()
2024-11-19 05:57:36 +00:00
const {userInfo}=useAuth()
2024-11-11 06:46:14 +00:00
2024-11-22 01:06:37 +00:00
const topItems = computed(() => talkStore.topItems)
const items = computed(() => {
// if (searchKeyword.value.length === 0) {
return talkStore.talkItems
// }
// return talkStore.talkItems.filter((item) => {
// let keyword = item.remark || item.name
// return keyword.toLowerCase().indexOf(searchKeyword.value.toLowerCase()) != -1
// })
})
watch(() => talkStore, (newValue, oldValue) => {
console.log(talkStore);
},{deep:true,immediate:true})
2024-11-11 06:46:14 +00:00
</script>
<style scoped lang="scss">
2024-11-19 05:57:36 +00:00
.outer-layer {
overflow-y: auto;
flex: 1;
background-image: url("@/static/image/clockIn/z3280@3x.png");
background-size: cover;
padding: 0 32rpx 20rpx 32rpx;
display: flex;
flex-direction: column;
}
.root {
flex: 1;
padding: 20rpx 0;
}
.searchRoot {
background-color: #fff;
padding: 22rpx 18rpx;
}
.contentRoot {
margin-top: 20rpx;
background-color: #fff;
}
2024-11-11 06:46:14 +00:00
</style>