Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行官方magic-admin项目,按照文档步骤执行,路由访问http://0.0.0.0:1024/editor::actId. #484

Open
LdPz-ROOM opened this issue Feb 16, 2023 · 1 comment

Comments

@LdPz-ROOM
Copy link

dom.ts:22 GET http://0.0.0.0:1024/static/vue3/entry/config/index.umd.js net::ERR_ABORTED 404 (Not Found)

[2023-02-16T10:35:36.782] [DEBUG] default - /static/vue3/entry/value/index.umd.js
ctx {
request: {
method: 'GET',
url: '/static/vue3/entry/value/index.umd.js',
header: {
'x-forwarded-host': '0.0.0.0:1024',
'x-forwarded-proto': 'http',
'x-forwarded-port': '1024',
'x-forwarded-for': '127.0.0.1',
cookie: 'userName=defaultName',
'accept-language': 'zh-CN,zh;q=0.9',
'accept-encoding': 'gzip, deflate',
referer: 'http://0.0.0.0:1024/editor',
accept: '/',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36',
connection: 'close',
host: 'localhost:3001'
}
},
response: {
status: 404,
message: 'Not Found',
header: [Object: null prototype] {}
},
app: { subdomainOffset: 2, proxy: false, env: 'development' },
originalUrl: '/static/vue3/entry/value/index.umd.js',
req: '',
res: '',
socket: ''
}

开发者本地调试 magic-admin 请按照如下步骤:
数据库: 我们在 magic-admin/server/src/database/init.sql 中准备了库表初始化文件,开发者首先需要创建所需数据表

表名:magic_act_info 项目基础信息表,包含项目 ID,项目名称,项目负责人,项目时间等项目基础信息。
表名:magic_ui_config 页面配置表,magic-admin 支持了一个项目中包含多个项目页面的能力,因此每个页面的组件配置信息将分别存储。
启动 web 端:

$ cd magic-admin/web
$ npm i
$ npm run serve
启动 server 端
$ cd magic-admin/server
$ npm i
$ npm run dev
server 文件夹下面这些敏感文件,需要开发者参考示例进行替换:

.
├── src
│ ├── config
│ │ ├── databaseExample.ts(数据库配置文件)
│ │ ├── keyExample.ts(加密秘钥配置)
关于登录态: magic-admin 在库表中为开发者预留了用户信息字段(项目负责人),开发者可以根据自身业务需要,实现用户登录态
// web/src/App.vue
watchEffect(async () => {
// 登录态获取交由开发者实现
const userName = process.env.VUE_APP_USER_NAME || "defaultName";
Cookies.set("userName", userName);
});
管理端能力
项目状态
我们将项目的状态分为三种:修改中,部分页面已发布,全部页面已发布。在项目列表页面,可以展开查看每个项目页面的状态。

修改中:项目所有页面均在编辑状态

部分已发布:项目的一些页面在编辑状态,一些页面已发布

已发布:项目所有页面均已发布

在管理端引入 runtime
在管理端中我们提供了一个可视化的模拟画布,他需要依赖 runtime 核心库,因此我们需要先在 magic 根目录下运行

cd magic
npm run build:runtime:admin
将 /runtime/vue3|vue2|react/dist 文件夹复制到 /magic-admin/serve/static 目录下。

mkdir ./magic-admin/server/static/vue3
cp -rf ./runtime/vue3/dist/* ./magic-admin/server/static/vue3

@khuntoriia
Copy link
Collaborator

对应路径下magic-admin/server/static需要有runtime构建产物。https://tencent.github.io/tmagic-editor/docs/guide/#runtimeurl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants