Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
DoraemonKit
提交
ede79696
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,发现更多精彩内容 >>
未验证
提交
ede79696
编写于
7月 14, 2021
作者:
A
AdamCaoQAQ
提交者:
GitHub
7月 14, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #857 from didi/feature/dev-web
Feature/dev web
上级
35cd5992
b73ca08e
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
390 addition
and
318 deletion
+390
-318
Web/packages/core/src/components/app.vue
Web/packages/core/src/components/app.vue
+1
-4
Web/packages/core/src/components/independ-container.vue
Web/packages/core/src/components/independ-container.vue
+0
-3
Web/packages/core/src/components/router-container.vue
Web/packages/core/src/components/router-container.vue
+0
-3
Web/packages/utils/src/index.js
Web/packages/utils/src/index.js
+2
-2
Web/packages/utils/src/network.js
Web/packages/utils/src/network.js
+30
-11
Web/packages/utils/src/utils.js
Web/packages/utils/src/utils.js
+14
-0
Web/packages/web/src/assets/util.js
Web/packages/web/src/assets/util.js
+4
-0
Web/packages/web/src/common/info-card.vue
Web/packages/web/src/common/info-card.vue
+1
-2
Web/packages/web/src/plugins/api-mock/index.js
Web/packages/web/src/plugins/api-mock/index.js
+2
-1
Web/packages/web/src/plugins/api-mock/main.vue
Web/packages/web/src/plugins/api-mock/main.vue
+0
-1
Web/packages/web/src/plugins/console/index.js
Web/packages/web/src/plugins/console/index.js
+0
-1
Web/packages/web/src/plugins/h5-door/ToolH5Door.vue
Web/packages/web/src/plugins/h5-door/ToolH5Door.vue
+0
-1
Web/packages/web/src/plugins/network/index.js
Web/packages/web/src/plugins/network/index.js
+6
-1
Web/packages/web/src/plugins/network/js/request.js
Web/packages/web/src/plugins/network/js/request.js
+20
-20
Web/packages/web/src/plugins/network/main.vue
Web/packages/web/src/plugins/network/main.vue
+16
-2
Web/packages/web/src/plugins/network/request-item.vue
Web/packages/web/src/plugins/network/request-item.vue
+112
-35
Web/packages/web/src/plugins/resources/index.js
Web/packages/web/src/plugins/resources/index.js
+1
-1
Web/packages/web/src/plugins/resources/js/resources.js
Web/packages/web/src/plugins/resources/js/resources.js
+32
-26
Web/packages/web/src/plugins/resources/main.vue
Web/packages/web/src/plugins/resources/main.vue
+11
-20
Web/packages/web/src/plugins/resources/resource-container.vue
...packages/web/src/plugins/resources/resource-container.vue
+4
-2
Web/packages/web/src/plugins/resources/resource-item.vue
Web/packages/web/src/plugins/resources/resource-item.vue
+118
-178
Web/packages/web/src/plugins/resources/resource-tap.vue
Web/packages/web/src/plugins/resources/resource-tap.vue
+6
-0
Web/packages/web/src/plugins/storage/info-card.vue
Web/packages/web/src/plugins/storage/info-card.vue
+0
-1
Web/playground/index.html
Web/playground/index.html
+10
-3
未找到文件。
Web/packages/core/src/components/app.vue
浏览文件 @
ede79696
...
...
@@ -46,10 +46,7 @@ export default {
methods
:
{
toggleShowContainer
()
{
toggleContainer
()
},
},
created
(){
console
.
log
(
"
CurState:
"
,
this
.
$store
.
state
)
}
}
};
</
script
>
...
...
Web/packages/core/src/components/independ-container.vue
浏览文件 @
ede79696
...
...
@@ -17,9 +17,6 @@ export default {
return
this
.
$store
.
state
.
independPlugins
}
},
created
(){
console
.
log
(
this
.
$router
)
},
methods
:
{
toRaw
:
toRaw
}
...
...
Web/packages/core/src/components/router-container.vue
浏览文件 @
ede79696
...
...
@@ -28,9 +28,6 @@ export default {
canBack
(){
return
this
.
$route
.
name
!==
'
home
'
}
},
created
(){
console
.
log
(
this
.
$router
)
}
}
</
script
>
...
...
Web/packages/utils/src/index.js
浏览文件 @
ede79696
...
...
@@ -3,5 +3,5 @@ export * from './dom'
export
*
from
'
./dragable
'
export
*
from
'
./eventEmiter
'
import
request
from
'
./network
'
export
{
request
}
\ No newline at end of file
// import request from './network'
export
*
from
'
./network
'
Web/packages/utils/src/network.js
浏览文件 @
ede79696
...
...
@@ -14,7 +14,7 @@ const getAllResponseHeadersMap = function (xhr) {
});
}
class
Request
extends
EventEmitter
{
export
class
Request
extends
EventEmitter
{
constructor
(){
super
()
this
.
hookFetchConfig
=
{}
...
...
@@ -23,7 +23,13 @@ class Request extends EventEmitter{
}
initialize
(){
let
Req
=
this
let
{
send
:
originSend
,
open
:
originOpen
,
setRequestHeader
:
originSetRequestHeader
}
=
window
.
XMLHttpRequest
.
prototype
;
// const {send:originSend, open:originOpen, setRequestHeader: originSetRequestHeader} = window.XMLHttpRequest.prototype;
const
winXhrProto
=
window
.
XMLHttpRequest
.
prototype
;
const
originSend
=
winXhrProto
.
send
;
const
originOpen
=
winXhrProto
.
open
;
const
originSetRequestHeader
=
winXhrProto
.
setRequestHeader
;
// XMLHttp
window
.
XMLHttpRequest
.
prototype
.
setRequestHeader
=
function
(){
...
...
@@ -36,24 +42,38 @@ class Request extends EventEmitter{
id
:
guid
(),
type
:
'
xhr
'
,
requestInfo
:
{
method
:
args
[
0
],
method
:
args
[
0
]
.
toUpperCase
()
,
url
:
args
[
1
]
}
}
xhr
.
addEventListener
(
'
readystatechange
'
,
function
()
{
xhr
.
addEventListener
(
'
readystatechange
'
,
function
(
e
)
{
switch
(
xhr
.
readyState
)
{
case
2
:
// this.headersReceived();
break
;
case
4
:
Req
.
handleDone
(
xhr
);
break
;
}
});
xhr
.
addEventListener
(
'
error
'
,
function
(
e
)
{
Req
.
emit
(
'
REQUEST.ERROR
'
,
{
id
:
this
.
reqConf
.
id
,
responseInfo
:
{
type
:
'
error
'
}
})
});
originOpen
.
apply
(
this
,
args
);
};
window
.
XMLHttpRequest
.
prototype
.
send
=
function
(){
if
(
arguments
.
length
)
{
this
.
reqConf
.
requestInfo
.
body
=
arguments
[
0
]
}
Req
.
emit
(
'
REQUEST.SEND
'
,
this
.
reqConf
)
originSend
.
apply
(
this
,
arguments
);
}
...
...
@@ -69,8 +89,9 @@ class Request extends EventEmitter{
type
:
'
fetch
'
,
requestInfo
:
{
url
:
args
[
0
],
method
:
args
.
length
>
1
?
(
args
[
1
].
method
||
'
get
'
)
:
'
get
'
,
method
:
(
args
.
length
>
1
?
(
args
[
1
].
method
||
'
get
'
)
:
'
get
'
).
toUpperCase
()
,
headers
:
args
.
length
>
1
?
(
args
[
1
].
headers
||
{})
:
{},
body
:
args
.
length
>
1
?
(
args
[
1
].
body
||
''
)
:
''
}
})
const
fetchResult
=
origFetch
(...
args
);
...
...
@@ -128,12 +149,13 @@ class Request extends EventEmitter{
handleDone
(
xhr
)
{
const
resType
=
xhr
.
responseType
;
let
resTxt
=
''
;
const
update
=
()
=>
{
this
.
emit
(
'
REQUEST.DONE
'
,
{
id
:
xhr
.
reqConf
.
id
,
responseInfo
:
{
resRaw
:
resTxt
resRaw
:
resTxt
,
contentType
:
xhr
.
getResponseHeader
(
'
Content-Type
'
),
status
:
xhr
.
status
,
}
})
};
...
...
@@ -157,7 +179,4 @@ class Request extends EventEmitter{
}
}
}
// 单例,保证有且只有一个
export
default
new
Request
()
\ No newline at end of file
}
\ No newline at end of file
Web/packages/utils/src/utils.js
浏览文件 @
ede79696
...
...
@@ -20,6 +20,20 @@ export const getPartUrlByParam = (url, param) => {
return
res
[
fields
.
indexOf
(
param
)]
}
export
const
getQueryMap
=
(
queryStr
)
=>
{
if
(
!
queryStr
)
{
return
null
}
let
queryMap
=
{}
let
queryList
=
queryStr
.
split
(
'
&
'
)
queryList
.
forEach
(
query
=>
{
if
(
query
)
{
queryMap
[
query
.
split
(
'
=
'
)[
0
]]
=
query
.
split
(
'
=
'
)[
1
]
}
});
return
queryMap
}
export
const
guid
=
function
()
{
function
S4
()
{
return
(((
1
+
Math
.
random
())
*
0x10000
)
|
0
).
toString
(
16
).
substring
(
1
)
...
...
Web/packages/web/src/assets/util.js
浏览文件 @
ede79696
import
{
Request
}
from
"
@dokit/web-utils
"
;
export
const
request
=
new
Request
()
export
const
getDataType
=
function
(
arg
)
{
if
(
arg
===
null
)
{
return
'
Null
'
...
...
Web/packages/web/src/common/info-card.vue
浏览文件 @
ede79696
...
...
@@ -78,9 +78,8 @@ export default {
}
},
refresh
()
{
console
.
log
(
'
refresh
'
)
this
.
$emit
(
"
refresh
"
);
}
,
}
},
};
</
script
>
...
...
Web/packages/web/src/plugins/api-mock/index.js
浏览文件 @
ede79696
import
ApiMock
from
'
./main.vue
'
import
{
getGlobalData
,
RouterPlugin
}
from
'
@dokit/web-core
'
import
{
request
,
getPartUrlByParam
}
from
"
@dokit/web-utils
"
;
import
{
getPartUrlByParam
}
from
"
@dokit/web-utils
"
;
import
{
request
}
from
'
./../../assets/util
'
const
mockBaseUrl
=
"
https://pre.dokit.cn
"
;
...
...
Web/packages/web/src/plugins/api-mock/main.vue
浏览文件 @
ede79696
...
...
@@ -11,7 +11,6 @@
</div>
</
template
>
<
script
>
import
{
request
,
getPartUrlByParam
}
from
"
@dokit/web-utils
"
;
import
interfaceItem
from
"
./interface-item
"
;
const
mockBaseUrl
=
"
https://pre.dokit.cn
"
;
...
...
Web/packages/web/src/plugins/console/index.js
浏览文件 @
ede79696
...
...
@@ -8,7 +8,6 @@ export default new RouterPlugin({
component
:
Console
,
icon
:
'
https://pt-starimg.didistatic.com/static/starimg/img/PbNXVyzTbq1618997544543.png
'
,
onLoad
(){
console
.
log
(
'
Load
'
)
overrideConsole
(({
name
,
type
,
value
})
=>
{
let
state
=
getGlobalData
();
state
.
logList
=
state
.
logList
||
[];
...
...
Web/packages/web/src/plugins/h5-door/ToolH5Door.vue
浏览文件 @
ede79696
...
...
@@ -90,7 +90,6 @@ export default {
},
methods
:
{
jumpToTarget
()
{
console
.
log
(
this
.
url
)
if
(
!
URL_REG
.
test
(
this
.
url
))
{
window
.
alert
(
'
输入的地址不符合URL规则
'
)
return
...
...
Web/packages/web/src/plugins/network/index.js
浏览文件 @
ede79696
import
Network
from
'
./main.vue
'
import
{
getGlobalData
,
RouterPlugin
}
from
'
@dokit/web-core
'
import
{
request
}
from
"
@dokit/web-utils
"
;
import
{
request
}
from
"
./../../assets/util
"
;
export
default
new
RouterPlugin
({
...
...
@@ -19,6 +19,11 @@ export default new RouterPlugin({
let
index
=
state
.
requestList
.
findIndex
(
e
=>
e
.
id
===
info
.
id
)
state
.
requestList
[
index
].
responseInfo
=
info
.
responseInfo
})
request
.
on
(
'
REQUEST.ERROR
'
,
info
=>
{
let
index
=
state
.
requestList
.
findIndex
(
e
=>
e
.
id
===
info
.
id
)
state
.
requestList
[
index
].
responseInfo
=
{...
state
.
requestList
[
index
].
responseInfo
,
...
info
.
responseInfo
}
})
},
onUnload
(){
...
...
Web/packages/web/src/plugins/network/js/request.js
浏览文件 @
ede79696
import
{
EventEmitter
}
from
'
@dokit/web-core
'
//
import {EventEmitter} from '@dokit/web-core'
class
Request
extends
EventEmitter
{
constructor
(){
super
()
this
.
initialize
()
}
initialize
(){
let
_this
=
this
let
{
send
:
originSend
,
open
:
originOpen
}
=
window
.
XMLHttpRequest
.
prototype
;
// TODO 增加请求拦截器,增加单测
window
.
XMLHttpRequest
.
prototype
.
open
=
function
(
method
,
url
){
originOpen
.
apply
(
this
,
arguments
);
}
window
.
XMLHttpRequest
.
prototype
.
send
=
function
(){
originSend
.
apply
(
this
,
arguments
);
}
}
}
//
class Request extends EventEmitter{
//
constructor(){
//
super()
//
this.initialize()
//
}
//
initialize(){
//
let _this = this
//
let {send:originSend, open:originOpen} = window.XMLHttpRequest.prototype;
//
// TODO 增加请求拦截器,增加单测
//
window.XMLHttpRequest.prototype.open = function(method, url){
//
originOpen.apply(this, arguments);
//
}
//
window.XMLHttpRequest.prototype.send = function(){
//
originSend.apply(this, arguments);
//
}
//
}
//
}
// 单例,保证有且只有一个
export
default
new
Request
()
\ No newline at end of file
// // 单例,保证有且只有一个
// export default new Request()
\ No newline at end of file
Web/packages/web/src/plugins/network/main.vue
浏览文件 @
ede79696
<
template
>
<div
class=
"network-plugin"
>
<div
class=
"network-header"
>
<do-row>
<do-col
:span=
"12"
>
url
</do-col>
<do-col
:span=
"3"
>
type
</do-col>
<do-col
:span=
"4"
>
method
</do-col>
<do-col
:span=
"3"
>
status
</do-col>
</do-row>
</div>
<requestItem
v-for=
"
requestItem
in requestList"
v-for=
"
(requestItem, index)
in requestList"
:key=
"requestItem.id"
:index=
"index"
:requestItem=
"requestItem"
></requestItem>
</div>
...
...
@@ -21,8 +30,13 @@ export default {
}
};
</
script
>
<
style
>
<
style
lang=
"less"
>
.network-plugin {
padding: 5px;
.network-header{
text-align: center;
font-weight: bold;
font-size: 14px;
}
}
</
style
>
\ No newline at end of file
Web/packages/web/src/plugins/network/request-item.vue
浏览文件 @
ede79696
<
template
>
<div
class=
"request-item"
>
<div
class=
"request-info"
@
click=
"showContent = !showContent"
>
<div
class=
"request-url"
>
{{
requestItem
.
requestInfo
.
url
}}
</div>
<div
class=
"request-type"
>
{{
requestItem
.
type
}}
</div>
<div
class=
"request-method"
>
{{
requestItem
.
requestInfo
.
method
}}
</div>
<div
class=
"request-status"
>
{{
requestItem
.
responseInfo
&&
requestItem
.
responseInfo
.
status
}}
</div>
</div>
<div
class=
"request-item"
:class=
"requestInfo.resType === 'error' && 'request-item-error'"
>
<do-row
class=
"request-info"
@
click=
"showContent = !showContent"
>
<do-col
:span=
"12"
>
<div
class=
"request-url"
>
{{
requestInfo
.
path
}}
</div>
</do-col>
<do-col
:span=
"3"
>
<div
class=
"request-type"
>
{{
requestInfo
.
type
}}
</div>
</do-col>
<do-col
:span=
"4"
>
<div
class=
"request-method"
>
{{
requestInfo
.
method
}}
</div>
</do-col>
<do-col
:span=
"3"
>
<div
class=
"request-status"
>
{{
requestInfo
.
status
}}
</div>
</do-col>
<do-col
:span=
"2"
>
<div
class=
"request-toggle-icon"
>
<span
v-if=
"!showContent"
>
▸
</span>
<span
v-else
>
▾
</span>
</div>
</do-col>
</do-row>
<div
class=
"response-info"
v-show=
"showContent"
>
<div
class=
"response-info-item"
>
<div>
headers
</div>
<div>
content-type:
{{
requestItem
.
responseInfo
&&
requestItem
.
responseInfo
.
contentType
}}
</div>
<div
class=
"response-info-item_title"
>
origin url
</div>
<div
class=
"response-info-item_content"
>
<span
class=
"response-info-item_content-key"
>
{{
requestInfo
.
url
}}
</span>
</div>
</div>
<div
class=
"response-info-item"
>
<div>
response
</div>
<pre>
{{
requestItem
.
responseInfo
&&
JSON
.
parse
(
requestItem
.
responseInfo
.
resRaw
)
}}
</pre>
<div
class=
"response-info-item"
v-if=
"requestInfo.queryMap"
>
<div
class=
"response-info-item_title"
>
query params
</div>
<div
class=
"response-info-item_content"
v-for=
"(value, key) in requestInfo.queryMap"
:key=
"key"
>
<span
class=
"response-info-item_content-key"
>
{{
key
}}
</span>
<span
class=
"response-info-item_content-value"
>
{{
value
}}
</span>
</div>
</div>
<div
class=
"response-info-item"
v-if=
"requestInfo.body"
>
<div
class=
"response-info-item_title"
>
body params
</div>
<div
class=
"response-info-item_content"
>
<span
class=
"response-info-item_content-value"
>
{{
requestInfo
.
body
}}
</span>
</div>
</div>
<div
class=
"response-info-item"
v-if=
"requestInfo.headers && requestInfo.headers.contentType"
>
<div
class=
"response-info-item_title"
>
headers
</div>
<div
class=
"response-info-item_content"
>
<span
class=
"response-info-item_content-key"
>
content-type
</span>
<span
class=
"response-info-item_content-value"
>
{{
requestInfo
.
headers
&&
requestInfo
.
headers
.
contentType
}}
</span>
</div>
</div>
<div
class=
"response-info-item"
v-if=
"requestInfo.resRaw"
>
<div
class=
"response-info-item_title"
>
response
</div>
<pre>
{{
requestInfo
.
resRaw
}}
</pre>
</div>
</div>
</div>
</
template
>
<
script
>
import
{
getPartUrlByParam
,
getQueryMap
}
from
"
@dokit/web-utils
"
;
export
default
{
props
:
{
requestItem
:
[
Object
]
requestItem
:
[
Object
],
index
:
[
Number
]
},
computed
:
{
requestInfo
()
{
let
{
requestInfo
:
{
url
,
method
,
contentType
,
body
},
responseInfo
:
{
status
,
resRaw
,
type
:
resType
}
=
{},
type
}
=
this
.
requestItem
let
queryString
=
getPartUrlByParam
(
url
,
'
query
'
)
let
queryMap
=
queryString
?
getQueryMap
(
queryString
)
:
null
try
{
resRaw
=
JSON
.
stringify
(
JSON
.
parse
(
resRaw
),
null
,
2
)
}
catch
(
error
)
{}
return
{
path
:
getPartUrlByParam
(
url
,
'
path
'
),
url
,
method
,
status
,
type
,
resRaw
,
headers
:
{
contentType
:
contentType
},
queryMap
,
body
,
resType
}
}
},
data
()
{
return
{
...
...
@@ -31,39 +95,52 @@ export default {
}
</
script
>
<
style
lang=
"less"
scoped
>
.request-item-error{
background-color:#FEF0F0;
border: 1px solid #F8D8D7 !important;
}
.request-item{
margin-top: 10px;
border-radius: 5px;
overflow: hidden;
border: 1px solid #d6e4ef;
font-size: 12px;
border-bottom: 1px solid #eee
;
padding: 5px
;
.request-info{
display: flex;
line-height: 24px;
text-align: center;
.request-url{
flex: 5;
overflow-x: scroll;
white-space: nowrap;
}
.request-type{
flex: 1;
text-align: center;
border-left: 1px solid #eee;
}
.request-method{
flex: 1;
text-align: center;
border-left: 1px solid #eee;
}
.request-status{
flex: 1;
text-align: center;
border-left: 1px solid #eee;
text-align: left;
word-wrap: break-word;
word-break:normal;
color: #1485ee;
}
}
.response-info{
background-color: #f1f2f3;
border-top: 1px solid #d6e4ef;
.response-info-item{
margin-top: 5px;
.response-info-item_title{
font-size: 16px;
}
.response-info-item_content{
.response-info-item_content-key{
color: #1485ee;
margin-right: 10px;
word-break: break-all;
white-space: normal;
}
}
}
pre{
margin: 0;
overflow: auto;
margin-top: 5px;
min-height: 100px;
max-height: 300px;
overflow-y: scroll;
border: 1px solid #aaa;
border-radius: 5px;
white-space: pre-wrap;
word-break: break-word;
}
...
...
Web/packages/web/src/plugins/resources/index.js
浏览文件 @
ede79696
...
...
@@ -10,7 +10,7 @@ export default new RouterPlugin({
onLoad
()
{
//console.log(window.performance.now())
console
.
log
(
'
resources
'
)
//
console.log('resources')
},
onUnload
()
{
...
...
Web/packages/web/src/plugins/resources/js/resources.js
浏览文件 @
ede79696
...
...
@@ -2,7 +2,7 @@ export const ResourceMap = {
0
:
'
css
'
,
1
:
'
script
'
,
2
:
'
img
'
,
3
:
'
other
'
,
//
3: 'other',
}
export
const
ResourceEnum
=
{
CSS
:
0
,
...
...
@@ -15,7 +15,7 @@ export const ResourceEntriesMap = {
'
css
'
:
ResourceEnum
.
CSS
,
'
script
'
:
ResourceEnum
.
SCRIPT
,
'
img
'
:
ResourceEnum
.
IMG
,
'
other
'
:
ResourceEnum
.
OTHER
,
//
'other': ResourceEnum.OTHER,
}
export
const
Resource_METHODS
=
[
"
css
"
,
"
script
"
,
"
img
"
]
...
...
@@ -62,23 +62,29 @@ export const getResourceEntries = function(callback) {
entryType
=
ResourceEntriesMap
[
type
];
}
})
if
(
entryType
===
ResourceEntriesMap
[
'
img
'
])
{
getBase64Image
(
entry
.
name
,
(
res
)
=>
{
callback
({
type
:
entryType
,
initiatorType
:
entry
.
initiatorType
,
entryName
:
entry
.
name
,
base64
:
res
})
})
}
else
{
callback
({
type
:
entryType
,
initiatorType
:
entry
.
initiatorType
,
entryName
:
entry
.
name
,
base64
:
''
})
}
callback
({
type
:
entryType
,
initiatorType
:
entry
.
initiatorType
,
entryName
:
entry
.
name
,
base64
:
''
})
// if (entryType === ResourceEntriesMap['img']) {
// getBase64Image(entry.name, (res) => {
// callback({
// type: entryType,
// initiatorType: entry.initiatorType,
// entryName: entry.name,
// base64: res
// })
// })
// } else {
// callback({
// type: entryType,
// initiatorType: entry.initiatorType,
// entryName: entry.name,
// base64: ''
// })
// }
})
}
}
...
...
@@ -141,11 +147,10 @@ export const url2blob = function(file_url, callback) {
export
const
url2blobPromise
=
function
(
file_url
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
let
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
"
get
"
,
file_url
,
true
);
xhr
.
open
(
"
get
"
,
file_url
);
xhr
.
responseType
=
"
blob
"
;
xhr
.
onload
=
function
()
{
xhr
.
addEventListener
(
'
load
'
,
function
()
{
if
(
this
.
status
==
200
)
{
//console.log(this.response)
const
reader
=
new
FileReader
()
reader
.
onload
=
function
()
{
resolve
(
reader
.
result
)
...
...
@@ -154,12 +159,13 @@ export const url2blobPromise = function(file_url) {
}
else
{
reject
()
}
};
xhr
.
onerror
=
function
(
e
)
{
})
xhr
.
addEventListener
(
'
error
'
,
function
()
{
reject
()
}
xhr
.
send
();
})
xhr
.
send
();
});
}
...
...
Web/packages/web/src/plugins/resources/main.vue
浏览文件 @
ede79696
<
template
>
<div
class=
"all-resources-container"
>
<resource-tap
:tabs=
"resourceTabs"
@
changeTap=
"handleChangeTab"
></resource-tap>
<resource-tap
:tabs=
"resourceTabs"
@
changeTap=
"handleChangeTab"
@
refreshResource=
"refreshResource"
></resource-tap>
<div
class=
"resource-container"
>
<resource-container
:resourceList =
"curResourceList"
></resource-container>
</div>
...
...
@@ -37,12 +37,19 @@ export default {
},
created
()
{
//console.log(window.performance.now())
this
.
$nextTick
(()
=>
{
this
.
refreshResource
()
})
},
mounted
(){
},
activated
(){
this
.
$nextTick
(()
=>
{
methods
:
{
handleChangeTab
(
type
){
this
.
curTab
=
type
//console.log(this.$store.state.resourceList)
},
refreshResource
()
{
let
resourceList
=
[];
getResourceEntries
(({
type
,
initiatorType
,
entryName
,
base64
})
=>
{
resourceList
.
push
({
...
...
@@ -54,13 +61,8 @@ export default {
})
this
.
$store
.
state
.
resourceList
=
resourceList
})
},
methods
:
{
handleChangeTab
(
type
){
this
.
curTab
=
type
//console.log(this.$store.state.resourceList)
}
}
}
</
script
>
...
...
@@ -72,15 +74,4 @@ export default {
flex-direction: column;
height: 100%;
}
.resource-container{
flex: 1;
display: flex;
flex-direction: column;
word-break: break-all;
overflow-y: scroll;
background-color: @background-color;
border-bottom: 1px solid @border-color;
}
</
style
>
\ No newline at end of file
Web/packages/web/src/plugins/resources/resource-container.vue
浏览文件 @
ede79696
...
...
@@ -2,7 +2,7 @@
<div
class=
"resource-container"
>
<resource-item
v-for=
"(item, index) in resourceList"
:key=
"i
ndex
"
:key=
"i
tem.entryName
"
:index=
"index"
:type=
"item.type"
:initiatorType=
"item.initiatorType"
...
...
@@ -13,7 +13,9 @@
</
template
>
<
style
lang=
"less"
scoped
>
@import "./css/var.less";
.resource-container{
padding: 0 5px;
}
</
style
>
<
script
>
import
ResourceItem
from
"
./resource-item
"
...
...
Web/packages/web/src/plugins/resources/resource-item.vue
浏览文件 @
ede79696
<
template
>
<div
class=
"resource-ltem"
>
<div
class=
"resource-preview"
v-html=
"resourcePreview"
@
click=
"toggleDetail"
></div>
<div
v-if=
"canShowDetail"
>
<div
class=
"resource-item"
>
<do-row>
<do-col
:span=
"22"
>
<div
class=
"resource-preview"
v-html=
"resourcePreview"
@
click=
"toggleDetail"
></div>
</do-col>
<do-col
:span=
"2"
>
<div
class=
"resource-toggle-icon"
>
<span
v-if=
"!showContent"
>
▸
</span>
<span
v-else
>
▾
</span>
</div>
</do-col>
</do-row>
<div
v-if=
"showContent"
>
<div
class=
"resource-detail"
>
<div
class=
"type"
v-html=
"detailType"
></div>
<div
class=
"code"
v-if=
"isCode"
v-html=
"detailCode"
></div>
<div
class=
"img-thumb"
v-if=
"isImg"
v-html=
"detailImgThumb"
></div>
<div
class=
"img-size"
v-if=
"isImg"
v-html=
"detailImgSize"
></div>
<div
v-html=
"detailHtml"
></div>
<div
class=
"resource-empty"
v-if=
"!detailHtml"
>
Loading ~
</div>
</div>
</div>
</div>
</
template
>
<
script
>
import
{
ResourceMap
,
imgLoad
,
url2blobPromise
,
trimLeft
}
from
'
./js/resources
'
import
{
ResourceMap
,
imgLoad
,
url2blobPromise
,
trimLeft
,
}
from
"
./js/resources
"
;
export
default
{
components
:
{
},
components
:
{},
props
:
{
index
:
[
Number
],
type
:
[
Number
],
...
...
@@ -27,188 +40,115 @@ export default {
entryName
:
[
String
],
base64
:
[
String
],
},
data
()
{
data
()
{
return
{
showDetail
:
false
,
codehtml
:
`Loading...`
,
imghtml
:
`Loading...`
,
sizehtml
:
`Loading...`
,
base64img
:
''
,
}
showContent
:
false
,
detailImgThumb
:
""
,
detailHtml
:
""
};
},
computed
:
{
isImg
(){
return
ResourceMap
[
this
.
type
]
===
"
img
"
resourcePreview
()
{
let
index
=
this
.
index
;
let
url
=
this
.
entryName
;
let
html
=
`<div>
${
index
+
1
}
.
${
url
}
</div>`
;
return
html
;
},
isCode
(){
return
ResourceMap
[
this
.
type
]
===
"
css
"
||
ResourceMap
[
this
.
type
]
===
"
script
"
},
canShowDetail
()
{
return
this
.
showDetail
},
detailType
(){
let
typehtml
=
`initiatorType:
${
this
.
initiatorType
}
`
return
typehtml
},
methods
:
{
toggleDetail
()
{
this
.
showContent
=
!
this
.
showContent
;
if
(
this
.
detailHtml
)
return
;
if
(
ResourceMap
[
this
.
type
]
===
"
img
"
)
{
this
.
getDetailImgThumb
((
htmlSrc
)
=>
{
this
.
detailHtml
=
htmlSrc
;
});
}
else
{
this
.
getDetailCode
((
htmlSrc
)
=>
{
this
.
detailHtml
=
`<div style="max-height: 300px;overflow-y: scroll;overflow-x:hidden;word-break:break-all;text-align: left;">`
+
htmlSrc
+
`</div>`
;
});
}
},
detailImgThumb
()
{
getDetailImgThumb
(
callback
)
{
let
url
;
if
(
this
.
base64
!==
""
)
{
url
=
this
.
base64
}
else
{
url
=
this
.
entryName
if
(
this
.
base64
!==
""
)
{
url
=
this
.
base64
;
}
else
{
url
=
this
.
entryName
;
}
this
.
imghtml
=
`<img src = "
${
url
}
" style="object-fit: cover;height:100px" />`
return
this
.
imghtml
let
htmlSrc
=
""
;
htmlSrc
=
`<img src = "
${
url
}
" style="object-fit: cover;height:100px" />`
;
this
.
getDetailImgSize
((
r
)
=>
{
htmlSrc
+=
r
;
callback
(
htmlSrc
);
});
},
detailImgSize
()
{
getDetailImgSize
(
callback
)
{
let
url
;
if
(
this
.
base64
!==
""
)
{
url
=
this
.
base64
}
else
{
url
=
this
.
entryName
if
(
this
.
base64
!==
""
)
{
url
=
this
.
base64
;
}
else
{
url
=
this
.
entryName
;
}
imgLoad
(
url
,
(
w
,
h
)
=>
{
this
.
sizehtml
=
`
${
w
}
*
${
h
}
`
})
return
this
.
sizehtml
imgLoad
(
url
,
(
w
,
h
)
=>
{
callback
(
`<div>
${
w
}
*
${
h
}
</div>`
);
});
},
detailCode
(){
url2blobPromise
(
this
.
entryName
).
then
((
res
)
=>
{
res
=
res
.
replace
(
/</g
,
'
<
'
)
res
=
res
.
replace
(
/>/g
,
'
>
'
)
let
tmp
=
res
tmp
=
tmp
.
split
(
'
\n
'
)
let
len
=
tmp
.
length
let
r
=
``
for
(
let
i
=
0
;
i
<
len
;
i
=
i
+
1
){
tmp
[
i
]
=
trimLeft
(
tmp
[
i
])
r
+=
`<div class="codeline" style="display:flex;"><div class="codeindex" style="min-width: 40px;color: #1485ee;">
${
i
+
1
}
</div><div class="codevalue">
${
tmp
[
i
]}
</div></div>`
getDetailCode
(
callback
)
{
url2blobPromise
(
this
.
entryName
)
.
then
((
res
)
=>
{
res
=
res
.
replace
(
/</g
,
"
<
"
);
res
=
res
.
replace
(
/>/g
,
"
>
"
);
let
tmp
=
res
;
tmp
=
tmp
.
split
(
"
\n
"
);
let
len
=
tmp
.
length
;
let
r
=
``
;
for
(
let
i
=
0
;
i
<
len
;
i
=
i
+
1
)
{
tmp
[
i
]
=
trimLeft
(
tmp
[
i
]);
r
+=
`
<div class="codeline" style="display:flex;line-height:14px;">
<div class="codeindex" style="min-width: 40px;background-color:#F0F0F0;color: #808080;text-align:right;padding-right:5px;">
${
i
+
1
}
</div>
<div class="codevalue">
${
tmp
[
i
]}
</div>
</div>
`
;
}
this
.
codehtml
=
r
}).
catch
(()
=>
{
this
.
codehtml
=
`fail to load resource`
callback
(
r
);
})
return
this
.
codehtml
.
catch
(()
=>
{
callback
(
`fail to load resource`
);
});
},
resourcePreview
()
{
let
index
=
this
.
index
let
url
=
this
.
entryName
let
html
=
`<div>
${
index
+
1
}
.
${
url
}
</div>`
return
html
},
resourceDetail
()
{
let
type
=
ResourceMap
[
this
.
type
]
let
url
=
this
.
entryName
let
initiatorType
=
this
.
initiatorType
let
typehtml
=
`<div class="type">initiatorType:
${
initiatorType
}
</div>`
if
(
type
===
'
script
'
||
type
===
'
css
'
){
url2blobPromise
(
url
).
then
((
res
)
=>
{
res
=
res
.
replace
(
/</g
,
'
<
'
)
res
=
res
.
replace
(
/>/g
,
'
>
'
)
let
tmp
=
res
tmp
=
tmp
.
split
(
'
\n
'
)
let
len
=
tmp
.
length
let
r
=
``
for
(
let
i
=
0
;
i
<
len
;
i
=
i
+
1
){
tmp
[
i
]
=
trimLeft
(
tmp
[
i
])
r
+=
`<div class="codeline"><div class="codeindex">
${
i
+
1
}
</div><div class="codevalue">
${
tmp
[
i
]}
</div></div>`
}
this
.
codehtml
=
`<div class="code">`
+
r
+
`</div>`
}).
catch
(()
=>
{
this
.
codehtml
=
`<div class="code">fail to load resource</div>`
})
return
typehtml
+
this
.
codehtml
}
else
if
(
type
===
'
img
'
){
if
(
this
.
base64
!==
""
){
this
.
imghtml
=
`<img src = "
${
this
.
base64
}
" class = "img-thumb" />`
imgLoad
(
this
.
base64
,
(
w
,
h
)
=>
{
this
.
sizehtml
=
`<div class="img-size">
${
w
}
*
${
h
}
</div>`
})
}
else
{
this
.
imghtml
=
`<img src = "
${
url
}
" class = "img-thumb" />`
imgLoad
(
url
,
(
w
,
h
)
=>
{
this
.
sizehtml
=
`<div class="img-size">
${
w
}
*
${
h
}
</div>`
})
}
return
typehtml
+
this
.
imghtml
+
this
.
sizehtml
}
else
if
(
type
===
'
other
'
){
typehtml
=
`<div class="type" style="border:0">initiatorType:
${
initiatorType
}
</div>`
return
typehtml
}
}
},
methods
:
{
toggleDetail
()
{
this
.
showDetail
=
!
this
.
showDetail
},
}
}
};
</
script
>
<
style
lang=
"less"
scoped
>
.resource-ltem
{
padding: 10px 2
0px;
border-top: 1px solid #eee
;
text-align: left
;
font-size: 12px
;
}
.resource-ltem:first-child {
border: none;
}
.resource-ltem:nth-of-type(odd){
background:#f3f3f3
;
}
.resource-preview
{
}
.resource-item
{
margin-top: 1
0px;
border-radius: 5px
;
overflow: hidden
;
border: 1px solid #d6e4ef
;
font-size: 12px;
}
.resource-preview {
word-break: break-all;
color: #1485ee;
padding: 5px
;
}
.resource-toggle-icon
{
line-height: 24px;
}
.resource-detail {
margin: 5px 10px;
border: 1px solid gray;
text-align: center;
.type {
padding: 5px 10px;
font-size: 12px;
text-align: center;
}
.code{
border-top: 1px solid gray;
padding: 10px 10px;
max-height: 300px;
overflow-y: scroll;
text-align: left;
.codeline{
display: flex;
flex: 1;
.codeindex{
min-width: 40px;
color: #1485ee;
}
.codevalue{
}
}
}
.img-thumb{
border-top: 1px solid gray;
padding: 5px 0px;
height: 100px;
}
.img-size{
padding:5px 0px;
}
.resource-detail {
border-top: 1px solid #d6e4ef;
text-align: center;
.resource-empty {
padding: 10px;
font-size: 16px;
}
}
</
style
>
\ No newline at end of file
Web/packages/web/src/plugins/resources/resource-tap.vue
浏览文件 @
ede79696
...
...
@@ -10,6 +10,9 @@
>
<span
class=
"tab-item-text"
>
{{
item
.
name
}}
</span>
</div>
<div
class=
"tab-item"
@
click=
"handleRefresh"
>
<img
style=
"width:16px;margin-top:12px;"
src=
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAvFQTFRFAAAAJCQkLCwsLS0tLCwsLCwsLCwsLS0tLCwsLCwsLS0tLCw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ifh0vvqSLonfxcdEItxRZUaUZo6pC+BtcFSrNLtdAUZ7NY7xSr0Ku0F0k80O1LgDgrxYt248kgig46SZ6MwcBjNP3s8utWwWcMj1EjYJtbqfdzyxMvd3Ro3Hqv2fc67rZzPtaduc6W1JZllhWWXJWdCGWLFmyZMmSJUuWLFmyZOn/ov8AOnjh87MOpuoAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMDYtMjNUMjE6MjY6MDkrMDg6MDBCOpSGAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTA2LTIzVDIxOjI2OjA5KzA4OjAwM2csOgAAAABJRU5ErkJggg=="
alt=
""
srcset=
""
>
</div>
</div>
</div>
</
template
>
...
...
@@ -59,6 +62,9 @@ export default {
this
.
curIndex
=
index
;
this
.
$emit
(
"
changeTap
"
,
type
);
},
handleRefresh
()
{
this
.
$emit
(
"
refreshResource
"
);
}
},
};
</
script
>
\ No newline at end of file
Web/packages/web/src/plugins/storage/info-card.vue
浏览文件 @
ede79696
...
...
@@ -82,7 +82,6 @@ export default {
}
},
refresh
()
{
console
.
log
(
"
refresh
"
);
this
.
$emit
(
"
refresh
"
);
},
},
...
...
Web/playground/index.html
浏览文件 @
ede79696
...
...
@@ -19,7 +19,12 @@
</script>
<script>
setTimeout
(()
=>
{
// fetch('https://www.tianqiapi.com/free/week?appid=68852321&appsecret=BgGLDVc7')
// fetch('https://www.tianqiapi.com/free/day?appid=68852321&appsecret=BgGLDVc7', {
// body: JSON.stringify({
// a:1
// }),
// method: 'get',
// })
// .then((response) => {
// let weatherInfo = response.json();
// return weatherInfo;
...
...
@@ -33,8 +38,10 @@
}
var
oReq
=
new
XMLHttpRequest
();
oReq
.
addEventListener
(
"
load
"
,
reqListener
);
oReq
.
open
(
"
GET
"
,
"
https://www.tianqiapi.com/free/week?appid=68852321&appsecret=BgGLDVc7
"
);
oReq
.
send
();
oReq
.
open
(
"
post
"
,
"
https://www.tianqiapi.com/free/week?appid=68852321&appsecret=BgGLDVc7
"
);
oReq
.
send
(
JSON
.
stringify
({
a
:
1
}));
},
5000
);
</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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录