feat; 消息与天气接口对接
This commit is contained in:
@@ -38,6 +38,12 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/ChatMain/NoticeMessage/detail",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"subPackages": [
|
"subPackages": [
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="relative">
|
<view class="relative">
|
||||||
<image class="w-full block" :src="mainPageDataModel.initPageImages.backgroundImageUrl"
|
<image class="w-full block" :src="mainPageDataModel?.initPageImages?.backgroundImageUrl"
|
||||||
mode="aspectFill" style="height: 252px;" />
|
mode="aspectFill" style="height: 252px;" />
|
||||||
<view class="absolute bottom-0 left-0 right-0 flex-full">
|
<view class="absolute bottom-0 left-0 right-0 flex-full">
|
||||||
<view class="px-12 pt-12">
|
<view class="px-12 pt-12">
|
||||||
@@ -204,8 +204,6 @@ import HomeWelcome from "../HomeWelcome/index.vue";
|
|||||||
import AiTabSwitch from "@/components/AiTabSwitch/index.vue";
|
import AiTabSwitch from "@/components/AiTabSwitch/index.vue";
|
||||||
import Discovery from "../../Discovery/index.vue";
|
import Discovery from "../../Discovery/index.vue";
|
||||||
|
|
||||||
import ChatTopWelcome from "../ChatTopWelcome/index.vue";
|
|
||||||
import NoticeMessage from "../NoticeMessage/index.vue";
|
|
||||||
import ChatTopNavBar from "../ChatTopNavBar/index.vue";
|
import ChatTopNavBar from "../ChatTopNavBar/index.vue";
|
||||||
import ChatCardAI from "../ChatCardAi/index.vue";
|
import ChatCardAI from "../ChatCardAi/index.vue";
|
||||||
import ChatCardMine from "../ChatCardMine/index.vue";
|
import ChatCardMine from "../ChatCardMine/index.vue";
|
||||||
|
|||||||
@@ -7,58 +7,21 @@
|
|||||||
<view class="flex flex-col flex-full min-width-0">
|
<view class="flex flex-col flex-full min-width-0">
|
||||||
<view class="flex flex-row flex-items-center flex-justify-between min-width-0">
|
<view class="flex flex-row flex-items-center flex-justify-between min-width-0">
|
||||||
<text class="flex-full min-width-0 font-size-20 font-500 color-white ellipsis-1">{{ mainPageDataModel.welcomeContent }}</text>
|
<text class="flex-full min-width-0 font-size-20 font-500 color-white ellipsis-1">{{ mainPageDataModel.welcomeContent }}</text>
|
||||||
<text class="flex-shrink-0 font-size-20 font-500 color-white mt-4"> 26°C ☀️ </text>
|
<text class="flex-shrink-0 font-size-20 font-500 color-white mt-4"> {{ weatherText }} </text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<swiper @change="onSwiperChange" class="swiper" circular :autoplay="autoplay" :interval="interval"
|
<NoticeMessage />
|
||||||
:duration="duration" :indicator-dots="false">
|
|
||||||
<swiper-item v-for="item in bannerList" :key="item.title">
|
|
||||||
<view class="swiper-item flex flex-col flex-items-start flex-justify-between px-10">
|
|
||||||
<text class="font-size-12 font-600 color-B45309">
|
|
||||||
{{ item.title }}
|
|
||||||
</text>
|
|
||||||
<view class="flex flex-row flex-justify-between">
|
|
||||||
<text class="font-size-10 font-500 color-D97706">
|
|
||||||
发布时间:{{ item.time }}
|
|
||||||
</text>
|
|
||||||
<text class="font-size-10 font-500 color-B45309 underline-text">
|
|
||||||
详情
|
|
||||||
</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</swiper-item>
|
|
||||||
</swiper>
|
|
||||||
|
|
||||||
<yo-indicator-dot :current-index="currentIndex" :length="bannerList.length" duration="0.5" default-width="4px"
|
|
||||||
active-width="16px" dot-height="4px" shape="circle" default-color="rgba(255,255,255,0.5)"
|
|
||||||
active-color="rgba(255,255,255,1)" />
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { defineProps, computed } from "vue";
|
import { defineProps, computed } from "vue";
|
||||||
import SpriteAnimator from "@/components/Sprite/SpriteAnimator.vue";
|
import SpriteAnimator from "@/components/Sprite/SpriteAnimator.vue";
|
||||||
|
import NoticeMessage from "../NoticeMessage/index.vue";
|
||||||
|
import { getLocalWeather } from "@/request/api/MainPageDataApi";
|
||||||
|
|
||||||
const autoplay = ref(true);
|
const weatherText = ref("26°C ☀️");
|
||||||
const interval = ref(7000);
|
|
||||||
const duration = ref(500);
|
|
||||||
|
|
||||||
const currentIndex = ref(0);
|
|
||||||
const bannerList = ref([
|
|
||||||
{
|
|
||||||
title: "小七欢迎你~",
|
|
||||||
time: "2025年7月12日 09:30",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "小8欢迎你~",
|
|
||||||
time: "2025年7月13日 09:30",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "小9欢迎你~",
|
|
||||||
time: "2025年7月15日 09:30",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
mainPageDataModel: {
|
mainPageDataModel: {
|
||||||
@@ -92,29 +55,18 @@ const spriteStyle = computed(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const onSwiperChange = (e) => {
|
const getLocalWeatherData = async () => {
|
||||||
currentIndex.value = e.detail.current;
|
const res = await getLocalWeather();
|
||||||
};
|
if (res && res.code === 0) {
|
||||||
|
const { temperature, weather } = res.data;
|
||||||
|
weatherText.value = `${temperature}°C ${weather}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getLocalWeatherData();
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped></style>
|
||||||
.swiper {
|
|
||||||
height: 50px;
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.swiper-item {
|
|
||||||
display: block;
|
|
||||||
height: 46px;
|
|
||||||
background: #fffbeb;
|
|
||||||
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);
|
|
||||||
border-radius: 12px;
|
|
||||||
border: 2px solid #fef3c7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.underline-text {
|
|
||||||
text-decoration: underline;
|
|
||||||
text-decoration-color: #b45309;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
96
src/pages/ChatMain/NoticeMessage/detail.vue
Normal file
96
src/pages/ChatMain/NoticeMessage/detail.vue
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<template>
|
||||||
|
<view class="flex flex-col bg-liner h-screen overflow-hidden">
|
||||||
|
<!-- ✅ 顶部固定导航 -->
|
||||||
|
<view class="flex-shrink-0">
|
||||||
|
<TopNavBar :title="detailTitle" background="transparent" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- ✅ 滚动区域 -->
|
||||||
|
<scroll-view class="flex-full overflow-hidden" scroll-y >
|
||||||
|
<view class="pb-24 border-box overflow-hidden">
|
||||||
|
<image class="w-full block" :src="coverImage" mode="aspectFill" />
|
||||||
|
|
||||||
|
<view class="pt-16 px-12 pb-24 border-box">
|
||||||
|
<view class="color-171717 font-size-16 font-weight-600">{{ detailTitle }}</view>
|
||||||
|
|
||||||
|
<view v-if="publishTime" class="notice-time-tag flex flex-row flex-items-center mt-16">
|
||||||
|
<uni-icons type="clock" size="18" color="#5A6780" />
|
||||||
|
<text class="color-171717 font-size-12 font-weight-600 ml-8">发布时间:{{ publishTime }}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="mt-16 mx-12 bg-gray w-full height-1"></view>
|
||||||
|
|
||||||
|
<view class="mt-16 color-171717 font-size-14">{{ noticeContent }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import TopNavBar from "@/components/TopNavBar/index.vue";
|
||||||
|
import defaultCover from "@/components/ImageSwiper/images/2025-07-12_180248.jpg";
|
||||||
|
import { computed, ref } from "vue";
|
||||||
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
|
|
||||||
|
const noticeData = ref({});
|
||||||
|
const fallbackContent = [
|
||||||
|
"因近日持续降雨导致景区内水位明显上升,为保障游客人身安全,景区管理部门决定自即日起临时封闭卧龙潭至鸳鸯湖沿溪步道,封闭时间视水位情况另行通知。",
|
||||||
|
"受影响游客可改走景区主干道绕行,全程增加约15分钟。观光车服务正常运营,建议优先乘车前往鸳鸯湖区域。",
|
||||||
|
"因近日持续降雨导致景区内水位明显上升,为保障游客人身安全,景区管理部门决定自即日起临时封闭卧龙潭至鸳鸯湖沿溪步道,封闭时间视水位情况另行通知。",
|
||||||
|
"因近日持续降雨导致景区内水位明显上升,为保障游客人身安全,景区管理部门决定自即日起临时封闭卧龙潭至鸳鸯湖沿溪步道,封闭时间视水位情况另行通知。",
|
||||||
|
"因近日持续降雨导致景区内水位明显上升,为保障游客人身安全,景区管理部门决定自即日起临时封闭卧龙潭至鸳鸯湖沿溪步道,封闭时间视水位情况另行通知。",
|
||||||
|
"因近日持续降雨导致景区内水位明显上升,为保障游客人身安全,景区管理部门决定自即日起临时封闭卧龙潭至鸳鸯湖沿溪步道,封闭时间视水位情况另行通知。",
|
||||||
|
"因近日持续降雨导致景区内水位明显上升,为保障游客人身安全,景区管理部门决定自即日起临时封闭卧龙潭至鸳鸯湖沿溪步道,封闭时间视水位情况另行通知。",
|
||||||
|
"如水位下降恢复安全标准,景区将第一时间通过广播及公告重新开放步道,请游客留意景区实时公告。"
|
||||||
|
];
|
||||||
|
|
||||||
|
const detailTitle = computed(() => {
|
||||||
|
return noticeData.value.entityName?.trim() || "消息详情";
|
||||||
|
});
|
||||||
|
|
||||||
|
const publishTime = computed(() => {
|
||||||
|
return noticeData.value.effectiveStartTime?.trim() || "";
|
||||||
|
});
|
||||||
|
|
||||||
|
const coverImage = computed(() => {
|
||||||
|
return noticeData.value.eventImage?.trim() || defaultCover;
|
||||||
|
});
|
||||||
|
|
||||||
|
const noticeContent = computed(() => {
|
||||||
|
return noticeData.value.eventDescription?.trim() || fallbackContent.join("\n");
|
||||||
|
});
|
||||||
|
|
||||||
|
onLoad((query = {}) => {
|
||||||
|
if (query.noticeData) {
|
||||||
|
try {
|
||||||
|
noticeData.value = JSON.parse(decodeURIComponent(query.noticeData));
|
||||||
|
} catch (error) {
|
||||||
|
console.warn("noticeData parse failed:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
.notice-title {
|
||||||
|
font-size: 48rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 68rpx;
|
||||||
|
color: #2d3a57;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-time-tag {
|
||||||
|
display: inline-flex;
|
||||||
|
min-height: 76rpx;
|
||||||
|
padding: 0 28rpx;
|
||||||
|
background: linear-gradient(180deg, #f4f7fb 0%, #e9eef6 100%);
|
||||||
|
border: 2rpx solid #d6dde8;
|
||||||
|
border-radius: 999rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,40 +1,100 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<view class="border-box pl-12 pr-12">
|
<view >
|
||||||
<view class="wrap rounded-20 bg-white relative overflow-hidden">
|
<swiper @change="onSwiperChange" class="swiper" circular :autoplay="autoplay" :interval="interval"
|
||||||
<view class="flex flex-col p-16 mr-110 border-box">
|
:duration="duration" :indicator-dots="false">
|
||||||
<view class="flex flex-row flex-items-center justify-center">
|
<swiper-item v-for="item in bannerList" :key="item.entityName">
|
||||||
<view class="w-24 h-24 rounded-full bg-theme-color-500 flex flex-items-center flex-justify-center">
|
<view class="swiper-item flex flex-col flex-items-start flex-justify-between px-10" @click="clickItem(item)">
|
||||||
<uni-icons type="sound" size="16" color="#ffffff"/>
|
<text class="font-size-12 font-600 color-B45309">
|
||||||
|
{{ item.entityName }}
|
||||||
|
</text>
|
||||||
|
<view class="flex flex-row flex-justify-between">
|
||||||
|
<text class="font-size-10 font-500 color-D97706">
|
||||||
|
发布时间:{{ item.effectiveStartTime }}
|
||||||
|
</text>
|
||||||
|
<text class="font-size-10 font-500 color-B45309 underline-text">
|
||||||
|
详情
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="font-size-16 font-500 text-color-900 ml-6">临时提醒</text>
|
|
||||||
</view>
|
|
||||||
<view class="font-size-12 font-color-600 mt-8">{{ props.noticeContent.eventMessageContent }}</view>
|
|
||||||
</view>
|
|
||||||
<image class="mt-4 object-cover absolute right-0 bottom-0 bg-image" src="./notice_bg_img.png"/>
|
|
||||||
</view>
|
</view>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
|
||||||
|
<yo-indicator-dot :current-index="currentIndex" :length="bannerList.length" duration="0.5" default-width="4px"
|
||||||
|
active-width="16px" dot-height="4px" shape="circle" default-color="rgba(255,255,255,0.5)"
|
||||||
|
active-color="rgba(255,255,255,1)" />
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { defineProps } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
|
import { getTimeNoticeList } from "@/request/api/MainPageDataApi";
|
||||||
|
|
||||||
const props = defineProps({
|
const autoplay = ref(true);
|
||||||
noticeContent: {
|
const interval = ref(7000);
|
||||||
type: Object,
|
const duration = ref(500);
|
||||||
default: () => ({}),
|
|
||||||
|
const currentIndex = ref(0);
|
||||||
|
// const bannerList = ref([]);
|
||||||
|
const bannerList = ref([
|
||||||
|
{
|
||||||
|
entityName: "小七欢迎你~",
|
||||||
|
effectiveStartTime: "2025年7月12日 09:30",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
entityName: "小8欢迎你~",
|
||||||
|
effectiveStartTime: "2025年7月13日 09:30",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
entityName: "小9欢迎你~",
|
||||||
|
effectiveStartTime: "2025年7月15日 09:30",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
const onSwiperChange = (e) => {
|
||||||
|
currentIndex.value = e.detail.current;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getTimeNoticeListData = async () => {
|
||||||
|
const res = await getTimeNoticeList();
|
||||||
|
if (res && res.code === 0) {
|
||||||
|
bannerList.value = res.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getTimeNoticeListData();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const clickItem = (item) => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/ChatMain/NoticeMessage/detail?noticeData=${encodeURIComponent(JSON.stringify(item))}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.bg-image {
|
.swiper {
|
||||||
width: 140px;
|
height: 50px;
|
||||||
height: 96px;
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
.mr-110 {
|
|
||||||
margin-right: 110px;
|
.swiper-item {
|
||||||
|
display: block;
|
||||||
|
height: 46px;
|
||||||
|
background: #fffbeb;
|
||||||
|
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 2px solid #fef3c7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.underline-text {
|
||||||
|
text-decoration: underline;
|
||||||
|
text-decoration-color: #b45309;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 178 KiB |
@@ -10,6 +10,16 @@ function homeTabContentData(args) {
|
|||||||
return request.post("/hotelBiz/mainScene/queryContentListWithCache", args);
|
return request.post("/hotelBiz/mainScene/queryContentListWithCache", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 获取本地天气
|
||||||
|
function getLocalWeather(args) {
|
||||||
|
return request.get("/hotelBiz/mainScene/getLocalWeather", args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 获取时间公告列表
|
||||||
|
function getTimeNoticeList(args) {
|
||||||
|
return request.get("/hotelBiz/mainScene/eventList", args);
|
||||||
|
}
|
||||||
|
|
||||||
/// 快速问题列表
|
/// 快速问题列表
|
||||||
function homeQuickQuestionData(args) {
|
function homeQuickQuestionData(args) {
|
||||||
return request.post("/hotelBiz/mainScene/queryQuickQuestionListWithCache", args);
|
return request.post("/hotelBiz/mainScene/queryQuickQuestionListWithCache", args);
|
||||||
@@ -34,6 +44,8 @@ function discoveryCradComponent() {
|
|||||||
export {
|
export {
|
||||||
homeTabsData,
|
homeTabsData,
|
||||||
homeTabContentData,
|
homeTabContentData,
|
||||||
|
getLocalWeather,
|
||||||
|
getTimeNoticeList,
|
||||||
homeQuickQuestionData,
|
homeQuickQuestionData,
|
||||||
mainPageData,
|
mainPageData,
|
||||||
quickBookingComponent,
|
quickBookingComponent,
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.h-1 {
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
.h-8 {
|
.h-8 {
|
||||||
height: 8px;
|
height: 8px;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user