Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
33194837
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
12 个月 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
33194837
编写于
3月 09, 2022
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
import monaco editor and electron
上级
4c3bf93c
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
291 addition
and
9835 deletion
+291
-9835
client/README.md
client/README.md
+1
-1
client/package-lock.json
client/package-lock.json
+189
-9791
client/package.json
client/package.json
+1
-0
client/src/main.js
client/src/main.js
+6
-1
internal/comm/helper/script/asset.go
internal/comm/helper/script/asset.go
+12
-0
internal/server/modules/v1/domain/test-script.go
internal/server/modules/v1/domain/test-script.go
+1
-0
ui/src/layouts/IndexLayout/components/RightTopProject.vue
ui/src/layouts/IndexLayout/components/RightTopProject.vue
+12
-0
ui/src/views/component/project/create.vue
ui/src/views/component/project/create.vue
+38
-2
ui/src/views/script/index/main.vue
ui/src/views/script/index/main.vue
+21
-19
ui/vue.config.js
ui/vue.config.js
+1
-20
xdoc/notes.txt
xdoc/notes.txt
+9
-1
未找到文件。
client/README.md
浏览文件 @
33194837
...
...
@@ -35,7 +35,7 @@ npm run start
**模式一:使用外部 UI 服务**
```
UI_SERVER_URL=http://localhost:8000 npm run start
SKIP_SERVER=1
UI_SERVER_URL=http://localhost:8000 npm run start
```
**模式二:使用本地 UI 静态文件目录**
...
...
client/package-lock.json
浏览文件 @
33194837
此差异已折叠。
点击以展开。
client/package.json
浏览文件 @
33194837
...
...
@@ -41,6 +41,7 @@
"dependencies"
:
{
"@electron/remote"
:
"^2.0.5"
,
"electron-log"
:
"^4.4.6"
,
"electron-remote"
:
"^1.3.0"
,
"electron-squirrel-startup"
:
"^1.0.0"
,
"express"
:
"^4.17.3"
,
"find-process"
:
"^1.4.7"
,
...
...
client/src/main.js
浏览文件 @
33194837
...
...
@@ -14,7 +14,12 @@ const createWindow = (url) => {
// height: 800,
// });
require
(
'
@electron/remote/main
'
).
initialize
()
const
mainWindow
=
new
BrowserWindow
({
show
:
false
,
webPreferences
:
{
nodeIntegration
:
true
,
contextIsolation
:
false
}})
require
(
"
@electron/remote/main
"
).
enable
(
mainWindow
.
webContents
)
mainWindow
.
maximize
()
mainWindow
.
show
()
...
...
@@ -63,7 +68,7 @@ app.on('window-all-closed', () => {
logInfo
(
`>> Event window-all-closed`
)
// if (process.platform !== 'darwin') {
app
.
quit
();
app
.
quit
();
// }
});
...
...
internal/comm/helper/script/asset.go
浏览文件 @
33194837
...
...
@@ -42,6 +42,18 @@ func LoadScriptByProject(projectPath string) (scriptFiles []string) {
func
GetScriptContent
(
pth
string
)
(
script
serverDomain
.
TestScript
,
err
error
)
{
script
.
Code
=
fileUtils
.
ReadFile
(
pth
)
script
.
Lang
=
getScriptLang
(
pth
)
return
}
func
getScriptLang
(
pth
string
)
(
lang
string
)
{
extName
:=
strings
.
TrimLeft
(
fileUtils
.
GetExtName
(
pth
),
"."
)
for
key
,
val
:=
range
langUtils
.
LangMap
{
if
extName
==
val
[
"extName"
]
{
lang
=
key
return
}
}
return
}
...
...
internal/server/modules/v1/domain/test-script.go
浏览文件 @
33194837
...
...
@@ -5,6 +5,7 @@ type TestScript struct {
Name
string
`json:"name"`
Code
string
`json:"code"`
Desc
string
`json:"desc"`
Lang
string
`json:"lang"`
ProjectId
uint
`json:"projectId"`
}
ui/src/layouts/IndexLayout/components/RightTopProject.vue
浏览文件 @
33194837
...
...
@@ -121,6 +121,18 @@ export default defineComponent({
if
(
!
item
)
{
setFormVisible
(
true
)
// if (window.require) {
// const {dialog} = window.require('@electron/remote');
// dialog.showOpenDialog({
// properties: ['openDirectory']
// }).then(result => {
// console.log(result.canceled)
// console.log(result.filePaths)
// }).catch(err => {
// console.log(err)
// })
// }
}
else
{
store
.
dispatch
(
'
project/fetchProject
'
,
item
.
path
)
}
...
...
ui/src/views/component/project/create.vue
浏览文件 @
33194837
...
...
@@ -14,7 +14,21 @@
<div>
<a-form
:labelCol=
"{ span: 4 }"
:wrapper-col=
"{span:20}"
>
<a-form-item
:label=
"t('path')"
v-bind=
"validateInfos.path"
:placeholder=
"t('project_path')"
>
<a-input
v-model:value=
"modelRef.path"
/>
<a-input-search
v-if=
"isElectron"
v-model:value=
"modelRef.path"
@
search=
"selectDir"
spellcheck=
"false"
>
<
template
#enterButton
>
<a-button>
选择
</a-button>
</
template
>
</a-input-search>
<a-input
v-if=
"!isElectron"
v-model:value=
"modelRef.path"
spellcheck=
"false"
/>
</a-form-item>
<a-form-item
:label=
"t('name')"
>
...
...
@@ -44,6 +58,8 @@ import { validateInfos } from 'ant-design-vue/lib/form/useForm';
interface
ProjectCreateFormSetupData
{
t
:
(
key
:
string
|
number
)
=>
string
;
isElectron
:
Ref
<
boolean
>
;
selectDir
:
()
=>
void
;
modelRef
:
Ref
<
Interpreter
>
validateInfos
:
validateInfos
onFinish
:
()
=>
Promise
<
void
>
;
...
...
@@ -71,7 +87,7 @@ export default defineComponent({
setup
(
props
):
ProjectCreateFormSetupData
{
const
{
t
}
=
useI18n
();
const
modelRef
=
re
active
<
any
>
({
path
:
''
,
type
:
'
func
'
})
const
modelRef
=
re
f
<
any
>
({
path
:
''
,
type
:
'
func
'
})
const
rulesRef
=
reactive
({
path
:
[
{
required
:
true
,
message
:
t
(
'
pls_project_path
'
)
}
],
type
:
[
{
required
:
true
,
message
:
t
(
'
pls_project_type
'
)
}
],
...
...
@@ -79,6 +95,24 @@ export default defineComponent({
const
{
validate
,
validateInfos
}
=
Form
.
useForm
(
modelRef
,
rulesRef
);
const
isElectron
=
ref
(
!!
window
.
require
)
const
selectDir
=
()
=>
{
console
.
log
(
'
selectDir
'
)
if
(
isElectron
.
value
)
{
const
{
dialog
}
=
window
.
require
(
'
@electron/remote
'
);
dialog
.
showOpenDialog
({
properties
:
[
'
openDirectory
'
]
}).
then
(
result
=>
{
if
(
result
.
filePaths
&&
result
.
filePaths
.
length
>
0
)
{
modelRef
.
value
.
path
=
result
.
filePaths
[
0
]
}
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
}
}
const
onFinish
=
async
()
=>
{
console
.
log
(
'
onFinish
'
)
...
...
@@ -93,6 +127,8 @@ export default defineComponent({
return
{
t
,
isElectron
,
selectDir
,
modelRef
,
validateInfos
,
onFinish
...
...
ui/src/views/script/index/main.vue
浏览文件 @
33194837
...
...
@@ -45,8 +45,12 @@
<a-button
@
click=
"extract"
type=
"primary"
>
{{ t('extract_step') }}
</a-button>
</div>
<div
class=
"panel"
>
<div
id=
"monaco"
></div>
<!-- <highlightjs v-if="scriptCode" autodetect :code="scriptCode" />-->
<MonacoEditor
v-if=
"scriptCode !== ''"
class=
"editor"
:value=
"scriptCode"
:language=
"lang"
/>
</div>
</div>
</div>
...
...
@@ -63,11 +67,7 @@ import {resizeWidth} from "@/utils/dom";
import
{
Empty
,
message
,
notification
}
from
"
ant-design-vue
"
;
import
{
useI18n
}
from
"
vue-i18n
"
;
// import 'highlight.js/lib/common';
// import hljsVuePlugin from "@highlightjs/vue-plugin";
// import 'highlight.js/styles/googlecode.css'
// import * as monaco from 'monaco-editor';
import
MonacoEditor
from
'
monaco-editor-vue3
'
interface
ListScriptPageSetupData
{
t
:
(
key
:
string
|
number
)
=>
string
;
...
...
@@ -77,6 +77,7 @@ interface ListScriptPageSetupData {
tree
:
Ref
;
script
:
ComputedRef
scriptCode
:
Ref
<
string
>
;
lang
:
Ref
<
string
>
;
isExpand
:
Ref
<
boolean
>
;
expandNode
:
(
expandedKeys
:
string
[],
e
:
any
)
=>
void
;
...
...
@@ -92,7 +93,7 @@ export default defineComponent({
name
:
'
ScriptListPage
'
,
components
:
{
IconSvg
,
// highlightjs: hljsVuePlugin.component
MonacoEditor
,
},
setup
():
ListScriptPageSetupData
{
const
{
t
}
=
useI18n
();
...
...
@@ -130,6 +131,7 @@ export default defineComponent({
const
storeScript
=
useStore
<
{
script
:
ScriptData
}
>
();
let
script
=
computed
<
any
>
(()
=>
storeScript
.
state
.
script
.
detail
);
let
scriptCode
=
ref
(
''
)
let
lang
=
ref
(
''
)
onMounted
(()
=>
{
console
.
log
(
'
onMounted
'
,
tree
)
...
...
@@ -151,19 +153,16 @@ export default defineComponent({
})
const
selectNode
=
(
selectedKeys
,
e
)
=>
{
console
.
log
(
'
selectNode
'
,
e
.
selectedNodes
)
if
(
e
.
selectedNodes
.
length
===
0
)
return
if
(
e
.
selectedNodes
.
length
===
0
||
e
.
selectedNodes
[
0
].
props
.
isDir
)
{
scriptCode
.
value
=
''
return
}
selectedNode
=
e
.
selectedNodes
[
0
]
scriptCode
.
value
=
''
storeScript
.
dispatch
(
'
script/getScript
'
,
selectedNode
.
props
).
then
(()
=>
{
console
.
log
(
'
===
'
,
script
)
scriptCode
.
value
=
script
.
value
.
code
// disposeEditor()
// monacoInstance = monaco.editor.create(document.getElementById("monaco") as HTMLElement,{
// value: script.value.code,
// language:"php"
// })
lang
.
value
=
script
.
value
.
lang
})
}
...
...
@@ -206,6 +205,7 @@ export default defineComponent({
expandedKeys
,
script
,
scriptCode
,
lang
,
simpleImage
:
Empty
.
PRESENTED_IMAGE_SIMPLE
,
}
}
...
...
@@ -213,7 +213,7 @@ export default defineComponent({
})
</
script
>
<
style
lang=
"less"
>
<
style
lang=
"less"
scoped
>
.indexlayout-main-conent {
margin: 0px;
height: 100%;
...
...
@@ -292,8 +292,10 @@ export default defineComponent({
}
}
}
</
style
>
#monaco {
height: 100%;
<
style
lang=
"less"
>
.monaco-editor {
padding: 10px 0;
}
</
style
>
ui/vue.config.js
浏览文件 @
33194837
...
...
@@ -43,25 +43,6 @@ module.exports = {
// 'vue': 'Vue',
// 'vue-router': 'VueRouter',
},
// module: {
// rules: [
// {
// test: /\.(sa|sc|c)ss$/,
// use: [
// 'vue-style-loader',
// 'style-loader',
// 'css-loader',
// 'sass-loader',
// 'postcss-loader',
// ]
// },
// {
// test: /\.ttf$/,
// use: ['file-loader']
// }
// ],
// },
// plugins: [new MonacoWebpackPlugin()],
},
chainWebpack
(
config
)
{
...
...
@@ -99,7 +80,7 @@ module.exports = {
config
.
plugin
(
'
monaco-editor
'
).
use
(
MonacoWebpackPlugin
,
[
{
// Languages are loaded on demand at runtime
languages
:
[
'
j
son
'
,
'
javascript
'
,
'
html
'
,
'
xml
'
]
languages
:
[
'
j
avascript
'
,
'
php
'
]
}
])
}
...
...
xdoc/notes.txt
浏览文件 @
33194837
...
...
@@ -29,4 +29,12 @@ scp -r client/out/ztf-linux-x64/ 192.168.0.114:/home/aaron
make compile_mac
cd client && npm run package-mac && cd ..
client/out/ztf-darwin-x64/ztf.app/Contents/MacOS/ztf
\ No newline at end of file
client/out/ztf-darwin-x64/ztf.app/Contents/MacOS/ztf
接口:
用户信息
产品树状列表(我参与的,其他的分开)
模块列表
套件列表
任务列表
用例树状列表(按模块组织,可以根据模块、套件、任务过滤)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录