Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

网页 API 设计 #73

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

wongsingfo
Copy link

@wongsingfo wongsingfo commented Apr 12, 2020

这个 pr 是关于 issue #68 的解决方案

目前的demo: 显示危险牌

Screen Shot 2020-04-12 at 3 35 51 PM

计划添加的内容

  • 将终端的信息都迁移到网页端
  • 通过 websocket 或 server-sent events 让服务器发现状态更新时主动 push 给客户端
  • bootstrap 排版
  • 前端优化(减少不必要的渲染过程)

@wongsingfo wongsingfo marked this pull request as draft April 12, 2020 07:37
@wongsingfo
Copy link
Author

wongsingfo commented Apr 12, 2020

目前完成度:

Screen Shot 2020-04-12 at 8 44 29 PM

已知的 bug:

  • 在鸣牌的时候显示有可能会出错
  • 数据结构的读写因为没有加锁,可能会少显示一些内容
  • 雀魂使用的是 https,还没有做雀魂的适配

@wongsingfo wongsingfo marked this pull request as ready for review April 12, 2020 13:00
@EndlessCheng
Copy link
Owner

看起来不错噢!我看你是用透明度表示危险度的,但感觉颜色过于接近,区分度不太明显,可以试试多种颜色的方案。

@wongsingfo
Copy link
Author

关于颜色,现在的方案是设置几个关键点的颜色(见下面的代码),关键点之间的颜色用 linear-gradient 计算(这里用的是 RGB color space。我也尝试过 HSL,但是效果并不是很好)

let gradient = [
	{ risk: 0.0 , color: [255, 255,  255] }, // 绝安,白色
	{ risk: 1e-5 , color: [131, 179,  17] },  // 只要有一点风险,鸭绿色
	{ risk: 8 , color:   [250, 195,  0] },  // 还可以冲一冲, 黄色
	{ risk: 16 , color: [253, 99, 0] },  // 相当危险,橙色
	{ risk: 25.0, color: [253, 0,  135] }, // 非常危险, 粉色/紫色
];

image

@wcp1231
Copy link

wcp1231 commented Mar 6, 2022

我在这个 pr 的基础上改造了一下,主要定义了页面的 JSON model,然后用 vue 简单写了个页面。
后端逻辑比较复杂,我就没怎么改。

可以看图
截屏2022-03-06 22 00 05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants