Skip to content

Commit

Permalink
发布
Browse files Browse the repository at this point in the history
  • Loading branch information
duolabmeng6 committed Aug 3, 2024
1 parent aecbdf9 commit 3cf2552
Showing 1 changed file with 35 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</el-form-item>
<el-form-item label="项目目录">
<el-input v-model="当前项目目录"/>
<el-button @click="选择目录">选择目录</el-button>
<el-button @click="选择目录">选择目录</el-button>
</el-form-item>

<el-form-item label="项目名称">
Expand All @@ -45,26 +45,27 @@
</el-dialog>
</template>

<script setup lang="jsx">
import { defineEmits, defineProps, onMounted, watch,ref } from "vue";
import { useAppStore } from "@/stores/appStore";
const store = useAppStore();
const emits = defineEmits(["创建项目","关闭"]);
<script setup lang="jsx">
import {defineEmits, onMounted, ref, watch} from "vue";
import {useAppStore} from "@/stores/appStore";
import * as goFc from "@/../wailsjs/go/main/App";
import {ElMessage} from "element-plus";
import {appAction} from "@/action/app";
const store = useAppStore();
const emits = defineEmits(["创建项目", "关闭"]);
const options = [
{ label: '示例项目', value: "https://github.com/duolabmeng6/wails-template-vue-go-easy" },
{ label: 'electron示例项目', value: "https://github.com/duolabmeng6/electron-template-easy-desinger" },
{ label: '投屏软件示例项目', value: "https://github.com/duolabmeng6/projection_screen_tv" },
{ label: 'ollama管理面板示例项目', value: "https://github.com/duolabmeng6/ollama_ui" },
{ label: '自定义远程Github项目', value: "" },
{label: '示例项目', value: "https://github.com/duolabmeng6/wails-template-vue-go-easy"},
{label: 'electron示例项目', value: "https://github.com/duolabmeng6/electron-template-easy-desinger"},
{label: '投屏软件示例项目', value: "https://github.com/duolabmeng6/projection_screen_tv"},
{label: 'ollama管理面板示例项目', value: "https://github.com/duolabmeng6/ollama_ui"},
{label: '自定义远程Github项目', value: ""},
];
const options2 = [
{ label: '不需要', value: "" },
{ label: 'https://mirror.ghproxy.com/', value: "https://mirror.ghproxy.com/" },
{label: '不需要', value: ""},
{label: 'https://mirror.ghproxy.com/', value: "https://mirror.ghproxy.com/"},
];
Expand All @@ -76,27 +77,25 @@ let GitHub镜像加速 = ref("");
onMounted(async () => {
项目目录.value = await goFc.E取当前目录();
console.log("项目目录",项目目录.value)
let files = await goFc.E搜索文件(项目目录.value+"/TemplateProject",".zip")
console.log("项目目录", 项目目录.value)
let files = await goFc.E搜索文件(项目目录.value + "/TemplateProject", ".zip")
// C:\eview\v2\GoEasyDesigner\TemplateProject
//加入到options
console.log("搜索文件",files,项目目录.value+"/TemplateProject")
if(files){
console.log("搜索文件", files, 项目目录.value + "/TemplateProject")
if (files) {
for (let i = 0; i < files.length; i++) {
let label = files[i]
//获取文件名
let index = label.lastIndexOf("/");
label = label.substring(index + 1, label.length);
//删除.zip
label = "本地项目-" + label.replace(".zip","")
label = "本地项目-" + label.replace(".zip", "")
options.push({label:label,value:files[i]})
options.push({label: label, value: files[i]})
}
}
});
// 我需要项目名称修改了以后 项目目录 为 项目目录/项目名称
Expand All @@ -109,20 +108,19 @@ watch(项目目录, (newName, oldName) => {
});
const 选择目录 = async () => {
const result = await goFc.E打开选择文件夹对话框();
console.log("选择目录",result)
if (result !=="") {
console.log("选择目录", result)
if (result !== "") {
项目目录.value = result;
}
};
async function 创建项目事件(){
console.log("项目url",项目URL.value)
console.log("项目目录",当前项目目录.value)
console.log("项目名称",项目名称.value)
if( await goFc.E文件是否存在(当前项目目录.value)){
async function 创建项目事件() {
console.log("项目url", 项目URL.value)
console.log("项目目录", 当前项目目录.value)
console.log("项目名称", 项目名称.value)
if (await goFc.E文件是否存在(当前项目目录.value)) {
//弹出饿了么信息框 提示创建失败
ElMessage({
message: '项目目录已经存在',
Expand All @@ -132,31 +130,31 @@ async function 创建项目事件(){
}
//检查 项目url是否包含https://
let pjurl = 项目URL.value
if(项目URL.value.indexOf("https://") !== -1){
if (项目URL.value.indexOf("https://") !== -1) {
pjurl = GitHub镜像加速.value + 项目URL.value
}
let ret = await goFc.E下载github项目(pjurl,当前项目目录.value)
if(ret === 'success'){
let ret = await goFc.E下载github项目(pjurl, 当前项目目录.value)
if (ret === 'success') {
emits('关闭')
}else{
} else {
//弹出饿了么信息框 提示创建失败
ElMessage({
message: '项目创建失败'+ret,
message: '项目创建失败' + ret,
type: 'error',
});
}
// 搜索 design.json 文件
let files = await goFc.E搜索文件(当前项目目录.value,"design.json")
if (files.length === 0){
let files = await goFc.E搜索文件(当前项目目录.value, "design.json")
if (files.length === 0) {
//弹出饿了么信息框 提示创建失败
ElMessage({
message: '项目目录下没有找到design.json文件',
type: 'error',
});
return
}
console.log("搜索文件",files)
console.log("搜索文件", files)
appAction._打开文件加载界面(files[0])
emits('关闭')
Expand Down

0 comments on commit 3cf2552

Please sign in to comment.