Commit e7452102 authored by 李鹏 's avatar 李鹏

管理中心功能1

parent 4d6d53a0
import { createApp } from 'vue'
import { createApp } from "vue";
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import locale from 'element-plus/lib/locale/lang/zh-cn'
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import locale from "element-plus/lib/locale/lang/zh-cn";
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import bgui from "@/bg-ui";
import "@/bg-ui/index.scss";
import msgSdk from './msg-sdk/index.js';
import msgSdk from "./msg-sdk/index.js";
import App from './App.vue'
import App from "./App.vue";
import router from './router'
import {generateRoutes} from './router/index.js'
import router from "./router";
import { generateRoutes } from "./router/index.js";
import "../src/assets/css/font.css";
import "../src/assets/css/index.css";
import "../src/assets/item.css";
import '../src/assets/css/font.css'
import '../src/assets/css/index.css'
import '../src/assets/item.css'
import store from "@/store";
import store from '@/store';
import i18n from "./i18n/i18n.js";
import i18n from './i18n/i18n.js'
import axios from "./request/http.js";
import axios from './request/http.js'
const createVue = createApp(App)
const createVue = createApp(App);
createVue.use(ElementPlus, { locale });
function getMsgAppid() {
axios.get(`/apaas/system/v5/message/account`).then(res => {
axios.get(`/apaas/system/v5/message/account`).then((res) => {
if (res.data.code == 200) {
createVue.use(msgSdk, {
requestUrl: 'https://msg.wodcloud.com', // 请求地址
requestUrl: "https://msg.wodcloud.com", // 请求地址
appID: decodeURIComponent(escape(window.atob(res.data.data.app_id))), // 应用id
secretKey: decodeURIComponent(escape(window.atob(res.data.data.secret_key))), // 应用密钥
userId: '',
userType: '',
roleId: '',
organization: '',
})
userId: "",
userType: "",
roleId: "",
organization: "",
});
}
})
});
}
// getMsgAppid()
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
createVue.component(key, component)
createVue.component(key, component);
}
createVue.config.globalProperties.$axios = axios
createVue.config.globalProperties.$axios = axios;
import menu from './router/function.js'
import menu from "./router/function.js";
//获取用户信息
function getUser() {
return axios.get(`/apaas/system/v5/user/getUserInfo`)
return axios.get(`/apaas/system/v5/user/getUserInfo`);
}
//获取用户菜单信息
function getMenu(search) {
return axios.get(`/apaas/system/v5/menu/user/tree?search=${search}`)
return axios.get(`/apaas/system/v5/menu/user/tree?search=${search}`);
}
//处理菜单成为对象
function getMenuObj(menu,parentRowPath,menuObj){
menu.forEach((e,idx) => {
e.rowPath = parentRowPath + '.' + idx
menuObj[e.path] = e
if(e.children&&e.children.length){
getMenuObj(e.children,e.rowPath,menuObj)
function getMenuObj(menu, parentRowPath, menuObj) {
menu.forEach((e, idx) => {
e.rowPath = parentRowPath + "." + idx;
menuObj[e.path] = e;
if (e.children && e.children.length) {
getMenuObj(e.children, e.rowPath, menuObj);
}
});
}
Promise.all([getUser(),getMenu('dadb2d3f-e263-48d1-9389-42acb9ea49f8')]).then(res => {
console.log(res);
if (res[0].data.code == 200&&res[1].data.code == 200) {
Promise.all([getUser(), getMenu("dadb2d3f-e263-48d1-9389-42acb9ea49f8")])
.then((res) => {
if (res[0].data.code == 200 && res[1].data.code == 200) {
//已登录则记录菜单和用户信息
let data = res[1].data.data&&res[1].data.data[0].children||[]
store.commit('setUserInfo', res[0].data.data)
let data = (res[1].data.data && res[1].data.data[0].children) || [];
store.commit("setUserInfo", res[0].data.data);
// if (res[0].data.data.userType == 1) {//超管
store.commit('setMenu', data)
menu.menuToRouter(data)
console.log(menu);
store.commit('setRoute',data)
store.commit("setMenu", data);
console.log("data", data);
menu.menuToRouter(data);
store.commit("setRoute", data);
//存储菜单对象信息
let menuObj = {}
getMenuObj(data,'',menuObj)
store.commit('setMenuObj',menuObj)
console.log(menuObj);
let menuObj = {};
getMenuObj(data, "", menuObj);
store.commit("setMenuObj", menuObj);
// }
}
generateRoutes()
generateRoutes();
createVue.use(ElementPlus).use(store).use(router).use(i18n).use(bgui)
createVue.mount('#app')
}).catch(() => {
createVue.use(ElementPlus).use(store).use(router).use(i18n).use(bgui)
createVue.mount('#app')
createVue.use(ElementPlus).use(store).use(router).use(i18n).use(bgui);
createVue.mount("#app");
})
.catch(() => {
createVue.use(ElementPlus).use(store).use(router).use(i18n).use(bgui);
createVue.mount("#app");
});
//后期加入权限处理,参考msg/ui
This diff is collapsed.
<!-- 角色管理 -->
<template>
<div class="page_container">
<bg-breadcrumb></bg-breadcrumb>
<div class="main_container">
<div class="form_content apaas_scroll_nor">
<el-form ref="refForm" :model="formData" :rules="rules" label-width="82px" class="registerForm">
<el-form-item label="LOGO" prop="logo">
<bg-upload-image
v-model="formData.logo"
:fileSize="1"
:showTips="true"
customTips="请选择图片上传:支持jpg、png等格式,图片需小于500KBB"
:limit="1"
listType="picture-card"
:accept="['.jpg', '.jpeg', '.png']"></bg-upload-image>
</el-form-item>
<el-form-item label="登录背景图" prop="banner">
<bg-upload-image
v-model="formData.banner"
:fileSize="1"
:showTips="true"
customTips="请选择图片上传:大小1920 * 1026像素支持jpg、png等格式,图片需小于1MB"
:limit="1"
listType="picture-card"
:accept="['.jpg', '.jpeg', '.png']"></bg-upload-image>
</el-form-item>
<bg-form-gap title="底部所有权内容"></bg-form-gap>
<el-form-item label="内容" prop="force">
<el-input placeholder="例如:Copyright © 某某大数据, All Rights Reserved." maxlength="100"></el-input>
</el-form-item>
<bg-form-gap title="底部ICP备案"></bg-form-gap>
<el-form-item label="内容" prop="force">
<el-input placeholder="请输入" maxlength="100"></el-input>
</el-form-item>
<el-form-item label="跳转连接" prop="force">
<el-input placeholder="例如:https://...或http://..." maxlength="100"></el-input>
</el-form-item>
<bg-form-gap title="底部公安网备案"></bg-form-gap>
<el-form-item label="内容" prop="force">
<el-input placeholder="请输入" maxlength="100"></el-input>
</el-form-item>
<el-form-item label="跳转连接" prop="force">
<el-input placeholder="例如:https://...或http://..." maxlength="100"></el-input>
</el-form-item>
<bg-form-gap title="法律声明"></bg-form-gap>
<el-form-item label="跳转连接" prop="force">
<el-input placeholder="例如:https://...或http://..." maxlength="100"></el-input>
</el-form-item>
<bg-form-gap title="隐私政策"></bg-form-gap>
<el-form-item label="跳转连接" prop="force">
<el-input placeholder="例如:https://...或http://..." maxlength="100"></el-input>
</el-form-item>
</el-form>
</div>
<div class="operate_btns">
<el-button type="primary" @click="save"> 保存 </el-button>
</div>
</div>
</div>
</template>
<script setup>
import { Search } from "@element-plus/icons-vue";
import { reactive, toRefs, ref, onBeforeMount, nextTick } from "vue";
import axios from "../../../../request/http.js";
import { ElMessage } from "element-plus";
import { useRouter } from "vue-router";
import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
//表单数据
const formData = reactive({
logo: "",
});
//表单校验规则
const rules = reactive({});
</script>
<style lang="scss" scoped>
.page_container {
.main_container {
position: relative;
margin: 0 0 16px;
width: 100%;
height: calc(100% - 62px);
padding: 32px 0 70px;
overflow: auto;
background-color: #fff;
box-shadow: 0px 1px 4px 0px rgba(0, 7, 101, 0.15);
border-radius: 6px;
.form_content {
overflow: auto;
height: 100%;
padding-left: 24px;
.el-form {
width: 60%;
::v-deep .el-form-item {
&:nth-of-type(1) {
.el-upload--picture-card {
width: 120px;
height: 120px;
}
}
&:nth-of-type(2) {
.el-upload--picture-card {
width: 367px;
height: 196px;
}
}
}
}
::v-deep .gap-title {
font-size: 16px;
color: #202531;
}
}
.operate_btns {
position: absolute;
bottom: 0;
width: 100%;
height: 70px;
text-align: right;
line-height: 68px;
border-top: solid 1px #e6e9ef;
.el-button {
width: 92px;
margin-right: 16px;
}
}
}
}
</style>
This diff is collapsed.
<template>
<div class="page_container">
<bg-breadcrumb></bg-breadcrumb>
<div class="page_content">
<bg-form-gap title="注册信息"></bg-form-gap>
<bg-detail-table2 class="register_info" :list="instanceData.applyBasicInfo">
<!-- <template v-slot:approvalStatus="{ data }">
<p class="detail-module">
<span>{{ data.label }}</span>
<span>{{ data.value }}</span>
</p>
</template> -->
</bg-detail-table2>
<bg-form-gap title="审批"></bg-form-gap>
<div class="approve">
<div class="header">
<div class="left">
<span class="approve_person">平台运营者审批</span>
<span class="approve_status">待审批</span>
</div>
<div class="right">
<span class="label">申请时间:</span>
<span class="value">2022-10-22 09:58:30</span>
</div>
</div>
<el-form
ref="approveFormRef"
:model="formData"
:rules="rules"
label-width="70px"
class="approveForm"
:size="formSize">
<el-form-item label="审批单位" prop="ability_name">
<el-input disabled placeholder="平台用户组织" maxlength="20" />
</el-form-item>
<el-form-item label="审批人" prop="synopsis">
<el-input disabled placeholder="超级管理员" maxlength="20" />
</el-form-item>
<el-form-item label="审批结果" prop="openness_id">
<el-radio-group>
<el-radio label="1"> 通过 </el-radio>
<el-radio label="0"> 驳回 </el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="审批意见" prop="synopsis">
<el-input placeholder="请输入审批意见" rows="5" maxlength="200" show-word-limit type="textarea" />
</el-form-item>
</el-form>
</div>
<div class="operate_btns">
<el-button type="default" @click="cancel"> 取消 </el-button>
<el-button type="primary" @click="save"> 保存 </el-button>
</div>
</div>
</div>
</template>
<script setup>
import { reactive, toRefs, computed, onBeforeMount } from "vue";
import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
const instanceData = reactive({
applyBasicInfo: [
{
key: "approval_status",
label: "所属机构",
value: "",
// slot: "approvalStatus",
},
{
key: "apply_time",
label: "业务系统名称",
value: "",
},
{
key: "apply_organization",
label: "账号",
value: "",
},
{
key: "business_name",
label: "手机号",
value: "",
},
{
key: "contact_person",
label: "开发厂商名称",
value: "",
},
{
key: "contact_phone",
label: "提交时间",
value: "",
},
{
key: "contact_person",
label: "联系人",
value: "",
},
{
key: "contact_phone",
label: "联系人手机号",
value: "",
},
{
key: "apply_application",
label: "业务系统描述",
value: "",
},
],
formData: {},
rules: {},
});
//取消
const cancel = () => {};
//保存
const save = () => {};
</script>
<style lang="scss" scoped>
.page_content {
position: relative;
padding: 24px 0 68px 24px;
.register_info {
margin-bottom: 24px;
width: 960px;
}
.approve {
overflow: hidden;
width: 1127px;
height: 378px;
background-color: #ffffff;
border-radius: 4px;
border: solid 1px #e3e4ef;
.header {
display: flex;
justify-content: space-between;
height: 38px;
padding: 0 16px;
border-bottom: 1px solid #e3e4ef;
background-color: #f9fafc;
.left {
display: flex;
justify-content: space-between;
align-items: center;
width: 150px;
height: 100%;
.approve_person {
display: inline-block;
width: 98px;
font-size: 14px;
font-weight: 600;
color: #242c43;
}
.approve_status {
display: inline-block;
width: 46px;
height: 18px;
font-size: 12px;
text-align: center;
color: #e56600;
background-color: #fcf0e6;
border-radius: 3px;
border: solid 1px #f2b380;
}
}
.right {
display: flex;
justify-content: space-between;
align-items: center;
width: 210px;
height: 100%;
font-size: 14px;
color: #7784a6;
.value {
color: #242c43;
}
}
}
.approveForm {
padding: 24px 24px 0 24px;
::v-deep .el-form-item {
margin-bottom: 24px;
}
::v-deep .el-form-item__label,
::v-deep .el-radio__label {
color: var(--el-text-color-primary);
}
}
}
.operate_btns {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 64px;
padding-right: 16px;
line-height: 64px;
text-align: right;
border-top: solid 1px #e6e9ef;
.el-button {
width: 92px;
& + .el-button {
margin-left: 16px;
}
}
}
}
</style>
<template>
<div class="page_container">
<bg-breadcrumb></bg-breadcrumb>
<div class="page_content">
<bg-form-gap title="注册信息"></bg-form-gap>
<bg-detail-table2 class="register_info" :list="instanceData.applyBasicInfo">
<template v-slot:approvalStatus="{ data }">
<p class="detail-module">
<span>{{ data.label }}</span>
<span>{{ data.value }}</span>
</p>
</template>
</bg-detail-table2>
<bg-form-gap title="审批信息"></bg-form-gap>
<bg-detail-table2 class="approve_info" :list="instanceData.approveInfo">
<template v-slot:applyOrganization="{ data }">
<p class="detail-module">
<span>{{ data.label }}</span>
<span>{{ data.value }}</span>
</p>
</template>
</bg-detail-table2>
</div>
</div>
</template>
<script setup>
import { reactive, toRefs, computed, onBeforeMount } from "vue";
import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
const instanceData = reactive({
applyBasicInfo: [
{
key: "approval_status",
label: "所属机构",
value: "1",
slot: "approvalStatus",
},
{
key: "apply_time",
label: "业务系统名称",
value: "",
},
{
key: "apply_organization",
label: "账号",
value: "",
},
{
key: "business_name",
label: "手机号",
value: "",
},
{
key: "contact_person",
label: "开发厂商名称",
value: "",
},
{
key: "contact_phone",
label: "提交时间",
value: "",
},
{
key: "contact_person",
label: "联系人",
value: "",
},
{
key: "contact_phone",
label: "联系人手机号",
value: "",
},
{
key: "apply_application",
label: "业务系统描述",
value: "",
},
],
approveInfo: [
{
key: "apply_organization",
label: "审核状态",
value: "",
slot: "applyOrganization",
},
{
key: "business_name",
label: "审核人",
value: "",
},
{
key: "apply_organization",
label: "审批时间",
value: "",
},
{
key: "business_name",
label: "审批意见",
value: "",
},
],
});
</script>
<style lang="scss" scoped>
.page_content {
position: relative;
padding: 24px 0 68px 24px;
.register_info,
.approve_info {
margin-bottom: 24px;
width: 960px;
}
}
</style>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -100,7 +100,7 @@ var adminMenu = [
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 2,
},
]
],
},
],
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
......@@ -169,7 +169,7 @@ var adminMenu = [
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType: 1, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
path: "/system/organization",
children:[
children: [
{
menuName: "新增平台用户",
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
......@@ -198,27 +198,27 @@ var adminMenu = [
show: false,
path: "/system/organization/org-detail",
},
]
],
},
{
menuName: "角色管理",
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType: 1, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
path: "/system/role",
children:[
children: [
{
menuName:'新增角色',
menuType:2,
menuName: "新增角色",
menuType: 2,
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
path: "/system/role/add",
},
{
menuName:'编辑角色',
menuType:2,
menuName: "编辑角色",
menuType: 2,
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
path: "/system/role/edit",
},
]
],
},
],
},
......@@ -241,13 +241,13 @@ var adminMenu = [
},
];
function getName(str){
if(str=='/'){
return 'index'
function getName(str) {
if (str == "/") {
return "index";
}
let temp = str.slice(1)
temp = temp.replaceAll('/','-')
return temp
let temp = str.slice(1);
temp = temp.replaceAll("/", "-");
return temp;
}
function getViews(path) {
......@@ -271,14 +271,13 @@ function getViews(path) {
break;
}
// 然后动态路由的时候这样来取
console.log(modules["../page/main" + path + "/index.vue"]);
return modules["../page/main" + path + "/index.vue"];
}
//处理路由方法
var menuToRouter = (menu) => {
menu.forEach((e) => {
e.name = getName(e.path)
e.name = getName(e.path);
if (e.children && e.menuType == 0) {
// 其他层级作为文件夹,只提供父级
e.component = () => import("../page/parent/parent.vue");
......@@ -286,28 +285,25 @@ var menuToRouter = (menu) => {
} else if (e.children && e.menuType !== 0) {
//叶子层级需要加载到对应文件
//对首页做兼容
if(e.source){
console.log(`@/page/main${e.source}/index.vue`);
if (e.source) {
e.component = getViews(e.source);
}else{
console.log(`@/page/main${e.path}/index.vue`);
} else {
e.component = getViews(e.path);
}
menuToRouter(e.children);
} else {
console.log(`@/page/main${e.path}/index.vue`);
//叶子层级需要加载到对应文件
//对首页做兼容
if (e.path == "/") {
if(e.source){
if (e.source) {
e.component = () => import(`../page/main/${e.source}/index.vue`);
}else{
} else {
e.component = () => import("../page/main/index/index.vue");
}
} else {
if(e.source){
if (e.source) {
e.component = getViews(e.source);
}else{
} else {
e.component = getViews(e.path);
}
}
......
//路由前端原则可以不写,但是需要在recorder中记录,防止以后忘记
//不用新增父路由的文件,父路由全部由parent/parent.vue来支撑
import {createRouter, createWebHashHistory} from "vue-router";
import store from '../store'
import { createRouter, createWebHashHistory } from "vue-router";
import store from "../store";
//写入初始必须有的路由
//或者隐藏式路由,不会表现在菜单上,但是需要存在的路由
const routes = [
{
path: '/login',
name: 'login',
show:true,
component: () => import('../page/login/index.vue')
path: "/login",
name: "login",
show: true,
component: () => import("../page/login/index.vue"),
},
{
path: '/',
name: 'index',
component: () => import('../page/welcom.vue'),
path: "/",
name: "index",
component: () => import("../page/welcom.vue"),
},
{
path: '/404',
show:true,
component: () => import('../page/404.vue')
path: "/404",
show: true,
component: () => import("../page/404.vue"),
},
]
];
//重新创建router
function newRouterFunc(){
function newRouterFunc() {
return createRouter({
history: createWebHashHistory(),
routes
routes,
});
}
const router = newRouterFunc()
const router = newRouterFunc();
function inWhiteList(toPath) {
//配置白名单
const whiteList = ['/login']
const whiteList = ["/login"];
const path = whiteList.find((value) => {
// 使用正则匹配
const reg = new RegExp('^' + value)
return reg.test(toPath)
})
return !!path
const reg = new RegExp("^" + value);
return reg.test(toPath);
});
return !!path;
}
router.beforeEach((to, from, next) => {
const userInfo = store.state.userInfo
const userInfo = store.state.userInfo;
console.log(store.state.route);
//已登录不可跳转登陆页
if(userInfo&&(to.path=='/login'||to.path=='/')){
next({path:'/develop/account'})
if (userInfo && (to.path == "/login" || to.path == "/")) {
next({ path: "/develop/account" });
}
// 检查to.path是否存在于免登陆白名单
if (inWhiteList(to.path)) {
next()
next();
} else {
// 判断是否已经登录,未登录则重定向到首页或其他页面(通过query传参记录原来的路径)
// 根据配置判断是否跳转第三方登录,跳转第三方登录则不跳login
// axios封装中也需要对是否登录过期进行判断,如果登录过期,则跳转登录页,具体跳转地址根据配置来·
if (!userInfo) {
next({
path: '/login',
})
path: "/login",
});
} else {
}
}
//判读是否匹配,否则跳转404
if (to.matched.length !== 0) {
next()
next();
} else {
return next({ path: '/404' })
return next({ path: "/404" });
}
})
});
// 在路由完成初始导航时调用,如果有异步操作放置到这里
// 请求相应的角色和菜单
// router.onReady(() => {
// generateRoutes()
// })
function addRoute(router,routers){
routers.forEach(e => {
if(e.path[0]=='/'){
router.addRoute(e)
if(e.children&&e.children.length){
addRoute(router,e.children)
function addRoute(router, routers) {
routers.forEach((e) => {
if (e.path[0] == "/") {
router.addRoute(e);
if (e.children && e.children.length) {
addRoute(router, e.children);
}
}
});
}
export function generateRoutes() {
const _asyncRoutes = store.state.route
const _asyncRoutes = store.state.route;
if (_asyncRoutes) {
//动态添加路由
addRoute(router,_asyncRoutes)
addRoute(router, _asyncRoutes);
}
router.addRoute(
{
path: '/:pathMatch(.*)',
redirect: '/404'
}
)
router.addRoute({
path: "/:pathMatch(.*)",
redirect: "/404",
});
console.log(router.getRoutes());
}
//新创建一个router替代之前的router,并把matcher方法替换成新的router的matcher
export function resetRouter() {
const newRouter = newRouterFunc()
router.matcher = newRouter.matcher
const newRouter = newRouterFunc();
router.matcher = newRouter.matcher;
}
export default router
export default router;
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