update:部分接口联调完善

parent b4bb3ab6
......@@ -7,7 +7,7 @@
"dev": "sh ./bin/start.sh development",
"test": "sh ./bin/start.sh testing",
"prod": "sh ./bin/start.sh production",
"koa": "nodemon app.js",
"koa": "node 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",
......
......@@ -14,26 +14,69 @@ exports.login = async (ctx, next) => {
}
ctx.body = await req(ctx, opts)
}
exports.getAll_role_list = async (ctx, next) => {
var url = `${API_INTERNAL_URI}/merchant/authority/get_role_list`;
var opts = {
url: url,
method: 'POST',
json: true,
timeout: 8000,
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 url = `${API_INTERNAL_URI}/merchant/authority/role_list`;
var opts = {
url: url,
method: 'GET',
timeout: 8000
method: 'POST',
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 url = `${API_INTERNAL_URI}/merchant/authority/add_role`;
var opts = {
url: url,
method: 'POST',
timeout: 8000
json: true,
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 url = `${API_INTERNAL_URI}/merchant/authority/get_role_info`;
var opts = {
url: url,
method: 'POST',
json: true,
timeout: 8000,
body: ctx.request.body
}
ctx.body = await req(ctx, opts)
}
exports.getUpdate_role = async (ctx, next) => {
var url = `${API_INTERNAL_URI}/merchant/authority/update_role`;
var opts = {
url: url,
method: 'POST',
timeout: 8000
}
ctx.body = await req(ctx, opts)
}
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
}
ctx.body = await req(ctx, opts)
}
exports.getUser_detail = async (ctx, next) => {
var url = `${API_INTERNAL_URI}/merchant/lifeinner/life_info`;
var opts = {
url: url,
method: 'POST',
......@@ -41,4 +84,3 @@ exports.get_role_info = async (ctx, next) => {
}
ctx.body = await req(ctx, opts)
}
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/role_list`, system.getRole_list)
router.post(`${API_VERSION}/merchant/authority/add_role`, system.getAdd_role)
router.post(`${API_VERSION}/merchant/authority/update_role`, system.getUpdate_role)
router.post(`${API_VERSION}/merchant/authority/get_role_list`, system.getAll_role_list)
router.post(`${API_VERSION}/merchant/authority/get_role_info`, system.get_role_info)
router.post(`${API_VERSION}/merchant/lifeinner/life_info`, system.getUser_detail)
router.get(`${API_VERSION}/merchant/lifeinner/life_list`, system.get_life_list)
getUser_detail
module.exports = router;
<template>
<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>
<layout> homesssss </layout>
</div>
</template>
<script>
import { getRole_list as reqGetRole_list, getAdd_role as reqGetAdd_role } from "../../service/role";
import Layout from '@/layouts';
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值和哪个值绑定
},
formLabelWidth: '120px',
selectedOptions: [],
rolePrivilege: [],
currentRolePrivilege: '',
options: [
{
"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() //获取角色列表
components: {
Layout,
},
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
<style lang="less" src="./index.less">
// 样式可以内联,也可以通过 src 引入
</style>
......@@ -24,17 +24,74 @@
生活号名称生活号名称生活号名称
</el-descriptions-item>
</el-descriptions>
<el-descriptions class="margin-top" title="类型信息" :column="3" border>
<template #extra> </template>
<el-descriptions-item>
<template #label>职业表标签 </template>
运动员
</el-descriptions-item>
<el-descriptions-item>
<template #label> 姓名 </template>
张三
</el-descriptions-item>
<el-descriptions-item>
<template #label> 身份证号 </template>
XXXXXXXXXX
</el-descriptions-item>
<el-descriptions-item>
<template #label> 统一社会信用代码(注册码) </template>
00019
</el-descriptions-item>
<el-descriptions-item>
<template #label> 企业注册名称 </template>
不二杂货铺
</el-descriptions-item>
</el-descriptions>
<el-descriptions class="margin-top" title="用户信息" :column="3" border>
<template #extra> </template>
<el-descriptions-item>
<template #label>管理员昵称 </template>
派大星
</el-descriptions-item>
<el-descriptions-item>
<template #label> 管理员账号 </template>
0001
</el-descriptions-item>
<el-descriptions-item>
<template #label> 管理员账号ID </template>
9203201993
</el-descriptions-item>
<el-descriptions-item>
<template #label> 子账号昵称 </template>
子账号昵称
</el-descriptions-item>
<el-descriptions-item>
<template #label> 子账号账号 </template>
0002
</el-descriptions-item>
<el-descriptions-item>
<template #label> 子账号账号ID </template>
0002ID
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script>
export default {
data () {
return {
lifeNoId: this.$route.query.lifeId
}
},
created () {
console.log(this.$route.query.lifeId, this.lifeNoId, '0000')
}
}
</script>
<style lang="less" scoped>
.lifeNoInfo {
.margin-top {
margin-top: 10px;
}
}
</style>
\ No newline at end of file
<template>
<div class="lifeNoUser">
<!-- 管理员:管理员昵称、管理员账号、管理员账号ID
子账号(多个):昵称、账号、账号ID -->
<el-descriptions class="margin-top" title="用户信息" :column="3" border>
<template #extra> </template>
<el-descriptions-item>
<template #label>管理员昵称 </template>
派大星
</el-descriptions-item>
<el-descriptions-item>
<template #label> 管理员账号 </template>
0001
</el-descriptions-item>
<el-descriptions-item>
<template #label> 管理员账号ID </template>
9203201993
</el-descriptions-item>
<el-descriptions-item>
<template #label> 子账号昵称 </template>
子账号昵称
</el-descriptions-item>
<el-descriptions-item>
<template #label> 子账号账号 </template>
0002
</el-descriptions-item>
<el-descriptions-item>
<template #label> 子账号账号ID </template>
0002ID
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script>
export default {
data () {
return {
}
}
}
</script>
<style lang="less" scoped>
.lifeNoUser {
.margin-top {
margin-top: 10px;
}
}
</style>
\ No newline at end of file
<template>
<div class="lifeNotype">
<el-descriptions class="margin-top" title="类型信息" :column="3" border>
<template #extra> </template>
<el-descriptions-item>
<template #label>职业表标签 </template>
运动员
</el-descriptions-item>
<el-descriptions-item>
<template #label> 姓名 </template>
张三
</el-descriptions-item>
<el-descriptions-item>
<template #label> 身份证号 </template>
XXXXXXXXXX
</el-descriptions-item>
<el-descriptions-item>
<template #label> 统一社会信用代码(注册码) </template>
00019
</el-descriptions-item>
<el-descriptions-item>
<template #label> 企业注册名称 </template>
不二杂货铺
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script>
export default {
data () {
return {
}
}
}
</script>
<style lang="less" scoped>
.lifeNotype {
.margin-top {
margin-top: 10px;
}
}
</style>
\ No newline at end of file
......@@ -6,15 +6,18 @@
<el-input
class="search_life"
maxlength="15"
v-model="formInline.user"
v-model="life_account.name"
placeholder="生活号名称/企业名称"
></el-input>
</el-form-item>
<el-form-item label="类型">
<el-select v-model="formInline.region" placeholder="类型">
<el-option value="个人"></el-option>
<el-option value="企业"></el-option>
<el-option value="全部"></el-option>
<el-select v-model="life_account.type" placeholder="类型">
<el-option
v-for="item in LifeNoList"
:key="item.value"
:label="item.life_account_type == 1 ? '个人' : '企业'"
:value="item.life_account_type"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
......@@ -23,25 +26,28 @@
</el-form-item>
</el-form>
<el-table
:data="tableData"
:data="LifeNoList"
border
style="width: 100%"
@row-click="toLifeDetail"
>
<el-table-column prop="id" label="ID"> </el-table-column>
<el-table-column prop="name" label="生活号名称"> </el-table-column>
<el-table-column prop="address" label="类型"> </el-table-column>
<el-table-column prop="name" label="状态"> </el-table-column>
<el-table-column prop="date" label="创建时间"> </el-table-column>
<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>
</template>
<script>
import page from "./components/Pagination"
import page from "../components/Pagination"
import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no";
export default {
name: "LifeNo",
components: {
page
},
......@@ -49,31 +55,15 @@ export default {
return {
params: {
page: 1,
pageSize: 10
page_size: 20
},
totalNum: 1000,
life_account: {
name: "",
type: "",
},
totalNum: null,
lifeList: [],
tableData: [{
id: '001',
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
id: '002',
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
id: '003',
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
id: '004',
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄'
}],
LifeNoList: [],
formInline: {
user: '',
region: ''
......@@ -81,33 +71,41 @@ export default {
}
},
created () {
reqGetLifeNoList().then(res => {
console.log(res, '000')
})
this.getLifeNoListFn()
},
methods: {
//获取列表数据
getLifeNoListFn () {
let { name, type } = this.life_account
let { page, page_size } = this.params
let params = {
page,
page_size,
life_account_name: name,
life_account_type: type
}
reqGetLifeNoList(params).then(res => {
this.totalNum = res.count
this.LifeNoList = res.data
})
},
//查询
onSearchSubmit () {
console.log(this.formInline.user, this.formInline.region, 'submit!');
this.getLifeNoListFn()
},
//重置
onReset () {
this.formInline.user = "",
this.formInline.region = ""
this.life_account.name = "",
this.life_account.type = ""
},
update (obj) {
Object.assign(this.params, obj)
this.getlifeNoList(this.params)
this.getLifeNoListFn(this.params)
},
toLifeDetail (row) {
// this.$router.push({ path: lifeNoDetail })
this.$router.push({ name: 'LifeNoDetail' });
console.log(row.id, 'eee去详情')
this.$router.push({ name: 'LifeNoDetail', query: { lifeId: row.life_account_id } });
console.log(row.life_account_id, 'eee去详情')
},
//获取列表数据
// getlifeNoList () {
// }
}
}
</script>
......
<template>
<div class="life-no-detail">
<lifeNoInfo />
<lifeNotype />
<lifeNoUser />
</div>
</template>
<script>
import lifeNoInfo from './components/lifeNoInfo'
import lifeNotype from './components/lifeNotype'
import lifeNoUser from './components/lifeNoUser'
export default {
components: {
lifeNoInfo,
lifeNotype,
lifeNoUser
},
data () {
return {
......
This diff is collapsed.
<template>
<div>
<el-form-item label="状态" :label-width="formLabelWidth" prop="pass">
<el-input disabled v-model="loaclRole_info.role_status"></el-input>
</el-form-item>
<el-form-item label="ID" :label-width="formLabelWidth" prop="pass">
<el-input disabled v-model="loaclRole_info.role_id"></el-input>
</el-form-item>
<el-form-item label="创建人账号" :label-width="formLabelWidth">
<el-input disabled v-model="loaclRole_info.create_user_name"></el-input>
</el-form-item>
<el-form-item label="创建时间" :label-width="formLabelWidth">
<el-input disabled v-model="loaclRole_info.create_time"></el-input>
</el-form-item>
<el-form-item label="最后修改人账号" :label-width="formLabelWidth">
<el-input disabled v-model="loaclRole_info.update_user_name"></el-input>
</el-form-item>
<el-form-item label="最后修改时间" :label-width="formLabelWidth">
<el-input disabled v-model="loaclRole_info.update_time"></el-input>
</el-form-item>
</div>
</template>
<script>
export default {
props: ["role_info_detail"],
data () {
return {
formLabelWidth: "120px",
loaclRole_info: this.role_info_detail
}
},
created () {
console.log(this.role_info_detail, 'role_info_detail')
}
}
</script>
\ No newline at end of file
<template>
<div class="user-detail">
<h2 style="margin-bottom: 10px">用户详情</h2>
<el-descriptions class="margin-top" :column="3" :size="size" border>
<el-descriptions-item>
<template #label> 用户姓名 </template>
......@@ -49,12 +50,19 @@
</div>
</template>
<script>
import { getUser_detail as reqGetUser_detail } from '../../service/user'
export default {
data () {
return {
user_id: 1,
userInfoList: [{
}]
}
},
created () {
reqGetUser_detail(this.user_id).then((res) => {
console.log(res, '000')
})
}
}
</script>
......
<template>
<div class="block">
<!-- <el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:page-size="page_size"
background
layout="total,prev, pager, next"
:total="totalNum"
>
</el-pagination> -->
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:page-size="pageSize"
layout=" total,prev, pager, next"
:current-page="currentPage"
:page-size="page_size"
background
layout="total, prev, pager, next, jumper"
:total="totalNum"
>
</el-pagination>
......@@ -15,14 +26,14 @@ export default {
props: ['data', 'totalNum'],
data () {
return {
currentPage: 5,
pageSize: 20
currentPage: 1,
page_size: 20
}
},
methods: {
handleSizeChange (size) {
console.log(`每页 ${size} 条`);
this.$emit('update', { pageSize: size })
this.$emit('update', { page_size: size })
},
handleCurrentChange (pageIndex) {
console.log(`当前页: ${pageIndex}`);
......@@ -35,5 +46,4 @@ export default {
.block {
margin-top: 50px;
}
// 样式可以内联,也可以通过 src 引入
</style>
\ No newline at end of file
......@@ -6,7 +6,6 @@ import LifeNoDetail from '../pages/Life-no/life-no-detail.vue'
import UserDetail from '../pages/User/user-detail.vue'
import AddRole from '../pages/Role/add-role.vue'
const routes = [
{
path: "/home",
......@@ -40,26 +39,26 @@ const routes = [
},
//生活号管理
{
path: '/life-no/life',
path: '/lifeNo',
name: 'LifeNo',
component: LifeNo,
},
{
path: '/life-no/lifeNoDetail',
path: '/lifeNoDetail',
name: 'LifeNoDetail',
component: LifeNoDetail,
},
//用户管理
{
path: '/user/userDetail',
path: '/userDetail',
name: 'UserDetail',
component: UserDetail,
},
//角色管理
{
path: '/role/addRole',
path: '/roleAddRole',
name: 'AddRole',
component: AddRole,
component: AddRole
},
];
......
import axios from '../utils/request';
export async function getLifeNoList () {
const res = await axios.get("/api/v1/merchant/authority/role_list");
return res.data;
//生活号列表
export async function getLifeNoList (params) {
const res = await axios.get(`/api/v1/merchant/lifeinner/life_list`, {
params
})
return res.result;
}
\ No newline at end of file
import axios from '../utils/request';
// import qs from 'qs';
//角色列表
export async function getRole_list () {
const res = await axios.get("/api/v1/merchant/authority/role_list")
export async function getRole_list (page, page_size) {
const res = await axios.post("/api/v1/merchant/authority/role_list", {
page, page_size
})
return res.result;
}
//添加角色
export async function getAdd_role () {
const res = await axios.get("/api/v1/merchant/authority/add_role", {
export async function getAdd_role (role_name, permissions) {
// qs.stringify(permissions)
const res = await axios.post("/api/v1/merchant/authority/add_role", {
role_name, permissions
})
return res.result;
}
//角色编辑
// export async function getAdd_role () {
// const res = await axios.get("/api/v1/merchant/authority/update_role", {
export async function getUpdate_role (role_name, role_id, permissions) {
const res = await axios.post("/api/v1/merchant/authority/update_role", {
role_name, role_id, permissions
})
return res.result;
}
//角色详情
export async function get_role_info (role_id) {
const res = await axios.post("/api/v1/merchant/authority/get_role_info", {
role_id
})
return res.result;
}
// })
// return res.result;
// }
//权限列表
export async function getAll_role_list (user_name, user_email) {
const res = await axios.post("/api/v1/merchant/authority/get_role_list", {
user_name, user_email
})
return res.permissions;
}
import axios from '../utils/request';
export async function login(email, password) {
export async function login (email, password) {
const res = await axios.post(`api/v1/login`, {
email, password, authCode: ''
});
return res.data;
}
export async function getPermissions() {
export async function getPermissions () {
return await axios.post("api/home/user/get_permissions")
}
\ No newline at end of file
}
//用户详情
export async function getUser_detail (user_id) {
const res = await axios.post("api/v1/merchant/lifeinner/life_info", {
user_id
})
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