diff --git a/bi-ui/src/components/global/WFlyingLine.vue b/bi-ui/src/components/global/WFlyingLine.vue new file mode 100644 index 0000000..2c64ce5 --- /dev/null +++ b/bi-ui/src/components/global/WFlyingLine.vue @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bi-ui/src/pages/index.vue b/bi-ui/src/pages/index.vue index 9bc4861..cfad95d 100644 --- a/bi-ui/src/pages/index.vue +++ b/bi-ui/src/pages/index.vue @@ -1,5 +1,8 @@ - index + index + + + diff --git a/bi-ui/src/pages/test/FlyingLine.vue b/bi-ui/src/pages/test/FlyingLine.vue new file mode 100644 index 0000000..43b2e4b --- /dev/null +++ b/bi-ui/src/pages/test/FlyingLine.vue @@ -0,0 +1,112 @@ + + + 绘制飞线 + + + + + + + 画布宽度width: + 画布高度height: + + + 线条配置lines: path-线条路径, size-线条大小, lineColor-线条颜色, + flyingColor-飞线颜色,flyingLen-飞线长度, flying-是否绘制飞线, + dot-是否绘制光点, am-是否启动动画,time-动画周期时间 + + + + 重绘线条 + + + 默认线段配置: + {{ JSON.stringify({ + path: `M 10,10 C 200,10,10,200,290,290`, + size: 1, + lineColor: "var(--w-bg-dark)", + flyingColor: "var(--w-main)", + flyingLen: 20, + flying: true, + dot: true, + am: true, + time: "5s", +},null,' ') }} + + + + + + \ No newline at end of file diff --git a/bi-ui/src/util/index.js b/bi-ui/src/util/index.js index 5588acc..cbf0389 100644 --- a/bi-ui/src/util/index.js +++ b/bi-ui/src/util/index.js @@ -12,6 +12,8 @@ export const util = { import * as jsencrypt from './modules/jsencrypt' export { jsencrypt } +export { IdGenerator} from './modules/IdGenerator' + export { timerBind, timerUnBind } from "./modules/timer"; export { icons } from "./modules/icons"; diff --git a/bi-ui/src/util/modules/IdGenerator.js b/bi-ui/src/util/modules/IdGenerator.js new file mode 100644 index 0000000..9bc4328 --- /dev/null +++ b/bi-ui/src/util/modules/IdGenerator.js @@ -0,0 +1,26 @@ +class IdGenerator { + static #idGenerator = new IdGenerator(); + + #count = 0; + + #countGen() { + this.#count++; + if (this.#count >= 1296) { + this.#count = 0; + } + return this.#count.toString(36).padEnd(2, "0"); + } + next() { + return ( + Date.now().toString(36) + + this.#countGen() + + Math.random().toString(36).substring(2, 10) + ); + } + + static next() { + return IdGenerator.#idGenerator.next(); + } +} + +export { IdGenerator } \ No newline at end of file
{{ JSON.stringify({ + path: `M 10,10 C 200,10,10,200,290,290`, + size: 1, + lineColor: "var(--w-bg-dark)", + flyingColor: "var(--w-main)", + flyingLen: 20, + flying: true, + dot: true, + am: true, + time: "5s", +},null,' ') }}