feat: 调整项目结构
This commit is contained in:
70
src/pages/index/index.vue
Normal file
70
src/pages/index/index.vue
Normal file
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<ChatMainList />
|
||||
</view>
|
||||
|
||||
<!-- 日历组件 -->
|
||||
<Calender
|
||||
:visible="calendarVisible"
|
||||
mode="single"
|
||||
:default-value="selectedDate"
|
||||
@close="handleCalendarClose"
|
||||
@select="handleDateSelect"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { ref, onUnmounted } from "vue";
|
||||
import { getUrlParams } from "@/utils/UrlParams";
|
||||
import { useAppStore } from "@/store";
|
||||
import ChatMainList from "./components/chat/ChatMainList/index.vue";
|
||||
import Calender from "@/components/Calender/index.vue";
|
||||
|
||||
const appStore = useAppStore();
|
||||
|
||||
const calendarVisible = ref(false);
|
||||
const selectedDate = ref("");
|
||||
|
||||
// 处理日历关闭
|
||||
const handleCalendarClose = () => {
|
||||
calendarVisible.value = false;
|
||||
};
|
||||
|
||||
// 处理日期选择
|
||||
const handleDateSelect = (data) => {
|
||||
selectedDate.value = data.date;
|
||||
calendarVisible.value = false;
|
||||
console.log("选择的日期:", data.date);
|
||||
uni.$emit("selectCalendarDate", selectedDate.value); // 传回父组件
|
||||
};
|
||||
|
||||
uni.$on("openCalendar", () => {
|
||||
calendarVisible.value = true;
|
||||
});
|
||||
|
||||
const getWeixinMiniProgramParams = (e) => {
|
||||
console.log("Params:", e);
|
||||
if (e.q && e.q != "undefined") {
|
||||
const qrUrl = decodeURIComponent(e.q); // 获取到二维码原始链接内容
|
||||
const params = getUrlParams(qrUrl);
|
||||
appStore.setSceneId(params.sceneId);
|
||||
}
|
||||
};
|
||||
|
||||
onLoad((e) => {
|
||||
getWeixinMiniProgramParams(e);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
// uni.$off('openCalendar')
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user