Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
DoraemonKit
提交
707bc929
D
DoraemonKit
项目概览
DiDi
/
DoraemonKit
12 个月 前同步成功
通知
166
Star
19623
Fork
3062
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DoraemonKit
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
707bc929
编写于
4月 21, 2021
作者:
D
duanlikang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: develop dokit web
上级
a9910189
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
363 addition
and
52 deletion
+363
-52
Web/packages/core/package.json
Web/packages/core/package.json
+0
-1
Web/packages/core/src/common/components/card.vue
Web/packages/core/src/common/components/card.vue
+71
-0
Web/packages/core/src/common/components/top-bar.vue
Web/packages/core/src/common/components/top-bar.vue
+68
-0
Web/packages/core/src/common/components/version.vue
Web/packages/core/src/common/components/version.vue
+44
-0
Web/packages/core/src/common/js/icon.js
Web/packages/core/src/common/js/icon.js
+5
-0
Web/packages/core/src/common/js/store.js
Web/packages/core/src/common/js/store.js
+24
-0
Web/packages/core/src/components/app.vue
Web/packages/core/src/components/app.vue
+1
-1
Web/packages/core/src/components/container.vue
Web/packages/core/src/components/container.vue
+22
-4
Web/packages/core/src/components/index.vue
Web/packages/core/src/components/index.vue
+33
-5
Web/packages/core/src/index.js
Web/packages/core/src/index.js
+10
-8
Web/packages/core/src/router/index.js
Web/packages/core/src/router/index.js
+7
-7
Web/packages/core/src/router/routes.js
Web/packages/core/src/router/routes.js
+23
-1
Web/packages/core/src/store/index.js
Web/packages/core/src/store/index.js
+7
-0
Web/packages/web/src/components/ToolAppInfo.vue
Web/packages/web/src/components/ToolAppInfo.vue
+1
-1
Web/packages/web/src/components/ToolConsole.vue
Web/packages/web/src/components/ToolConsole.vue
+4
-4
Web/packages/web/src/components/ToolHelloWorld.vue
Web/packages/web/src/components/ToolHelloWorld.vue
+2
-2
Web/packages/web/src/components/common/Card.vue
Web/packages/web/src/components/common/Card.vue
+1
-1
Web/packages/web/src/components/console/LogItem.vue
Web/packages/web/src/components/console/LogItem.vue
+3
-2
Web/packages/web/src/feature.js
Web/packages/web/src/feature.js
+34
-0
Web/packages/web/src/index.js
Web/packages/web/src/index.js
+2
-15
Web/playground/index.html
Web/playground/index.html
+1
-0
未找到文件。
Web/packages/core/package.json
浏览文件 @
707bc929
...
...
@@ -28,7 +28,6 @@
"url"
:
"https://github.com/didi/DoraemonKit/issues"
},
"dependencies"
:
{
"vue"
:
"^3.0.11"
,
"vue-router"
:
"^4.0.6"
}
}
Web/packages/core/src/common/components/card.vue
0 → 100644
浏览文件 @
707bc929
<
template
>
<div
class=
"card"
>
<div
class=
"card-title"
>
<span
class=
"card-title-text"
>
{{
title
}}
</span>
</div>
<div
class=
"item-list"
>
<div
class=
"item"
v-for=
"(item,index) in list"
:key=
"index"
@
click=
"handleClickItem(item)"
>
<div
class=
"item-icon"
>
<img
class=
"item-icon-image"
:src=
"item.icon || defaultIcon"
/>
</div>
<div
class=
"item-title"
>
{{
item
.
title
||
'
默认功能
'
}}
</div>
</div>
</div>
</div>
</
template
>
<
script
>
import
{
DefaultItemIcon
}
from
'
../js/icon
'
export
default
{
props
:
{
title
:
{
default
:
'
专区
'
},
list
:
{
default
:
[]
}
},
data
(){
return
{
defaultIcon
:
DefaultItemIcon
}
},
methods
:
{
handleClickItem
(
item
){
this
.
$router
.
push
({
name
:
item
.
name
})
}
}
};
</
script
>
<
style
lang=
"less"
scoped
>
.card {
margin-top: 15px;
padding: 10px;
background-color: white;
}
.card-title-text {
font-size: 17px;
color: #333333;
}
.item-list {
display: flex;
flex-wrap: wrap;
}
.item {
display: flex;
flex-direction: column;
align-items: center;
width: 25%;
margin-top: 10px;
.item-icon-image {
width: 50px;
}
.item-title {
font-size: 16px;
}
}
</
style
>
\ No newline at end of file
Web/packages/core/src/common/components/top-bar.vue
0 → 100644
浏览文件 @
707bc929
<
template
>
<div
class=
"bar"
>
<div
class=
"bar-back"
@
click=
"handleBackRoute"
>
<img
class=
"bar-back-icon"
:src=
"icon"
/>
<span
class=
"bar-back-btn"
>
返回
</span>
</div>
<div
class=
"bar-title"
>
<span
class=
"bar-title-text"
>
{{
title
}}
</span>
</div>
<div
class=
"bar-other"
>
<span
class=
"bar-other-text"
>
更多
</span>
</div>
</div>
</
template
>
<
script
>
import
{
IconBack
}
from
'
../js/icon
'
;
export
default
{
props
:
{
title
:
{
default
:
'
DoKit
'
}
},
data
(){
return
{
icon
:
IconBack
}
},
methods
:
{
handleBackRoute
(){
this
.
$router
.
back
()
}
}
}
</
script
>
<
style
lang=
"less"
scoped
>
.bar{
background-color: white;
height: 50px;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10px;
box-sizing: border-box;
}
.bar-back{
display: flex;
flex-direction: row;
align-items: center;
}
.bar-back-icon{
display: inline-block;
height: 20px;
}
.bar-back-btn{
color: #337CC4;
font-size: 19px;
margin-left: 5px;
}
.bar-title-text{
color: #333333;
font-size: 22px;
}
.bar-other-text{
color: #666666;
font-size: 15px;
}
</
style
>
\ No newline at end of file
Web/packages/core/src/common/components/version.vue
0 → 100644
浏览文件 @
707bc929
<
template
>
<div
class=
"card version"
>
<div>
<span
class=
"version-text"
>
当前版本:V
{{
version
}}
</span>
</div>
<div
class=
"version-image"
>
<img
class=
"dokit-icon"
:src=
"dokitIcon"
/>
</div>
</div>
</
template
>
<
script
>
import
{
dokitIcon
}
from
'
../js/icon
'
export
default
{
props
:
{
version
:
String
},
data
(){
return
{
dokitIcon
:
dokitIcon
}
}
}
</
script
>
<
style
lang=
"less"
scoped
>
.card {
margin-top: 15px;
padding: 10px;
background-color: white;
}
.version{
padding: 20px 0;
text-align: center;
.version-text{
font-size: 16px;
color: #999999;
}
.version-image{
margin-top: 20px;
}
.dokit-icon{
width: 300px;
}
}
</
style
>
\ No newline at end of file
Web/packages/core/src/common/js/icon.js
0 → 100644
浏览文件 @
707bc929
export
const
IconBack
=
'
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAzCAMAAADIDVqJAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAXFQTFRFAAAANX7GNHzFM3zFM3zFNn3ENYDHNHzFM3zENIDHNH7INH3ENX3GNn7GM33ENYDFNYDGM4DINH7HM3zENH3HNHzENYDGM37FM33FNH3FNn3FNX7HN4DINHzEM33HNH7FNIDGNn7GM33ENX3FNXzHNoDENH7FNH3EM3zEN33INHzFNH3FM4DHNX3HNH3GNX7ENHzENHzFNYDFNH3FM33ENn3JM33GN4DINX7EM3zEM33GNH7FM33FM33FNIDFNH3GNX3KM37HNHzFN4DINX7FNH3EOHzHNH3GM3zFM4DGM33EM3zENHzENH3EM33FOoTFgID/NHzFOIDHM3zEM3zFNoPJM33FM33ENH3FNHzENYDL////NHzENH3FM4PFM3zFOYDGNH3FM3zFN3zINHzEM33FNoDJM3zFM33FNH3ENHzFM37FNH3ENH3FM33ENH7GNX7FM33ENH3FNH7FM37ENH7FM3zFNH3EM4jMM3zE////TdHL6gAAAHl0Uk5TAEPy+vA9RPb0QEX3P0fzPkg8Sfg7SjpL+fE5TThON082Ue81UjRT++4zVO0yVjFX/OwwWOsvWi5b6i1d/eksXitf6Cph5yli/ihk5ieh3x8CoiCg4CGf4Z3iIgGc4yOaJJnkJZjlJpaVk5KQj42LioiHhYSCgHOyD3AmCqsAAAABYktHRFt0vJU0AAAACXBIWXMAAABIAAAASABGyWs+AAABPUlEQVQ4y43UxVoCUBQE4Ctgd3cXKAYoKqioINiBrdjdXby9C+6c3ZzPWf+rE2MMS4bDmY4rk5qs7FQ6ObnU5OXDFFBTCFNUTE2JmFJqysqtcVRQUymmiprqGmtq66ipF9NATSOMq4maZidMCzWtMG3t1HSI6aSmq9sat4eaHpheLzV9YvqpGRi0xuenZghmOEDNiJhRasZggiFqxiesmQxTMyVmmpoZmEiUmlmYWJyauXmYBWoWYZaWqTEr1qRW1zhaT4jaUNQm1Na2onagdjW1B7V/wFXyEOroWFEnok4VdQZ1fqGoS6ira0XdpP4x+uStKL5EY+6gYpq6h4rEFfUgKqqoRyjlkI15ggqGFfUsKqSoFyjlTY15hfIFFPUmyq+odyilhIz5gHJ7FfUpyqOoLyilYo35/rFJ/Jo/DZ3bT7fEcIgAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMDQtMjFUMTc6MzI6MjgrMDg6MDBBnT5hAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTA0LTIxVDE3OjMyOjI4KzA4OjAwMMCG3QAAAABJRU5ErkJggg==
'
export
const
DefaultItemIcon
=
'
https://pt-starimg.didistatic.com/static/starimg/img/FHqpI3InaS1618997548865.png
'
export
const
dokitIcon
=
'
https://pt-starimg.didistatic.com/static/starimg/img/eM7MJKDqVG1618998466986.png
'
\ No newline at end of file
Web/packages/core/src/common/js/store.js
0 → 100644
浏览文件 @
707bc929
import
{
reactive
}
from
'
vue
'
const
storeKey
=
'
store
'
export
class
Store
{
constructor
(
options
){
let
{
state
}
=
options
this
.
initData
(
state
)
}
initData
(
data
=
{}){
this
.
_state
=
reactive
({
data
:
data
})
}
get
state
(){
return
this
.
_state
.
data
}
install
(
app
){
app
.
provide
(
storeKey
,
this
)
app
.
config
.
globalProperties
.
$store
=
this
}
}
Web/packages/core/src/components/app.vue
浏览文件 @
707bc929
...
...
@@ -18,7 +18,7 @@ export default {
},
data
()
{
return
{
showContainer
:
fals
e
,
showContainer
:
tru
e
,
};
},
methods
:
{
...
...
Web/packages/core/src/components/container.vue
浏览文件 @
707bc929
<
template
>
<div
class=
"container"
>
<router-view
v-slot=
"
{Component}">
<top-bar
:title=
"title"
></top-bar>
<router-view
v-slot=
"
{ Component }">
<keep-alive>
<component
:is=
"
{Component}"
/>
<component
:is=
"
Component"
/>
</keep-alive>
</router-view>
</div>
</
template
>
<
script
>
import
TopBar
from
"
../common/components/top-bar
"
;
export
default
{
components
:
{
TopBar
},
data
(){
},
computed
:{
curRoute
(){
return
this
.
$router
.
currentRoute
.
value
},
title
(){
return
this
.
curRoute
.
meta
.
title
||
'
Dokit
'
}
},
created
(){
}
}
</
script
>
<
style
lang=
"less"
scoped
>
...
...
@@ -19,6 +37,6 @@ export default {
right: 0;
top:0;
bottom: 0;
background-color: #f
fffff
;
background-color: #f
5f6f7
;
}
</
style
>
\ No newline at end of file
Web/packages/core/src/components/index.vue
浏览文件 @
707bc929
<
template
>
<div>
门户
<div
class=
"container"
>
<top-bar></top-bar>
<card
v-for=
"(item, index) in features"
:key=
"index"
:title=
"item.title"
:list=
"item.list"
></card>
<version-card
:version=
"version"
></version-card>
</div>
</
template
>
<
script
>
import
TopBar
from
"
../common/components/top-bar
"
;
import
Card
from
"
../common/components/card
"
;
import
VersionCard
from
"
../common/components/version
"
;
export
default
{
}
components
:
{
TopBar
,
Card
,
VersionCard
},
data
(){
return
{
version
:
'
1.0.0
'
}
},
mounted
(){
},
computed
:
{
features
(){
return
this
.
$store
.
state
.
features
}
}
};
</
script
>
<
style
lang=
"less"
scoped
>
.container {
background-color: #f5f6f7;
}
</
style
>
\ No newline at end of file
Web/packages/core/src/index.js
浏览文件 @
707bc929
import
*
as
vue
from
'
vue
'
import
{
createApp
}
from
'
vue
'
import
App
from
'
./components/app
'
import
Router
from
'
./router
'
import
Store
from
'
./store
'
import
{
getRouter
}
from
'
./router
'
export
class
Dokit
{
constructor
(
options
){
let
app
=
vue
.
createApp
(
App
);
let
{
plugins
}
=
options
;
console
.
log
(
'
plugins1
'
,
plugins
)
app
.
use
(
Router
);
let
app
=
createApp
(
App
);
let
{
features
}
=
options
;
app
.
use
(
getRouter
(
features
));
app
.
use
(
Store
);
Store
.
state
.
features
=
features
;
this
.
app
=
app
;
this
.
_vue
=
vue
;
this
.
init
();
}
init
(
options
){
init
(){
let
dokitRoot
=
document
.
createElement
(
'
div
'
)
dokitRoot
.
id
=
"
dokit-root
"
document
.
documentElement
.
appendChild
(
dokitRoot
);
...
...
Web/packages/core/src/router/index.js
浏览文件 @
707bc929
import
{
createRouter
,
createMemoryHistory
}
from
'
vue-router
'
import
{
routes
}
from
'
./routes
'
import
{
routes
,
getRoutes
}
from
'
./routes
'
const
router
=
createRouter
({
routes
,
history
:
createMemoryHistory
()
})
export
default
router
\ No newline at end of file
export
function
getRouter
(
features
){
return
createRouter
({
routes
:
[...
routes
,
...
getRoutes
(
features
)],
history
:
createMemoryHistory
()
})
}
\ No newline at end of file
Web/packages/core/src/router/routes.js
浏览文件 @
707bc929
import
Index
from
'
../components/index
'
export
const
routes
=
[{
path
:
'
/
'
,
name
:
'
index
'
,
component
:
Index
}]
\ No newline at end of file
}]
export
function
getRoutes
(
features
){
let
routes
=
[]
features
.
forEach
(
feature
=>
{
let
{
list
,
title
:
featureTitle
}
=
feature
list
.
forEach
(
item
=>
{
// TODO 暂时只支持路由方式的插件
let
{
name
,
title
,
component
}
=
item
routes
.
push
({
path
:
`/
${
name
}
`
,
name
:
name
,
component
:
component
,
meta
:
{
title
:
title
,
feature
:
featureTitle
}
})
})
})
return
routes
}
\ No newline at end of file
Web/packages/core/src/store/index.js
0 → 100644
浏览文件 @
707bc929
import
{
Store
}
from
"
../common/js/store
"
;
export
default
new
Store
({
state
:
{
features
:
[]
}
})
\ No newline at end of file
Web/packages/web/src/components/ToolAppInfo.vue
浏览文件 @
707bc929
<
template
lang=
""
>
<
template
>
<div
class=
"app-info-container"
>
<div
class=
"info-wrapper"
>
<Card
title=
"Page Info"
>
...
...
Web/packages/web/src/components/ToolConsole.vue
浏览文件 @
707bc929
<
template
lang=
""
>
<
template
>
<div
class=
"console-container"
>
<div
class=
"log-container"
>
<LogItem
v-for=
"(log, index) in logList"
:key=
"index"
:value=
"log"
></LogItem>
...
...
@@ -23,12 +23,12 @@ export default {
},
created
()
{
let
self
=
this
let
originConsole
=
window
.
console
;
[
'
log
'
].
forEach
(
type
=>
{
let
originConsole
=
window
.
console
;
[
'
log
'
].
forEach
(
type
=>
{
let
origin
=
originConsole
[
type
].
bind
(
originConsole
)
originConsole
[
type
]
=
function
(...
args
)
{
origin
(...
args
)
self
.
logList
.
push
(
args
)
origin
(...
args
)
}
})
}
...
...
Web/packages/web/src/components/ToolHelloWorld.vue
浏览文件 @
707bc929
<
template
lang=
""
>
<
template
>
<div
class=
"hello-world"
>
<div
style=
"font-weight:bold;font-size:30px;font-style:italic;"
>
Hello World
</div>
<div>
this is a demo plugin
</div>
...
...
@@ -9,7 +9,7 @@ export default {
}
</
script
>
<
style
lang=
""
>
<
style
>
.hello-world
{
padding
:
10px
;
text-align
:
center
;
...
...
Web/packages/web/src/components/common/Card.vue
浏览文件 @
707bc929
<
template
lang=
""
>
<
template
>
<div
class=
"dokit-card"
>
<div
class=
"dokit-card__header"
>
{{
title
}}
</div>
<div
class=
"dokit-card__body"
>
...
...
Web/packages/web/src/components/console/LogItem.vue
浏览文件 @
707bc929
<
template
lang=
""
>
<
template
>
<div
class=
"log-ltem"
>
{{
value
}}
<div
class=
"log-preview"
v-html=
"logPreview"
@
click=
"toggleDetail"
></div>
<div
v-if=
"showDetail"
>
<div
class=
"list-item"
v-if=
"typeof value === 'object'"
v-for=
"(key, index) in value"
>
...
...
@@ -9,7 +10,7 @@
</div>
</
template
>
<
script
>
import
{
getDataType
,
getDataStructureStr
}
from
'
../../assets/util
'
import
{
getDataType
,
getDataStructureStr
}
from
'
.
/.
./../assets/util
'
import
Detail
from
'
./Detail
'
const
DATATYPE_NOT_DISPLAY
=
[
'
Number
'
,
'
String
'
,
'
Boolean
'
]
...
...
Web/packages/web/src/feature.js
0 → 100644
浏览文件 @
707bc929
import
Console
from
'
./components/ToolConsole
'
import
AppInfo
from
'
./components/ToolAppInfo
'
import
HelloWorld
from
'
./components/ToolHelloWorld
'
export
const
BasicFeatures
=
{
title
:
'
基础功能
'
,
list
:
[{
title
:
'
日志
'
,
name
:
'
console
'
,
icon
:
''
,
component
:
Console
},
{
title
:
'
应用信息
'
,
name
:
'
app-info
'
,
icon
:
''
,
component
:
AppInfo
},
{
title
:
'
测试
'
,
name
:
'
hello
'
,
icon
:
''
,
component
:
HelloWorld
}]
}
export
const
DokitFeatures
=
{
title
:
'
平台功能
'
,
list
:
[{
title
:
'
接口 Mock
'
,
name
:
'
mock
'
,
icon
:
''
,
component
:
HelloWorld
}]
}
export
const
Features
=
[
BasicFeatures
,
DokitFeatures
]
\ No newline at end of file
Web/packages/web/src/index.js
浏览文件 @
707bc929
import
Console
from
'
./components/ToolConsole
'
import
AppInfo
from
'
./components/ToolAppInfo
'
import
HelloWorld
from
'
./components/ToolHelloWorld
'
import
{
Dokit
}
from
'
@dokit/web-core
'
import
{
Features
}
from
'
./feature
'
new
Dokit
({
plugins
:
[{
name
:
'
日志
'
,
component
:
Console
},
{
name
:
'
应用信息
'
,
component
:
AppInfo
},
{
name
:
'
你好
'
,
component
:
HelloWorld
}]
features
:
Features
});
\ No newline at end of file
Web/playground/index.html
浏览文件 @
707bc929
...
...
@@ -9,6 +9,7 @@
</head>
<body>
<h1>
Dokit For Web
</h1>
</body>
<script
src=
"../packages/web/dist/dokit.js"
></script>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录