Skip to content

Commit

Permalink
feat: 1. 修复登录问题。 2. 修复后台问题。3. 新增使用文档
Browse files Browse the repository at this point in the history
  • Loading branch information
JackySoft committed Aug 17, 2024
1 parent e4c133c commit 52ca774
Show file tree
Hide file tree
Showing 67 changed files with 1,333 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ packages/**/*/node_modules
/dist
# misc
.DS_Store
cache
4 changes: 2 additions & 2 deletions packages/admin/.env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 接口地址
VITE_BASE_API=http://localhost:5000/api
#VITE_BASE_API=http://mars-api.marsview.cc/api
# VITE_BASE_API=http://localhost:5000/api
VITE_BASE_API=http://mars-api.marsview.cc/api
# 后台访问地址
VITE_ADMIN_URL=http://admin.marsview.cc
14 changes: 9 additions & 5 deletions packages/admin/src/pages/login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ export default function Login() {
if (res.token) {
storage.set('token', res.token);
saveUserInfo(res);
const params = new URLSearchParams(location.search);
setTimeout(() => {
const url = new URL(params.get('callback') as string);
navigate(url.pathname || '/welcome');
});
if (location.search) {
const params = new URLSearchParams(location.search);
setTimeout(() => {
const url = new URL(params.get('callback') as string);
navigate(url.pathname || '/welcome');
});
} else {
navigate('/');
}
}
};
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ instance.interceptors.response.use(
if (res.code === 10018) {
message.error('登录已过期,请重新登录');
setTimeout(() => {
window.location.replace(`/#/login?callback=${window.location.href}`);
window.location.replace(`/login?callback=${window.location.href}`);
return null;
}, 2000);
return Promise.reject(res.message);
Expand Down
66 changes: 66 additions & 0 deletions packages/docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { defineConfig } from 'vitepress';

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: 'Marsview',
description: '一款面向中后台低代码平台,支持逻辑编排、事件交互和接口配置。',
lastUpdated: true,
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
logo: './../assets/mars-logo.png',
nav: [
{ text: '首页', link: '/' },
{ text: '项目', link: '/project' },
{ text: '页面', link: '/page' },
{ text: '组件', link: '/lib' },
{ text: '团队', link: '/team' },
],

sidebar: [
{
text: '登录',
items: [{ text: '账号登录', link: '/login' }],
},
{
text: '项目',
items: [
{ text: '项目介绍', link: '/project' },
{ text: '菜单介绍', link: '/project/menu' },
{ text: '角色介绍', link: '/project/role' },
{ text: '用户介绍', link: '/project/user' },
{ text: '项目访问', link: '/project/visit' },
],
},
{
text: '页面',
items: [
{ text: '页面介绍', link: '/page' },
{ text: '左侧菜单', link: '/page/sideNav' },
{ text: '组件拖拽', link: '/page/drag' },
{ text: '组件大纲', link: '/page/outline' },
{ text: 'JSON源码', link: '/page/json' },
{ text: '接口管理', link: '/page/api' },
{ text: '变量管理', link: '/page/variable' },
{ text: '页面成员', link: '/page/member' },
],
},
{
text: '组件',
items: [{ text: '组件介绍', link: '/lib' }],
},
{
text: '团队介绍',
link: '/team',
},
],

socialLinks: [{ icon: 'github', link: 'https://github.com/JackySoft/marsview' }],
footer: {
message: 'Released under the MIT License.',
copyright: 'Copyright © 2014-present 河畔一角',
},
search: {
provider: 'local',
},
},
});
49 changes: 49 additions & 0 deletions packages/docs/api-examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
outline: deep
---

# Runtime API Examples

This page demonstrates usage of some of the runtime APIs provided by VitePress.

The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:

```md
<script setup>
import { useData } from 'vitepress'

const { theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>
```

<script setup>
import { useData } from 'vitepress'

const { site, theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>

## More

Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
Binary file added packages/docs/assets/lib/createLib.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/lib/dev.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/login/login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/login/welcome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/m1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/m2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/mars-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/p1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/p4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/api.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/canvas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/click_api.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/click_api_config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/click_api_structure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/click_json.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/click_member.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/click_outline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/click_variable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/createPage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/drag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/json.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/member.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/outline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/sort.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/assets/page/variable.png
Binary file added packages/docs/assets/project/admin1.png
Binary file added packages/docs/assets/project/admin2.png
Binary file added packages/docs/assets/project/config.png
Binary file added packages/docs/assets/project/console.png
Binary file added packages/docs/assets/project/createMenu.png
Binary file added packages/docs/assets/project/createRole.png
Binary file added packages/docs/assets/project/createUser.png
Binary file added packages/docs/assets/project/menu.png
Binary file added packages/docs/assets/project/project-list.png
Binary file added packages/docs/assets/project/project_limit.png
Binary file added packages/docs/assets/project/role.png
Binary file added packages/docs/assets/project/roleLimit.png
Binary file added packages/docs/assets/project/user.png
Binary file added packages/docs/assets/welcome-bg.png
42 changes: 42 additions & 0 deletions packages/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
# https://vitepress.dev/reference/default-theme-home-page
layout: home

hero:
name: 'Marsview 低代码平台'
text: '快速搭建后台管理系统'
tagline: 让搭建更简单,让开发更高效
image:
src: /assets/welcome-bg.png
alt: Marsview
actions:
- theme: brand
text: 使用文档
link: /login
- theme: alt
text: 在线体验
link: http://www.marsview.cc
target: _blank
- theme: alt
text: GitHub
link: https://github.com/JackySoft/marsview
target: _blank

features:
- icon:
src: /assets/m1.png
title: 项目配置
details: 可创建完整项目,支持菜单角色配置、RBAC权限、项目主题等。
- icon:
src: /assets/m2.png
title: 权限管理
details: 支持项目权限、页面权限设置,页面支持开发和预览两种模式。
- icon:
src: /assets/p1.png
title: 逻辑编排
details: 可配置事件流完成高复杂度需求,比如:接口请求、条件判断、组件联动等。
- icon:
src: /assets/p4.png
title: 数据源配置
details: 任何一个组件,都可以配置静态数据、接口请求和变量绑定。
---
32 changes: 32 additions & 0 deletions packages/docs/lib/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 组件

在开发页面的过程中,假如平台提供的组件不能满足需求,那么就需要自定义组件。当前平台不支持本地开发和上传组件,只能通过平台在线开发自定义组件。 组件开发完成发布以后,可在编辑器界面的自定义组件中显示。

## 创建组件

进入组件列表,点击右侧新建组件,输入按钮名称,按钮标识,点击确定。

组件标识为英文,类似于`Antd`组件库中的`Button`,组件名称为中文。

![创建组件](./../assets/lib/createLib.png)

## 组件开发

组件创建完成后,在列表点击开发按钮,即可进入开发界面。

![组件开发](./../assets/lib/dev.png)

## 开发流程

组件基于`React`开发,不支持`import`引入,只能通过`window.antd`的方式引入,当前支持的插件有`react``antd``dayjs`等。

- `index.jsx`为组件源码,在发布之前尽可能保证渲染成功。
- `index.less`为组件样式。
- `config.js`为组件属性配置,`attrs`为编辑器中需要展示的配置项。`config`为组件默认值,`events`为组件在编辑器中展示的事件,`methods`为组件在编辑器中展示的方法。
- `index.md`为组件文档。

## 组件发布

当组件开发完成后,先进行保存,确保组件渲染成功,在点击发布按钮,即可将组件发布到平台。

发布完成后,在编辑器的自定义组件中会显示该组件。
19 changes: 19 additions & 0 deletions packages/docs/login.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 平台账号登录

### 打开 Marsview

输入平台地址:`http://marsview.com`

![进入首页](./assets/login/welcome.png)

### 进入登录页面

点击快速开始按钮,如果没有登录,会跳转到登录页面。

![点击快速开始](./assets/login/login.png)

### 登录账号

系统默认账号:`demo@marsview.cc/marsview`,目前平台还不支持个人注册,如果需要私人账号,请发邮件到`sunnyboysoft@163.com`进行申请。

登录成后会跳转到项目列表页面。
85 changes: 85 additions & 0 deletions packages/docs/markdown-examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Markdown Extension Examples

This page demonstrates some of the built-in markdown extensions provided by VitePress.

## Syntax Highlighting

VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:

**Input**

````md
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````

**Output**

```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```

## Custom Containers

**Input**

```md
::: info
This is an info box.
:::

::: tip
This is a tip.
:::

::: warning
This is a warning.
:::

::: danger
This is a dangerous warning.
:::

::: details
This is a details block.
:::
```

**Output**

::: info
This is an info box.
:::

::: tip
This is a tip.
:::

::: warning
This is a warning.
:::

::: danger
This is a dangerous warning.
:::

::: details
This is a details block.
:::

## More

Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).
15 changes: 15 additions & 0 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "docs",
"version": "1.0.0",
"description": "Marsview低代码平台开发使用文档",
"scripts": {
"docs:dev": "vitepress dev",
"docs:build": "vitepress build && mv ./.vitepress/dist ../../dist/docs",
"docs:preview": "vitepress preview"
},
"author": "河畔一角",
"license": "MIT",
"dependencies": {
"vitepress": "^1.3.2"
}
}
19 changes: 19 additions & 0 deletions packages/docs/page/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 接口管理

Marsview 支持接口位置,通过左侧菜单,可以提前创建页面需要的接口,最终把接口配置在组件中。

## 创建接口

点击左侧接口图标,会显示当前页面所有的接口,点击创建按钮,可以创建新的接口。

![访问端工作台](./../assets/page/click_api.png)

支持返回结构定义,比如:code, msg, data。

![访问端工作台](./../assets/page/click_api_structure.png)

## 组件配置接口

选中表格组件,点击右侧数据配置,数据来源选择接口请求,请求地址选择刚刚创建的接口。

![访问端工作台](./../assets/page/click_api_config.png)
11 changes: 11 additions & 0 deletions packages/docs/page/drag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 组件拖拽

打开左侧组件物料,可以直接点击或者拖拽组件到画布中。

![访问端工作台](./../assets/page/drag.png)

## 组件排序

组件支持排序,选中画布中的组件,会有一个工具条,点击上移或者下移,即可调整组件的位置。

![访问端工作台](./../assets/page/sort.png)
Loading

0 comments on commit 52ca774

Please sign in to comment.