diff --git a/GoEasyDesigner/frontend/src/action/app9.js b/GoEasyDesigner/frontend/src/action/app9.js index 6a4b4f9f..442b4406 100644 --- a/GoEasyDesigner/frontend/src/action/app9.js +++ b/GoEasyDesigner/frontend/src/action/app9.js @@ -1,5 +1,4 @@ import {useCounterStore} from '@/stores/counter' -import {onMounted, ref} from "vue"; import { E保存, E保存件对话框, @@ -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下载地址) + } + } diff --git a/GoEasyDesigner/frontend/src/app9.vue b/GoEasyDesigner/frontend/src/app9.vue index e0b3d6e5..2615b8c5 100644 --- a/GoEasyDesigner/frontend/src/app9.vue +++ b/GoEasyDesigner/frontend/src/app9.vue @@ -82,12 +82,15 @@ type="border-card">

- 在浏览器中仅可保存设计界面,项目需要手动创建, - 前往查看项目创建教程 Github GoEasyDesigner - + + 窗口项目需要手动创建 + 前往查看运行窗口项目的创建教程 Github GoEasyDesigner +
+ 在浏览器中仅可保存设计界面
- 建议下载客户端体验更佳 - 前往下载 Github Releases + 建议使用客户端保存更简单 目前仍需自行安装 go 和 node 环境 + + 点击下载客户端

@@ -115,7 +118,7 @@ - 窗口设计师 + 窗口设计师 {{store.版本号}}
diff --git a/GoEasyDesigner/frontend/src/main.js b/GoEasyDesigner/frontend/src/main.js index fe32c4f1..efb790fc 100644 --- a/GoEasyDesigner/frontend/src/main.js +++ b/GoEasyDesigner/frontend/src/main.js @@ -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'; @@ -26,7 +62,6 @@ const store = useCounterStore() // app.component('开关', 开关) // 读取 components 的所有文件名,然后自动导入 -import 渲染组件 from "./components/渲染设计组件.vue" app.component('渲染组件', 渲染组件) @@ -76,12 +111,10 @@ 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 @@ -89,14 +122,6 @@ app.use(VueMonacoEditorPlugin, { 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) { @@ -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); @@ -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)); } }); @@ -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) { // 自定义处理警告的逻辑,或者什么都不做以屏蔽 }; diff --git a/GoEasyDesigner/frontend/src/releases_latest.json b/GoEasyDesigner/frontend/src/releases_latest.json new file mode 100644 index 00000000..8cf5253d --- /dev/null +++ b/GoEasyDesigner/frontend/src/releases_latest.json @@ -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快下载体验~" +} diff --git a/GoEasyDesigner/frontend/src/stores/counter.js b/GoEasyDesigner/frontend/src/stores/counter.js index a3d6fe8b..e44dc57d 100644 --- a/GoEasyDesigner/frontend/src/stores/counter.js +++ b/GoEasyDesigner/frontend/src/stores/counter.js @@ -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的文件信息 } }, diff --git a/GoEasyDesigner/frontend/src/update_github_latest_releases.sh b/GoEasyDesigner/frontend/src/update_github_latest_releases.sh new file mode 100644 index 00000000..86e90a5a --- /dev/null +++ b/GoEasyDesigner/frontend/src/update_github_latest_releases.sh @@ -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 \ No newline at end of file