From 4af837d99863559b3ba51b42c55b4eb1fee7558f Mon Sep 17 00:00:00 2001
From: fifththirteen <570205219@qq.com>
Date: Sat, 9 Nov 2024 16:17:40 +0800
Subject: [PATCH] =?UTF-8?q?feat:=E5=90=8D=E6=9C=9B=E6=8A=AB=E9=A3=8E?=
=?UTF-8?q?=E4=BC=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/gonggao/Daily.vue | 22 ++++++--
.../gonggao/daily/SimpleCelebrity.vue | 56 ++++++++++++++++++-
src/components/gonggao/daily/SimpleDaily.vue | 10 ++--
3 files changed, 77 insertions(+), 11 deletions(-)
diff --git a/src/components/gonggao/Daily.vue b/src/components/gonggao/Daily.vue
index bd4d9ba35..5139fb2ac 100644
--- a/src/components/gonggao/Daily.vue
+++ b/src/components/gonggao/Daily.vue
@@ -15,8 +15,15 @@
-
{{ !currentCelebrity ? "楚天社" : "云从社" }}
-
切换
+
{{ celebrityMap[currentCelebrity] }}
+
+ 切换
+
+ 披风会
+ 云从社
+ 楚天社
+
+
@@ -63,7 +70,12 @@ export default {
},
data() {
return {
- currentCelebrity: 1, // 楚天社0 云从社1
+ currentCelebrity: 2, // 楚天社0 云从社1 披风会 2
+ celebrityMap: {
+ 0: "楚天社",
+ 1: "云从社",
+ 2: "披风会",
+ },
currentFurniture: {},
nextFurniture: {},
activities: [], // 日常配置列表
@@ -98,8 +110,8 @@ export default {
},
},
methods: {
- switchCelebrity() {
- this.currentCelebrity = ~~!this.currentCelebrity;
+ changeCelebrity(i) {
+ this.currentCelebrity = i;
},
loadDailyNew() {
const params = {
diff --git a/src/components/gonggao/daily/SimpleCelebrity.vue b/src/components/gonggao/daily/SimpleCelebrity.vue
index 2f535fa92..c9a2e1e62 100644
--- a/src/components/gonggao/daily/SimpleCelebrity.vue
+++ b/src/components/gonggao/daily/SimpleCelebrity.vue
@@ -224,11 +224,65 @@ export default {
this.list = combineList.slice(0, this.showNum);
},
+ // 处理披风会
+ getPi(date) {
+ // 3小时循环事件
+ // 当前时间
+ const currentH = date.h % 3;
+ const preH = currentH === 0 ? 2 : currentH - 1;
+ const nextH = currentH === 2 ? 0 : currentH + 1;
+
+ const circleList = this.celebrityList.filter((item) => item.key === "p3" && Number(item.hour) === currentH);
+ const preList = this.celebrityList.filter((item) => item.key === "p3" && Number(item.hour) === preH);
+ const nextList = this.celebrityList.filter((item) => item.key === "p3" && Number(item.hour) === nextH);
+
+ let index = -1;
+ index = circleList.findIndex((item) => {
+ return item.time === date.m;
+ });
+ if (index === -1) {
+ index = circleList.findIndex((item) => {
+ return item.time > date.m;
+ });
+ if (index > 0) {
+ index = index - 1;
+ } else if (index === -1 && date.m > circleList[circleList.length - 1].time) {
+ index = circleList.length - 1;
+ }
+ }
+ // 当前小时的第一项, 且当前时间大于当前项的时间时取上一小时的最后一项
+ let list =
+ index === 0 && circleList[0].time > date.m
+ ? [preList[preList.length - 1]].concat(circleList.slice(0, this.showNum - 1))
+ : circleList.slice(index, index + this.showNum);
+ let newList = [];
+ if (list.length < this.showNum) {
+ newList = list.concat(nextList.slice(0, this.showNum - list.length));
+ } else {
+ newList = [].concat(list);
+ }
+ const circleNumList = newList.map((item) => {
+ // 当前时间
+ let h = this.currentDate.h;
+ if (Number(item.hour) === preH) {
+ h = h - 1;
+ }
+ if (Number(item.hour) === nextH) {
+ h = h + 1;
+ }
+ item.m = item.time;
+ item.timeFormat = this.toFormatTime(h, item.time);
+ return item;
+ });
+ this.list = circleNumList;
+ },
getList(date) {
if (this.type === 0) {
this.getChu(date);
- } else {
+ } else if (this.type === 1) {
this.getYun(date);
+ } else {
+ this.getPi(date);
}
},
},
diff --git a/src/components/gonggao/daily/SimpleDaily.vue b/src/components/gonggao/daily/SimpleDaily.vue
index 075295c07..080f87cee 100644
--- a/src/components/gonggao/daily/SimpleDaily.vue
+++ b/src/components/gonggao/daily/SimpleDaily.vue
@@ -75,11 +75,11 @@ export default {
},
},
watch: {
- server: {
- handler(val) {
- val && this.loadMeirentu();
- },
- },
+ // server: {
+ // handler(val) {
+ // val && this.loadMeirentu();
+ // },
+ // },
},
methods: {
// // 获取美人图