趋势图改为累计净值, 范围调整至最近42个交易日

master
宇天 2020-08-04 11:32:33 +08:00
parent 00c341e2a9
commit 6493ee516e
6 changed files with 21 additions and 17 deletions

View File

@ -1,6 +1,6 @@
{
"name": "io.yutent.gaystat",
"version": "1.5.0",
"version": "1.6.0",
"description": "搞基数据",
"main": "src/main.js",
"scripts": {

View File

@ -1 +1 @@
html{font-size:12.8px;width:100%;height:100vh}body{display:flex;flex-direction:column;width:100%;height:100%;padding-top:.9375rem;line-height:1.25;font-size:1.09375rem;color:#f2f5fc;background:transparent}.app{position:relative;display:flex;flex-direction:column;height:100%;padding:1.25rem 0 .46875rem;border-radius:.46875rem;background:rgba(88,88,88,0.85)}.app::before{position:absolute;left:12.10938rem;top:-.54688rem;width:1.09375rem;height:1.09375rem;border-radius:.15625rem;background:linear-gradient(to bottom right, rgba(88,88,88,0.85) 50%, transparent 50%);-webkit-transform:rotate(45deg);transform:rotate(45deg);content:""}.app .option,.app .close,.app .load{position:absolute;right:.46875rem;top:.15625rem;--size: 1.09375rem;cursor:pointer;opacity:0}.app .option:hover,.app .close:hover,.app .load:hover{opacity:1}.app .close{right:auto;left:.46875rem}.app .load{right:auto;left:12.10938rem}.app .list{flex:1}.app .list .item{display:flex;align-items:center;height:4.21875rem;padding:.78125rem .9375rem;line-height:1.17188rem;border-bottom:.07812rem solid rgba(200,200,200,0.1);border-top:.07812rem solid rgba(0,0,0,0.1)}.app .list .item:first-child{border-top:0}.app .list .item:last-child{border-bottom:0}.app .list .item .info{overflow:hidden;flex:1}.app .list .item .info h3{font-size:1.09375rem}.app .list .item .info cite{color:#dae1e9}.app .list .item .last-week{display:flex;width:3.75rem;height:2.34375rem;margin:0 1.25rem}.app .list .item .today{width:4.0625rem;font-size:.9375rem;color:#fff;text-align:right}.app .list .item .today span{display:block;padding:0 .3125rem}.app .list .item .today .percent{border-radius:.15625rem}.app .list .item .today .percent.red{background:#ff5061}.app .list .item .today .percent.green{background:#4caf50}
html{font-size:12.8px;width:100%;height:100vh}body{display:flex;flex-direction:column;width:100%;height:100%;padding-top:.9375rem;line-height:1.25;font-size:1.09375rem;color:#f2f5fc;background:transparent}.app{position:relative;display:flex;flex-direction:column;height:100%;padding:1.25rem 0 .46875rem;border-radius:.46875rem;background:rgba(88,88,88,0.85)}.app::before{position:absolute;left:12.10938rem;top:-.54688rem;width:1.09375rem;height:1.09375rem;border-radius:.15625rem;background:linear-gradient(to bottom right, rgba(88,88,88,0.85) 50%, transparent 50%);-webkit-transform:rotate(45deg);transform:rotate(45deg);content:""}.app .option,.app .close,.app .load{position:absolute;right:.46875rem;top:.15625rem;--size: 1.09375rem;cursor:pointer;opacity:0}.app .option:hover,.app .close:hover,.app .load:hover{opacity:1}.app .close{right:auto;left:.46875rem}.app .load{right:auto;left:12.10938rem}.app .list{flex:1}.app .list .item{display:flex;align-items:center;height:4.21875rem;padding:.78125rem .9375rem;line-height:1.17188rem;border-bottom:.07812rem solid rgba(200,200,200,0.1);border-top:.07812rem solid rgba(0,0,0,0.1)}.app .list .item:first-child{border-top:0}.app .list .item:last-child{border-bottom:0}.app .list .item .info{overflow:hidden;flex:1}.app .list .item .info h3{font-size:1.09375rem}.app .list .item .info cite{color:#dae1e9}.app .list .item .last-days{display:flex;width:5rem;height:2.34375rem;margin:0 .46875rem}.app .list .item .today{width:4.0625rem;font-size:.9375rem;color:#fff;text-align:right}.app .list .item .today span{display:block;padding:0 .3125rem}.app .list .item .today .percent{border-radius:.15625rem}.app .list .item .today .percent.red{background:#ff5061}.app .list .item .today .percent.green{background:#4caf50}

View File

@ -77,10 +77,10 @@ body {
cite {color:nth($cp, 3);}
}
.last-week {
.last-days {
display:flex;
width:px(48);height:px(30);
margin:0 px(16);
width:px(64);height:px(30);
margin:0 px(6);
}
.today {

View File

@ -23,7 +23,7 @@
<cite :text="it.code"></cite>
</div>
<canvas class="last-week" width="70" height="30" :draw="it.last"></canvas>
<canvas class="last-days" width="128" height="60" :draw="it.last"></canvas>
<div class="today">
<span class="money" :text="it.curr"></span>

View File

@ -36,7 +36,7 @@ function getTableData(str) {
table.innerHTML = match[0]
list = Array.from(table.children[0].children)
.map(it => {
let m = +it.children[1].textContent
let m = +it.children[2].textContent
if (m > max) {
max = m
}
@ -48,7 +48,7 @@ function getTableData(str) {
.reverse()
list.forEach(it => {
it.h = +(((it.m - min) * 25) / (max - min)).toFixed(2)
it.h = +(((it.m - min) * 60) / (max - min)).toFixed(2)
})
return list
}
@ -99,7 +99,7 @@ Anot({
getLastMonth(id) {
var res = ipcRenderer.sendSync(
'net',
`https://fund.eastmoney.com/f10/F10DataApi.aspx?type=lsjz&per=30&code=${id}`
`https://fund.eastmoney.com/f10/F10DataApi.aspx?type=lsjz&per=42&code=${id}`
)
return getTableData(res)
},

View File

@ -8,6 +8,9 @@
const log = console.log
const RED = '#ff5061'
const GREEN = '#4caf50'
Anot.directive('draw', {
priority: 1500,
init(binding) {
@ -18,22 +21,23 @@ Anot.directive('draw', {
update: function(val) {
var list = val.$model
var start = list.shift()
var end = list[list.length - 1]
var x = 0
this.$ctx.clearRect(0, 0, 70, 30)
this.$ctx.clearRect(0, 0, 128, 60)
this.$ctx.fillStyle = '#a7a8ab'
this.$ctx.fillRect(0, 0, 1, 30)
this.$ctx.fillRect(0, 29, 70, 1)
this.$ctx.fillRect(0, 29, 128, 1)
this.$ctx.beginPath()
this.$ctx.strokeStyle = '#ff5061'
this.$ctx.lineWidth = 1
this.$ctx.moveTo(0, 30 - start.h)
this.$ctx.strokeStyle = start.m < end.m ? RED : GREEN
this.$ctx.lineWidth = 2
this.$ctx.moveTo(0, 60 - start.h)
while (list.length) {
start = list.shift()
x += 2
this.$ctx.lineTo(x, 30 - start.h)
x += 3
this.$ctx.lineTo(x, 60 - start.h)
}
this.$ctx.stroke()
}