Browse Source

首页K先优化

master
ltlzx 4 years ago
parent
commit
26b10a01d8
  1. 138
      src/views/home/index.vue

138
src/views/home/index.vue

@ -239,7 +239,7 @@
<img src="../../assets/img/decreace.png" class="td_img" alt="" v-show="item.increase * 1 < 0"> --> <img src="../../assets/img/decreace.png" class="td_img" alt="" v-show="item.increase * 1 < 0"> -->
<svg width="109" height="39"> <svg width="109" height="39">
<g style="transform: translate(0, 10px)"> <g style="transform: translate(0, 10px)">
<path :d="item.line" /> <path :d="item.line" :class="item.increase *1 <0 ?'path_decreace':'path_increace'"/>
</g> </g>
</svg> </svg>
</td> </td>
@ -512,7 +512,6 @@ export default {
}; };
}, },
methods: { methods: {
getScales(data) { getScales(data) {
const x = d3.scaleTime().range([0, 100]); const x = d3.scaleTime().range([0, 100]);
const y = d3.scaleLinear().range([39, 0]); const y = d3.scaleLinear().range([39, 0]);
@ -531,28 +530,28 @@ export default {
// this.calculatePath(item.prices) // this.calculatePath(item.prices)
item.line = path(item.prices); item.line = path(item.prices);
}) })
console.info(this.marketList[0].marketInfoList)
}, },
truncate(str, length) { truncate(str, length) {
return _.truncate(str, { length }); return _.truncate(str, { length });
}, },
isShow(str) { isShow(str) {
let reg = new RegExp(this.searchTxt, "ig"); let reg = new RegExp(this.searchTxt, "ig");
return reg.test(str); return reg.test(str);
}, },
filterCode: function (str) { filterCode: function (str) {
return str.replace(/<[^<>]+>/g, "").replace(/&nbsp;/gi, ""); return str.replace(/<[^<>]+>/g, "").replace(/&nbsp;/gi, "");
}, },
swiperPrev() { swiperPrev() {
let $swiper = this.$refs.swiper.$swiper; let $swiper = this.$refs.swiper.$swiper;
$swiper.slidePrev(); $swiper.slidePrev();
}, },
swiperNext() { swiperNext() {
let $swiper = this.$refs.swiper.$swiper; let $swiper = this.$refs.swiper.$swiper;
$swiper.slideNext(); $swiper.slideNext();
}, },
indexList() { indexList() {
Home.indexList() Home.indexList().then((res) => {
.then((res) => {
console.info(res) console.info(res)
this.bannerList = res.bannerList; this.bannerList = res.bannerList;
@ -569,48 +568,47 @@ export default {
.catch((res) => {}); .catch((res) => {});
}, },
skroll() { skroll() {
let skro = this.skro; let skro = this.skro;
skro skro
.add(".marquee-list .item", { .add(".marquee-list .item", {
animation: "fadeInLeft", animation: "fadeInLeft",
delay: 80, delay: 80,
duration: 1000, duration: 1000,
}) })
.add(".new-ticker-block", { .add(".new-ticker-block", {
animation: "fadeInRight", animation: "fadeInRight",
delay: 80, delay: 80,
duration: 800, duration: 800,
}) })
.add(".shlitu", { .add(".shlitu", {
animation: "fadeInLeft", animation: "fadeInLeft",
delay: 80, delay: 80,
duration: 800, duration: 800,
}) })
.add(".activity-box", { .add(".activity-box", {
animation: "zoomIn", animation: "zoomIn",
delay: 80, delay: 80,
duration: 800, duration: 800,
}) })
.add(".lattest-news-section .item", { .add(".lattest-news-section .item", {
animation: "zoomIn", animation: "zoomIn",
wait: 150, wait: 150,
delay: 80, delay: 80,
duration: 800, duration: 800,
}) })
.init(); .init();
}, },
// //
isCoolect(i) { 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() { getCollect() {
Home.getCollect() Home.getCollect().then((res) => {
.then((res) => { this.collect = res || [];
this.collect = res || [];
}) })
.catch((err) => {}); .catch((err) => {});
}, },
@ -647,26 +645,27 @@ export default {
// socket // socket
indexMarketList() { indexMarketList() {
const ws = new Socket(this.Globals.Server.Path.WS); const ws = new Socket(this.Globals.Server.Path.WS);
ws.on("open", () => { ws.on("open", () => {
this.ws = ws; this.ws = ws;
ws.send({ ws.send({
cmd: "sub", cmd: "sub",
msg: "indexMarketList", 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() {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
svg{
margin: 25px;
}
path{ path{
// stroke: #76BF8A;
fill: none; fill: none;
stroke: #76BF8A;
stroke-width: 3px; stroke-width: 3px;
} }
.path_decreace{
stroke: #ff231f;
}
.path_increace{
stroke: #76BF8A;
}
// .view-more { // .view-more {
// background: #fd5b2c !important; // background: #fd5b2c !important;
// } // }

Loading…
Cancel
Save