Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
夜猫逐梦
1024程序员开源挑战赛
提交
45c1a9ad
1
1024程序员开源挑战赛
项目概览
夜猫逐梦
/
1024程序员开源挑战赛
与 Fork 源项目一致
Fork自
GitCode / 1024程序员开源挑战赛(10.23-11.14)
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
1
1024程序员开源挑战赛
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
45c1a9ad
编写于
7月 09, 2020
作者:
B
baiy
提交者:
ninecents
10月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
上级
a1958607
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
69 addition
and
239 deletion
+69
-239
src/adapter/chrome/manifest.json
src/adapter/chrome/manifest.json
+0
-1
src/tool.vue
src/tool.vue
+69
-238
未找到文件。
src/adapter/chrome/manifest.json
浏览文件 @
45c1a9ad
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
"permissions"
:
[
"permissions"
:
[
"clipboardWrite"
,
"clipboardWrite"
,
"clipboardRead"
,
"clipboardRead"
,
"webRequest"
,
"storage"
,
"storage"
,
"http://ip.taobao.com/*"
"http://ip.taobao.com/*"
],
],
...
...
src/tool.vue
浏览文件 @
45c1a9ad
<
template
>
<
template
>
<div>
<div>
<Menu
class=
"tool-category-menu-block"
mode=
"horizontal"
theme=
"light"
:active-name=
"currentCategory"
@
on-select=
"categorySelect"
<Menu
mode=
"horizontal"
theme=
"light"
:active-name=
"currentCategory"
@
on-select=
"categorySelect"
style=
"height: 45px;line-height: 45px;"
>
style=
"height: 45px;line-height: 45px;"
>
<MenuItem
:name=
"cat.name"
v-for=
"(cat) in category"
:key=
"cat.name"
>
<MenuItem
:style=
"$t('main_css_main_category_item_style')"
:name=
"cat.name"
v-for=
"(cat) in category"
:key=
"cat.name"
>
<Badge
v-if=
"badgeCategoryIsShow(cat.name)"
dot
:offset=
"[15,-10]"
>
<Badge
v-if=
"badgeCategoryIsShow(cat.name)"
dot
:offset=
"[15,-10]"
>
{{
$t
(
'
main_category_
'
+
cat
.
name
)
}}
{{
cat
.
title
}}
</Badge>
</Badge>
<template
v-else
>
<template
v-else
>
{{
$t
(
'
main_category_
'
+
cat
.
name
)
}}
{{
cat
.
title
}}
</
template
>
</MenuItem>
<MenuItem
style=
"padding: 0 5px;float: right"
name=
"_new"
v-if=
"!isUtools"
>
<Icon
type=
"md-expand"
:size=
"24"
/>
</MenuItem>
<MenuItem
style=
"padding: 0 5px;float: right"
name=
"_feedback"
>
<Icon
type=
"md-help-circle"
:size=
"24"
/>
</MenuItem>
<MenuItem
style=
"padding: 0 5px;float: right"
name=
"_setting"
>
<Icon
type=
"md-settings"
:size=
"24"
/>
</MenuItem>
<MenuItem
style=
"padding: 0 5px;float: right"
name=
"_about"
>
<Icon
type=
"logo-github"
:size=
"24"
/>
</MenuItem>
<MenuItem
style=
"padding: 0 5px;float: right"
name=
"_history"
>
<Badge
v-if=
"historyLength>0"
dot
:offset=
"[10,-3]"
>
<Icon
type=
"md-time"
:size=
"24"
/>
</Badge>
<
template
v-else
>
<Icon
type=
"md-time"
:size=
"24"
/>
</
template
>
</
template
>
</MenuItem>
</MenuItem>
<MenuItem
style=
"padding: 0 5px;float: right"
name=
"_new"
><Icon
type=
"md-expand"
:size=
"24"
/></MenuItem>
<MenuItem
style=
"padding: 0 5px;float: right"
name=
"_feedback"
><Icon
type=
"md-help-circle"
:size=
"24"
/></MenuItem>
<MenuItem
style=
"padding: 0 5px;float: right"
name=
"_setting"
><Icon
type=
"md-settings"
:size=
"24"
/></MenuItem>
<MenuItem
style=
"padding: 0 5px;float: right"
name=
"_about"
><Icon
type=
"logo-github"
:size=
"24"
/></MenuItem>
</Menu>
</Menu>
<RadioGroup
class=
"tool-select-block"
:value=
"currentTool"
@
on-change=
"toolSelect"
style=
"margin: 10px 0 10px 20px;line-height: 30px;"
>
<RadioGroup
:value=
"currentTool"
@
on-change=
"toolSelect"
style=
"margin: 10px 0 10px 20px;line-height: 30px;"
>
<Radio
:label=
"tool.name"
v-for=
"(tool) in tools"
:key=
"tool.name"
>
<Radio
:label=
"tool.name"
v-for=
"(tool) in tools"
:key=
"tool.name"
>
<Badge
v-if=
"badgeToolIsShow(tool.name)"
dot
:offset=
"[5,-5]"
>
<Badge
v-if=
"badgeToolIsShow(tool.name)"
dot
:offset=
"[5,-5]"
>
{{
$t('main_tool_'+tool.name)
}}
{{
tool.title
}}
</Badge>
</Badge>
<
template
v-else
>
<
template
v-else
>
{{
$t
(
'
main_tool_
'
+
tool
.
name
)
}}
{{
tool
.
title
}}
</
template
>
</
template
>
</Radio>
</Radio>
</RadioGroup>
</RadioGroup>
<div>
<div>
<router-view
v-if=
"isRouterAlive"
:key=
"$route.path + $route.query.t"
/>
<router-view/>
</div>
</div>
<Drawer
:title=
"$t('main_tool_'+currentTool)+' - '+$t('main_history')"
v-model=
"historyShow"
:width=
"100"
>
<Table
ref=
"historyTable"
border
:columns=
"historyColumns"
:data=
"historyData"
:height=
"historyTableHeight"
>
<
template
slot-scope=
"{ row }"
slot=
"_value"
>
<div>
{{
historyValue
(
row
.
value
)
}}
}
</div>
</
template
>
<
template
slot-scope=
"{ index }"
slot=
"_op"
>
<Button
type=
"primary"
size=
"small"
@
click=
"historyView(index)"
>
{{
$t
(
'
main_ui_views
'
)
}}
</Button>
<Button
type=
"primary"
style=
"margin-left: 5px"
@
click=
"historyLoad(index)"
size=
"small"
>
{{
$t
(
'
main_ui_load
'
)
}}
</Button>
</
template
>
</Table>
<div
class=
"drawer-footer"
>
<Button
type=
"primary"
@
click=
"historyClear"
>
{{ $t('main_history_clear') }}
</Button>
</div>
</Drawer>
<Drawer
:title=
"$t('main_ui_setting')"
v-model=
"settingShow"
:width=
"400"
>
<setting-block
v-if=
"settingShow"
></setting-block>
</Drawer>
<bottom-block/>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
config
from
'
./tool/config
'
import
config
from
"
./tool/config
"
import
instance
from
'
./tool/instance
'
import
model
from
"
./tool/model
"
import
BottomBlock
from
'
./bottom
'
import
{
openTab
}
from
"
./helper
"
;
import
settingBlock
from
"
./views/setting/block
"
import
model
from
'
./tool/model
'
import
historyFactory
,
{
setLoadHistoryIndex
}
from
'
./tool/history
'
import
{
isUtools
,
openUrl
}
from
'
./helper
'
export
default
{
components
:
{
"
setting-block
"
:
settingBlock
,
"
bottom-block
"
:
BottomBlock
},
data
()
{
return
{
isRouterAlive
:
true
,
isUtools
:
isUtools
,
category
:
config
.
category
,
currentCategory
:
''
,
currentTool
:
''
,
historyData
:
[],
settingShow
:
false
,
historyShow
:
false
,
historyColumns
:
[
{
title
:
this
.
$t
(
'
main_history_time
'
),
key
:
'
time
'
,
width
:
180
},
{
title
:
this
.
$t
(
'
main_history_data
'
),
slot
:
'
_value
'
,
ellipsis
:
true
,
},
{
title
:
this
.
$t
(
'
main_history_op
'
),
slot
:
'
_op
'
,
width
:
150
}
],
}
},
computed
:
{
tools
()
{
return
config
.
getToolByCategory
(
this
.
currentCategory
)
},
historyLength
()
{
return
historyFactory
(
this
.
currentTool
).
length
()
},
historyTableHeight
()
{
// 设置表格高度
return
window
.
innerHeight
-
140
}
},
watch
:
{
currentTool
(
name
)
{
model
.
setCurrentTool
(
name
)
this
.
$router
.
push
(
'
/tool/
'
+
name
)
},
},
created
()
{
if
(
this
.
isUtools
)
{
window
.
utools
.
onPluginEnter
(({
code
,
payload
,
type
})
=>
{
let
tool
=
""
;
let
feature
=
""
;
if
(
code
.
indexOf
(
'
ctool-
'
)
!==
-
1
)
{
tool
=
code
.
replace
(
/ctool-/g
,
""
)
if
(
tool
.
indexOf
(
'
-
'
)
!==
-
1
)
{
let
temp
=
tool
.
split
(
'
-
'
);
tool
=
temp
[
0
]
feature
=
temp
[
1
]
}
}
// 写入正则匹配数据到固定数据数据
export
default
{
if
(
type
===
"
regex
"
&&
payload
)
{
data
()
{
model
.
setFixeInputData
(
payload
)
return
{
category
:
config
.
category
,
}
currentCategory
:
""
,
if
(
feature
)
{
currentTool
:
""
,
// 设置工具内功能
model
.
setToolCurrentFeature
(
feature
)
}
if
(
tool
&&
this
.
currentTool
!==
tool
)
{
let
cat
=
config
.
getToolDefaultCategory
(
tool
);
if
(
cat
)
{
model
.
setCategoryHistory
(
cat
)
model
.
setToolHistory
(
cat
,
tool
)
this
.
currentCategory
=
cat
;
this
.
currentTool
=
tool
;
}
}
this
.
reload
()
})
}
this
.
currentCategory
=
model
.
getCategoryHistory
()
this
.
currentTool
=
model
.
getToolHistory
(
this
.
currentCategory
)
this
.
$Message
.
config
({
top
:
150
,
})
},
mounted
()
{
instance
.
set
(
this
)
},
methods
:
{
reload
()
{
this
.
isRouterAlive
=
false
this
.
$nextTick
(()
=>
(
this
.
isRouterAlive
=
true
))
},
categorySelect
(
name
)
{
switch
(
name
)
{
case
'
_feedback
'
:
openUrl
(
'
https://github.com/baiy/Ctool/issues
'
)
break
case
'
_about
'
:
openUrl
(
'
https://github.com/baiy/Ctool
'
)
break
case
'
_setting
'
:
this
.
settingShow
=
true
;
break
case
'
_new
'
:
openUrl
(
window
.
location
.
href
)
break
case
'
_history
'
:
this
.
history
()
break
default
:
this
.
currentCategory
=
name
model
.
setCategoryHistory
(
name
)
this
.
currentTool
=
model
.
getToolHistory
(
this
.
currentCategory
)
break
}
}
},
},
history
()
{
computed
:
{
let
history
=
historyFactory
(
this
.
currentTool
)
tools
()
{
if
(
history
.
length
()
<
1
)
{
return
config
.
getToolByCategory
(
this
.
currentCategory
)
return
this
.
$Message
.
error
(
this
.
$t
(
'
main_history_null
'
))
}
}
this
.
historyData
=
history
.
all
()
this
.
historyShow
=
true
},
},
historyValue
(
value
)
{
watch
:
{
return
JSON
.
stringify
(
value
)
currentTool
(
name
)
{
model
.
setCurrentTool
(
name
);
this
.
$router
.
push
(
"
/tool/
"
+
name
);
}
},
},
historyView
(
index
)
{
created
()
{
this
.
$Modal
.
info
({
this
.
currentCategory
=
model
.
getCategoryHistory
();
render
:
(
h
)
=>
{
this
.
currentTool
=
model
.
getToolHistory
(
this
.
currentCategory
)
return
h
(
'
Input
'
,
{
this
.
$Message
.
config
({
props
:
{
top
:
150
type
:
"
textarea
"
,
rows
:
10
,
value
:
JSON
.
stringify
(
historyFactory
(
this
.
currentTool
).
get
(
index
),
null
,
"
\t
"
),
}
})
},
width
:
700
,
okText
:
this
.
$t
(
'
main_ui_close
'
)
})
})
},
},
historyClear
()
{
mounted
()
{},
historyFactory
(
this
.
currentTool
).
clear
()
methods
:
{
this
.
historyShow
=
false
;
categorySelect
(
name
)
{
},
switch
(
name
)
{
historyLoad
(
index
)
{
case
"
_feedback
"
:
setLoadHistoryIndex
(
index
)
openTab
(
"
https://github.com/baiy/Ctool/issues
"
);
this
.
historyShow
=
false
;
break
;
this
.
$router
.
push
({
case
"
_about
"
:
path
:
this
.
$router
.
currentRoute
.
fullPath
,
openTab
(
"
https://github.com/baiy/Ctool
"
);
query
:
{
break
;
t
:
Date
.
now
(),
case
"
_setting
"
:
},
openTab
(
"
/setting.html
"
);
});
break
;
},
case
"
_new
"
:
toolSelect
(
name
)
{
openTab
(
window
.
location
.
href
);
model
.
setToolHistory
(
this
.
currentCategory
,
name
)
break
;
this
.
currentTool
=
name
default
:
},
this
.
currentCategory
=
name
;
badgeToolIsShow
(
tool
)
{
model
.
setCategoryHistory
(
name
);
return
config
.
badgeToolIsShow
(
tool
)
this
.
currentTool
=
model
.
getToolHistory
(
this
.
currentCategory
)
},
break
;
badgeCategoryIsShow
(
cat
)
{
}
return
config
.
badgeCategoryIsShow
(
cat
)
},
toolSelect
(
name
)
{
model
.
setToolHistory
(
this
.
currentCategory
,
name
)
this
.
currentTool
=
name
},
badgeToolIsShow
(
tool
)
{
return
config
.
badgeToolIsShow
(
tool
);
},
badgeCategoryIsShow
(
cat
)
{
return
config
.
badgeCategoryIsShow
(
cat
);
}
},
},
},
}
}
</
script
>
</
script
>
\ No newline at end of file
<
style
scoped
>
.drawer-footer
{
width
:
100%
;
position
:
absolute
;
bottom
:
0
;
left
:
0
;
border-top
:
1px
solid
#e8e8e8
;
padding
:
10px
16px
;
text-align
:
right
;
background
:
#fff
;
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录