Skip to content

Commit

Permalink
fix: client
Browse files Browse the repository at this point in the history
  • Loading branch information
zixuan1986 committed Oct 15, 2023
1 parent fb767b3 commit e4f4f7b
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 52 deletions.
64 changes: 33 additions & 31 deletions src/components/gonggao/Daily.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@
</div>
</div>
<template v-if="!isOrigin">
<div class="m-daily-item">
<div class="u-title">园宅会赛</div>
<div class="m-child-item">
<SimpleFurniture :furniture="currentFurniture" title="本期"></SimpleFurniture>
<div class="m-daily-item">
<div class="u-title">园宅会赛</div>
<div class="m-child-item">
<SimpleFurniture :furniture="currentFurniture" title="本期"></SimpleFurniture>
</div>
<div class="m-child-item">
<SimpleFurniture :furniture="nextFurniture" title="下期"></SimpleFurniture>
</div>
</div>
<div class="m-child-item">
<SimpleFurniture :furniture="nextFurniture" title="下期"></SimpleFurniture>
<div class="m-daily-item">
<div class="u-title">抓马播报</div>
<SimpleHorse></SimpleHorse>
</div>
</div>
<div class="m-daily-item">
<div class="u-title">抓马播报</div>
<SimpleHorse></SimpleHorse>
</div>
</template>
</div>
</template>
Expand Down Expand Up @@ -115,31 +115,33 @@ export default {
server() {
return this.$store.state.server;
},
isOrigin() {
return location.href.includes("origin") ? "origin" : "std";
isOrigin() {
return location.href.includes("origin");
},
},
methods: {
getFurniture() {
const params = {
subtypes: "category,property,next_match",
start: dayjs.tz().startOf("isoWeek").format("YYYY-MM-DD"),
end: dayjs.tz().endOf("isoWeek").format("YYYY-MM-DD"),
};
getFurniture(params).then((res) => {
const list = res.data?.data;
this.currentFurniture = {
property: list.find((item) => item.subtype === "property")?.content || "",
category: list.find((item) => item.subtype === "category")?.content || "",
};
const nextContent = list.find((item) => item.subtype === "next_match")?.content || "";
const reg = nextContent.indexOf("") > -1 ? /.*/g : /.*:/g;
const nextArr = nextContent ? nextContent.replace(reg, "").split("\n") : [];
this.nextFurniture = {
property: nextArr[0] || "",
category: nextArr[1] || "",
if (!this.isOrigin) {
const params = {
subtypes: "category,property,next_match",
start: dayjs.tz().startOf("isoWeek").format("YYYY-MM-DD"),
end: dayjs.tz().endOf("isoWeek").format("YYYY-MM-DD"),
};
});
getFurniture(params).then((res) => {
const list = res.data?.data;
this.currentFurniture = {
property: list.find((item) => item.subtype === "property")?.content || "",
category: list.find((item) => item.subtype === "category")?.content || "",
};
const nextContent = list.find((item) => item.subtype === "next_match")?.content || "";
const reg = nextContent.indexOf("") > -1 ? /.*/g : /.*:/g;
const nextArr = nextContent ? nextContent.replace(reg, "").split("\n") : [];
this.nextFurniture = {
property: nextArr[0] || "",
category: nextArr[1] || "",
};
});
}
},
},
mounted() {
Expand Down
8 changes: 7 additions & 1 deletion src/components/gonggao/daily/SimpleServer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export default {
uid() {
return this.$store.state.uid;
},
isOrigin() {
return location.href.includes("origin");
},
myServer() {
// 当前服务器
if (this.uid) {
Expand All @@ -52,7 +55,10 @@ export default {
let list = [];
if (this.serverList.length) {
const favList = this.favList.filter((item) => item.main_server !== this.$store.state.server);
const serverList = this.serverList.filter((item) => item.main_server !== this.myServer?.main_server);
const clientServerList = this.isOrigin
? this.serverList.filter((item) => item.zone_name == "缘起大区")
: this.serverList.filter((item) => item.main_server !== this.$store.state.server);
const serverList = clientServerList.filter((item) => item.main_server !== this.myServer?.main_server);
if (this.uid && favList.length > 3) {
list = favList.splice(0, 3);
} else {
Expand Down
47 changes: 27 additions & 20 deletions src/views/price/overview/index.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<template>
<div class="p-price-overview">
<div class="m-price-overview-header">
<div class="u-title">走势速览</div>
<div class="u-servers">
<el-select v-model="server" placeholder="请选择" :default-first-option="true" @change="serverChange">
<div slot="prefix">区服价格</div>
<el-option v-for="server in server_cn" :key="server" :label="server" :value="server">
</el-option>
</el-select>
</div>
<div class="p-price-overview">
<div class="m-price-overview-header">
<div class="u-title">走势速览</div>
<div class="u-servers">
<el-select v-model="server" placeholder="请选择" :default-first-option="true" @change="serverChange">
<div slot="prefix">区服价格</div>
<el-option v-for="server in serverList" :key="server" :label="server" :value="server"> </el-option>
</el-select>
</div>
</div>
<div class="m-price-overview-body">
<goldCharts :server="server" v-if="server" />
<goods ref="goods" :server="server" v-if="server" />
</div>
</div>
<div class="m-price-overview-body">
<goldCharts :server="server" v-if="server" />
<goods ref="goods" :server="server" v-if="server" />
</div>
</div>
</template>
<script>
import server_cn from "@jx3box/jx3box-data/data/server/server_cn.json";
import server_origin from "@jx3box/jx3box-data/data/server/server_origin.json";
import { getUserInfo } from "@/service/price.js"; // 系统关注物品类型
import goods from "./goods.vue";
import goldCharts from "./goldCharts.vue";
Expand All @@ -26,10 +26,17 @@ export default {
components: { goods, goldCharts },
data() {
return {
server_cn,
server: "",
};
},
computed: {
client() {
return this.$store.state.client;
},
serverList() {
return this.client == "std" ? server_cn : server_origin;
},
},
methods: {
serverChange() {
this.$nextTick(() => {
Expand All @@ -38,16 +45,16 @@ export default {
},
},
created() {
if (User.isLogin()) {
if (User.isLogin() && this.client == "std") {
getUserInfo().then((res) => {
this.server = res.data?.data?.jx3_server || "梦江南";
});
} else {
this.server = "梦江南";
this.server = this.client == "std" ? "梦江南" : "缘起稻香";
}
},
};
</script>
<style lang="less" >
<style lang="less">
@import "~@/assets/css/price/overview.less";
</style>
</style>

0 comments on commit e4f4f7b

Please sign in to comment.