Commit 04e74b14 authored by lvweichao's avatar lvweichao

update: fix merge confilct

parent 1749109c
...@@ -23,4 +23,14 @@ npm run dev ...@@ -23,4 +23,14 @@ npm run dev
# 新版 # 新版
npm run web-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 @@ ...@@ -7,7 +7,7 @@
"dev": "sh ./bin/start.sh development", "dev": "sh ./bin/start.sh development",
"test": "sh ./bin/start.sh testing", "test": "sh ./bin/start.sh testing",
"prod": "sh ./bin/start.sh production", "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-dev": "cross-env NODE_ENV=development vue-cli-service serve",
"web-build": "cross-env NODE_ENV=production vue-cli-service build", "web-build": "cross-env NODE_ENV=production vue-cli-service build",
"test:unit": "vue-cli-service test:unit", "test:unit": "vue-cli-service test:unit",
...@@ -55,4 +55,4 @@ ...@@ -55,4 +55,4 @@
"Android >= 4.1" "Android >= 4.1"
], ],
"license": "YIDIAN" "license": "YIDIAN"
} }
\ No newline at end of file
...@@ -23,7 +23,6 @@ exports.entCommit = async ctx => { ...@@ -23,7 +23,6 @@ exports.entCommit = async ctx => {
url, url,
method: "POST", method: "POST",
json: true, json: true,
timeout: 8000,
body: ctx.request.body body: ctx.request.body
}; };
ctx.body = await req(ctx, opts); ctx.body = await req(ctx, opts);
...@@ -36,7 +35,6 @@ exports.checkLife = async ctx => { ...@@ -36,7 +35,6 @@ exports.checkLife = async ctx => {
url, url,
method: "POST", method: "POST",
json: true, json: true,
timeout: 8000,
body: ctx.request.body body: ctx.request.body
}; };
ctx.body = await req(ctx, opts); ctx.body = await req(ctx, opts);
...@@ -49,7 +47,6 @@ exports.createLife = async ctx => { ...@@ -49,7 +47,6 @@ exports.createLife = async ctx => {
url, url,
method: "POST", method: "POST",
json: true, json: true,
timeout: 8000,
body: ctx.request.body body: ctx.request.body
}; };
ctx.body = await req(ctx, opts); ctx.body = await req(ctx, opts);
......
const LOGIN_URI = require('../config.js').LOGIN_URI const LOGIN_URI = require('../config.js').LOGIN_URI
const API_INTERNAL_URI = require('../config.js').API_INTERNAL_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 url = `${API_INTERNAL_URI}/merchant/lifeinner/life_list`;
var opts = { var opts = {
url: url, url: url,
method: 'GET', method: 'GET',
json: true, qs: ctx.request.query
timeout: 8000,
body: ctx.request.body
} }
ctx.body = await req(ctx, opts) ctx.body = await req(ctx, opts)
} }
\ No newline at end of file
...@@ -17,7 +17,6 @@ exports.getRole_list = async (ctx, next) => { ...@@ -17,7 +17,6 @@ exports.getRole_list = async (ctx, next) => {
var opts = { var opts = {
url: url, url: url,
method: 'POST', method: 'POST',
timeout: 8000,
} }
ctx.body = await req(ctx, opts) ctx.body = await req(ctx, opts)
} }
...@@ -27,7 +26,16 @@ exports.get_role_info = async (ctx, next) => { ...@@ -27,7 +26,16 @@ exports.get_role_info = async (ctx, next) => {
url: url, url: url,
method: 'POST', method: 'POST',
json: true, 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 body: ctx.request.body
} }
ctx.body = await req(ctx, opts) ctx.body = await req(ctx, opts)
...@@ -37,7 +45,6 @@ exports.getUpdate_role = async (ctx, next) => { ...@@ -37,7 +45,6 @@ exports.getUpdate_role = async (ctx, next) => {
var opts = { var opts = {
url: url, url: url,
method: 'POST', method: 'POST',
timeout: 8000
} }
ctx.body = await req(ctx, opts) ctx.body = await req(ctx, opts)
} }
...@@ -46,7 +53,6 @@ exports.getUser_detail = async (ctx, next) => { ...@@ -46,7 +53,6 @@ exports.getUser_detail = async (ctx, next) => {
var opts = { var opts = {
url: url, url: url,
method: 'POST', method: 'POST',
timeout: 8000
} }
ctx.body = await req(ctx, opts) ctx.body = await req(ctx, opts)
} }
\ No newline at end of file
const Router = require("koa-router"); const Router = require("koa-router");
const system = require("./controllers/system"); const system = require("./controllers/system");
const user = require("./controllers/user"); const user = require("./controllers/user");
...@@ -16,6 +15,7 @@ router.get(`${API_VERSION}/certification`, enterprise.entCheck); ...@@ -16,6 +15,7 @@ router.get(`${API_VERSION}/certification`, enterprise.entCheck);
router.post(`${API_VERSION}/emterprise_commit`, enterprise.entCommit); router.post(`${API_VERSION}/emterprise_commit`, enterprise.entCommit);
router.post(`${API_VERSION}/check_life`, enterprise.checkLife); router.post(`${API_VERSION}/check_life`, enterprise.checkLife);
router.post(`${API_VERSION}/create_life`, enterprise.createLife); 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/role_list`, role.getRole_list)
router.post(`${API_VERSION}/merchant/authority/add_role`, role.getAdd_role) router.post(`${API_VERSION}/merchant/authority/add_role`, role.getAdd_role)
router.post(`${API_VERSION}/merchant/authority/update_role`, role.getUpdate_role) router.post(`${API_VERSION}/merchant/authority/update_role`, role.getUpdate_role)
......
...@@ -40,12 +40,11 @@ export default { ...@@ -40,12 +40,11 @@ export default {
data () { data () {
return { return {
menuItems, menuItems,
modulePermissions: []
}; };
}, },
computed: { computed: {
menuItemsWithAuth: function() { menuItemsWithAuth: function() {
return this.menuItems.filter(ele => this.modulePermissions.includes(ele.key)) return this.menuItems.filter(ele => getModulePermissions().includes(ele.key))
}, },
activeMenu: function () { activeMenu: function () {
...@@ -53,7 +52,6 @@ export default { ...@@ -53,7 +52,6 @@ export default {
}, },
}, },
beforeMount() { beforeMount() {
this.modulePermissions = getModulePermissions();
}, },
methods: {}, methods: {},
}; };
......
...@@ -9,12 +9,12 @@ export const HEADER_CONFIG = { ...@@ -9,12 +9,12 @@ export const HEADER_CONFIG = {
key: 'enterprise', key: 'enterprise',
}, },
{ {
path: '/life-no/life', path: '/lifeNo',
name: '生活号管理', name: '生活号管理',
key: 'lifeNo', key: 'lifeNo',
}, },
{ {
path: '/role', path: '/roleManageRole',
name: '角色管理', name: '角色管理',
key: 'role', key: 'role',
}, },
...@@ -58,9 +58,9 @@ export const PATH_PERMISSION_NAME = { ...@@ -58,9 +58,9 @@ export const PATH_PERMISSION_NAME = {
'/enterprise/audit': 'enterprise_certification_management.audit', '/enterprise/audit': 'enterprise_certification_management.audit',
'/enterprise/establish': 'enterprise_certification_management.create', '/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' '/user': 'user_management'
} }
\ No newline at end of file
...@@ -14,21 +14,18 @@ import { redirectToLogin } from './utils/util'; ...@@ -14,21 +14,18 @@ import { redirectToLogin } from './utils/util';
// 处理路由权限 // 处理路由权限
router.beforeResolve(async (to, from, next) => { router.beforeResolve(async (to, from, next) => {
if (to.meta.requireAuth) { if (to.meta.requireAuth && !store.state.permissions) {
if (!store.state.permissions) { const { status, user } = await fetchCurrentUser();
const { status, user } = await fetchCurrentUser(); if (status === 'success') {
if (status === 'success') { store.commit('updateUserInfo', user);
store.commit('updateUserInfo', user); store.dispatch('updateUserPermission', { email: user.email }).then(() => {
store.dispatch('updateUserPermission', { email: user.email }).then(() => { if (!checkPathAuth(to.path)) {
if (!checkPathAuth(to.path)) { router.push('/403')
router.push('/403') }
} })
}) } else {
} else { redirectToLogin();
redirectToLogin();
}
} }
next()
} else { } else {
next() next()
} }
......
<template> <template>
<div class="life-no"> <layout>
<el-form :inline="true" :model="formInline" class="demo-form-inline"> <div class="life-no">
<el-form-item label="生活号名称/企业名称"> <el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-input <el-form-item label="生活号名称/企业名称">
class="search_life" <el-input
maxlength="15" class="search_life"
v-model="life_account.name" maxlength="15"
placeholder="生活号名称/企业名称" v-model="life_account.name"
></el-input> placeholder="生活号名称/企业名称"
</el-form-item> ></el-input>
<el-form-item label="类型"> </el-form-item>
<el-select v-model="life_account.type" placeholder="类型"> <el-form-item label="类型">
<el-option value="个人" label="个人"></el-option> <el-select v-model="life_account.type" placeholder="类型">
<el-option value="企业" label="企业"></el-option> <el-option value="个人" label="个人"></el-option>
</el-select> <el-option value="企业" label="企业"></el-option>
</el-form-item> </el-select>
<el-form-item> </el-form-item>
<el-button type="primary" @click="onSearchSubmit">查询</el-button> <el-form-item>
<el-button @click="onReset">重置</el-button> <el-button type="primary" @click="onSearchSubmit">查询</el-button>
</el-form-item> <el-button @click="onReset">重置</el-button>
</el-form> </el-form-item>
<el-table </el-form>
:data="LifeNoList" <el-table
border :data="LifeNoList"
style="width: 100%" border
@row-click="toLifeDetail" 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 prop="life_account_id" label="ID"> </el-table-column>
</el-table-column> <el-table-column prop="life_account_name" label="生活号名称">
<el-table-column prop="life_account_type" label="类型"> </el-table-column> </el-table-column>
<el-table-column prop="life_account_auth_status" label="状态"> <el-table-column prop="life_account_type" label="类型"> </el-table-column>
</el-table-column> <el-table-column prop="life_account_auth_status" label="状态">
<el-table-column prop="create_time" label="创建时间"> </el-table-column> </el-table-column>
</el-table> <el-table-column prop="create_time" label="创建时间"> </el-table-column>
<page :totalNum="totalNum" @update="update" /> </el-table>
</div> <page :totalNum="totalNum" @update="update" />
</div>
</layout>
</template> </template>
<script> <script>
import Layout from '@/layouts'
import page from "../components/Pagination" import page from "../components/Pagination"
import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no"; import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no";
export default { export default {
name: "LifeNo", name: "LifeNo",
components: { components: {
Layout,
page page
}, },
data () { data () {
......
...@@ -18,8 +18,6 @@ const routes = [ ...@@ -18,8 +18,6 @@ const routes = [
name: 'NotFound', name: 'NotFound',
component: () => import(/* webpackChunkName: "enterprise" */ '@/pages/Catch/notFound'), component: () => import(/* webpackChunkName: "enterprise" */ '@/pages/Catch/notFound'),
}, },
// 企业认证管理
{ {
path: '/403', path: '/403',
name: 'Forbidden', 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