Skip to content

Commit

Permalink
体验更好 直接可以下载客户端
Browse files Browse the repository at this point in the history
  • Loading branch information
duolabmeng6 committed Oct 17, 2023
1 parent 80e5f33 commit bd136e3
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 30 deletions.
8 changes: 6 additions & 2 deletions GoEasyDesigner/frontend/src/action/app9.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {useCounterStore} from '@/stores/counter'
import {onMounted, ref} from "vue";
import {
E保存,
E保存件对话框,
Expand Down Expand Up @@ -259,7 +258,12 @@ appAction.帮助 = function () {
}

appAction.下载客户端 = function () {
window.open("https://github.com/duolabmeng6/GoEasyDesigner/releases")
if (store.是否为window系统) {
window.open(store.window下载地址)
} else {
window.open(store.mac下载地址)
}

}


Expand Down
15 changes: 9 additions & 6 deletions GoEasyDesigner/frontend/src/app9.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,15 @@
type="border-card">
<el-tab-pane label="帮助信息">
<p v-if="!store.客户端模式">
在浏览器中仅可保存设计界面,项目需要手动创建,
<el-link href="https://github.com/duolabmeng6/GoEasyDesigner">前往查看项目创建教程 Github GoEasyDesigner
</el-link>

窗口项目需要手动创建
<el-link href="https://gitee.com/duolabmeng666/go-easy-designer">前往查看运行窗口项目的创建教程 Github GoEasyDesigner</el-link>
<br>
在浏览器中仅可保存设计界面
<br>
建议下载客户端体验更佳
<el-link href="https://github.com/duolabmeng6/GoEasyDesigner/releases">前往下载 Github Releases</el-link>
建议使用客户端保存更简单 目前仍需自行安装 go 和 node 环境

<el-link @click="appAction.下载客户端()">点击下载客户端</el-link>

</p>

Expand Down Expand Up @@ -115,7 +118,7 @@
<el-icon>
<Sunny/>
</el-icon>
窗口设计师
窗口设计师 <el-text size="small">{{store.版本号}}</el-text>
</el-text>
</div>
<div class="工具条 clear-select">
Expand Down
67 changes: 45 additions & 22 deletions GoEasyDesigner/frontend/src/main.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,57 @@
import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import {createApp} from 'vue'
import {createPinia} from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import { ref } from 'vue'

// import App from './components/设计器组件/代码编辑器.vue'
// import App from './测试代码编辑器.vue'
import App from './app9.vue'
import {useCounterStore} from '@/stores/counter'
import releases_latest from './releases_latest.json'
import 渲染组件 from "./components/渲染设计组件.vue"
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import {install as VueMonacoEditorPlugin, loader} from '@guolao/vue-monaco-editor'

import * as monaco from "monaco-editor"
import editorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker"
import jsonWorker from "monaco-editor/esm/vs/language/json/json.worker?worker"
import cssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker"
import htmlWorker from "monaco-editor/esm/vs/language/html/html.worker?worker"
import tsWorker from "monaco-editor/esm/vs/language/typescript/ts.worker?worker"
import 编辑器数据 from './编辑器/编辑器提示数据.js'
import ldf from './编辑器/编辑器语法文件.js'
// import App from './components/设计器组件/项目管理.vue'

//读入 releases_latest.json


const app = createApp(App)
app.use(createPinia())
import {useCounterStore} from '@/stores/counter'

const store = useCounterStore()


// console.log(releases_latest)
//检索releases_latest 中 assets
for (const asset of releases_latest.assets) {
// console.log(asset.name)
// console.log(asset.browser_download_url)
if (asset.name.includes(".exe")) {
store.window下载地址 = "https://ghproxy.com/" + asset.browser_download_url
}
if (asset.name.includes(".dmg")) {
store.mac下载地址 = "https://ghproxy.com/" + asset.browser_download_url
}

}
store.版本号 = releases_latest.tag_name
store.releases_latest = releases_latest

store.是否为window系统 = navigator.platform.includes("Win")


// import 按钮.json from '@/components/按钮.json.vue';
// app.component('按钮.json', 按钮.json)
// import 编辑框 from '@/components/编辑框.vue';
Expand All @@ -26,7 +62,6 @@ const store = useCounterStore()
// app.component('开关', 开关)
// 读取 components 的所有文件名,然后自动导入

import 渲染组件 from "./components/渲染设计组件.vue"
app.component('渲染组件', 渲染组件)


Expand Down Expand Up @@ -76,27 +111,17 @@ for (const path in modules3) {
}


import * as ElementPlusIconsVue from '@element-plus/icons-vue'
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
}

import { install as VueMonacoEditorPlugin } from '@guolao/vue-monaco-editor'
app.use(VueMonacoEditorPlugin, {
paths: {
// The default CDN config
// vs: 'https://cdn.jsdelivr.net/npm/monaco-editor@0.36.0/min/vs'
vs: ''
},
})
import { loader } from "@guolao/vue-monaco-editor"

import * as monaco from "monaco-editor"
import editorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker"
import jsonWorker from "monaco-editor/esm/vs/language/json/json.worker?worker"
import cssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker"
import htmlWorker from "monaco-editor/esm/vs/language/html/html.worker?worker"
import tsWorker from "monaco-editor/esm/vs/language/typescript/ts.worker?worker"

self.MonacoEnvironment = {
getWorker(_, label) {
Expand Down Expand Up @@ -125,16 +150,14 @@ function createCustomProposal(range, insertText, label) {
range: range,
};
}
import 编辑器数据 from './编辑器/编辑器提示数据.js'

// let keywordMappings = ref({})
// keywordMappings.value = 编辑器数据
store.keywordMappings = 编辑器数据
// 将 keywordMappings 共享到全局课修改
// app.provide('keywordMappings',keywordMappings);
// 注册你的自定义语言
monaco.languages.register({ id: 'javascript' });

import ldf from './编辑器/编辑器语法文件.js'
monaco.languages.register({id: 'javascript'});

monaco.languages.setMonarchTokensProvider('javascript', ldf);

Expand All @@ -152,7 +175,7 @@ monaco.languages.registerCompletionItemProvider("javascript", {
Object.keys(store.keywordMappings).forEach(function (keyword) {
var regex = new RegExp("^" + word.word, "i");
if (regex.test(keyword)) {
var { insertText, label } = store.keywordMappings[keyword];
var {insertText, label} = store.keywordMappings[keyword];
suggestions.push(createCustomProposal(range, insertText, label));
}
});
Expand All @@ -162,11 +185,11 @@ monaco.languages.registerCompletionItemProvider("javascript", {
// });
// console.log(JSON.stringify(suggestions, null, 2))

return { suggestions: suggestions };
return {suggestions: suggestions};
},
});

loader.config({ monaco })
loader.config({monaco})
app.config.warnHandler = function (msg, vm, trace) {
// 自定义处理警告的逻辑,或者什么都不做以屏蔽
};
Expand Down
142 changes: 142 additions & 0 deletions GoEasyDesigner/frontend/src/releases_latest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
{
"url": "https://api.github.com/repos/duolabmeng6/GoEasyDesigner/releases/124931121",
"assets_url": "https://api.github.com/repos/duolabmeng6/GoEasyDesigner/releases/124931121/assets",
"upload_url": "https://uploads.github.com/repos/duolabmeng6/GoEasyDesigner/releases/124931121/assets{?name,label}",
"html_url": "https://github.com/duolabmeng6/GoEasyDesigner/releases/tag/v0.1.15",
"id": 124931121,
"author": {
"login": "github-actions[bot]",
"id": 41898282,
"node_id": "MDM6Qm90NDE4OTgyODI=",
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
"html_url": "https://github.com/apps/github-actions",
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
"type": "Bot",
"site_admin": false
},
"node_id": "RE_kwDOKGTsf84Hckwx",
"tag_name": "v0.1.15",
"target_commitish": "refs/heads/main",
"name": "v0.1.15",
"draft": false,
"prerelease": false,
"created_at": "2023-10-13T05:51:24Z",
"published_at": "2023-10-13T06:03:00Z",
"assets": [
{
"url": "https://api.github.com/repos/duolabmeng6/GoEasyDesigner/releases/assets/130377811",
"id": 130377811,
"node_id": "RA_kwDOKGTsf84HxWhT",
"name": "GoEasyDesigner-v0.1.15.dmg",
"label": "",
"uploader": {
"login": "github-actions[bot]",
"id": 41898282,
"node_id": "MDM6Qm90NDE4OTgyODI=",
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
"html_url": "https://github.com/apps/github-actions",
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
"type": "Bot",
"site_admin": false
},
"content_type": "raw",
"state": "uploaded",
"size": 9399658,
"download_count": 1,
"created_at": "2023-10-13T06:03:03Z",
"updated_at": "2023-10-13T06:03:04Z",
"browser_download_url": "https://github.com/duolabmeng6/GoEasyDesigner/releases/download/v0.1.15/GoEasyDesigner-v0.1.15.dmg"
},
{
"url": "https://api.github.com/repos/duolabmeng6/GoEasyDesigner/releases/assets/130377813",
"id": 130377813,
"node_id": "RA_kwDOKGTsf84HxWhV",
"name": "GoEasyDesigner.exe",
"label": "",
"uploader": {
"login": "github-actions[bot]",
"id": 41898282,
"node_id": "MDM6Qm90NDE4OTgyODI=",
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
"html_url": "https://github.com/apps/github-actions",
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
"type": "Bot",
"site_admin": false
},
"content_type": "raw",
"state": "uploaded",
"size": 8522240,
"download_count": 24,
"created_at": "2023-10-13T06:03:04Z",
"updated_at": "2023-10-13T06:03:05Z",
"browser_download_url": "https://github.com/duolabmeng6/GoEasyDesigner/releases/download/v0.1.15/GoEasyDesigner.exe"
},
{
"url": "https://api.github.com/repos/duolabmeng6/GoEasyDesigner/releases/assets/130377809",
"id": 130377809,
"node_id": "RA_kwDOKGTsf84HxWhR",
"name": "GoEasyDesigner_MacOS.zip",
"label": "",
"uploader": {
"login": "github-actions[bot]",
"id": 41898282,
"node_id": "MDM6Qm90NDE4OTgyODI=",
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
"html_url": "https://github.com/apps/github-actions",
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
"type": "Bot",
"site_admin": false
},
"content_type": "raw",
"state": "uploaded",
"size": 8183676,
"download_count": 0,
"created_at": "2023-10-13T06:03:01Z",
"updated_at": "2023-10-13T06:03:02Z",
"browser_download_url": "https://github.com/duolabmeng6/GoEasyDesigner/releases/download/v0.1.15/GoEasyDesigner_MacOS.zip"
}
],
"tarball_url": "https://api.github.com/repos/duolabmeng6/GoEasyDesigner/tarball/v0.1.15",
"zipball_url": "https://api.github.com/repos/duolabmeng6/GoEasyDesigner/zipball/v0.1.15",
"body": "# GoEasyDesigner 窗口设计师\n* 基于 go 语言 使用 wails框架, 支持 window macos linux 等系统.\n\n快下载体验~"
}
5 changes: 5 additions & 0 deletions GoEasyDesigner/frontend/src/stores/counter.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export const useCounterStore = defineStore('counter', {
组件列表tree现行选中项: ref(""),
组件列表tree: ref([]),
scrollContainer: ref(null),
releases_latest:{},//github的文件信息
window下载地址:"",//github的文件信息
mac下载地址:"",//github的文件信息
版本号:"",//github的文件信息
是否为window系统:true,//github的文件信息
}
},

Expand Down
3 changes: 3 additions & 0 deletions GoEasyDesigner/frontend/src/update_github_latest_releases.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 访问 https://api.github.com/repos/duolabmeng6/GoEasyDesigner/releases/latest 保存为 releases_latest.json

curl -o releases_latest.json https://api.github.com/repos/duolabmeng6/GoEasyDesigner/releases/latest

0 comments on commit bd136e3

Please sign in to comment.