From 26b10a01d88b5aac9e6097eabb7e9a81d77fb3d9 Mon Sep 17 00:00:00 2001 From: ltlzx <942659938@qq.com> Date: Tue, 15 Feb 2022 10:10:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5K=E5=85=88=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/index.vue | 138 ++++++++++++++++++++------------------- 1 file changed, 70 insertions(+), 68 deletions(-) diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 32d3c9a..cfa106c 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -239,7 +239,7 @@ --> - + @@ -512,7 +512,6 @@ export default { }; }, methods: { - getScales(data) { const x = d3.scaleTime().range([0, 100]); const y = d3.scaleLinear().range([39, 0]); @@ -531,28 +530,28 @@ export default { // this.calculatePath(item.prices) item.line = path(item.prices); }) + console.info(this.marketList[0].marketInfoList) }, truncate(str, length) { return _.truncate(str, { length }); }, isShow(str) { - let reg = new RegExp(this.searchTxt, "ig"); - return reg.test(str); + let reg = new RegExp(this.searchTxt, "ig"); + return reg.test(str); }, filterCode: function (str) { - return str.replace(/<[^<>]+>/g, "").replace(/ /gi, ""); + return str.replace(/<[^<>]+>/g, "").replace(/ /gi, ""); }, swiperPrev() { - let $swiper = this.$refs.swiper.$swiper; - $swiper.slidePrev(); + let $swiper = this.$refs.swiper.$swiper; + $swiper.slidePrev(); }, swiperNext() { - let $swiper = this.$refs.swiper.$swiper; - $swiper.slideNext(); + let $swiper = this.$refs.swiper.$swiper; + $swiper.slideNext(); }, indexList() { - Home.indexList() - .then((res) => { + Home.indexList().then((res) => { console.info(res) this.bannerList = res.bannerList; @@ -569,48 +568,47 @@ export default { .catch((res) => {}); }, skroll() { - let skro = this.skro; - - skro - .add(".marquee-list .item", { - animation: "fadeInLeft", - delay: 80, - duration: 1000, - }) - .add(".new-ticker-block", { - animation: "fadeInRight", - delay: 80, - duration: 800, - }) - .add(".shlitu", { - animation: "fadeInLeft", - delay: 80, - duration: 800, - }) - .add(".activity-box", { - animation: "zoomIn", - delay: 80, - duration: 800, - }) - .add(".lattest-news-section .item", { - animation: "zoomIn", - wait: 150, - delay: 80, - duration: 800, - }) - .init(); + let skro = this.skro; + + skro + .add(".marquee-list .item", { + animation: "fadeInLeft", + delay: 80, + duration: 1000, + }) + .add(".new-ticker-block", { + animation: "fadeInRight", + delay: 80, + duration: 800, + }) + .add(".shlitu", { + animation: "fadeInLeft", + delay: 80, + duration: 800, + }) + .add(".activity-box", { + animation: "zoomIn", + delay: 80, + duration: 800, + }) + .add(".lattest-news-section .item", { + animation: "zoomIn", + wait: 150, + delay: 80, + duration: 800, + }) + .init(); }, // 是否为自选 isCoolect(i) { - return this.collect.map((item) => item.pair_name).includes(i.pair_name); + return this.collect.map((item) => item.pair_name).includes(i.pair_name); }, // 获取自选交易列表 getCollect() { - Home.getCollect() - .then((res) => { - this.collect = res || []; + Home.getCollect().then((res) => { + this.collect = res || []; }) .catch((err) => {}); }, @@ -647,26 +645,27 @@ export default { // 链接socket indexMarketList() { - const ws = new Socket(this.Globals.Server.Path.WS); - ws.on("open", () => { - this.ws = ws; - ws.send({ - cmd: "sub", - msg: "indexMarketList", + const ws = new Socket(this.Globals.Server.Path.WS); + ws.on("open", () => { + this.ws = ws; + ws.send({ + cmd: "sub", + msg: "indexMarketList", + }); + }); + ws.on("message", (res) => { + console.info(res) + let { data, msg, code, sub, type, status } = res; + if (sub == "indexMarketList") { + this.marketList = data; + this.replaceOptional(); + this.calculatePath() + } else if (type == "ping") { + ws.send({ + cmd: "pong", + }); + } }); - }); - ws.on("message", (res) => { - console.info(res) - let { data, msg, code, sub, type, status } = res; - if (sub == "indexMarketList") { - this.marketList = data; - this.replaceOptional(); - } else if (type == "ping") { - ws.send({ - cmd: "pong", - }); - } - }); }, // 鼠标移入卡片的样式 @@ -763,14 +762,17 @@ mounted() {