update:接口联调部分完成

parent f0407c55
......@@ -7,6 +7,7 @@
"dev": "sh ./bin/start.sh development",
"test": "sh ./bin/start.sh testing",
"prod": "sh ./bin/start.sh production",
"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",
......@@ -41,6 +42,7 @@
"eslint-plugin-vue": "^7.0.0-alpha.0",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"nodemon": "^2.0.7",
"pm2": "2.7.0",
"prettier": "^1.19.1"
},
......
......@@ -2,15 +2,14 @@ const env = process.env.NODE_ENV || 'development';
const port = process.env.PORT || 8055;
const LOGIN_URI = {
'development': "http://web-rest.int.yidian-inc.com",
'development': "http://bp-test.ini.yidian-inc.com ",
'test': "http://web-rest.int.yidian-inc.com",
'production': "http://web-rest.int.yidian-inc.com"
}
const API_INTERNAL_URI = {
'development': "bp-test.ini.yidian-inc.com ",
'test': "bp-test.ini.yidian-inc.com ",
'production': "bp-test.go2yd.com "
'development': "http://bp-test.ini.yidian-inc.com",
'test': "http://bp-test.ini.yidian-inc.com ",
'production': "http://bp-test.go2yd.com "
}
module.exports = {
......
const { API_INTERNAL_URI } = require('../config.js')
const req = require('../utils/request').httpReq
var query = {
async getRole_list (ctx, next) {
var url = `${API_INTERNAL_URI}/merchant/authority/role_list`;
const opts = {
url,
method: 'GET',
}
ctx.body = await req(ctx, opts)
},
}
exports.query = async (ctx, next) => {
var type = ctx.params.type
console.log(812391823912839)
// query[type](ctx, next)
// var type = ctx.params.type
// if (query[type]) {
// try {
// ctx.set('Content-Type', 'application/json; charset=utf-8')
// await query[type](ctx, next)
// } catch (e) {
// console.error('/home/q error', e, ctx.url, ctx.headers['cookie'])
// ctx.body = { status: 'failed', reason: 'Internal Server Error' }
// }
// } else {
// ctx.body = {
// status: 'failed',
// reason: 'Invalid type param',
// }
// }
}
\ No newline at end of file
const LOGIN_URI = require('../config.js').LOGIN_URI
const API_INTERNAL_URI = require('../config.js').API_INTERNAL_URI
const req = require('../utils/request').httpReq
......@@ -9,7 +10,34 @@ exports.login = async (ctx, next) => {
method: 'POST',
json: true,
timeout: 8000,
body : ctx.request.body
body: ctx.request.body
}
ctx.body = await req(ctx, opts)
}
exports.getRole_list = async (ctx, next) => {
var url = `${API_INTERNAL_URI}/api/v1/merchant/authority/role_list`;
var opts = {
url: url,
method: 'GET',
timeout: 8000
}
ctx.body = await req(ctx, opts)
}
exports.getAdd_role = async (ctx, next) => {
var url = `http://bp-test.ini.yidian-inc.com/merchant/authority/add_role`;
var opts = {
url: url,
method: 'POST',
timeout: 8000
}
ctx.body = await req(ctx, opts)
}
exports.get_role_info = async (ctx, next) => {
var url = `http://bp-test.ini.yidian-inc.com/merchant/authority/get_role_info`;
var opts = {
url: url,
method: 'POST',
timeout: 8000
}
ctx.body = await req(ctx, opts)
}
......
const { API_INTERNAL_URI } = require('../config.js')
const req = require('../utils/request').httpReq
var query = {
async get_permissions(ctx, next) {
async get_permissions (ctx, next) {
// http://bp-test.ini.yidian-inc.com/merchant/authority/get_role_list?user_email=jianghaiming@126.com
const url = `${API_INTERNAL_URI}/merchant/authority/get_role_list`;
const { email } = ctx.request.query;
......@@ -13,11 +13,12 @@ var query = {
}
}
ctx.body = await req(ctx, opts)
}
}
},
}
exports.query = async (ctx, next) => {
var type = ctx.params.type
console.log(ctx, '21930193019320')
if (query[type]) {
try {
ctx.set('Content-Type', 'application/json; charset=utf-8')
......
const Router = require('koa-router');
const system = require('./controllers/system')
const user = require('./controllers/user')
const lifeNo = require('./controllers/life-no')
const router = Router();
const API_VERSION = "/api/v1";
console.log(lifeNo.query, '22222222222')
console.log(user.query, '333333')
router.post(`${API_VERSION}/login`, system.login);
router.get(`${API_VERSION}/user/:type`, user.query)
router.get(`${API_VERSION}/home`, lifeNo.query)
// router.get(`${API_VERSION}/merchant/authority/role_list`, system.getRole_list)
router.get(`${API_VERSION}/merchant/authority/add_role`, system.getAdd_role)
router.post(`${API_VERSION}/merchant/authority/get_role_info`, system.get_role_info)
module.exports = router;
<template>
<div>
<layout>
homesssss
</layout>
<div class="addRole">
<el-button
type="primary"
@click="(dialogFormVisible = true), (roleTitle = '新增角色')"
>新增</el-button
>
<!-- 角色列表 -->
<el-table
:data="roleDataList"
style="width: 100%; margin-top: 10px"
:header-cell-style="{ background: '#e1e4e5', color: '#80878f' }"
>
<el-table-column prop="role_name" label="角色名称" width="180">
</el-table-column>
<el-table-column prop="role_name" label="角色范围"> </el-table-column>
<el-table-column label="操作">
<template #default="scope">
<el-button
size="mini"
type="text"
@click="handleModify(scope.$index, scope.row)"
>修改</el-button
>
</template>
</el-table-column>
</el-table>
<!-- 弹框 -->
<el-dialog :title="roleTitle" v-model="dialogFormVisible">
<el-form>
<!-- 编辑 -->
<div v-if="edit">
<el-form-item label="状态" :label-width="formLabelWidth" prop="pass">
<el-input disabled v-model="roleName" autocomplete="off"></el-input>
</el-form-item>
<el-form-item
label="ID"
:label-width="formLabelWidth"
prop="checkPass"
>
<el-input disabled v-model="roleName" autocomplete="off"></el-input>
</el-form-item>
<el-form-item
label="创建人账号"
:label-width="formLabelWidth"
prop="age"
>
<el-input disabled v-model="roleName"></el-input>
</el-form-item>
<el-form-item
label="创建时间"
:label-width="formLabelWidth"
prop="age"
>
<el-input disabled v-model="roleName"></el-input>
</el-form-item>
<el-form-item
label="最后修改人账号"
:label-width="formLabelWidth"
prop="age"
>
<el-input disabled v-model="roleName"></el-input>
</el-form-item>
<el-form-item
label="最后修改时间"
:label-width="formLabelWidth"
prop="age"
>
<el-input disabled v-model="roleName"></el-input>
</el-form-item>
</div>
<!-- 新增 -->
<el-form-item label="角色名称" :label-width="formLabelWidth">
<el-input v-model="roleName" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="角色范围" :label-width="formLabelWidth">
<el-cascader
v-model="selectedOptions"
:options="options"
:props="props"
@change="parentCateChange"
clearable
></el-cascader>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="confirmRole">确 定</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script>
import Layout from '@/layouts';
export default {
components: {
Layout,
import { getRole_list as reqGetRole_list, getAdd_role as reqGetAdd_role } from "../../service/role";
export default {
data () {
return {
roleDataList: [{
id: '1',
name: '超级管理员',
address: '角色范围'
}, {
id: '2',
name: '普通角色',
address: '角色范围'
}, {
id: '3',
name: '超级管理员',
address: '角色范围'
}, {
id: '4',
name: '普通角色',
address: '角色范围'
}],
vals: [],
edit: false,
dialogFormVisible: false,
roleName: '',
checkedRole: [],//已经选择的角色
roleTitle: '',
props: {
multiple: true,//设置为多选
checkStrictly: true,
value: 'name', //value值和哪个值绑定
label: 'desc',//label值和哪个值绑定
children: 'button_list'//children值和哪个值绑定
},
};
</script>
formLabelWidth: '120px',
selectedOptions: [],
rolePrivilege: [],
currentRolePrivilege: '',
options: [
{
<style lang="less" src="./index.less">
// 样式可以内联,也可以通过 src 引入
"name": "用户列表",
"desc": "用户列表",
// "menu_redirect":"\/user\/user\/list",
"button_list": [
{
"name": "deleteBtn",
"desc": "删除用户"
},
{
"name": "addBtn",
"desc": "添加用户"
},
{
"name": "updateBtn",
"desc": "修改用户"
}
]
},
{
"menu_name": "企业审核列表",
// "menu_redirect": "\/aut\/user\/list",
"desc": "企业审核列表",
"button_list": [
{
"name": "addBtn",
"desc": "添加"
},
{
"name": "showBtn",
"desc": "查看"
}
]
}
]
}
},
created () {
this.getGetRole_list() //获取角色列表
},
methods: {
getGetRole_list () {
reqGetRole_list().then(res => {
this.roleDataList = res
})
},
getAdd_role () {
reqGetAdd_role().then(res => {
console.log(res, 'resresres999')
})
},
//修改
handleModify (index, row) {
console.log(index, row, 'index, row')
this.edit = true
this.roleTitle = '角色修改'
this.dialogFormVisible = true
},
confirmRole () {
console.log(this.roleName, 'roleNameroleName')
this.getAdd_role()
this.dialogFormVisible = false
},
// getCascaderObj (val, opt) {
// console.log(val, opt, 'val, opt')
// return val.map(function (value) {
// for (var itm of opt) {
// if (itm.value == value) { opt = itm.children; return itm; }
// }
// return null;
// });
// },
parentCateChange () {
// this.vals = this.getCascaderObj(this.selectedOptions, this.options);
// const checkedNodes = this.$refs['cascaderAddr'].getCheckedNodes()
//console.log(checkedNodes[0].pathLabels, '000') // 获取由 label 组成的数
},
// getCurrentPrivilege (id) {
// get("/merchant/authority/get_role_list").then((res) => {
// if (res.status == 200) {
// this.rolePrivilege = res.data;
// res.data.forEach((item) => {
// if (item.id == id) {
// this.currentRolePrivilege = item;
// console.log(item);
// // this.getCheckedId(this.currentRolePrivilege);
// }
// });
// }
// });
// },
// getSelectedKeys (obj) {
// this.SelectedKeys = [];
// console.log(obj);
// obj.privileges.forEach((item, index) => {
// if (item.parentId != null) {
// this.selectedKeys.push([item.btn_name, item.btn_desc]);
// } else {
// this.selectedKeys.push([item.btn_name, item.btn_desc]);
// }
// });
// console.log(this.checkedId);
// },
}
}
</script>
<style lang="less" scoped>
.addRole {
margin: 50px;
}
</style>
\ No newline at end of file
......@@ -3,7 +3,6 @@
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
v-model:currentPage="currentPage"
:page-size="pageSize"
layout=" total,prev, pager, next"
:total="totalNum"
......
<template>
<div class="lifeNoInfo">
<!-- 状态、生活号名称、创建时间、创建人(账号信息,昵称+账号) -->
<el-descriptions
class="margin-top"
title="生活号信息"
:column="3"
:size="size"
border
>
<el-descriptions class="margin-top" title="生活号信息" :column="3" border>
<template #extra> </template>
<el-descriptions-item>
<template #label> ID </template>
......
......@@ -2,13 +2,7 @@
<div class="lifeNoUser">
<!-- 管理员:管理员昵称、管理员账号、管理员账号ID
子账号(多个):昵称、账号、账号ID -->
<el-descriptions
class="margin-top"
title="用户信息"
:column="3"
:size="size"
border
>
<el-descriptions class="margin-top" title="用户信息" :column="3" border>
<template #extra> </template>
<el-descriptions-item>
<template #label>管理员昵称 </template>
......
<template>
<div class="lifeNotype">
<el-descriptions
class="margin-top"
title="类型信息"
:column="3"
:size="size"
border
>
<el-descriptions class="margin-top" title="类型信息" :column="3" border>
<template #extra> </template>
<el-descriptions-item>
<template #label>职业表标签 </template>
......
......@@ -12,8 +12,9 @@
</el-form-item>
<el-form-item label="类型">
<el-select v-model="formInline.region" placeholder="类型">
<el-option value="shanghai"></el-option>
<el-option value="beijing"></el-option>
<el-option value="个人"></el-option>
<el-option value="企业"></el-option>
<el-option value="全部"></el-option>
</el-select>
</el-form-item>
<el-form-item>
......@@ -39,6 +40,7 @@
<script>
import page from "./components/Pagination"
import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no";
export default {
components: {
page
......@@ -78,6 +80,11 @@ export default {
}
}
},
created () {
reqGetLifeNoList().then(res => {
console.log(res, '000')
})
},
methods: {
//查询
onSearchSubmit () {
......@@ -94,12 +101,13 @@ export default {
},
toLifeDetail (row) {
// this.$router.push({ path: lifeNoDetail })
this.$router.push({ name: 'LifeNoDetail' });
console.log(row.id, 'eee去详情')
},
//获取列表数据
getlifeNoList () {
// getlifeNoList () {
}
// }
}
}
</script>
......
......@@ -28,7 +28,7 @@
import { login as reqLogin } from "../../service/user";
export default {
name: "Login",
data() {
data () {
return {
userInfo: {
email: "",
......@@ -36,9 +36,9 @@ export default {
},
};
},
created() {},
created () { },
methods: {
async login() {
async login () {
const { email, password } = this.userInfo;
console.log(34333, email, password);
if (!email) {
......
<template>
<div class="addRole">
<el-button type="primary" @click="dialogFormVisible = true">新增</el-button>
<el-button
type="primary"
@click="(dialogFormVisible = true), (roleTitle = '新增角色')"
>新增</el-button
>
<!-- 角色列表 -->
<el-table
:data="tableData"
style="width: 100%; margin-top: 10px"
......@@ -20,23 +25,60 @@
</template>
</el-table-column>
</el-table>
<el-dialog title="新增角色" v-model="dialogFormVisible">
<!-- 弹框 -->
<el-dialog :title="roleTitle" v-model="dialogFormVisible">
<el-form>
<!-- 编辑 -->
<div v-if="edit">
<el-form-item label="状态" :label-width="formLabelWidth" prop="pass">
<el-input disabled v-model="roleName" autocomplete="off"></el-input>
</el-form-item>
<el-form-item
label="ID"
:label-width="formLabelWidth"
prop="checkPass"
>
<el-input disabled v-model="roleName" autocomplete="off"></el-input>
</el-form-item>
<el-form-item
label="创建人账号"
:label-width="formLabelWidth"
prop="age"
>
<el-input disabled v-model="roleName"></el-input>
</el-form-item>
<el-form-item
label="创建时间"
:label-width="formLabelWidth"
prop="age"
>
<el-input disabled v-model="roleName"></el-input>
</el-form-item>
<el-form-item
label="最后修改人账号"
:label-width="formLabelWidth"
prop="age"
>
<el-input disabled v-model="roleName"></el-input>
</el-form-item>
<el-form-item
label="最后修改时间"
:label-width="formLabelWidth"
prop="age"
>
<el-input disabled v-model="roleName"></el-input>
</el-form-item>
</div>
<!-- 新增 -->
<el-form-item label="角色名称" :label-width="formLabelWidth">
<el-input
style="width: 400px"
v-model="roleName"
autocomplete="off"
></el-input>
<el-input v-model="roleName" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="角色范围" :label-width="formLabelWidth">
<el-cascader
v-model="selectedOptions"
:options="options"
:props="props"
ref="cascaderAddr"
@change="parentCateChange"
filterable
clearable
></el-cascader>
</el-form-item>
......@@ -72,10 +114,11 @@ export default {
address: '角色范围'
}],
vals: [],
edit: false,
dialogFormVisible: false,
roleName: '',
checkedRole: [],//已经选择的角色
roleTitle: '新增角色',
roleTitle: '',
props: {
multiple: true,//设置为多选
checkStrictly: true,
......@@ -130,6 +173,7 @@ export default {
//修改
handleModify (index, row) {
console.log(index, row, 'index, row')
this.edit = true
this.roleTitle = '角色修改'
this.dialogFormVisible = true
},
......@@ -137,19 +181,19 @@ export default {
console.log(this.roleName, 'roleNameroleName')
this.dialogFormVisible = false
},
getCascaderObj (val, opt) {
console.log(val, opt, 'val, opt')
return val.map(function (value) {
for (var itm of opt) {
if (itm.value == value) { opt = itm.children; return itm; }
}
return null;
});
},
// getCascaderObj (val, opt) {
// console.log(val, opt, 'val, opt')
// return val.map(function (value) {
// for (var itm of opt) {
// if (itm.value == value) { opt = itm.children; return itm; }
// }
// return null;
// });
// },
parentCateChange () {
this.vals = this.getCascaderObj(this.selectedOptions, this.options);
const checkedNodes = this.$refs['cascaderAddr'].getCheckedNodes()
console.log(checkedNodes[0].pathLabels, '000') // 获取由 label 组成的数
// this.vals = this.getCascaderObj(this.selectedOptions, this.options);
// const checkedNodes = this.$refs['cascaderAddr'].getCheckedNodes()
//console.log(checkedNodes[0].pathLabels, '000') // 获取由 label 组成的数
},
// getCurrentPrivilege (id) {
// get("/merchant/authority/get_role_list").then((res) => {
......
import axios from '../utils/request';
export async function getLifeNoList () {
const res = await axios.get("/api/v1/merchant/authority/role_list");
return res.data;
}
\ No newline at end of file
import axios from '../utils/request';
//角色列表
export async function getRole_list () {
const res = await axios.get("/api/v1/merchant/authority/role_list")
return res.result;
}
//添加角色
export async function getAdd_role () {
const res = await axios.get("/api/v1/merchant/authority/add_role", {
})
return res.result;
}
//角色编辑
// export async function getAdd_role () {
// const res = await axios.get("/api/v1/merchant/authority/update_role", {
// })
// return res.result;
// }
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