Commit 02471f8b authored by lvweichao's avatar lvweichao

feat: user page & ks3

parents 79ec63e3 26b4e91f
exports.KS3_CONST = {
AccessKeyID: 'AKLTTpZx6fNBQsGSKe5chqHdXA',
AccessKeySecret: 'OG9Bk93RUHwaH71U9K+OtWkvx44AdMheywjFlifILikvh96jNGgznJm+AyR5l4wPhw==',
DOMAIN: 'ks3-cn-beijing.ksyun.com'
exports.KS3_CONFIG = {
AK: 'AKLTTpZx6fNBQsGSKe5chqHdXA',
SK: 'OG9Bk93RUHwaH71U9K+OtWkvx44AdMheywjFlifILikvh96jNGgznJm+AyR5l4wPhw==',
DOMAIN: 'ks3-cn-beijing.ksyun.com',
protocol:'http',
baseUrl:'',
region: '',
bucket: '',
prefix:'kss',
// 分块上传的最小单位
chunkSize:5*1024*1024,
// 分块上传重试次数
retries:20,
currentUploadId: '',
stopFlag: false // for multipart upload
}
\ No newline at end of file
const API_INTERNAL_URI = require("../config.js").API_INTERNAL_URI;
const req = require("../utils/request").httpReq;
// 获取企业信息验证
exports.entCheck = async ctx => {
const url = `${API_INTERNAL_URI}/merchant/inner/ent_check`;
// const url = `http://bp-test.ini.yidian-inc.com/merchant/inner/ent_check`;
const { user_id } = ctx.request.query;
// 获取企业信息列表
exports.auditList = async ctx => {
const url = `${API_INTERNAL_URI}/merchant/inner/audit_list`;
const opts = {
url: url,
method: "GET",
qs: {
user_id
}
url,
method: "POST",
json: true,
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
};
// 企业信息提交
exports.entCommit = async ctx => {
const url = `${API_INTERNAL_URI}/merchant/inner/ent_commit`;
// 企业认证获取验证码
exports.sendCode = async ctx => {
const url = `${API_INTERNAL_URI}/merchant/lifeinner/send_code`;
const opts = {
url,
method: "POST",
......@@ -28,21 +25,21 @@ exports.entCommit = async ctx => {
ctx.body = await req(ctx, opts);
};
// 生活号检查
exports.checkLife = async ctx => {
const url = `${API_INTERNAL_URI}/merchant/enterprise/check_life`;
// 企业认证校验验证码
exports.checkCode = async ctx => {
const url = `${API_INTERNAL_URI}/merchant/lifeinner/check_code`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
ctx.body = await req(ctx, opts)
};
// 创建生活号
exports.createLife = async ctx => {
const url = `${API_INTERNAL_URI}/merchant/enterprise/create_life`;
// 企业信息提交
exports.entCommit = async ctx => {
const url = `${API_INTERNAL_URI}/merchant/inner/ent_commit`;
const opts = {
url,
method: "POST",
......
const fsPromise = require("fs/promises");
const FormData = require('form-data');
const crypto = require('crypto');
const IDGEN_URI = require('../config.js').IDGEN_URI
const Ks3Util = require('../utils/ksUtil').Ks3Util
const KS3_CONST = require('../constant').KS3_CONST
const KS3_CONFIG = require('../constant').KS3_CONFIG
const req = require("../utils/request").httpReq;
const FormData = require('form-data');
const _get_obj_id = async (ctx, next) => {
......@@ -59,8 +60,11 @@ exports.get_token = async (ctx, next) => {
}
exports.get_ks3_config = async (ctx, next) => {
const { result: { bucket }} = await _get_bucket(ctx, next)
const { result: { objectId }} = await _get_obj_id(ctx, next)
console.log(8888, await _get_bucket(ctx, next))
const { result: { bucket }} = JSON.parse(await _get_bucket(ctx, next))
const { result: { objectId }} = JSON.parse(await _get_obj_id(ctx, next))
console.log(888834333, bucket, objectId)
const getExpires = (seconds) => {
return Math.round(new Date().getTime()/1000) + seconds;
......@@ -84,8 +88,11 @@ exports.get_ks3_config = async (ctx, next) => {
}
const stringToSign = Ks3Util.Base64.encode(JSON.stringify(policy))
console.log('stringToSign:::', stringToSign)
const signature = Ks3Util.b64_hmac_sha1(KS3_CONST.AccessKeySecret, stringToSign)
// const signature = Ks3Util.b64_hmac_sha1(KS3_CONFIG.AccessKeySecret, stringToSign)
const signature = crypto.createHmac('sha1', KS3_CONFIG.SK).update(stringToSign).digest().toString('base64');
console.log("signature::::::", signature)
ctx.body = {
bucket,
......@@ -99,35 +106,17 @@ exports.upload_ks3_image = async (ctx, next) => {
// console.log('upload_ks3_image::::::', ctx.request.files)
const file = ctx.request.files && ctx.request.files.file;
// console.log(34444, file)
// const bucketOpt = {
// url: `${IDGEN_URI}/Ksy/ksyun/getBucket`,
// params: {
// appid: 'merchant-b',
// },
// method: 'GET',
// timeout: 8000,
// }
// const objIdOpt = {
// url: `${IDGEN_URI}/Ksy/ksyun/buildObectid`,
// params: {
// appid: 'merchant-b',
// },
// method: 'GET',
// timeout: 8000,
// }
// const { result: { bucket }} = await _get_bucket(ctx, next)
// const { result: { objectId }} = await _get_obj_id(ctx, next)
const { result: { bucket }} = await _get_bucket(ctx, next)
const { result: { objectId }} = await _get_obj_id(ctx, next)
console.log(3334444, bucket, objectId, file,)
console.log(888899, await _get_bucket(ctx, next))
const { result: { bucket }} = JSON.parse(await _get_bucket(ctx, next))
const { result: { objectId }} = JSON.parse(await _get_obj_id(ctx, next))
console.log(3334444, file.type)
const getExpires = (seconds) => {
return Math.round(new Date().getTime()/1000) + seconds;
};
const acl = 'public-read';
const policy = {
"expiration": new Date(getExpires(3600)*1000).toISOString(), //一小时后
"conditions": [
......@@ -138,43 +127,85 @@ exports.upload_ks3_image = async (ctx, next) => {
const stringToSign = Ks3Util.Base64.encode(JSON.stringify(policy))
console.log('stringToSign:::', stringToSign)
const signature = Ks3Util.b64_hmac_sha1(KS3_CONST.AccessKeySecret, stringToSign)
const signature = Ks3Util.b64_hmac_sha1(KS3_CONFIG.SK, stringToSign)
// const reader = fs.createReadStream(file.path);
const reader = await fsPromise.readFile(file.path);
const formData = new FormData()
formData.append('acl', 'public-read')
formData.append('key', objectId)
formData.append('signature', signature)
formData.append('KSSAccessKeyId', KS3_CONST.AccessKeyID)
formData.append('policy', stringToSign)
formData.append('bucket_name', stringToSign)
// formData.append('acl', acl)
// formData.append('key', objectId)
// formData.append('signature', signature)
// formData.append('KSSAccessKeyId', KS3_CONFIG.AK)
// formData.append('policy', stringToSign)
// formData.append('bucket_name', stringToSign)
formData.append('file', reader)
// axios.post(OSS_URL, formData).then(res => {
// const { status } = res
// if (status === 200) {
// const data = {
// url: `${OSS_URL}/${key}`,
// type: fileType(file.name)
// }
// resolve(data)
// } else {
// reject(res)
// })
const attrAcl = `x-${KS3_CONFIG.prefix}-acl`;
const date = new Date().toGMTString();
console.log('!!!!!', date)
const headersForSign = {
// ...formData.getHeaders(),
// 'content-length': formData.getLengthSync(),
'x-kss-date': date,
[attrAcl]: acl
}
const headerSignature = Ks3Util.generateToken(KS3_CONFIG.SK, bucket, objectId, 'PUT', file.type, headersForSign, date)
const hmac = crypto.createHmac('sha256', KS3_CONFIG.SK);
hmac.update(headerSignature);
console.log(hmac.digest('hex'));
console.log('headerSignature::::', headerSignature)
const headers = {
...headersForSign,
'Authorization': `KSS ${KS3_CONFIG.AK}:${headerSignature}`
}
console.log('before send::::::', headers)
var opts = {
url: `http://${KS3_CONST.DOMAIN}/${bucket}`,
method: 'POST',
headers: {
// 'content-type': 'multipart/form-data'
...formData.getHeaders(),
'content-length': formData.getLengthSync(),
},
data: formData
url: `http://${KS3_CONFIG.DOMAIN}/${bucket}/${objectId}`,
method: 'PUT',
headers,
data: file
}
console.log(3333333333, formData.getLengthSync());
const res = await req(ctx, opts);
console.log('sever ks3 image::::::', res)
ctx.body = res;
// const url = `http://${KS3_CONFIG.DOMAIN}/${bucket}/${objectId}`
// var xhr = new XMLHttpRequest();
// xhr.open('PUT', url, true);
// var headers = {};
// var acl = 'public-read';
// if (acl == 'private' || acl == 'public-read') {
// var attr_Acl = 'x-' + KS3_CONFIG.prefix + '-acl';
// xhr.setRequestHeader(attr_Acl, acl);
// headers[attr_Acl] = acl;
// }
// var signature = Ks3Util.generateToken(KS3_CONFIG.SK, bucket, objectId, 'PUT', file.type, headers, '');
// xhr.onreadystatechange = function() {
// if (xhr.readyState == 4) {
// if(xhr.status >= 200 && xhr.status < 300 || xhr.status == 304){
// cb(null);
// }else if(xhr.status === 413 || xhr.status === 415) {
// // var errMsg = Ks3.xmlToJson(xhr.responseXML)['Error']['Message'];
// // cb({"msg":errMsg});
// console.log('image::::', xhr.responseXML);
// }else {
// console.log('status: ' + xhr.status);
// cb({"msg":"request failed"});
// }
// }
// };
// // xhr.upload.addEventListener("progress", params.ProgressListener, false);
// xhr.setRequestHeader('Authorization','KSS ' + KS3_CONFIG.AK + ':' + signature );
// xhr.send(file);
}
\ 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
exports.get_life_list = async (ctx, next) => {
......@@ -11,4 +12,16 @@ exports.get_life_list = async (ctx, next) => {
}
ctx.body = await req(ctx, opts)
}
\ No newline at end of file
}
//生活号详情
exports.get_life_info = async (ctx, next) => {
var url = `${API_INTERNAL_URI}/merchant/lifeinner/life_info`;
var opts = {
url: url,
method: 'POST',
json: true,
timeout: 8000,
body: ctx.request.body
}
ctx.body = await req(ctx, opts)
}
......@@ -17,11 +17,14 @@ exports.getRole_list = async (ctx, next) => {
var opts = {
url: url,
method: 'POST',
json: true,
body: ctx.request.body
}
console.log('server getlist_role::::', opts)
ctx.body = await req(ctx, opts)
}
exports.get_role_info = async (ctx, next) => {
var url = `${API_INTERNAL_URI}/merchant/authority/get_role_info`;
exports.getAdd_role = async (ctx, next) => {
var url = `${API_INTERNAL_URI}/merchant/authority/add_role`;
var opts = {
url: url,
method: 'POST',
......@@ -30,12 +33,13 @@ exports.get_role_info = async (ctx, next) => {
}
ctx.body = await req(ctx, opts)
}
exports.getAdd_role = async (ctx, next) => {
var url = `${API_INTERNAL_URI}/merchant/authority/add_role`;
exports.get_role_info = async (ctx, next) => {
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)
......@@ -45,14 +49,18 @@ exports.getUpdate_role = async (ctx, next) => {
var opts = {
url: url,
method: 'POST',
json: true,
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`;
exports.getDelete_role = async (ctx, next) => {
var url = `${API_INTERNAL_URI}/merchant/authority/delete_role`;
var opts = {
url: url,
method: 'POST',
json: true,
body: ctx.request.body
}
ctx.body = await req(ctx, opts)
}
\ No newline at end of file
}
const LOGIN_URI = require("../config.js").LOGIN_URI;
const PANDORA_URI = require("../config.js").PANDORA_URI;
const req = require("../utils/request").httpReq;
// exports.login = async (ctx, next) => {
// const url = `${LOGIN_URI}/api/v1/pandora/auth`;
// const opts = {
// url: url,
// method: 'POST',
// json: true,
// body : ctx.request.body
// }
// console.log("koa login:::::", ctx.request)
// ctx.body = await req(ctx, opts)
// }
exports.fetch_user = async (ctx, next) => {
const url = `${PANDORA_URI}/api/user/getuser`;
const cookie = ctx.request.header.cookie;
......
const { API_INTERNAL_URI } = require("../config.js");
const req = require("../utils/request").httpReq;
const API_INTERNAL_URI = require('../config.js').API_INTERNAL_URI
const req = require('../utils/request').httpReq
//用户详情
exports.getUser_detail = async (ctx, next) => {
var url = `${API_INTERNAL_URI}/merchant/authority/get_user_info`;
var opts = {
url: url,
method: 'POST',
json: true,
timeout: 8000,
body: ctx.request.body
}
ctx.body = await req(ctx, opts)
}
var query = {
async get_permissions (ctx) {
// http://bp-test.ini.yidian-inc.com/merchant/authority/get_role_list?user_email=jianghaiming@126.com
......@@ -38,7 +51,6 @@ exports.query = async (ctx, next) => {
}
};
exports.user_list = async (ctx, next) => {
const url = `${API_INTERNAL_URI}/merchant/authority/get_user_list`;
const opts = {
......
......@@ -12,10 +12,6 @@ const API_VERSION = "/api/v1";
// router.post(`${API_VERSION}/login`, system.login);
router.get(`${API_VERSION}/fetch_user`, system.fetch_user);
router.get(`${API_VERSION}/user/:type`, user.query)
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.get(`${API_VERSION}/users`, user.user_list);
router.get(`${API_VERSION}/users/detail`, user.user_detail);
......@@ -27,13 +23,22 @@ 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/get_role_list`, role.getAll_role_list)
router.post(`${API_VERSION}/merchant/authority/get_role_info`, role.get_role_info)
router.post(`${API_VERSION}/merchant/lifeinner/life_info`, role.getUser_detail)
router.get(`${API_VERSION}/merchant/lifeinner/life_list`, life.get_life_list)
router.post(`${API_VERSION}/merchant/authority/delete_role`, role.getDelete_role)
/* 企业认证 */
router.post(`${API_VERSION}/certification`, enterprise.auditList);
router.post(`${API_VERSION}/emterprise_commit`, enterprise.entCommit);
router.post(`${API_VERSION}/send_code`, enterprise.sendCode);
router.post(`${API_VERSION}/check_code`, enterprise.checkCode);
router.get(`${API_VERSION}/image/get_image_id`, image.get_obj_id)
router.get(`${API_VERSION}/image/get_bucket`, image.get_bucket)
router.get(`${API_VERSION}/image/get_token`, image.get_token)
router.post(`${API_VERSION}/image/upload_ks3_image`, image.upload_ks3_image)
router.get(`${API_VERSION}/image/get_ks3_config`, image.get_ks3_config)
//生活号
router.post(`${API_VERSION}/merchant/lifeinner/life_info`, life.get_life_info)
router.get(`${API_VERSION}/merchant/lifeinner/life_list`, life.get_life_list)
//用户
router.post(`${API_VERSION}/merchant/authority/get_user_info`, user.getUser_detail)
module.exports = router;
......@@ -139,6 +139,66 @@ Ks3.safe_add = function (x, y) {
return (msw << 16) | (lsw & 0xFFFF);
}
/**
* 产生headers
* CanonicalizedKssHeaders
*/
Ks3.generateHeaders =function(header) {
var str = '';
var arr = [];
if(header){
var prefix = 'x-kss';
for(var it in header){
// step1 : 所有`x-kss`的属性都转换为小写
if(it.indexOf(prefix) == 0){
arr.push((it.toLowerCase() +':'+header[it]));
}
}
// step2 : 根据属性名排序
arr.sort();
// step3 : 拼接起来
str = arr.join('\n');
}
return str;
}
/**
* 根据SK和请求生成Signature(用于Authorization头部)
* @param sk secrete key
* @param bucket bucket name
* @param resource ObjectKey[?subResource]
* @param http_verb PUT/GET/POST/DELETE
* @param content_type Content-Type request header
* @param headers headers of request
* @returns {*}
*/
Ks3.generateToken = function (sk, bucket, resource, http_verb, content_type, headers, time_stamp){
// Content-MD5, Content-Type, CanonicalizedKssHeaders都为空
var canonicalized_Kss_Headers = Ks3.generateHeaders(headers);
var canonicalized_Resource = '/' + bucket + '/' + resource;
if (canonicalized_Kss_Headers !== '') {
var string2Sign = http_verb + '\n' + '' + '\n' + content_type + '\n' + time_stamp + '\n' + canonicalized_Kss_Headers + '\n' + canonicalized_Resource;
} else {
var string2Sign = http_verb + '\n' + '' + '\n' + content_type + '\n' + time_stamp + '\n' + canonicalized_Resource;
}
// console.log('string2Sign::::::' + string2Sign);
// var signature = Ks3.b64_hmac_sha1(sk, string2Sign);
// console.log('signature:::::::::' + signature);
return string2Sign;
}
/*
* url endpoints for different regions
*/
Ks3.ENDPOINT = {
HANGZHOU : 'kss.ksyun.com',
AMERICA: 'ks3-us-west-1.ksyun.com',
BEIJING : 'ks3-cn-beijing.ksyun.com',
HONGKONG: 'ks3-cn-hk-1.ksyun.com',
SHANGHAI: 'ks3-cn-shanghai.ksyun.com'
};
/*基于Javascript的Base64加解密算法*/
Ks3.Base64 = {
encTable :[ /*Base64编码表*/
......
......@@ -5,10 +5,11 @@ exports.httpReq = (ctx, opts) => {
opts.timeout = opts.timeout || 1000
return new Promise((resolve, reject) => {
// var time_start = +new Date()
opts.qs = {...ctx.request.query, ...opts.qs};
// opts.qs = {...ctx.request.query, ...opts.qs};
request(opts, (err, res, body) => {
//console.info(`[Api] httpReq (${opts.url},${opts.headers && opts.headers.cookie}) spent: ${+new Date() - time_start}ms`)
if (!err) {
resolve(body)
} else {
......
......@@ -9,7 +9,7 @@ import { fetchCurrentUser } from './service/user';
import { redirectToLogin } from './utils/util';
export default {
async mounted() {
async mounted () {
if (this.$store.state.permissions && this.$store.status.userInfo) return
const { status, user } = await fetchCurrentUser();
// {"status":"success","user":{"userid":"732473439","name":"吕伟朝","email":"lvweichao@yidian-inc.com","avatar":""}}
......
......@@ -17,7 +17,7 @@
>
{{ item.name }}
</el-menu-item>
<el-menu-item key="usermenu" class="user-menu">
<el-menu-item key="usermenu" index="usermenu" class="user-menu">
<user></user>
</el-menu-item>
</el-menu>
......@@ -28,8 +28,6 @@
import { HEADER_CONFIG } from "@/config/pageconfig";
import User from './User.vue';
import { getModulePermissions } from '@/utils/authUtil'
const { menuItems } = HEADER_CONFIG;
export default {
......@@ -44,10 +42,12 @@ export default {
},
computed: {
menuItemsWithAuth: function() {
return this.menuItems.filter(ele => getModulePermissions().includes(ele.key))
const keys = Object.keys(this.$store.getters.subPermissions)
return this.menuItems.filter(ele => keys.includes(ele.key))
},
activeMenu: function () {
console.log(988888, this.$route.path)
return this.$route.path;
},
},
......
ks3-js-sdk @ ea6ab311
Subproject commit ea6ab311ebfa69725e824a5cc28bd53d93681d34
import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import ElementPlus from 'element-plus';
import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import ElementPlus from "element-plus";
import 'element-plus/lib/theme-chalk/index.css';
import 'dayjs/locale/zh-cn';
import locale from 'element-plus/lib/locale/lang/zh-cn';
import "element-plus/lib/theme-chalk/index.css";
import "dayjs/locale/zh-cn";
import locale from "element-plus/lib/locale/lang/zh-cn";
import { fetchCurrentUser } from './service/user';
import { checkPathAuth } from './utils/authUtil';
import { redirectToLogin } from './utils/util';
/* import { fetchCurrentUser } from "./service/user";
import { checkPathAuth } from "./utils/authUtil";
import { redirectToLogin } from "./utils/util"; */
// 处理路由权限
router.beforeResolve(async (to, from, next) => {
/* router.beforeResolve(async (to, from, next) => {
if (to.meta.requireAuth && !store.state.permissions) {
const { status, user } = await fetchCurrentUser();
if (status === 'success') {
......@@ -31,10 +31,10 @@ router.beforeResolve(async (to, from, next) => {
} else {
next()
}
})
}) */
createApp(App)
.use(router)
.use(store)
.use(ElementPlus, { locale })
.mount('#app');
.mount("#app");
......@@ -48,7 +48,7 @@ export default {
console.log('handlePreview:::', file, typeof File);
console.log(222, raw)
// uploadImageToKs3(raw)
ksOssUpload(raw)
},
handleExceed(files, fileList) {
......
......@@ -80,6 +80,21 @@
ref="establish_form"
:model="messageList[0]"
>
<el-form-item
label="商户类型"
prop="merchantsType"
>
<el-select v-model="messageList[0].merchantsType">
<el-option
label="个体工商户"
:value="1"
></el-option>
<el-option
label="普通企业"
:value="2"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label="营业执照:"
ref="licenseChange"
......@@ -275,17 +290,6 @@
align="center"
prop="adminId"
></el-table-column>
<el-table-column
label="创建生活号"
align="center"
>
<template #default="scope">
<el-button
type="primary"
@click="onCreateLife(scope.row)"
>创建生活号</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<!-- 查看详情__创建生活号表单 -->
......@@ -393,10 +397,10 @@ export default {
return {
pageStatus: null, // 哪个按钮进入
auditId: null, // 传入的企业id
// 审核/修改详情/查看详情-企业信息
messageList: [
{
merchantsType: null,
status: 1,
id: 1221,
code: 112211,
......@@ -429,7 +433,6 @@ export default {
],
// 审核-审核意见
opinionArea: "",
// 创建生活号表单是否弹出
isDialogShow: false,
// 生活号-生活号信息
......@@ -487,7 +490,13 @@ export default {
validator: idcardNumberRules,
trigger: "blur"
}
]
],
// 商户类型
merchantsType: [{
required: true,
message: "请选择商户类型",
trigger: "change"
}]
},
// 生活号状态
......
This diff is collapsed.
<template>
<div class="lifeNoInfo">
<!-- 状态、生活号名称、创建时间、创建人(账号信息,昵称+账号) -->
<el-descriptions class="margin-top" title="生活号信息" :column="3" border>
<template #extra> </template>
<el-descriptions-item>
<template #label> ID </template>
00001
</el-descriptions-item>
<el-descriptions-item>
<template #label> 状态 </template>
想吃饭
</el-descriptions-item>
<el-descriptions-item>
<template #label> 创建人 </template>
张三
</el-descriptions-item>
<el-descriptions-item>
<template #label> 创建时间 </template>
2020-03-21
</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>
张三
</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
......@@ -13,8 +13,8 @@
</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-option value="1" label="个人"></el-option>
<el-option value="2" label="企业"></el-option>
</el-select>
</el-form-item>
<el-form-item>
......@@ -31,7 +31,8 @@
<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_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>
......@@ -82,7 +83,7 @@ export default {
page,
page_size,
life_account_name: name,
life_account_type: type == "个人" ? 1 : 2
life_account_type: type
}
reqGetLifeNoList(params).then(res => {
this.totalNum = res.count
......@@ -97,6 +98,7 @@ export default {
onReset () {
this.life_account.name = "",
this.life_account.type = ""
this.getLifeNoListFn()
},
update (obj) {
Object.assign(this.params, obj)
......@@ -104,7 +106,6 @@ export default {
},
toLifeDetail (row) {
this.$router.push({ name: 'LifeNoDetail', query: { lifeId: row.life_account_id } });
console.log(row.life_account_id, 'eee去详情')
},
}
}
......
<template>
<div class="life-no-detail">
<lifeNoInfo />
<el-button type="text" @click="goBack" icon="el-icon-arrow-left"
>返回</el-button
>
<el-card class="management">
<h4 class="titleInfo">生活号信息</h4>
<el-descriptions :column="3" border>
<template #extra> </template>
<el-descriptions-item>
<template #label> ID </template>
{{ life_account.life_account_id }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 状态 </template>
{{ life_account.life_account_status == 1 ? "上线" : "下线" }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 创建人 </template>
{{ life_account.create_user_nick_name }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 创建时间 </template>
{{ life_account.create_time }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 生活号名称 </template>
{{ life_account.life_account_name }}
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card class="management">
<h4 class="titleInfo">类型信息</h4>
<el-descriptions :column="3" border>
<template #extra> </template>
<el-descriptions-item>
<template #label>职业表标签 </template>
{{ personal_auth_record.occupation }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 姓名 </template>
{{ personal_auth_record.full_name }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 身份证号 </template>
{{ personal_auth_record.id_card }}
</el-descriptions-item>
<div v-if="company_auth_record">
<el-descriptions-item>
<template #label> 统一社会信用代码(注册码) </template>
{{ company_auth_record.code }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 企业注册名称 </template>
{{ company_auth_record.name }}
</el-descriptions-item>
</div>
</el-descriptions>
</el-card>
<el-card class="management">
<h4 class="titleInfo">用户信息</h4>
<div class="accountRoleList">
<el-table :data="accountRoleList" border style="width: 100%">
<el-table-column prop="nick_name" label="昵称" width="180">
</el-table-column>
<el-table-column prop="mobile" label="账号" width="180">
</el-table-column>
<el-table-column :formatter="roleRangeFormat" label="管理员">
</el-table-column>
</el-table>
</div>
</el-card>
</div>
</template>
<script>
import lifeNoInfo from './components/lifeNoInfo'
import { getLife_info as reqGetLife_info } from "../../service/life-no";
export default {
components: {
lifeNoInfo,
},
data () {
return {
lifeNoInfo: {}
accountRoleList: [],//用户信息
life_account: {},//生活号信息
company_auth_record: [],//企业生活号
personal_auth_record: {},//个人生活号
life_account_id: null,
}
},
created () {
this.life_account_id = this.$route.query.lifeId
reqGetLife_info(this.life_account_id).then(res => {
this.personal_auth_record = res.personal_auth_record
this.life_account = res.life_account
this.company_auth_record = res.company_auth_record
this.accountRoleList = res.accountRoleList
})
},
methods: {
roleRangeFormat (row) {
return row.role_type == 1 ? '是' : '否'
},
goBack () {
this.$router.go(-1)
}
}
}
</script>
<style lang="less" scoped>
.life-no-detail {
.titleInfo {
margin-top: 10px;
}
margin: 50px;
.box-card {
width: 100%;
}
.accountRoleList {
margin-top: 20px;
}
.management {
margin-top: 20px;
}
}
</style>
\ No newline at end of file
......@@ -40,39 +40,15 @@ export default {
methods: {
async login () {
const { email, password } = this.userInfo;
console.log(34333, email, password);
if (!email) {
console.error("请输入用户邮箱");
return;
}
// if (urlParams.auth && !pwdSec.value) {
// message.error("请输入二次验证码!")
// return
// }
try {
const emailAddress =
email.indexOf("@") === -1 ? email + "@yidian-inc.com" : email;
const res = await reqLogin(emailAddress, password);
console.log(111111, res);
if (!res || !res.token) return;
// const storage = window.localStorage
// storage["YD_PANDORA_auth"] = JSON.stringify(res.auth || {})
// storage["YD_PANDORA_JWT_TOKEN"] = (res.type + " " + res.token) || ''
// storage["YD_PANDORA_user"] = JSON.stringify(res.userInfo || {})
// setCookie('uid', res.userInfo && res.userInfo.id, 16)
// setCookie('YD_PANDORA_UID', res.userInfo && res.userInfo.id, 16)
// setCookie('userid', res.userInfo && res.userInfo.id, 16)
// setCookie('username', res.userInfo && res.userInfo.email, 16)
// setCookie('nickname', res.userInfo && res.userInfo.displayName, 16)
// setCookie('YD_PANDORA_JWT_TOKEN', (res.type + " " + res.token) || '', 16)
// if (urlParams.callback) {
// // window.location.href = `${callback}${callback.indexOf('?') >= 0 ? '&' : '?'}token=${res.token}`
// window.location.href = `${urlParams.callback}`
// } else {
// window.location.href = `/?tid=${toolId}`
// }
} catch (e) {
console.log(e);
// message.error("登录不成功,请检查登录信息后重试!")
......
......@@ -6,17 +6,18 @@
:data="roleDataList"
style="width: 100%; margin-top: 10px"
:header-cell-style="{ background: '#e1e4e5', color: '#80878f' }"
border
@row-click="toRoleDetail"
>
<el-table-column prop="role_name" label="角色名称" width="180">
</el-table-column>
<el-table-column :formatter="roleRangeFormat" label="角色范围">
</el-table-column>
<el-table-column prop="role_range" label="角色范围"> </el-table-column>
<el-table-column label="操作">
<template #default="scope">
<el-button
size="mini"
type="primary"
@click="handleModify(scope.$index, scope.row)"
@click.stop="handleModify(scope.$index, scope.row)"
>修改</el-button
>
</template>
......@@ -27,43 +28,7 @@
<el-form>
<!-- 编辑 -->
<div v-if="edit">
<!-- <roleDetail
v-if="role_info_detail.role_id"
:role_info_detail="role_info_detail"
/> -->
<el-form-item label="状态" :label-width="formLabelWidth" prop="pass">
<el-input
disabled
v-model="role_info_detail.role_status"
></el-input>
</el-form-item>
<el-form-item label="ID" :label-width="formLabelWidth" prop="pass">
<el-input disabled v-model="role_info_detail.role_id"></el-input>
</el-form-item>
<el-form-item label="创建人账号" :label-width="formLabelWidth">
<el-input
disabled
v-model="role_info_detail.create_user_name"
></el-input>
</el-form-item>
<el-form-item label="创建时间" :label-width="formLabelWidth">
<el-input
disabled
v-model="role_info_detail.create_time"
></el-input>
</el-form-item>
<el-form-item label="最后修改人账号" :label-width="formLabelWidth">
<el-input
disabled
v-model="role_info_detail.update_user_name"
></el-input>
</el-form-item>
<el-form-item label="最后修改时间" :label-width="formLabelWidth">
<el-input
disabled
v-model="role_info_detail.update_time"
></el-input>
</el-form-item>
<roleDetail :role_info_detail="role_info_detail" />
</div>
<!-- 新增 -->
<el-form-item label="角色名称" :label-width="formLabelWidth">
......@@ -75,8 +40,8 @@
:options="permissionsAll"
:props="props"
@change="parentCateChange"
filterable
clearable
style="width: 280px"
></el-cascader>
</el-form-item>
</el-form>
......@@ -92,7 +57,7 @@
</template>
<script>
import page from "../components/Pagination"
//import roleDetail from './components/roleDetail'
import roleDetail from './components/roleDetail'
import {
getRole_list as reqGetRole_list, getAdd_role as reqGetAdd_role,
getAll_role_list as reqGetAll_role_list,
......@@ -103,17 +68,18 @@ import { ElMessage } from 'element-plus'
export default {
components: {
page,
// roleDetail
roleDetail
},
data () {
return {
parmas: {
page: 1,
page_size: 20
page_size: 10
},
user_info: {
user_name: "jianghaiming",
user_email: "jianghaiming@126.com",
op_cur_user: "jianghaiming@yidian-inc.com",
},
roleDataList: [],
totalNum: null,
......@@ -122,14 +88,14 @@ export default {
roleName: '',
roleTitle: '',
props: {
multiple: true,//设置为多选
value: 'id', //value值和哪个值绑定
label: 'desc',//label值和哪个值绑定
children: 'sub_permissions'//children值和哪个值绑定
multiple: true,
value: 'id', //value值
label: 'desc',//label值
children: 'sub_permissions'//children值
},
formLabelWidth: '120px',
selectedOptions: [189, 190],//选中权限类型
currentRolePrivilege: [],//当前权限设置
selectedOptions: [],//选中权限类型
currentRolePrivilege: [],
role_info_detail: {//详情非编辑项
role_id: "",
role_name: "",
......@@ -146,25 +112,25 @@ export default {
},
created () {
this.getGetRole_list()
let { user_name, user_email } = this.user_info
reqGetAll_role_list(user_name, user_email).then(res => {
this.permissionsAll = res
})
this.getPermissionsAll()
},
methods: {
roleRangeFormat (row) {
let arr = []
for (let i in row.role_range) {
arr.push(row.role_range[i]);
}
return arr.join('/')
toRoleDetail (row) {
this.$router.push({ name: 'RoleDetail', query: { roleId: row.role_id } });
},
getPermissionsAll () {
let { user_name, user_email } = this.user_info
reqGetAll_role_list(user_name, user_email).then(res => {
this.permissionsAll = res
})
},
newAddRole () {
this.dialogFormVisible = true
this.roleTitle = '新增角色'
this.edit = false
this.roleName = ""
this.selectedOptions = []
},
//获取角色列表
getGetRole_list () {
......@@ -187,10 +153,11 @@ export default {
return false
}
let role_name = this.roleName, permissions = this.currentRolePrivilege
console.log(JSON.stringify(role_name), '1111')
console.log(JSON.stringify(permissions), '2222')
reqGetAdd_role(role_name, permissions).then(res => {
console.log(res, 'resresres999')
if (res.status === "success") {
this.dialogFormVisible = false
this.getGetRole_list()
}
})
},
checkFn () {
......@@ -202,18 +169,15 @@ export default {
},
//修改
handleModify (index, row) {
console.log(index, row.role_id, 'indexindex')
this.getRole_info_detail(row.role_id)
this.edit = true
this.roleTitle = '角色修改'
this.dialogFormVisible = true
this.getRole_info_detail(row.role_id)
},
//角色详情数据
getRole_info_detail (role_id) {
reqGet_role_info(role_id).then(res => {
this.roleName = res.role_name
let { permissions } = res
const { role_id, role_name, role_status, update_time, update_user_name, create_time, create_user_name } = res
const { role_id, role_name, role_status, update_time, update_user_name, create_time, create_user_name, permissions } = res
this.role_info_detail = {
role_id,
role_name,
......@@ -223,28 +187,25 @@ export default {
create_time,
create_user_name
}
this.roleName = role_name
this.permissionsUpdate = permissions
this.editEchoData(permissions)
})
},
//遍历回显值selectedOptions
editEchoData (permissions) {
console.log(permissions, 'permissionspermissions')
let parentArr = []
let childArr = []
permissions.forEach(item => {
parentArr.push(item.sub_permissions)
})
parentArr.forEach(element => {
element.forEach(val => {
childArr.push(val.id)
})
let selectData = []
permissions.map(item => {
let one = { id: item.id }
if (item.sub_permissions) {
item.sub_permissions.map(info => {
let selectId = [one.id, info.id]
selectData.push(selectId)
})
}
})
let selectedArr = []
for (let i in childArr) {
selectedArr.push(childArr[i]);
}
this.selectedOptions = selectedArr
this.selectedOptions = selectData
console.log(this.selectedOptions, '00008u989')
},
//编辑角色
getUpdate_role () {
......@@ -252,9 +213,15 @@ export default {
this.checkFn()
return false
}
let { role_name, role_id } = this.role_info_detail
reqGetUpdate_role(role_name, role_id, this.permissionsUpdate).then(res => {
console.log(res, 'esesesoo111')
let { role_name, role_id, role_status } = this.role_info_detail
let { op_cur_user } = this.user_info
role_name = this.roleName
reqGetUpdate_role(op_cur_user, role_name, role_id, role_status, this.permissionsUpdate).then(res => {
if (res.status === "success") {
this.dialogFormVisible = false
this.edit = true
this.getGetRole_list()
}
})
},
//确定
......@@ -266,6 +233,7 @@ export default {
}
},
parentCateChange (id) {
console.log(id, '000')
this.getSelectedOptions(id)
},
getSelectedOptions (selectedOptions) {
......
<template>
<div>
<el-form-item label="状态" :label-width="formLabelWidth" prop="pass">
<el-input disabled v-model="loaclRole_info.role_status"></el-input>
<el-input disabled v-model="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>
......@@ -23,14 +23,18 @@
<script>
export default {
props: ["role_info_detail"],
watch: {
role_info_detail (val) {
this.loaclRole_info = val
this.role_status = val.role_status == 1 ? '正常' : val.role_status == 2 ? '禁用' : '删除'
}
},
data () {
return {
formLabelWidth: "120px",
loaclRole_info: this.role_info_detail
loaclRole_info: {},
role_status: ""
}
},
created () {
console.log(this.role_info_detail, 'role_info_detail')
}
}
</script>
\ No newline at end of file
This diff is collapsed.
<template>
<div class="user-detail">
<el-button type="text" @click="goBack" icon="el-icon-arrow-left"
>返回</el-button
>
<el-card class="management">
<h3 style="margin-bottom: 10px">角色详情</h3>
<el-descriptions class="margin-top" :column="2" border>
<el-descriptions-item>
<template #label>状态 </template>
{{ role_info_detail.role_status }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> ID </template>
{{ role_info_detail.role_id }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 角色名称 </template>
{{ role_info_detail.role_name }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 创建人账号 </template>
{{ role_info_detail.update_user_name }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 创建时间 </template>
{{ role_info_detail.create_time }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 最后修改人账号 </template>
{{ role_info_detail.update_user_name }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 最后修改时间 </template>
{{ role_info_detail.update_time }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 角色账号 </template>
{{ role_info_detail.role_status }}
</el-descriptions-item>
</el-descriptions>
<div class="tree" v-if="selectedOptions">
<h5 style="margin-bottom: 10px">角色范围</h5>
<div class="content">
<!-- <el-tree
:data="permissionsAll"
show-checkbox
:default-checked-keys="checkedKeys"
:default-expanded-keys="expandedKeys"
node-key="id"
ref="tree"
highlight-current
:props="defaultProps"
:expand-on-click-node="false"
>
</el-tree> -->
<el-cascader
v-model="selectedOptions"
:options="permissionsAll"
placeholder="暂无数据"
disabled
:props="props"
style="width: 300px"
></el-cascader>
</div>
</div>
</el-card>
</div>
</template>
<script>
import { get_role_info as reqGet_role_info, getAll_role_list as reqGetAll_role_list, } from '../../service/role'
export default {
data () {
return {
roleId: this.$route.query.roleId,
defaultProps: {
children: 'sub_permissions',
label: 'desc'
},
user_info: {
user_name: "jianghaiming",
user_email: "jianghaiming@126.com",
},
props: {
multiple: true,//设置为多选
value: 'id', //value值和哪个值绑定
label: 'desc',//label值和哪个值绑定
children: 'sub_permissions'//children值和哪个值绑定
},
selectedOptions: [],
checkedKeys: [],
expandedKeys: [],
permissionsAll: [],
role_info_detail: {//详情非编辑项
role_id: "",
role_name: "",
role_status: "",
update_time: "",
update_user_name: "",
create_time: "",
create_user_name: ""
},
}
},
created () {
let { user_name, user_email } = this.user_info
reqGetAll_role_list(user_name, user_email).then(res => {
this.permissionsAll = res
// this.permissionsAll.forEach(item => {
// item.disabled = true
// item.sub_permissions.forEach(element => {
// element.disabled = true
// })
// })
})
reqGet_role_info(this.roleId).then((res) => {
const { role_id, role_name, role_status, update_time, update_user_name, create_time, create_user_name, permissions } = res
this.role_info_detail = {
role_id,
role_name,
role_status,
update_time,
update_user_name,
create_time,
create_user_name
}
this.editEchoData(permissions)
})
},
methods: {
goBack () {
this.$router.back(-1);
},
//遍历回显值selectedOptions
editEchoData (permissions) {
// let childArr = [], selectExpandedKeys = []
// permissions.forEach(item => {
// selectExpandedKeys.push(item.id)
// if (item.sub_permissions) {
// item.sub_permissions.forEach(element => {
// childArr.push(element.id)
// })
// }
// })
// this.checkedKeys = childArr
// this.expandedKeys = selectExpandedKeys
// console.log(this.checkedKeys, this.expandedKeys, ' this.expandedKeys ')
let selectData = []
permissions.map(item => {
let one = { id: item.id }
if (item.sub_permissions) {
item.sub_permissions.map(info => {
let selectId = [one.id, info.id]
selectData.push(selectId)
})
}
})
this.selectedOptions = selectData
},
}
}
</script>
<style lang="less" scoped>
.user-detail {
margin: 50px;
.management {
margin-top: 20px;
}
.tree {
// border: 1px solid #ebeef5;
margin-top: 20px;
}
}
</style>
\ 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>
kooriookami
</el-descriptions-item>
<el-descriptions-item>
<template #label> 手机号 </template>
18100000000
</el-descriptions-item>
<el-descriptions-item>
<template #label> 所属组织 </template>
研发部
</el-descriptions-item>
<el-descriptions-item>
<template #label> 添加人账号 </template>
XXXX
</el-descriptions-item>
<el-descriptions-item>
<template #label> 添加时间 </template>
2020-12-01
</el-descriptions-item>
<el-descriptions-item>
<template #label> 最后修改人账号 </template>
张三
</el-descriptions-item>
<el-descriptions-item>
<template #label> 最后修改时间 </template>
2021-05-21
</el-descriptions-item>
<el-descriptions-item>
<template #label> 已拥有角色池 </template>
角色池
</el-descriptions-item>
<el-descriptions-item>
<template #label> 角色名称 </template>
管理员
</el-descriptions-item>
<el-descriptions-item>
<template #label> 敏感词权限 </template>
敏感词权限
</el-descriptions-item>
<el-descriptions-item>
<template #label> 数据权限 </template>
数据权限
</el-descriptions-item>
</el-descriptions>
<el-button type="text" @click="goBack" icon="el-icon-arrow-left"
>返回</el-button
>
<el-card class="management">
<h2 style="margin-bottom: 10px">用户详情</h2>
<el-descriptions class="margin-top" :column="3" :size="size" border>
<el-descriptions-item>
<template #label> 用户姓名 </template>
{{ user_info.user_name }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 手机号 </template>
{{ user_info.user_mobile }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 所属组织 </template>
{{ user_info.organization }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 添加人账号 </template>
{{ user_info.create_user_name }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 添加时间 </template>
{{ user_info.create_time }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 最后修改人账号 </template>
{{ user_info.update_user_name }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 最后修改时间 </template>
{{ user_info.update_user_name }}
</el-descriptions-item>
<el-descriptions-item>
<template #label> 敏感词权限 </template>
{{ user_info.is_sensitive_authority == 1 ? "有" : "无" }}
</el-descriptions-item>
</el-descriptions>
<div class="role">已拥有角色池</div>
<el-table :data="role_list" border style="width: 100%">
<el-table-column prop="role_id" label="ID" width="180">
</el-table-column>
<el-table-column prop="role_name" label="角色名称"> </el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
// import { getUser_detail as reqGetUser_detail } from '../../service/user'
import { getUser_detail as reqGetUser_detail } from "../../service/user";
export default {
data () {
return {
user_id: 1,
userInfoList: [{
}]
user_id: '1',
user_info: {},
role_list: []//角色池
}
},
created () {
// reqGetUser_detail(this.user_id).then((res) => {
// console.log(res, '000')
// })
this.getUser_date()
},
methods: {
getUser_date () {
reqGetUser_detail(this.user_id).then((res) => {
this.user_info = res.user_info
this.role_list = res.role_list
})
},
goBack () {
this.$router.go(-1)
}
}
}
</script>
<style lang="less" scoped>
.user-detail {
margin: 50px;
.role {
margin: 10px;
font-weight: bold;
}
}
</style>
\ No newline at end of file
<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"
......@@ -23,11 +14,11 @@
</template>
<script>
export default {
props: ['data', 'totalNum'],
props: ['totalNum'],
data () {
return {
currentPage: 1,
page_size: 20
page_size: 10
}
},
methods: {
......
......@@ -12,6 +12,7 @@ import UserDetail from '../pages/User/user-detail.vue'
import AddRole from '../pages/Role/add-role.vue'
import ManageRole from '../pages/Role/manage-role.vue'
import RoleDetail from '../pages/Role/role-detail.vue'
const routes = [
{
......@@ -83,12 +84,20 @@ const routes = [
{
path: '/roleAddRole',
name: 'AddRole',
component: AddRole
component: AddRole,
meta: {
requireAuth: true,
}
},
{
path: '/roleManageRole',
name: 'ManageRole',
component: ManageRole
},
{
path: '/roleRoleDetail',
name: 'RoleDetail',
component: RoleDetail
}
];
......
......@@ -3,31 +3,36 @@
*/
import axios from "../utils/request";
// 获取审核列表
// export async function auditList (params) {
// const res = await axios.post(``)
// }
// 企业信息检查
export async function entCheck (user_id) {
const res = await axios.get(`/api/v1/certification`, { params: { user_id } });
/**
* 获取企业信息列表
* @param query
*/
export async function auditList (params) {
const res = await axios.post(`/api/v1/certification`, params);
return res;
}
// 发送企业信息认证
export async function entCommit (query) {
const res = await axios.post(`/api/v1/emterprise_commit`, { query });
/**
* 企业认证审核获取验证码
* @param enterprise_auth_record_id 企业认证审核id
*/
export async function sendCode (enterprise_auth_record_id) {
const res = await axios.post(`/api/v1/send_code`, enterprise_auth_record_id);
return res;
}
// 检查生活号信息唯一性
export async function checkLife (life_account_name) {
const res = await axios.post(`/api/v1/check_life`, { life_account_name });
/**
* 企业认证检测验证码
* @param enterprise_auth_record_id 企业认证审核id
* @param code 验证码
*/
export async function checkCode (params) {
const res = await axios.post(`/api/v1/check_code`, params);
return res;
}
// 创建生活号
export async function createLife (params) {
const res = await axios.post(`/api/v1/create_life`, { params });
// 发送企业信息认证
export async function entCommit (query) {
const res = await axios.post(`/api/v1/emterprise_commit`, query);
return res;
}
......@@ -5,4 +5,11 @@ export async function getLifeNoList (params) {
params
})
return res.result;
}
//生活号详情
export async function getLife_info (life_account_id) {
const res = await axios.post(`/api/v1/merchant/lifeinner/life_info`, {
life_account_id
})
return res.result;
}
\ No newline at end of file
import axios from '../utils/request';
// import qs from 'qs';
//角色列表
export async function getRole_list (page, page_size) {
export async function getRole_list (page, page_size, role_status, role_name) {
const res = await axios.post("/api/v1/merchant/authority/role_list", {
page, page_size
page, page_size, role_status, role_name
})
return res;
}
......@@ -12,14 +12,14 @@ export async function getAdd_role (role_name, permissions) {
const res = await axios.post("/api/v1/merchant/authority/add_role", {
role_name, permissions
})
return res.result;
return res;
}
//角色编辑
export async function getUpdate_role (role_name, role_id, permissions) {
export async function getUpdate_role (op_cur_user, role_name, role_id, role_status, permissions) {
const res = await axios.post("/api/v1/merchant/authority/update_role", {
role_name, role_id, permissions
op_cur_user, role_name, role_id, role_status, permissions
})
return res.result;
return res;
}
//角色详情
export async function get_role_info (role_id) {
......@@ -28,6 +28,13 @@ export async function get_role_info (role_id) {
})
return res.result;
}
//角色删除
export async function getDelete_role (role_id) {
const res = await axios.post("/api/v1/merchant/authority/delete_role", {
role_id
})
return res;
}
//权限列表
export async function getAll_role_list (user_name, user_email) {
......
......@@ -31,3 +31,10 @@ export async function editUser (data) {
export async function createUser (data) {
return await axios.post("/api/v1/users/new", { data });
}
//用户详情
export async function getUser_detail (user_id) {
const res = await axios.post(`/api/v1/merchant/authority/get_user_info`, {
user_id
})
return res.result;
}
import { createStore } from "vuex";
import { getPermissions } from '@/service/user';
import { PAGEMODULE_PERMISSIONNAME, PERMISSIONNAME_PAGEMODULE, PATH_PERMISSION_NAME } from '../config/pageconfig'
export default createStore({
state: {
......@@ -22,5 +23,25 @@ export default createStore({
}
},
modules: {},
getters: {}
getters: {
subPermissions: state => {
const permissionCol = {};
(state.permissions || []).forEach(element => {
PERMISSIONNAME_PAGEMODULE[element.name] && (permissionCol[PERMISSIONNAME_PAGEMODULE[element.name]] = element.sub_permissions)
});
return permissionCol;
},
/**
*
* @param {*} module 模块名,可选值: enterprise, lifeNo, role, user
* @returns
*/
moduleSubPermissions: (state) => (module) => {
const permissionCol = {};
(state.permissions || []).forEach(element => {
PERMISSIONNAME_PAGEMODULE[element.name] && (permissionCol[PERMISSIONNAME_PAGEMODULE[element.name]] = element.sub_permissions)
});
return permissionCol[module];
}
}
});
......@@ -40,22 +40,22 @@ export function checkPathAuth(path) {
return true;
}
/**
* 获取页面子权限
* @param {*} module: 枚举值参考:PAGEMODULE_PERMISSIONNAME key
* @returns 自权限列表
*/
export function getModuleSubPermissions(module) {
const authObj = getPermissionObj();
return Object.keys(authObj[PAGEMODULE_PERMISSIONNAME[module]])
}
// /**
// * 获取页面子权限
// * @param {*} module: 枚举值参考:PAGEMODULE_PERMISSIONNAME key
// * @returns 子权限列表
// */
// export function getModuleSubPermissions(module) {
// const authObj = getPermissionObj() || {};
// return Object.keys(authObj[PAGEMODULE_PERMISSIONNAME[module]])
// }
/**
* 获取一级权限
* @returns 一级权限列表
*/
export function getModulePermissions() {
const authObj = getPermissionObj();
const modules = Object.keys(authObj).map(ele => PERMISSIONNAME_PAGEMODULE[ele])
return modules.filter(ele => !!ele)
}
\ No newline at end of file
// /**
// * 获取一级权限
// * @returns 一级权限列表
// */
// export function getModulePermissions() {
// const authObj = getPermissionObj();
// const modules = Object.keys(authObj).map(ele => PERMISSIONNAME_PAGEMODULE[ele])
// return modules.filter(ele => !!ele)
// }
\ No newline at end of file
import moment from "moment";
import CommonServer from "@/api/common";
import CommonServer from "./common";
import axios from "axios";
import { ElMessage } from "element-plus";
......
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