Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
944889a6
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
9 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
944889a6
编写于
9月 19, 2022
作者:
雨
雨爱无痕
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix issue
上级
5ef2e013
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
16 deletion
+35
-16
ui/src/store/proxy.ts
ui/src/store/proxy.ts
+19
-0
ui/src/views/interpreter/interpreterModal.vue
ui/src/views/interpreter/interpreterModal.vue
+4
-4
ui/src/views/proxy/ProxyNav.vue
ui/src/views/proxy/ProxyNav.vue
+1
-1
ui/src/views/settings/SettingsModal.vue
ui/src/views/settings/SettingsModal.vue
+11
-11
未找到文件。
ui/src/store/proxy.ts
浏览文件 @
944889a6
...
...
@@ -4,9 +4,11 @@ import { ResponseData } from '@/utils/request';
import
{
listProxy
}
from
'
@/views/proxy/service
'
;
import
{
getCurrProxyId
,
setCurrProxyId
}
from
"
@/utils/cache
"
;
import
{
get
as
getWorkspace
}
from
"
@/views/workspace/service
"
;
import
{
listInterpreter
}
from
"
@/views/interpreter/service
"
;
export
interface
ProxyData
{
proxies
:
any
[];
interpreters
:
any
[];
proxyMap
:
Record
<
number
,
string
>
;
currProxy
:
any
;
}
...
...
@@ -15,11 +17,13 @@ export interface ModuleType extends StoreModuleType<ProxyData> {
state
:
ProxyData
;
mutations
:
{
saveProxies
:
Mutation
<
any
>
;
saveInterpreters
:
Mutation
<
any
>
;
saveProxyMap
:
Mutation
<
any
>
;
saveCurrProxy
:
Mutation
<
any
>
;
};
actions
:
{
fetchProxies
:
Action
<
ProxyData
,
ProxyData
>
;
fetchInterpreters
:
Action
<
ProxyData
,
ProxyData
>
;
selectProxy
:
Action
<
ProxyData
,
ProxyData
>
;
fetchProxyByWorkspace
:
Action
<
ProxyData
,
ProxyData
>
;
};
...
...
@@ -27,6 +31,7 @@ export interface ModuleType extends StoreModuleType<ProxyData> {
const
initState
:
ProxyData
=
{
proxies
:
[],
interpreters
:
[],
proxyMap
:
{},
currProxy
:{},
};
...
...
@@ -42,6 +47,10 @@ const StoreModel: ModuleType = {
console
.
log
(
'
payload
'
,
payload
);
state
.
proxies
=
payload
;
},
saveInterpreters
(
state
,
payload
)
{
console
.
log
(
'
payload
'
,
payload
);
state
.
interpreters
=
payload
;
},
saveProxyMap
(
state
,
payload
)
{
console
.
log
(
'
payload
'
,
payload
);
const
map
=
{};
...
...
@@ -84,6 +93,16 @@ const StoreModel: ModuleType = {
return
false
;
}
},
async
fetchInterpreters
({
commit
,
state
},
params
)
{
try
{
const
response
:
ResponseData
=
await
listInterpreter
(
state
.
currProxy
.
path
);
const
{
data
}
=
response
;
commit
(
'
saveInterpreters
'
,
data
);
return
true
;
}
catch
(
error
)
{
return
false
;
}
},
async
selectProxy
({
commit
},
payload
)
{
await
setCurrProxyId
(
payload
.
currProxyId
);
commit
(
'
saveCurrProxy
'
,
[]);
...
...
ui/src/views/interpreter/interpreterModal.vue
浏览文件 @
944889a6
...
...
@@ -68,13 +68,10 @@ import {
withDefaults
,
}
from
"
vue
"
;
import
{
useStore
}
from
"
vuex
"
;
import
{
StateType
}
from
"
@/views/site/store
"
;
import
{
momentUtcDef
}
from
"
@/utils/datetime
"
;
import
Table
from
"
@/components/Table.vue
"
;
import
notification
from
"
@/utils/notification
"
;
import
Modal
from
"
@/utils/modal
"
;
import
Button
from
"
@/components/Button.vue
"
;
import
LanguageSettings
from
"
./LanguageSettings.vue
"
;
import
{
listInterpreter
,
saveInterpreter
,
removeInterpreter
}
from
"
@/views/interpreter/service
"
;
import
FormInterpreter
from
"
@/views/interpreter/FormInterpreter.vue
"
;
import
{
getLangSettings
}
from
"
@/views/interpreter/service
"
;
...
...
@@ -108,6 +105,7 @@ onMounted(() => {
const
store
=
useStore
<
{
global
:
GlobalData
}
>
();
const
serverUrl
=
computed
<
any
>
(()
=>
store
.
state
.
global
.
serverUrl
);
watch
(
serverUrl
,
()
=>
{
console
.
log
(
'
watch serverUrl
'
,
serverUrl
.
value
)
list
()
...
...
@@ -154,7 +152,7 @@ const setColumns = () => {
setColumns
();
const
showCreateInterpreterModal
=
ref
(
false
);
let
languageMap
=
ref
<
any
>
({});
const
getInterpretersA
=
async
()
=>
{
const
data
=
await
getLangSettings
(
props
.
proxyInfo
.
path
);
...
...
@@ -219,6 +217,7 @@ const createInterpreter = (formData) => {
formInterpreter
.
value
.
clearFormData
();
showCreateInterpreterModal
.
value
=
false
;
list
();
store
.
dispatch
(
'
proxy/fetchInterpreters
'
,
{})
}
},
(
json
)
=>
{
console
.
log
(
json
)
})
});
...
...
@@ -230,6 +229,7 @@ const createInterpreter = (formData) => {
formInterpreter
.
value
.
clearFormData
();
showCreateInterpreterModal
.
value
=
false
;
list
();
store
.
dispatch
(
'
proxy/fetchInterpreters
'
,
{})
}
},
(
json
)
=>
{
console
.
log
(
json
)
})
}
...
...
ui/src/views/proxy/ProxyNav.vue
浏览文件 @
944889a6
...
...
@@ -10,7 +10,7 @@
class=
"padding-0-bottom"
:items=
"proxies"
keyName=
"id"
:checkedKey=
"currProxy.id"
:checkedKey=
"currProxy.id
== undefined ? 0 : currProxy.id
"
@
click=
"selectProxy"
:replaceFields=
"replaceFields"
>
...
...
ui/src/views/settings/SettingsModal.vue
浏览文件 @
944889a6
...
...
@@ -90,7 +90,7 @@
<Button
v-if=
"!record.value.is_default"
@
click=
"() => handleSetDefault(record)"
class=
"tab-setting-btn"
size=
"sm"
>
{{
t
(
"
set_default
"
)
}}
</Button>
<Button
@
click=
"() => createProxy(record)"
class=
"tab-setting-btn"
size=
"sm"
>
{{
t
(
"
create_
interpreter
"
)
t
(
"
create_
remote_proxy
"
)
}}
</Button>
</
template
>
...
...
@@ -170,7 +170,6 @@ const emit = defineEmits<{
const
{
t
,
locale
}
=
useI18n
();
const
momentUtc
=
momentUtcDef
;
const
interpreters
=
ref
<
any
>
([]);
const
remoteServers
=
ref
<
any
>
([]);
const
editInfo
=
ref
({});
...
...
@@ -183,7 +182,9 @@ onMounted(() => {
const
store
=
useStore
<
{
global
:
GlobalData
,
proxy
:
ProxyData
}
>
();
store
.
dispatch
(
"
proxy/fetchProxies
"
);
store
.
dispatch
(
'
proxy/fetchInterpreters
'
)
const
interpreters
=
computed
<
any
>
(()
=>
store
.
state
.
proxy
.
interpreters
);
const
serverUrl
=
computed
<
any
>
(()
=>
store
.
state
.
global
.
serverUrl
);
watch
(
serverUrl
,
()
=>
{
console
.
log
(
'
watch serverUrl
'
,
serverUrl
.
value
)
...
...
@@ -272,6 +273,7 @@ const showCreateInterpreterModal = ref(false);
const
showCreateProxyModal
=
ref
(
false
);
const
showCreateServerModal
=
ref
(
false
);
const
showInterpreterModal
=
ref
(
false
);
const
defaultProxy
=
computed
<
any
>
(()
=>
store
.
state
.
proxy
.
currProxy
);
let
languageMap
=
ref
<
any
>
({});
const
getInterpretersA
=
async
()
=>
{
...
...
@@ -282,17 +284,15 @@ getInterpretersA();
onMounted
(()
=>
{
console
.
log
(
"
onMounted
"
);
list
();
});
const
list
=
()
=>
{
const
defaultProxy
=
computed
<
any
>
(()
=>
store
.
state
.
proxy
.
currProxy
);
listInterpreter
(
defaultProxy
.
value
.
path
).
then
((
json
)
=>
{
console
.
log
(
"
---
"
,
json
);
watch
(
defaultProxy
,
()
=>
{
console
.
log
(
"
watch default proxy
"
)
list
()
})
if
(
json
.
code
===
0
)
{
interpreters
.
value
=
json
.
data
;
}
});
const
list
=
()
=>
{
listServer
().
then
((
json
)
=>
{
if
(
json
.
code
===
0
)
{
let
defaultServerId
=
0
;
...
...
@@ -312,7 +312,7 @@ const list = () => {
}
});
};
list
();
const
create
=
()
=>
{
editInfo
.
value
=
{};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录