Commit 04e74b14 authored by lvweichao's avatar lvweichao

update: fix merge confilct

parent 1749109c
......@@ -23,4 +23,14 @@ npm run dev
# 新版
npm run web-dev
```
\ No newline at end of file
```
# 增加需要权限控制的页面
1. 配置 router meta 信息:requireAuth: true
2. 配置 */src/config/pageconfig.js* PATH_PERMISSION_NAME 路由对应的权限名,子权限用逗号分割。权限名需与服务端返回权限列表中的一级权限保持一致
# 增加顶部导航
1. 配置 */src/config/pageconfig.js* HEADER_CONFIG.menuItems 增加对应项
2. 若需要权限控制顶栏是否展示对应项, 需配置 */src/config/pageconfig.js* PAGEMODULE_PERMISSIONNAME 模块对应的权限名。权限名需与服务端返回权限列表中的一级权限保持一致
......@@ -7,7 +7,7 @@
"dev": "sh ./bin/start.sh development",
"test": "sh ./bin/start.sh testing",
"prod": "sh ./bin/start.sh production",
"koa": "node app.js",
"koa": "nodemon app.js",
"web-dev": "cross-env NODE_ENV=development vue-cli-service serve",
"web-build": "cross-env NODE_ENV=production vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
......@@ -55,4 +55,4 @@
"Android >= 4.1"
],
"license": "YIDIAN"
}
\ No newline at end of file
}
......@@ -23,7 +23,6 @@ exports.entCommit = async ctx => {
url,
method: "POST",
json: true,
timeout: 8000,
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
......@@ -36,7 +35,6 @@ exports.checkLife = async ctx => {
url,
method: "POST",
json: true,
timeout: 8000,
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
......@@ -49,7 +47,6 @@ exports.createLife = async ctx => {
url,
method: "POST",
json: true,
timeout: 8000,
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
......
const LOGIN_URI = require('../config.js').LOGIN_URI
const API_INTERNAL_URI = require('../config.js').API_INTERNAL_URI
const req = require('../utils/request').httpReqexports.get_life_list = async (ctx, next) => {
const req = require('../utils/request').httpReq
exports.get_life_list = async (ctx, next) => {
var url = `${API_INTERNAL_URI}/merchant/lifeinner/life_list`;
var opts = {
url: url,
method: 'GET',
json: true,
timeout: 8000,
body: ctx.request.body
qs: ctx.request.query
}
ctx.body = await req(ctx, opts)
}
\ No newline at end of file
......@@ -17,7 +17,6 @@ exports.getRole_list = async (ctx, next) => {
var opts = {
url: url,
method: 'POST',
timeout: 8000,
}
ctx.body = await req(ctx, opts)
}
......@@ -27,7 +26,16 @@ exports.get_role_info = async (ctx, next) => {
url: url,
method: 'POST',
json: true,
timeout: 8000,
body: ctx.request.body
}
ctx.body = await req(ctx, opts)
}
exports.getAdd_role = async (ctx, next) => {
var url = `${API_INTERNAL_URI}/merchant/authority/add_role`;
var opts = {
url: url,
method: 'POST',
json: true,
body: ctx.request.body
}
ctx.body = await req(ctx, opts)
......@@ -37,7 +45,6 @@ exports.getUpdate_role = async (ctx, next) => {
var opts = {
url: url,
method: 'POST',
timeout: 8000
}
ctx.body = await req(ctx, opts)
}
......@@ -46,7 +53,6 @@ exports.getUser_detail = async (ctx, next) => {
var opts = {
url: url,
method: 'POST',
timeout: 8000
}
ctx.body = await req(ctx, opts)
}
\ No newline at end of file
const Router = require("koa-router");
const system = require("./controllers/system");
const user = require("./controllers/user");
......@@ -16,6 +15,7 @@ router.get(`${API_VERSION}/certification`, enterprise.entCheck);
router.post(`${API_VERSION}/emterprise_commit`, enterprise.entCommit);
router.post(`${API_VERSION}/check_life`, enterprise.checkLife);
router.post(`${API_VERSION}/create_life`, enterprise.createLife);
router.post(`${API_VERSION}/merchant/authority/role_list`, role.getRole_list)
router.post(`${API_VERSION}/merchant/authority/add_role`, role.getAdd_role)
router.post(`${API_VERSION}/merchant/authority/update_role`, role.getUpdate_role)
......
......@@ -40,12 +40,11 @@ export default {
data () {
return {
menuItems,
modulePermissions: []
};
},
computed: {
menuItemsWithAuth: function() {
return this.menuItems.filter(ele => this.modulePermissions.includes(ele.key))
return this.menuItems.filter(ele => getModulePermissions().includes(ele.key))
},
activeMenu: function () {
......@@ -53,7 +52,6 @@ export default {
},
},
beforeMount() {
this.modulePermissions = getModulePermissions();
},
methods: {},
};
......
......@@ -9,12 +9,12 @@ export const HEADER_CONFIG = {
key: 'enterprise',
},
{
path: '/life-no/life',
path: '/lifeNo',
name: '生活号管理',
key: 'lifeNo',
},
{
path: '/role',
path: '/roleManageRole',
name: '角色管理',
key: 'role',
},
......@@ -58,9 +58,9 @@ export const PATH_PERMISSION_NAME = {
'/enterprise/audit': 'enterprise_certification_management.audit',
'/enterprise/establish': 'enterprise_certification_management.create',
'/life-no/life': 'life_official_account_management',
'/lifeNo': 'life_official_account_management',
'/role': 'role_management',
'/roleManageRole': 'role_management',
'/user': 'user_management'
}
\ No newline at end of file
......@@ -14,21 +14,18 @@ import { redirectToLogin } from './utils/util';
// 处理路由权限
router.beforeResolve(async (to, from, next) => {
if (to.meta.requireAuth) {
if (!store.state.permissions) {
const { status, user } = await fetchCurrentUser();
if (status === 'success') {
store.commit('updateUserInfo', user);
store.dispatch('updateUserPermission', { email: user.email }).then(() => {
if (!checkPathAuth(to.path)) {
router.push('/403')
}
})
} else {
redirectToLogin();
}
if (to.meta.requireAuth && !store.state.permissions) {
const { status, user } = await fetchCurrentUser();
if (status === 'success') {
store.commit('updateUserInfo', user);
store.dispatch('updateUserPermission', { email: user.email }).then(() => {
if (!checkPathAuth(to.path)) {
router.push('/403')
}
})
} else {
redirectToLogin();
}
next()
} else {
next()
}
......
<template>
<div class="life-no">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="生活号名称/企业名称">
<el-input
class="search_life"
maxlength="15"
v-model="life_account.name"
placeholder="生活号名称/企业名称"
></el-input>
</el-form-item>
<el-form-item label="类型">
<el-select v-model="life_account.type" placeholder="类型">
<el-option value="个人" label="个人"></el-option>
<el-option value="企业" label="企业"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSearchSubmit">查询</el-button>
<el-button @click="onReset">重置</el-button>
</el-form-item>
</el-form>
<el-table
:data="LifeNoList"
border
style="width: 100%"
@row-click="toLifeDetail"
>
<el-table-column prop="life_account_id" label="ID"> </el-table-column>
<el-table-column prop="life_account_name" label="生活号名称">
</el-table-column>
<el-table-column prop="life_account_type" label="类型"> </el-table-column>
<el-table-column prop="life_account_auth_status" label="状态">
</el-table-column>
<el-table-column prop="create_time" label="创建时间"> </el-table-column>
</el-table>
<page :totalNum="totalNum" @update="update" />
</div>
<layout>
<div class="life-no">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="生活号名称/企业名称">
<el-input
class="search_life"
maxlength="15"
v-model="life_account.name"
placeholder="生活号名称/企业名称"
></el-input>
</el-form-item>
<el-form-item label="类型">
<el-select v-model="life_account.type" placeholder="类型">
<el-option value="个人" label="个人"></el-option>
<el-option value="企业" label="企业"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSearchSubmit">查询</el-button>
<el-button @click="onReset">重置</el-button>
</el-form-item>
</el-form>
<el-table
:data="LifeNoList"
border
style="width: 100%"
@row-click="toLifeDetail"
>
<el-table-column prop="life_account_id" label="ID"> </el-table-column>
<el-table-column prop="life_account_name" label="生活号名称">
</el-table-column>
<el-table-column prop="life_account_type" label="类型"> </el-table-column>
<el-table-column prop="life_account_auth_status" label="状态">
</el-table-column>
<el-table-column prop="create_time" label="创建时间"> </el-table-column>
</el-table>
<page :totalNum="totalNum" @update="update" />
</div>
</layout>
</template>
<script>
import Layout from '@/layouts'
import page from "../components/Pagination"
import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no";
export default {
name: "LifeNo",
components: {
Layout,
page
},
data () {
......
......@@ -18,8 +18,6 @@ const routes = [
name: 'NotFound',
component: () => import(/* webpackChunkName: "enterprise" */ '@/pages/Catch/notFound'),
},
// 企业认证管理
{
path: '/403',
name: 'Forbidden',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment