diff --git a/components/noticePopup.vue b/components/noticePopup.vue
index 49884e5..f8d6e11 100644
--- a/components/noticePopup.vue
+++ b/components/noticePopup.vue
@@ -19,7 +19,6 @@
-
@@ -57,8 +56,7 @@ export default {
})
.then(res => {
if (res.code == '200') {
- let list = JSON.parse(localStorage.getItem('menuList'))
- let arr = res.data[0]?.publishLocation.split(',') || []
+ const arr = res.data[0]?.publishLocation.split(',') || []
arr.forEach(items => {
if (items == this.publishLocationIndex) {
this.noticeFlag = true
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 31a1067..25b3174 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -147,20 +147,17 @@
-
-
+ > -->
+
-
+ > -->
+
+
+
+
@@ -231,6 +278,11 @@ export default {
recommendSpecialAreaList: [],
banners: [],
noticeList: [],
+ // Popup related data
+ showNoticePopup: false,
+ noticePopupCountdown: 5,
+ canCloseNoticePopup: false,
+ // End popup related data
recommendGoodsList: [],
goodsList: [],
displayedGoodsList: [],
@@ -466,6 +518,16 @@ export default {
getNoticeList() {
ban.getNoticeList({ functionType: 1 }).then(res => {
this.noticeList = res.rows || []
+ // Logic for showing notice popup once per day
+ if (this.noticeList.length > 0) {
+ const today = new Date().toDateString()
+ const lastShownDate = uni.getStorageSync('noticePopupLastShownDate')
+ if (lastShownDate !== today) {
+ this.showNoticePopup = true
+ this.startNoticePopupTimer()
+ uni.setStorageSync('noticePopupLastShownDate', today)
+ }
+ }
})
},
goNotice(item) {
@@ -714,6 +776,23 @@ export default {
url: '/pages/index/specialArea/index',
})
},
+ // Methods for Notice Popup
+ startNoticePopupTimer() {
+ this.noticePopupCountdown = 5 // Reset countdown
+ this.canCloseNoticePopup = false
+ const timerInterval = setInterval(() => {
+ if (this.noticePopupCountdown > 0) {
+ this.noticePopupCountdown--
+ } else {
+ this.canCloseNoticePopup = true
+ clearInterval(timerInterval)
+ }
+ }, 1000)
+ },
+ closeNoticePopup() {
+ this.showNoticePopup = false
+ },
+ // End Methods for Notice Popup
},
}
@@ -1626,4 +1705,79 @@ page {
或者调整recommend-item的padding/margin。
*/
}
+
+/* New Notice Popup Styles */
+.notice-popup-content-wrapper {
+ padding: 20rpx;
+ box-sizing: border-box;
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ // max-height: 80vh; /* Ensure popup doesn't get too tall */
+}
+
+.notice-popup-swiper {
+ width: 100%;
+ height: 65vh; /* Adjust height as needed */
+ margin-bottom: 20rpx;
+}
+
+.notice-popup-swiper-item {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: flex-start; /* Align content to the top */
+ box-sizing: border-box;
+ padding: 0 10rpx;
+}
+
+.notice-popup-title {
+ font-size: 32rpx;
+ font-weight: bold;
+ color: #333;
+ margin-bottom: 20rpx;
+ text-align: center;
+ width: 100%;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.notice-popup-scroll-content {
+ width: 100%;
+ height: calc(65vh - 80rpx); /* Adjust based on title height and padding */
+ box-sizing: border-box;
+ color: #555;
+ font-size: 28rpx;
+ line-height: 1.6;
+}
+
+.notice-popup-footer {
+ margin-top: 20rpx;
+ text-align: center;
+ width: 100%;
+}
+
+.close-notice-button {
+ background-color: #cccccc; /* Disabled color */
+ color: #666666;
+ padding: 18rpx 40rpx;
+ border-radius: 40rpx;
+ font-size: 28rpx;
+ border: none;
+ width: 80%;
+ transition: background-color 0.3s ease;
+}
+
+.close-notice-button.button-enabled {
+ background-color: #de3932; /* Enabled color (theme red) */
+ color: white;
+ cursor: pointer;
+}
+
+.close-notice-button:disabled {
+ opacity: 0.7;
+ cursor: not-allowed;
+}
+/* End of New Notice Popup Styles */