Skip to content

Commit

Permalink
发布 创建项目功能优化
Browse files Browse the repository at this point in the history
  • Loading branch information
duolabmeng6 committed Dec 9, 2023
1 parent 46408ae commit 4bda6a7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@
v-model="项目URL"
:options="options"
placeholder="请选择模板项目"
clearable
@focus="onFocus"
@blur="onBlur"
></t-select>

</el-form-item>
<el-form-item label="模板项目地址">
<el-input v-model="项目URL"/>
</el-form-item>

<el-form-item label="GitHub镜像加速">
<t-select
v-model="GitHub镜像加速"
:options="options2"
placeholder="请选择是否需要加速"
></t-select>
</el-form-item>
<el-form-item label="项目目录">
<el-input v-model="当前项目目录"/>
<el-button @click="选择目录">选择目录</el-button>
Expand Down Expand Up @@ -57,12 +60,17 @@ const options = [
{ label: '自定义远程Github项目', value: "" },
];
const options2 = [
{ label: '不需要', value: "" },
{ label: 'https://mirror.ghproxy.com/', value: "https://mirror.ghproxy.com/" },
];
const 项目URL = ref(options[0].value);
let 当前项目目录 = ref("");
let 项目目录 = ref("");
let 项目名称 = ref("myporject");
let GitHub镜像加速 = ref("");
onMounted(async () => {
项目目录.value = await goFc.E取当前目录();
Expand All @@ -88,6 +96,7 @@ onMounted(async () => {
});
// 我需要项目名称修改了以后 项目目录 为 项目目录/项目名称
watch(项目名称, (newName, oldName) => {
当前项目目录.value = 项目目录.value + '/' + 项目名称.value;
Expand All @@ -97,13 +106,7 @@ watch(项目目录, (newName, oldName) => {
当前项目目录.value = 项目目录.value + '/' + 项目名称.value;
});
const onFocus = (ctx) => {
console.log('focus:', ctx);
};
const onBlur = (ctx) => {
console.log('blur:', ctx);
};
const 选择目录 = async () => {
const result = await goFc.E打开选择文件夹对话框();
Expand All @@ -125,8 +128,13 @@ async function 创建项目事件(){
});
return
}
//检查 项目url是否包含https://
let pjurl = 项目URL.value
if(项目URL.value.indexOf("https://") !== -1){
pjurl = GitHub镜像加速.value + 项目URL.value
}
let ret = await goFc.E下载github项目(项目URL.value,当前项目目录.value)
let ret = await goFc.E下载github项目(pjurl,当前项目目录.value)
if(ret === 'success'){
emits('关闭')
}else{
Expand Down
2 changes: 2 additions & 0 deletions GoEasyDesigner/mymodel/git项目操作.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ func E下载github项目(github项目地址, 保存目录 string) error {
// 我希望通过https下载github的项目到指定的目录上
//修改 GitHub 项目地址以指向 ZIP 压缩包
//检查github项目地址 是否包含https://
fmt.Println("下载URL", github项目地址)

name := ecore.E文件取文件名(github项目地址, false)
savePath := 保存目录 + "/" + name + "_project.zip"
删除文件 := false
Expand Down

0 comments on commit 4bda6a7

Please sign in to comment.