Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
lianghx-319 committed Feb 18, 2020
2 parents ff070de + f7005e0 commit 2b1a910
Show file tree
Hide file tree
Showing 43 changed files with 651 additions and 392 deletions.
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Create an enterprise nuxt app in seconds.
- [x] [element-ui](https://element.eleme.io/) A Vue.js 2.0 UI Toolkit for Web
- [x] [vant](https://youzan.github.io/vant) Lightweight Mobile UI Components built on Vue
- [x] [PWA](https://pwa.nuxtjs.org) Nuxt Progressive Web Apps solution
- [x] [API Manage](https://github.com/FEMessage/create-nuxt-app/blob/dev/docs/api.md) RESTful API management

[⬆ Back to Top](#table-of-contents)

Expand Down Expand Up @@ -80,7 +81,7 @@ Options:

<details><summary>Preview</summary>

![preview](https://i.loli.net/2019/06/24/5d108d92206de47421.gif)
![preview](https://i.loli.net/2020/02/17/B8FHNTerut53m14.gif)

</details>

Expand All @@ -90,23 +91,20 @@ Options:

## Frameworks

### Single
### Admin

```bash
npx @femessage/create-nuxt-app -t single
npx @femessage/create-nuxt-app -t admin
```

![nuxt-element-dashboard](https://i.loli.net/2019/06/24/5d108e301184d60426.png)
![nuxt-admin](https://i.loli.net/2020/02/17/sMtU3kHCefAyRTN.jpg)

### Multiple
An PC admin template

```bash
npx @femessage/create-nuxt-app -t multiple
```

![nuxt-multiple-spa](https://i.loli.net/2019/06/24/5d108e300bc8e21918.png)

This is a pratice of micro-frontends
Default account
admin
admin
abcd1234

### Mobile

Expand Down
4 changes: 2 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

```javascript
// Page 1 获取一个用户的信息
this.$axios.$get('/deepexi-cloud/users/1')
this.$axios.$get('/security/users/1')

// Page 2 创建一个用户
this.$axios.$post('/deepexi-cloud/users', body)
this.$axios.$post('/security/users', body)
```

对于 RESTful API 同一个资源,需要创建多个字符串来维护,即便可以通过抽离常量来维护,但对于调用者,还必须 import apiUrl,使用对应的 methods 来调用接口。
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"test": "ava test --verbose",
"test:snapshot": "ava test --verbose --update-snapshots",
"generate": "node bin/cli.js -a -o release",
"clean": "rm -rf release",
"zip": "node bin/zip.js",
"build": "node bin/deploy/build.js",
"release": "gren release --override"
Expand Down
2 changes: 2 additions & 0 deletions template/framework-admin/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
API_SERVER=https://mockapi.eolinker.com/IeZWjzy87c204a1f7030b2a17b00f3776ce0a07a5030a1b
APP_ID=1204701543597604893
36 changes: 18 additions & 18 deletions template/framework-admin/components/breadcrumb/bread-data.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
const HOME = { name: '首页' }
const ACCOUNT = { name: '账户管理', disabled: true }
const FIELD = { name: '字段管理' }
const GROUP = { name: '群组管理' }
const ORGANNIZATION = { name: '组织管理' }
const POSITION = { name: '职位管理' }
const STAFF = { name: '员工管理' }
const HOME = {name: '首页'}
const ACCOUNT = {name: '账户管理', disabled: true}
const FIELD = {name: '字段管理'}
const GROUP = {name: '群组管理'}
const ORGANNIZATION = {name: '组织管理'}
const POSITION = {name: '职位管理'}
const STAFF = {name: '员工管理'}

export default [
{
name: 'index',
breadcrumb: [HOME]
breadcrumb: [HOME],
},
{
name: "account-field",
breadcrumb: [ACCOUNT, FIELD]
name: 'account-field',
breadcrumb: [ACCOUNT, FIELD],
},
{
name: "account-group",
breadcrumb: [ACCOUNT, GROUP]
name: 'account-group',
breadcrumb: [ACCOUNT, GROUP],
},
{
name: "account-organization",
breadcrumb: [ACCOUNT, ORGANNIZATION]
name: 'account-organization',
breadcrumb: [ACCOUNT, ORGANNIZATION],
},
{
name: "account-position",
breadcrumb: [ACCOUNT, POSITION]
name: 'account-position',
breadcrumb: [ACCOUNT, POSITION],
},
{
name: "account-staff",
breadcrumb: [ACCOUNT, STAFF]
name: 'account-staff',
breadcrumb: [ACCOUNT, STAFF],
},
]
5 changes: 4 additions & 1 deletion template/framework-admin/components/sidebar.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<div :class="{hideSidebar: collapse}" class="sidebar-container scroller-vertical">
<div
:class="{hideSidebar: collapse}"
class="sidebar-container scroller-vertical"
>
<el-menu
:collapse="collapse"
:default-active="$route.path"
Expand Down
7 changes: 5 additions & 2 deletions template/framework-admin/containers/header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
:key="index"
class="navigation-menu"
@click="handleHeaderMenu(item)"
>{{ item.name }}</div>
>
{{ item.name }}
</div>
</el-col>

<!-- 头部操作栏 -->
Expand Down Expand Up @@ -47,7 +49,8 @@
v-for="(item, index) in dropdown"
:key="index"
:command="index"
>{{ item.name }}</el-dropdown-item>
>{{ item.name }}</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
</el-col>
Expand Down
3 changes: 2 additions & 1 deletion template/framework-admin/layouts/blank.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
@clickTitle="$router.push('/')"
>
<template slot="title">
<svg-icon icon-class="logo" style="margin-right: 5px;"></svg-icon>DEEPEXI ADMIN
<svg-icon icon-class="logo" style="margin-right: 5px;"></svg-icon
>DEEPEXI ADMIN
</template>
</layout-header>

Expand Down
3 changes: 2 additions & 1 deletion template/framework-admin/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
@clickTitle="$router.push('/')"
>
<template slot="title">
<svg-icon icon-class="logo" style="margin-right: 5px;"></svg-icon>DEEPEXI ADMIN
<svg-icon icon-class="logo" style="margin-right: 5px;"></svg-icon
>DEEPEXI ADMIN
</template>
</layout-header>

Expand Down
8 changes: 2 additions & 6 deletions template/framework-admin/pages/account/field.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
</template>

<script>
export default {
}
export default {}
</script>

<style lang="less">
</style>
<style lang="less"></style>
8 changes: 2 additions & 6 deletions template/framework-admin/pages/account/group.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
</template>

<script>
export default {
}
export default {}
</script>

<style lang="less">
</style>
<style lang="less"></style>
8 changes: 2 additions & 6 deletions template/framework-admin/pages/account/organization.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
</template>

<script>
export default {
}
export default {}
</script>

<style lang="less">
</style>
<style lang="less"></style>
8 changes: 2 additions & 6 deletions template/framework-admin/pages/account/position.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
</template>

<script>
export default {
}
export default {}
</script>

<style lang="less">
</style>
<style lang="less"></style>
8 changes: 2 additions & 6 deletions template/framework-admin/pages/account/staff.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
</template>

<script>
export default {
}
export default {}
</script>

<style lang="less">
</style>
<style lang="less"></style>
10 changes: 4 additions & 6 deletions template/framework-admin/pages/dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
</template>

<script>
export default {
layout: 'blank'
}
export default {
layout: 'blank',
}
</script>

<style lang="less">
</style>
<style lang="less"></style>
10 changes: 4 additions & 6 deletions template/framework-admin/pages/help.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
</template>

<script>
export default {
layout: 'blank'
}
export default {
layout: 'blank',
}
</script>

<style lang="less">
</style>
<style lang="less"></style>
2 changes: 1 addition & 1 deletion template/framework-admin/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script>
export default {
name: 'Index',
layout: 'blank'
layout: 'blank',
}
</script>

Expand Down
2 changes: 1 addition & 1 deletion template/framework-admin/pages/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default {
name: 'Login',
head() {
return {
title: 'DEEPEXI IAM 登录',
title: 'DEEPEXI ADMIN 登录',
}
},
data() {
Expand Down
19 changes: 10 additions & 9 deletions template/framework-admin/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import meta from '@/const/meta'

const cookieConfig = {
get domain() {
const { hostname } = location
const {hostname} = location
// 本地环境
if (/^(127\.0\.0\.1|localhost)|(netlify\.com)$/.test(hostname)) return hostname
if (/^(127\.0\.0\.1|localhost)|(netlify\.com)$/.test(hostname))
return hostname
// 线上环境
const s = hostname.indexOf('.')
return hostname.slice(s)
Expand All @@ -16,7 +17,7 @@ const cookieConfig = {
},
}

const createMenuItem = ({ name = '', id = '', pathUrl = '/', iconUrl }) => {
const createMenuItem = ({name = '', id = '', pathUrl = '/', iconUrl}) => {
return {
url: pathUrl,
id: id,
Expand Down Expand Up @@ -86,7 +87,7 @@ export const mutations = {
},

setUserInfo(state, payload = {}) {
const { params = {}, username, avatar = '', tenantId, token } = payload
const {params = {}, username, avatar = '', tenantId, token} = payload
state.username = params.nickname || username
state.avatar = avatar
state.tenantId = tenantId
Expand All @@ -96,7 +97,7 @@ export const mutations = {
}

export const actions = {
async login({ commit, dispatch }, { body, redirect = '/' }) {
async login({commit, dispatch}, {body, redirect = '/'}) {
try {
const userInfo = await this.$http.login.create(body)
commit('setUserInfo', userInfo.payload)
Expand All @@ -110,7 +111,7 @@ export const actions = {
}
},

async refresh({ commit, dispatch }, token) {
async refresh({commit, dispatch}, token) {
const userInfo = await this.$http.userInfo.list({
params: {
token,
Expand All @@ -121,7 +122,7 @@ export const actions = {
commit('setUserInfo', userInfo.payload)
},

async getHeaderMenu({ commit }) {
async getHeaderMenu({commit}) {
const menus = await this.$http.menus.list({
params: {
appId: process.env.APP_ID,
Expand All @@ -131,13 +132,13 @@ export const actions = {
commit('setHeaderMenu', menus.payload)
},

async getSiderMenu({ commit }) {
async getSiderMenu({commit}) {
const menus = await this.$http.menus.list({
params: {
appId: process.env.APP_ID,
code: 'account-enterprise',
},
})
commit('setSiderMenu', menus.payload)
}
},
}
Loading

0 comments on commit 2b1a910

Please sign in to comment.