Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yma16
可视化 csdn 数据
提交
a9f4f072
可
可视化 csdn 数据
项目概览
yma16
/
可视化 csdn 数据
该项目与 Fork 源项目分叉
Fork自
inscode / VueJS
通知
17
Star
15
Fork
10
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
可
可视化 csdn 数据
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a9f4f072
编写于
1月 26, 2024
作者:
Q
qq_38870145
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fri Jan 26 17:16:00 CST 2024 inscode
上级
855fc5f2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
78 addition
and
64 deletion
+78
-64
src/App.vue
src/App.vue
+67
-53
src/components/Author.vue
src/components/Author.vue
+9
-9
src/components/visualHtml/html/data.js
src/components/visualHtml/html/data.js
+2
-2
未找到文件。
src/App.vue
浏览文件 @
a9f4f072
...
@@ -3,10 +3,10 @@ import GameChart from './components/GameChart.vue'
...
@@ -3,10 +3,10 @@ import GameChart from './components/GameChart.vue'
import
SearchGrade
from
'
./components/SearchGrade.vue
'
import
SearchGrade
from
'
./components/SearchGrade.vue
'
import
Draw
from
'
./components/draw/Draw.vue
'
import
Draw
from
'
./components/draw/Draw.vue
'
import
Commit
from
'
./components/commit/Commit.vue
'
import
Commit
from
'
./components/commit/Commit.vue
'
import
Drag
from
'
./components/drag/Drag.vue
'
import
Drag
from
'
./components/drag/Drag.vue
'
import
Visual
from
'
./components/visual/index.vue
'
import
Visual
from
'
./components/visual/index.vue
'
import
VisualHtml
from
'
./components/visualHtml/index.vue
'
import
VisualHtml
from
'
./components/visualHtml/index.vue
'
import
{
reactive
,
onBeforeMount
,
onMounted
}
from
'
vue
'
;
import
{
reactive
,
onBeforeMount
,
onMounted
}
from
'
vue
'
;
import
html2canvas
from
'
html2canvas
'
;
import
html2canvas
from
'
html2canvas
'
;
// state
// state
...
@@ -15,7 +15,7 @@ const state = reactive({
...
@@ -15,7 +15,7 @@ const state = reactive({
})
})
/** 下载图片 */
/** 下载图片 */
const
downloadBase64
=
(
content
,
fileName
)
=>
{
const
downloadBase64
=
(
content
,
fileName
)
=>
{
const
base64ToBlob
=
function
(
code
)
{
const
base64ToBlob
=
function
(
code
)
{
let
parts
=
code
.
split
(
'
;base64,
'
);
let
parts
=
code
.
split
(
'
;base64,
'
);
let
contentType
=
parts
[
0
].
split
(
'
:
'
)[
1
];
let
contentType
=
parts
[
0
].
split
(
'
:
'
)[
1
];
...
@@ -38,23 +38,37 @@ const downloadBase64 = (content,fileName) => {
...
@@ -38,23 +38,37 @@ const downloadBase64 = (content,fileName) => {
};
};
// 截图
// 截图
const
shotAction
=
()
=>
{
const
shotAction
=
()
=>
{
html2canvas
(
document
.
getElementById
(
'
render-id
'
),
{
html2canvas
(
document
.
getElementById
(
'
render-id
'
),
{
useCORS
:
true
,
useCORS
:
true
,
proxy
:
'
inscode.csdn.net
'
,
proxy
:
'
inscode.csdn.net
'
,
allowTaint
:
true
,
allowTaint
:
true
,
scale
:
2
,
scale
:
2
,
}).
then
(
function
(
canvas
)
{
}).
then
(
function
(
canvas
)
{
console
.
log
(
'
canvas
'
,
canvas
)
console
.
log
(
'
canvas
'
,
canvas
)
const
base64
=
canvas
.
toDataURL
().
replace
(
/^data:image
\/(
png|jpg
)
;base64,/
,
''
);
const
base64
=
canvas
.
toDataURL
().
replace
(
/^data:image
\/(
png|jpg
)
;base64,/
,
''
);
const
base64img
=
`data:image/png;base64,
${
base64
}
`
;
const
base64img
=
`data:image/png;base64,
${
base64
}
`
;
downloadBase64
(
base64img
,
state
.
current
);
downloadBase64
(
base64img
,
state
.
current
);
// document.body.appendChild(canvas);
// document.body.appendChild(canvas);
});
});
}
}
onMounted
(()
=>
{
console
.
log
(
'
html2canvas
'
,
html2canvas
)
onMounted
(()
=>
{
console
.
log
(
'
html2canvas
'
,
html2canvas
)
// 计算DOMContentLoaded
const
observer
=
new
PerformanceObserver
((
list
)
=>
{
list
.
getEntries
().
forEach
((
entry
)
=>
{
const
domContentLoadedTime
=
entry
.
domContentLoadedEventEnd
-
entry
.
domContentLoadedEventStart
;
console
.
log
(
`
${
entry
.
name
}
: DOMContentLoaded processing time:
${
domContentLoadedTime
}
ms`
,
);
});
});
observer
.
observe
({
type
:
"
navigation
"
,
buffered
:
true
});
})
})
// 之前
// 之前
...
@@ -70,23 +84,23 @@ onBeforeMount(() => {
...
@@ -70,23 +84,23 @@ onBeforeMount(() => {
const
value
=
itemArray
[
1
]
const
value
=
itemArray
[
1
]
data
[
key
]
=
value
data
[
key
]
=
value
})
})
console
.
log
(
'
urlArray
'
,
urlArray
)
console
.
log
(
'
urlArray
'
,
urlArray
)
if
(
data
[
'
type
'
]
=
'
csdn_game
'
)
{
if
(
data
[
'
type
'
]
=
'
csdn_game
'
)
{
state
.
current
=
'
新星赛道选手信息可视化
'
state
.
current
=
'
新星赛道选手信息可视化
'
}
}
else
if
(
data
[
'
type
'
]
=
'
csdn_grade
'
)
{
else
if
(
data
[
'
type
'
]
=
'
csdn_grade
'
)
{
state
.
current
=
'
grade查询分数
'
state
.
current
=
'
grade查询分数
'
}
}
else
if
(
data
[
'
type
'
]
=
'
draw
'
)
{
else
if
(
data
[
'
type
'
]
=
'
draw
'
)
{
state
.
current
=
'
抽奖
'
state
.
current
=
'
抽奖
'
}
}
else
if
(
data
[
'
type
'
]
=
'
commit
'
)
{
else
if
(
data
[
'
type
'
]
=
'
commit
'
)
{
state
.
current
=
'
评论
'
state
.
current
=
'
评论
'
}
}
else
if
(
data
[
'
type
'
]
=
'
grag
'
)
{
else
if
(
data
[
'
type
'
]
=
'
grag
'
)
{
state
.
current
=
'
拖拽
'
state
.
current
=
'
拖拽
'
}
}
else
if
(
data
[
'
type
'
]
=
'
Visual
'
)
{
else
if
(
data
[
'
type
'
]
=
'
Visual
'
)
{
state
.
current
=
'
Visual
'
state
.
current
=
'
Visual
'
}
}
}
}
...
@@ -94,39 +108,39 @@ onBeforeMount(() => {
...
@@ -94,39 +108,39 @@ onBeforeMount(() => {
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"container-main"
>
<div
class=
"container-main"
>
<div
style=
"text-align: center;padding: 20px;"
>
<div
style=
"text-align: center;padding: 20px;"
>
<a-radio-group
v-model:value=
"state.current"
name=
"radioGroup"
>
<a-radio-group
v-model:value=
"state.current"
name=
"radioGroup"
>
<a-radio
value=
"grade查询分数"
>
csdn查询分数
</a-radio>
<a-radio
value=
"grade查询分数"
>
csdn查询分数
</a-radio>
<a-radio
value=
"新星赛道选手信息可视化"
>
csdn新星赛道可视化
</a-radio>
<a-radio
value=
"新星赛道选手信息可视化"
>
csdn新星赛道可视化
</a-radio>
<a-radio
value=
"抽奖"
>
随机抽奖
</a-radio>
<a-radio
value=
"抽奖"
>
随机抽奖
</a-radio>
<a-radio
value=
"评论"
>
csdn分析评论
</a-radio>
<a-radio
value=
"评论"
>
csdn分析评论
</a-radio>
<a-radio
value=
"拖拽"
>
拼图
</a-radio>
<a-radio
value=
"拖拽"
>
拼图
</a-radio>
<a-radio
value=
"Visual"
>
可视化 2023 编码之旅
</a-radio>
<a-radio
value=
"Visual"
>
可视化 2023 编码之旅
</a-radio>
<a-radio
value=
"VisualHtml"
>
可视化 html
</a-radio>
<a-radio
value=
"VisualHtml"
>
可视化 html
</a-radio>
</a-radio-group>
</a-radio-group>
<a-button
type=
"primary"
@
click=
"shotAction"
>
<a-button
type=
"primary"
@
click=
"shotAction"
>
截图
截图
</a-button>
</a-button>
</div>
<div
id=
"render-id"
>
<SearchGrade
v-if=
"state.current === 'grade查询分数'"
/>
<GameChart
v-else-if=
"state.current === '新星赛道选手信息可视化'"
/>
<Commit
v-else-if=
"state.current === '评论'"
/>
<Drag
v-else-if=
"state.current === '拖拽'"
/>
<Visual
v-else-if=
"state.current === 'Visual'"
/>
<VisualHtml
v-else-if=
"state.current === 'VisualHtml'"
/>
<Draw
v-else
/>
</div>
</div>
</div>
<div
id=
"render-id"
>
<SearchGrade
v-if=
"state.current === 'grade查询分数'"
/>
<GameChart
v-else-if=
"state.current === '新星赛道选手信息可视化'"
/>
<Commit
v-else-if=
"state.current === '评论'"
/>
<Drag
v-else-if=
"state.current === '拖拽'"
/>
<Visual
v-else-if=
"state.current === 'Visual'"
/>
<VisualHtml
v-else-if=
"state.current === 'VisualHtml'"
/>
<Draw
v-else
/>
</div>
</div>
</
template
>
</
template
>
<
style
scoped
>
<
style
scoped
>
.container-main
{
.container-main
{
position
:
absolute
;
position
:
absolute
;
width
:
100vw
;
width
:
100vw
;
height
:
100vh
;
height
:
100vh
;
padding
:
10px
;
padding
:
10px
;
margin
:
0
;
margin
:
0
;
}
}
</
style
>
</
style
>
src/components/Author.vue
浏览文件 @
a9f4f072
...
@@ -27,15 +27,15 @@
...
@@ -27,15 +27,15 @@
import
{
ref
,
onMounted
}
from
'
vue
'
import
{
ref
,
onMounted
}
from
'
vue
'
const
imgRef
=
ref
(
null
)
const
imgRef
=
ref
(
null
)
onMounted
(()
=>
{
onMounted
(()
=>
{
console
.
log
(
'
imgRef
'
,
imgRef
)
//
console.log('imgRef',imgRef)
try
{
//
try{
if
(
imgRef
&&
imgRef
.
value
){
//
if(imgRef&&imgRef.value){
imgRef
.
value
.
click
()
//
imgRef.value.click()
}
//
}
}
//
}
catch
(
e
){
//
catch(e){
console
.
log
(
e
)
//
console.log(e)
}
//
}
})
})
</
script
>
</
script
>
<
style
>
<
style
>
...
...
src/components/visualHtml/html/data.js
浏览文件 @
a9f4f072
...
@@ -29,12 +29,12 @@ const genTreeData = async (htmlHref) => {
...
@@ -29,12 +29,12 @@ const genTreeData = async (htmlHref) => {
// 请求 html 内容
// 请求 html 内容
const
{
data
:
htmlContent
}
=
await
axios
.
get
(
htmlHref
)
const
{
data
:
htmlContent
}
=
await
axios
.
get
(
htmlHref
)
console
.
log
(
'
htmlContent
'
,
htmlContent
)
//
console.log('htmlContent',htmlContent)
const
htmlDoc
=
getHtmlDoc
(
htmlContent
)
const
htmlDoc
=
getHtmlDoc
(
htmlContent
)
const
treeData
=
traverse
(
htmlDoc
.
body
)
const
treeData
=
traverse
(
htmlDoc
.
body
)
console
.
log
(
'
treeData
'
,
treeData
)
//
console.log('treeData',treeData)
return
treeData
return
treeData
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录