Skip to content

Commit

Permalink
Merge branch 'master' of github.com:JX3BOX/pvx into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
zixuan1986 committed Mar 25, 2024
2 parents e14910c + 1456afa commit 8da0ca5
Show file tree
Hide file tree
Showing 10 changed files with 409 additions and 210 deletions.
4 changes: 3 additions & 1 deletion src/assets/css/gonggao/daily.less
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
height: auto;
.m-fav-list {
flex-wrap: wrap;
}
}
}
}
.m-all-servers {
Expand Down Expand Up @@ -296,6 +296,8 @@
.u-desc {
font-size: 12px;
color: rgba(0, 0, 0, 0.5);
max-width: 240px;
.nobreak;
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/components/gonggao/Daily.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
<template v-if="!isOrigin">
<div class="m-daily-item">
<div class="u-title">日常&福缘</div>
<div class="u-title">家园声望&福缘</div>
<SimpleDaily class="m-daily-content" :activities="activities"></SimpleDaily>
</div>
<div class="m-daily-item">
Expand All @@ -20,15 +20,15 @@
</div>
<SimpleCelebrity :type="currentCelebrity" class="m-daily-content"></SimpleCelebrity>
</div>
<div class="m-daily-item">
<!-- <div class="m-daily-item">
<div class="u-title">武林通鉴</div>
<SimpleWeek class="m-daily-content" :activities="activities"></SimpleWeek>
</div>
<div class="m-daily-item">
</div> -->
<!-- <div class="m-daily-item">
<div class="u-title">家园</div>
<SimpleReputation :activities="activities"></SimpleReputation>
<SimpleFurniture :furniture="currentFurniture" :nextFurniture="nextFurniture"></SimpleFurniture>
</div>
</div> -->
<div class="m-daily-item">
<div class="u-title">抓马播报</div>
<SimpleHorse class="m-daily-content"></SimpleHorse>
Expand All @@ -43,10 +43,10 @@ import { getFurniture, getDailyFromOs } from "@/service/gonggao";
import SimpleNotice from "./daily/SimpleNotice.vue";
import SimpleServer from "./daily/SimpleServer.vue";
import SimpleDaily from "./daily/SimpleDaily.vue";
import SimpleWeek from "./daily/SimpleWeek.vue";
// import SimpleWeek from "./daily/SimpleWeek.vue";
import SimpleCelebrity from "./daily/SimpleCelebrity.vue";
import SimpleReputation from "./daily/SimpleReputation.vue";
import SimpleFurniture from "./daily/SimpleFurniture.vue";
// import SimpleReputation from "./daily/SimpleReputation.vue";
// import SimpleFurniture from "./daily/SimpleFurniture.vue";
import SimpleHorse from "./daily/SimpleHorse.vue";
import dailyKeys from "@/assets/data/daily_keys.json";
export default {
Expand All @@ -55,10 +55,10 @@ export default {
SimpleNotice,
SimpleServer,
SimpleDaily,
SimpleReputation,
// SimpleReputation,
SimpleCelebrity,
SimpleWeek,
SimpleFurniture,
// SimpleWeek,
// SimpleFurniture,
SimpleHorse,
},
data() {
Expand Down
186 changes: 186 additions & 0 deletions src/components/gonggao/daily/Reputation.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
<template>
<div v-if="reputationList.length" class="m-reputation-list">
<a
class="u-reputation"
v-for="item in reputationList"
:key="item.id"
:href="getItemLink(item.id)"
target="_blank"
>
<el-tooltip class="box-item" effect="dark" :content="item.Desc" placement="top">
<div class="u-reputation-item">
<div class="u-reputation-icon" :class="`u-quality-${item.Quality}`">
<img :src="iconLink(item.IconID)" :alt="item.Name" />
</div>
<span class="u-reputation-name">{{ item.Name }}</span>
</div>
</el-tooltip>
</a>
</div>
</template>

<script>
import dayjs from "@/plugins/day";
import { getHomeReputation, getItems } from "@/service/spider";
import { iconLink } from "@jx3box/jx3box-common/js/utils";
export default {
name: "Reputation",
data() {
return {
reputation: {},
};
},
computed: {
reputationList() {
return this.reputation?.list || [];
},
date() {
// 当7点以前,请求前面一天的日常 当7~24点,请求当天的日常
const hour = dayjs.tz().get("hours");
return 0 <= hour && hour < 7
? dayjs.tz().subtract(1, "day").format("YYYY-MM-DD")
: dayjs.tz().format("YYYY-MM-DD");
},
client() {
return "std";
},
},
watch: {
date: {
immediate: true,
handler() {
if (this.client === "std") {
this.loadReputation();
}
},
},
},
methods: {
iconLink,
getItemLink(id) {
return `/item/view/${id}`;
},
// 家园声望
loadReputation() {
const cache = sessionStorage.getItem(`index_reputation_items`);
if (cache) {
const obj = JSON.parse(cache);
if (obj.date === this.date) {
this.reputation = obj;
return;
}
}
getHomeReputation(this.date, this.$store.state.server).then((res) => {
const list = res.data?.data?.list || [];
if (list.length) {
const ids = list.map((item) => {
return item.item_type_id + "_" + item.item_id;
});
this.loadItems(ids);
}
});
},
loadItems(ids) {
// 读取本地数据
if (!ids.length) return;
getItems(ids).then((res) => {
const list = res.data?.list || [];
let newData = {
date: this.date,
list: list.map((item) => {
return {
id: item.id,
Name: item.Name.replace("声望·", ""),
IconID: item.IconID,
Quality: item.Quality,
Desc: /中(.*)\\\\\\/.exec(item.Desc)[1].trim(),
};
}),
};
this.reputation = newData;
sessionStorage.setItem(`index_reputation_items`, JSON.stringify(newData));
});
},
},
};
</script>
<style lang="less">
.m-reputation-list {
padding: 10px;
width: 100%;
height: 119px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
background: #ffffff;
border-radius: 10px;
display: grid;
grid-template-columns: repeat(2, 1fr);
margin-bottom: 10px;
overflow-y: auto;
.scrollbar();
.u-reputation-item {
.flex;
align-items: center;
justify-content: space-between;
padding: 2px 5px;
gap: 5px;
&:hover {
background: @bg-gray;
.u-reputation-name {
color: #ffa500;
}
}
}
.u-desc {
color: #999;
}
.u-reputation {
display: flex;
gap: 10px;
align-items: center;
font-size: 14px;
color: #000;
}
.u-reputation-icon {
@s: 38px;
.size(@s);
overflow: hidden;
.mr(5px);
img {
.size(100%);
.db;
&:hover {
filter: brightness(110%) saturate(110%);
}
}
.db;
.pr;
&:after {
content: "";
.db;
.size(100%);
.pa;
.lt(0);
border: 1px solid transparent;
box-sizing: border-box;
.r(100%);
}
&.u-quality-2:after {
border-color: #00d24b;
}
&.u-quality-3:after {
border-color: #007eff;
}
&.u-quality-4:after {
border-color: #ff2dff;
}
&.u-quality-5:after {
border-color: #ffa500;
}
}
}
</style>
27 changes: 15 additions & 12 deletions src/components/gonggao/daily/SimpleDaily.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="m-simple-daily">
<div class="m-daily-wrap">
<!-- <div class="m-daily-wrap">
<div class="m-simple-daily-item" :class="item.isDone && 'is-done'" v-for="item in daily" :key="item.name">
<div class="u-name">
<span>{{ item.name }}</span>
Expand All @@ -16,20 +16,23 @@
<span class="u-desc">{{ (meirentu && meirentu.name) || "今日暂无画像" }}</span>
</div>
</el-tooltip>
</div>
</div> -->
<Reputation></Reputation>
<SimplePet></SimplePet>
</div>
</template>

<script>
import { getMeirentu } from "@/service/gonggao";
// import { getMeirentu } from "@/service/gonggao";
import dayjs from "@/plugins/day";
import dailyKeys from "@/assets/data/daily_keys.json";
// import dailyKeys from "@/assets/data/daily_keys.json";
import SimplePet from "./SimplePet";
import Reputation from "./Reputation";
export default {
name: "SimpleDaily",
components: {
SimplePet,
Reputation,
},
props: {
activities: {
Expand All @@ -39,7 +42,7 @@ export default {
},
data() {
return {
meirentu: {},
// meirentu: {},
};
},
computed: {
Expand Down Expand Up @@ -79,15 +82,15 @@ export default {
},
},
methods: {
// 获取美人图
loadMeirentu() {
getMeirentu(this.server).then((res) => {
this.meirentu = res.data?.data || {};
});
},
// // 获取美人图
// loadMeirentu() {
// getMeirentu(this.server).then((res) => {
// this.meirentu = res.data?.data || {};
// });
// },
},
mounted() {
this.loadMeirentu();
// this.loadMeirentu();
},
};
</script>
8 changes: 4 additions & 4 deletions src/components/pet/item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
target="_blank"
>
<div class="m-info">
<el-image class="u-icon" :src="iconLink(petObject.IconID)" fit="fit"></el-image>
<el-image class="u-icon" :src="iconLink(petObject.IconID, client)" fit="fit"></el-image>
<div class="u-text">
<div class="u-name">{{ petObject.Name }}</div>
<div class="u-rate">
Expand All @@ -26,7 +26,7 @@
</template>

<script>
import { iconLink, extractTextContent } from "@jx3box/jx3box-common/js/utils";
import { extractTextContent, iconLink } from "@jx3box/jx3box-common/js/utils";
import { __iconPath } from "@jx3box/jx3box-common/data/jx3box.json";
export default {
props: {
Expand All @@ -38,14 +38,14 @@ export default {
},
computed: {
client() {
client() {
return this.$store.state.client;
},
},
methods: {
iconLink,
renderTextHtml: function (Text) {
let result = Text;
let result = Text;
const matches = Text.match(/<Text>(.*?)<\/text>/gims);
if (!matches) return Text;
for (let match of matches) {
Expand Down
26 changes: 26 additions & 0 deletions src/service/spider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { $next, $node } from "@jx3box/jx3box-common/js/https";
// 家园声望
function getHomeReputation(date, server = "梦江南") {
const params = {
server: server, // 所有服务器数据一致
upload_time: date + " 07:00:00",
// 上传时间, 查询时请格式化为 2006-01-02 07:00:00,表示查询当天上报的物价
};
return $next().get("/api/next2/npc-shop/list", {
params,
});
}
// 批量获取物品
function getItems(ids, client = "std") {
const per = ids.length || 15;
const params = {
client,
per,
};
const idString = ids.join(",");
if (!idString) return;
return $node().get(`/item_merged/id/${idString}`, {
params,
});
}
export { getHomeReputation, getItems };
Loading

0 comments on commit 8da0ca5

Please sign in to comment.