Skip to content

Commit

Permalink
perf:price
Browse files Browse the repository at this point in the history
  • Loading branch information
iRuxu committed Jan 8, 2024
1 parent 5898291 commit 6adbd36
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 103 deletions.
Binary file modified README.md
Binary file not shown.
201 changes: 102 additions & 99 deletions src/components/item/price.vue
Original file line number Diff line number Diff line change
@@ -1,99 +1,102 @@
<template>
<div class="p-price-new">
<div class="m-price-title">
<div class="u-title">📈 价格波动</div>
<div class="m-server">
<i class="el-icon-s-shop"></i> 服务器
<el-select
class="u-server"
style="width: 120px"
v-model="server"
placeholder="请选择服务器"
size="small"
>
<el-option v-for="serve in servers" :key="serve" :label="serve" :value="serve"></el-option>
</el-select>
</div>
</div>
<div class="m-price-content">
<item-price-chart ref="item_price_chart" :item_id="sourceId" :server="server" />
</div>

<div class="m-price-title">
<div class="u-title">💰 近期价格</div>
</div>
<div class="m-price-content">
<item-prices :item_id="sourceId" :server="server" />
</div>
</div>
</template>

<script>
import ItemPrices from "@/components/item/prices.vue";
import ItemPriceChart from "@/components/item/price-chart.vue";
import servers_origin from "@jx3box/jx3box-data/data/server/server_origin.json";
import servers_std from "@jx3box/jx3box-data/data/server/server_std.json";
export default {
name: "PriceNew",
components: {
"item-prices": ItemPrices,
"item-price-chart": ItemPriceChart,
},
props: ["sourceId"],
inject: ["client"],
data() {
return {
server: "",
};
},
computed: {
isOrigin: function () {
return this.client == "origin";
},
servers: function () {
return this.isOrigin ? servers_origin : servers_std;
},
},
mounted() {
let params = new URLSearchParams(location.search);
let server = params.get("server");
this.server = server || (this.isOrigin ? "缘起稻香" : "梦江南");
this.$nextTick(() => {
this.$refs.item_price_chart.render();
});
},
};
</script>

<style lang="less">
.p-price-new {
.m-price-title {
.flex;
justify-content: space-between;
align-items: center;
background-color: #f5f7fa;
padding: 10px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
font-size: 17px;
font-weight: 300;
.m-server {
.flex;
justify-content: flex-end;
align-items: center;
gap: 5px;
.u-server {
margin-left: 5px;
}
}
}
.m-price-content {
padding: 20px;
box-sizing: border-box;
border: 1px solid #e4e7ed;
margin-bottom: 30px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
}
</style>
<template>
<div class="p-price-new">
<div class="m-price-title">
<div class="u-title">📈 价格波动</div>
<div class="m-server">
<i class="el-icon-s-shop"></i> 服务器
<el-select
class="u-server"
style="width: 120px"
v-model="server"
placeholder="请选择服务器"
size="small"
>
<el-option v-for="serve in servers" :key="serve" :label="serve" :value="serve"></el-option>
</el-select>
</div>
</div>
<div class="m-price-content">
<item-price-chart ref="item_price_chart" :item_id="sourceId" :server="server" />
</div>

<div class="m-price-title">
<div class="u-title">💰 近期价格</div>
</div>
<div class="m-price-content">
<item-prices :item_id="sourceId" :server="server" />
</div>
</div>
</template>

<script>
import ItemPrices from "@/components/item/prices.vue";
import ItemPriceChart from "@/components/item/price-chart.vue";
import servers_origin from "@jx3box/jx3box-data/data/server/server_origin.json";
import servers_std from "@jx3box/jx3box-data/data/server/server_std.json";
export default {
name: "PriceNew",
components: {
"item-prices": ItemPrices,
"item-price-chart": ItemPriceChart,
},
props: ["sourceId"],
inject: ["client"],
data() {
return {
server: "",
};
},
computed: {
isOrigin: function () {
return this.client == "origin";
},
servers: function () {
return this.isOrigin ? servers_origin : servers_std;
},
},
mounted() {
let params = new URLSearchParams(location.search);
let server = params.get("server");
this.server = server || (this.isOrigin ? "缘起稻香" : "梦江南");
this.$nextTick(() => {
this.$refs.item_price_chart.render();
});
},
};
</script>

<style lang="less">
.p-price-new {
.m-price-title {
.flex;
justify-content: space-between;
align-items: center;
background-color: #f5f7fa;
padding: 10px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
font-size: 15px;
font-weight: 300;
.m-server {
.flex;
justify-content: flex-end;
align-items: center;
gap: 5px;
.u-server {
margin-left: 5px;
}
}
}
.m-price-content {
padding: 20px;
box-sizing: border-box;
border: 1px solid #e4e7ed;
margin-bottom: 30px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
.m-item-prices{
.fz(12px);
}
}
</style>
19 changes: 15 additions & 4 deletions src/views/game.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
<template>
<GameLayout>
<div class="m-wiki-view" v-if="wikiPost">
<!-- Warning -->
<div class="m-warning" :class="{ none: !warning }">❌ 您的浏览器版本太低,将无法正常使用本应用</div>
<!-- 公告 -->
<Notice class="m-game-notice" v-if="type === 'achievement'"></Notice>
<!-- 百科 -->
<WikiContent v-if="type !== 'price'" :wiki-post="wikiPost" :compatible="compatible" />
<!-- 物品价格 -->
<PriceTabs
v-if="type == 'item' && wikiPost && wikiPost.source && wikiPost.source.BindType != 3"
:source-id="source_id"
/>
<!-- 单纯价格 -->
<Price v-if="type === 'price'" :source-id="source_id"></Price>
<!-- <Relations :source-id="source_id" v-if="type == 'achievement'" /> -->
<WikiRevisions v-if="wikiPost && wikiPost.post" :type="source_type" :source-id="source_id" :isGame="true" />
<WikiComments v-if="wikiPost && wikiPost.post" :type="source_type" :source-id="source_id" />
<template v-else>
<!-- 历史版本 -->
<WikiRevisions
v-if="wikiPost && wikiPost.post"
:type="source_type"
:source-id="source_id"
:isGame="true"
/>
<!-- 评论 -->
<WikiComments v-if="wikiPost && wikiPost.post" :type="source_type" :source-id="source_id" />
</template>
</div>
</GameLayout>
</template>
Expand Down

0 comments on commit 6adbd36

Please sign in to comment.