diff --git a/package.json b/package.json index 6022a14..084dc49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io.yutent.gaystat", - "version": "1.5.0", + "version": "1.6.0", "description": "搞基数据", "main": "src/main.js", "scripts": { diff --git a/src/css/app.css b/src/css/app.css index d4ad7f1..906d1e8 100644 --- a/src/css/app.css +++ b/src/css/app.css @@ -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} diff --git a/src/css/app.scss b/src/css/app.scss index 9e19014..a4d447d 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -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 { diff --git a/src/index.html b/src/index.html index 6aad89b..550415d 100644 --- a/src/index.html +++ b/src/index.html @@ -23,7 +23,7 @@ - +
diff --git a/src/js/app.js b/src/js/app.js index 2908a0e..e576b04 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -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) }, diff --git a/src/lib/canvas-draw.js b/src/lib/canvas-draw.js index b686c3d..3c91334 100644 --- a/src/lib/canvas-draw.js +++ b/src/lib/canvas-draw.js @@ -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() }