feat: add new features, update theme and build config
- Add 40+ new UI components including chat modules, discovery cards, photo galleries, FAQ and booking tools - Standardize brand color across all styles by replacing $theme-color-500 SCSS variables with #0ccd58 - Add sass 1.58.3 dependency and update vite config for modern scss compiler support - Refactor existing components (AddCarCrad, login page) and remove unused /quick/list router route - Add utility functions for URL parameter handling - Add static assets including custom znicons font, component images and icons - Fix scss syntax issues and deprecation warnings
This commit is contained in:
127
src/pages/home/components/NoticeMessage/index.vue
Normal file
127
src/pages/home/components/NoticeMessage/index.vue
Normal file
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<div v-if="hasBannerList">
|
||||
<swiper @change="onSwiperChange" class="swiper" circular :autoplay="autoplay" :interval="interval"
|
||||
:duration="duration" :indicator-dots="false">
|
||||
<swiper-item v-for="item in bannerList" :key="item.entityName">
|
||||
<div class="swiper-item flex flex-col flex-items-start flex-justify-between px-10" @click="clickItem(item)">
|
||||
<span class="text-color font-size-12 font-600">
|
||||
{{ item.entityName }}
|
||||
</span>
|
||||
<div class="flex flex-row flex-justify-between">
|
||||
<span class="text-color font-size-10 font-500">
|
||||
发布时间:{{ item.effectiveStartTime }}
|
||||
</span>
|
||||
<text class="text-color font-size-10 font-500 underline-text">
|
||||
详情
|
||||
</text>
|
||||
</div>
|
||||
</div>
|
||||
</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)" />
|
||||
|
||||
</div>
|
||||
|
||||
<div v-else-if="props.tipsMessage">
|
||||
<div class="noMessage">
|
||||
<span class="noMessage-text text-color font-size-12 font-600">
|
||||
{{ props.tipsMessage }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { getTimeNoticeList } from "@/request/api/MainPageDataApi";
|
||||
import { NOTICE_EVENT_LOGIN_SUCCESS } from "@/constant/constant";
|
||||
|
||||
const props = defineProps({
|
||||
tipsMessage: {
|
||||
type: String,
|
||||
default: "随时吩咐,懂你的旅游搭子",
|
||||
},
|
||||
});
|
||||
|
||||
const autoplay = ref(true);
|
||||
const interval = ref(7000);
|
||||
const duration = ref(500);
|
||||
|
||||
const currentIndex = ref(0);
|
||||
const bannerList = ref([]);
|
||||
const hasBannerList = computed(() => Array.isArray(bannerList.value) && bannerList.value.length > 0);
|
||||
|
||||
const onSwiperChange = (e) => {
|
||||
currentIndex.value = e.detail.current;
|
||||
};
|
||||
|
||||
const getTimeNoticeListData = async () => {
|
||||
const res = await getTimeNoticeList();
|
||||
if (res && res.code === 0) {
|
||||
bannerList.value = Array.isArray(res.data) ? res.data : [];
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getTimeNoticeListData();
|
||||
uni.$on(NOTICE_EVENT_LOGIN_SUCCESS, () => {
|
||||
getTimeNoticeListData();
|
||||
});
|
||||
});
|
||||
|
||||
const clickItem = (item) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/ChatMain/NoticeMessage/detail?noticeData=${encodeURIComponent(JSON.stringify(item))}`
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.swiper {
|
||||
height: 50px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.swiper-item {
|
||||
display: block;
|
||||
height: 46px;
|
||||
background: #EBEFFF;
|
||||
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);
|
||||
border-radius: 12px;
|
||||
border: 1px solid #C7D2FE;
|
||||
}
|
||||
|
||||
.text-color {
|
||||
color: #0CCD58;
|
||||
}
|
||||
|
||||
.underline-text {
|
||||
text-decoration: underline;
|
||||
text-decoration-color: #0CCD58;
|
||||
}
|
||||
|
||||
.noMessage {
|
||||
display: inline-flex;
|
||||
margin-top: 8px;
|
||||
padding: 4px 12px;
|
||||
background: #EBEFFF;
|
||||
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);
|
||||
border-radius: 8px;
|
||||
border: 1px solid #C7D2FE;
|
||||
width: fit-content;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.noMessage-text {
|
||||
line-height: 18px;
|
||||
white-space: normal;
|
||||
overflow-wrap: break-word;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user