Skip to content

Commit

Permalink
feat:名望披风会
Browse files Browse the repository at this point in the history
  • Loading branch information
fifthThirteen committed Nov 9, 2024
1 parent 5aa464e commit 4af837d
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 11 deletions.
22 changes: 17 additions & 5 deletions src/components/gonggao/Daily.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@
</div>
<div class="m-daily-item">
<div class="u-title">
<div>{{ !currentCelebrity ? "楚天社" : "云从社" }}</div>
<span @click="switchCelebrity">切换</span>
<div>{{ celebrityMap[currentCelebrity] }}</div>
<el-dropdown>
<span class="el-dropdown-link"> 切换<i class="el-icon-arrow-down el-icon--right"></i> </span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="changeCelebrity(2)">披风会</el-dropdown-item>
<el-dropdown-item @click.native="changeCelebrity(1)">云从社</el-dropdown-item>
<el-dropdown-item @click.native="changeCelebrity(0)">楚天社</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<SimpleCelebrity :type="currentCelebrity" class="m-daily-content"></SimpleCelebrity>
</div>
Expand Down Expand Up @@ -63,7 +70,12 @@ export default {
},
data() {
return {
currentCelebrity: 1, // 楚天社0 云从社1
currentCelebrity: 2, // 楚天社0 云从社1 披风会 2
celebrityMap: {
0: "楚天社",
1: "云从社",
2: "披风会",
},
currentFurniture: {},
nextFurniture: {},
activities: [], // 日常配置列表
Expand Down Expand Up @@ -98,8 +110,8 @@ export default {
},
},
methods: {
switchCelebrity() {
this.currentCelebrity = ~~!this.currentCelebrity;
changeCelebrity(i) {
this.currentCelebrity = i;
},
loadDailyNew() {
const params = {
Expand Down
56 changes: 55 additions & 1 deletion src/components/gonggao/daily/SimpleCelebrity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
},
},
Expand Down
10 changes: 5 additions & 5 deletions src/components/gonggao/daily/SimpleDaily.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ export default {
},
},
watch: {
server: {
handler(val) {
val && this.loadMeirentu();
},
},
// server: {
// handler(val) {
// val && this.loadMeirentu();
// },
// },
},
methods: {
// // 获取美人图
Expand Down

0 comments on commit 4af837d

Please sign in to comment.