Browse Source

优化首页和合约

master
ltlzx 4 years ago
parent
commit
fb8db64dfb
  1. 2
      src/views/contract/handicap.vue
  2. 15
      src/views/home/index.vue
  3. 36
      src/views/market/price-line.vue
  4. 39
      src/views/option/kline.vue

2
src/views/contract/handicap.vue

@ -190,7 +190,7 @@ export default {
this.linkSocket(); this.linkSocket();
} }
bus.$on('collapse', msg => { bus.$on('collapse', msg => {
console.info(msg) // console.info(msg)
this.newPriceObj.price = msg.close; this.newPriceObj.price = msg.close;
this.$emit("input", this.newPriceObj); this.$emit("input", this.newPriceObj);
}); });

15
src/views/home/index.vue

@ -237,11 +237,12 @@
> --> > -->
<!-- <img src="../../assets/img/increace.png" class="td_img" alt="" v-show="item.increase * 1 >= 0"> <!-- <img src="../../assets/img/increace.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"> --> <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" :class="item.increase *1 <0 ?'path_decreace':'path_increace'"/> <path :d="item.line" :class="item.increase *1 <0 ?'path_decreace':'path_increace'"/>
</g> </g>
</svg> </svg> -->
<price-line :line="item.prices" :increase="item.increase" class="td_img"/>
</td> </td>
<td> <td>
<router-link :to="`/exchange/${item.symbol}`"> <router-link :to="`/exchange/${item.symbol}`">
@ -420,10 +421,12 @@ import Socket from "@/api/server/Socket.js";
import College from "@/api/college"; import College from "@/api/college";
import Member from "@/api/member"; import Member from "@/api/member";
import * as d3 from 'd3'; import * as d3 from 'd3';
import priceLine from "../market/price-line";
// Vue.use(VueAwesomeSwiper); // Vue.use(VueAwesomeSwiper);
export default { export default {
components: { components: {
vueQr, vueQr,
priceLine
}, },
computed: { computed: {
@ -557,7 +560,7 @@ export default {
this.homeList = res.homeList; this.homeList = res.homeList;
this.marketList = res.marketList; this.marketList = res.marketList;
this.calculatePath() // this.calculatePath()
this.iconList = res.iconList; this.iconList = res.iconList;
this.pcBannerList = res.pcBannerList this.pcBannerList = res.pcBannerList
this.tab = this.marketList[0].coin_name; this.tab = this.marketList[0].coin_name;
@ -659,7 +662,7 @@ export default {
if (sub == "indexMarketList") { if (sub == "indexMarketList") {
this.marketList = data; this.marketList = data;
this.replaceOptional(); this.replaceOptional();
this.calculatePath() // this.calculatePath()
} else if (type == "ping") { } else if (type == "ping") {
ws.send({ ws.send({
cmd: "pong", cmd: "pong",
@ -708,7 +711,6 @@ created(){
this.indexList(); this.indexList();
}, },
mounted() { mounted() {
// this.calculatePath();
this.article() this.article()
if (this.isLogin) { if (this.isLogin) {
this.getCollect(); this.getCollect();
@ -1208,7 +1210,8 @@ path{
} }
.td_img{ .td_img{
width: 109px; width: 109px;
height: 39px; height: 39px !important;
margin: 0 auto;
} }
.td_button{ .td_button{
width: 140px; width: 140px;

36
src/views/market/price-line.vue

@ -6,7 +6,7 @@
import Highcharts from "highcharts/highstock"; import Highcharts from "highcharts/highstock";
export default { export default {
name: "price-line", name: "price-line",
props: ['line'], props: ['line','increase'],
data() { data() {
return { return {
chart: undefined chart: undefined
@ -61,7 +61,8 @@ export default {
enabled: false enabled: false
}, },
data: this.dataFilter(this.line), data: this.dataFilter(this.line),
color: "#00c162", // color: "#00c162",
color: this.changeColors(),
fillColor: { fillColor: {
linearGradient: { linearGradient: {
x1: 0, x1: 0,
@ -69,13 +70,38 @@ export default {
y1: 0, y1: 0,
y2: 1 y2: 1
}, },
stops: [ stops:this.changeColors1()
// stops: [
// [0, "rgba(2,150,82,.5)"],
// [1, "rgba(2,150,82,.2)"]
// ]
}
}, ]
});
},
changeColors(){
let col
if(this.increase * 1 >= 0 || !this.increase){
col='#00c162'
}else{
col="#ff0500"
}
return col
},
changeColors1(){
let col
if(this.increase * 1 >= 0 || !this.increase){
col=[
[0, "rgba(2,150,82,.5)"], [0, "rgba(2,150,82,.5)"],
[1, "rgba(2,150,82,.2)"] [1, "rgba(2,150,82,.2)"]
] ]
}else{
col=[
[0, "rgba(255,5,0,.5)"],
[1, "rgba(255,5,0,.2)"]
]
} }
}, ] return col
});
} }
}, },
mounted() { mounted() {

39
src/views/option/kline.vue

@ -323,11 +323,19 @@ methods: {
// "header_widget_dom_node", // "header_widget_dom_node",
'timeframes_toolbar', 'timeframes_toolbar',
], ],
// enabled_features:['header_indicators'],
supported_resolutions: ["5", "15", "30", "60", "240", "1D", "1W", "1M"], supported_resolutions: ["5", "15", "30", "60", "240", "1D", "1W", "1M"],
overrides: tvStyle[_this.theme], overrides: tvStyle[_this.theme],
custom_css_url: `/static/Kline/charting_library/static/css/tradingview_${ custom_css_url: `/static/Kline/charting_library/static/css/tradingview_${
_this.theme == "light" ? "white" : "black" _this.theme == "light" ? "white" : "black"
}.css`, }.css`,
drawings_access: {
type: "black",
tools: [
{ name: "Trend Line", grayed: true },
{ name: "Trend Angle", grayed: true }
]
},
})); }));
widget.onChartReady(function () { widget.onChartReady(function () {
let buttonArr = [ let buttonArr = [
@ -408,7 +416,38 @@ methods: {
.find("div.button") .find("div.button")
.removeClass("mydate"); .removeClass("mydate");
}; };
widget.chart().createStudy(
"Moving Average",
false,
true,
[5, "close", 0],
null,
{
"Plot.color": "#e843da",
}
);
widget.chart().createStudy(
"Moving Average",
false,
true,
[10, "close", 0],
null,
{
"Plot.color": "#53b987",
}
);
widget.chart().createStudy(
"Moving Average",
false,
true,
[30, "close", 0],
null,
{
"Plot.color": "#ff231f",
}
);
}); });
}, },
}, },
mounted() { mounted() {

Loading…
Cancel
Save