3fb3cb23 by ‘jikai@pashanhoo.com’
2 parents 9dc753ab d3eeff7b
{
"TITLE": "汉中市数据上报系统",
"THEME": "sb",
"THEME": "jg",
"SERVERAPI": "/bdcsjsb",
"MANAGEMENTAPI": "http: //192.168.2.236/management"
"MANAGEMENTAPI": "http://192.168.2.236/management"
}
\ No newline at end of file
......
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-23 17:19:52
*/
import request from "@/utils/request";
import SERVER from "./config";
// import SERVER from "./config";
let SERVER = JSON.parse(localStorage.getItem('ApiUrl'))
// console.log(SERVER, 'SERVERSERVER');
export function loginIn(username, password) {
export function loginIn (username, password) {
return request({
url: `${SERVER.MANAGEMENTAPI}/login?username=${username}&password=${password}`,
method: "post",
});
}
export function logout() {
export function logout () {
return request({
url: `${SERVER.MANAGEMENTAPI}/logout`,
method: "post",
......
import request from '@/utils/request'
import SERVER from "./config";
// import SERVER from "./config";
let SERVER = JSON.parse(localStorage.getItem('ApiUrl'))
const workflow = '/workflow'
const log = '/log'
const crud = '/crud'
......
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-23 13:17:59
*/
import request from '@/utils/request'
// let SERVER = JSON.parse(localStorage.getItem('ApiUrl'))
let SERVER = JSON.parse(localStorage.getItem('ApiUrl'))
console.log(JSON.parse(localStorage.getItem('ApiUrl')));
// 获取用户信息
export function getUserInfo () {
return request({
......@@ -9,14 +15,6 @@ export function getUserInfo () {
})
}
// // 获取菜单信息
// export function getMenuInfo () {
// return request({
// url: SERVER.SERVERAPI + '/rest/user/getUserAuthorizationMenus',
// method: 'get',
// })
// }
// 获取菜单信息
export function getMenuInfo (data) {
return request({
......
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1673321301365" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3462" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><path d="M910.617673 211.45497c-29.726022-40.739866-65.373916-76.582189-105.953124-106.533338-31.447223-23.211654-65.346287-42.500976-101.132328-57.574277-17.797341-7.496741-38.217417 1.723248-44.400233 20.018939l0 0c-5.586229 16.531512 2.569522 34.533514 18.648732 41.309848 30.91408 13.027711 60.204174 29.700439 87.38421 49.761334 35.128055 25.927509 65.986877 56.9562 91.719958 92.223425 53.42477 73.218582 81.662905 159.989831 81.662905 250.935146 0 57.551764-11.264555 113.364931-33.480532 165.888168-21.464871 50.748824-52.199872 96.333022-91.352591 135.484717-39.152718 39.153742-84.736916 69.888743-135.484717 91.352591-52.523237 22.215978-108.336404 33.480532-165.888168 33.480532-57.552787 0-113.364931-11.264555-165.889191-33.480532-50.748824-21.464871-96.331999-52.199872-135.484717-91.352591-39.152718-39.152718-69.888743-84.736916-91.353614-135.484717-22.214954-52.523237-33.479509-108.336404-33.479509-165.888168 0-90.842984 28.180829-177.536462 81.495082-250.706949 25.681916-35.244712 56.481386-66.265216 91.545996-92.199888 27.118638-20.056801 56.344263-36.737716 87.192851-49.78794 16.072047-6.798846 24.204262-24.812105 18.594497-41.336454l0 0c-6.207375-18.285458-26.638707-27.478841-44.424792-19.958564-35.712363 15.098883-69.537749 34.399461-100.915387 57.607022-40.505529 29.958312-76.084862 65.791425-105.750509 106.506732C52.210106 296.342312 19.618826 396.581294 19.618826 501.596046c0 66.5016 13.031804 131.033335 38.734186 191.800327 24.818245 58.677401 60.340273 111.367437 105.58064 156.606781 45.240367 45.240367 97.930403 80.763418 156.607804 105.581664 60.766992 25.701358 125.297704 38.734186 191.800327 38.734186 66.502623 0 131.033335-13.031804 191.800327-38.734186 58.677401-24.818245 111.366414-60.341297 156.606781-105.581664 45.240367-45.239344 80.762395-97.92938 105.581664-156.606781 25.701358-60.766992 38.734186-125.297704 38.734186-191.800327C1005.062695 396.463614 972.403878 296.133557 910.617673 211.45497z" fill="#ffffff" p-id="3463"></path><path d="M509.270842 388.009058 509.270842 388.009058c20.261463 0 36.839023-16.57756 36.839023-36.839023L546.109866 75.454506c0-20.261463-16.57756-36.839023-36.839023-36.839023l0 0c-20.261463 0-36.839023 16.57756-36.839023 36.839023l0 275.715529C472.431819 371.431497 489.00938 388.009058 509.270842 388.009058z" fill="#ffffff" p-id="3464"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1673321301365" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3462" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><path d="M910.617673 211.45497c-29.726022-40.739866-65.373916-76.582189-105.953124-106.533338-31.447223-23.211654-65.346287-42.500976-101.132328-57.574277-17.797341-7.496741-38.217417 1.723248-44.400233 20.018939l0 0c-5.586229 16.531512 2.569522 34.533514 18.648732 41.309848 30.91408 13.027711 60.204174 29.700439 87.38421 49.761334 35.128055 25.927509 65.986877 56.9562 91.719958 92.223425 53.42477 73.218582 81.662905 159.989831 81.662905 250.935146 0 57.551764-11.264555 113.364931-33.480532 165.888168-21.464871 50.748824-52.199872 96.333022-91.352591 135.484717-39.152718 39.153742-84.736916 69.888743-135.484717 91.352591-52.523237 22.215978-108.336404 33.480532-165.888168 33.480532-57.552787 0-113.364931-11.264555-165.889191-33.480532-50.748824-21.464871-96.331999-52.199872-135.484717-91.352591-39.152718-39.152718-69.888743-84.736916-91.353614-135.484717-22.214954-52.523237-33.479509-108.336404-33.479509-165.888168 0-90.842984 28.180829-177.536462 81.495082-250.706949 25.681916-35.244712 56.481386-66.265216 91.545996-92.199888 27.118638-20.056801 56.344263-36.737716 87.192851-49.78794 16.072047-6.798846 24.204262-24.812105 18.594497-41.336454l0 0c-6.207375-18.285458-26.638707-27.478841-44.424792-19.958564-35.712363 15.098883-69.537749 34.399461-100.915387 57.607022-40.505529 29.958312-76.084862 65.791425-105.750509 106.506732C52.210106 296.342312 19.618826 396.581294 19.618826 501.596046c0 66.5016 13.031804 131.033335 38.734186 191.800327 24.818245 58.677401 60.340273 111.367437 105.58064 156.606781 45.240367 45.240367 97.930403 80.763418 156.607804 105.581664 60.766992 25.701358 125.297704 38.734186 191.800327 38.734186 66.502623 0 131.033335-13.031804 191.800327-38.734186 58.677401-24.818245 111.366414-60.341297 156.606781-105.581664 45.240367-45.239344 80.762395-97.92938 105.581664-156.606781 25.701358-60.766992 38.734186-125.297704 38.734186-191.800327C1005.062695 396.463614 972.403878 296.133557 910.617673 211.45497z" fill="#ffffff" p-id="3463"></path><path d="M509.270842 388.009058 509.270842 388.009058c20.261463 0 36.839023-16.57756 36.839023-36.839023L546.109866 75.454506c0-20.261463-16.57756-36.839023-36.839023-36.839023l0 0c-20.261463 0-36.839023 16.57756-36.839023 36.839023l0 275.715529C472.431819 371.431497 489.00938 388.009058 509.270842 388.009058z" p-id="3464"></path></svg>
\ No newline at end of file
......
......@@ -29,7 +29,7 @@ export default {
sidebarRight,
},
computed: {
...mapGetters(["sidebar", "dicData", "userInfo"]),
...mapGetters(["sidebar", "dicData", , "permission_routes", "userInfo"]),
logoName () {
return this.dicData['sysCode'] && this.dicData['sysCode'].filter(item =>
item.DCODE == "systemTitle"
......@@ -55,9 +55,9 @@ export default {
})
.catch((error) => {
// console.dir(error);
});
},
},
})
}
}
};
</script>
<style lang="scss" scoped>
......
<!--
* @Description: log
* @Autor: renchao
* @LastEditTime: 2023-03-23 16:29:12
-->
<template>
<el-menu router :default-active="activeMenu" mode="horizontal">
<!-- 权限菜单 -->
<sidebar-item v-for="route in permission_routes.slice(3, 6)" :key="route.path" :item="route"
<sidebar-item v-for="route in permission_routes.slice(4, 7)" :key="route.path" :item="route"
:base-path="route.path" />
<!-- 菜单全部展示 -->
<!-- <sidebar-item v-for="route in asyncRoutes" :key="route.path" :item="route" :base-path="route.path" /> -->
......
......@@ -2,14 +2,14 @@
* @Author: xiaomiao 1158771342@qq.com
* @Date: 2023-01-10 09:03:06
* @LastEditors: Please set LastEditors
* @LastEditTime: 2023-03-22 10:43:26
* @LastEditTime: 2023-03-23 16:29:24
* @FilePath: \监管系统\js-web-jianguan\src\layout\components\Sidebar\sidebarRight.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<el-menu router :default-active="activeMenu" mode="horizontal">
<!-- 权限菜单 -->
<sidebar-item v-for="route in permission_routes.slice(6, 9)" :key="route.path" :item="route"
<sidebar-item v-for="route in permission_routes.slice(7, 10)" :key="route.path" :item="route"
:base-path="route.path" />
<!-- 菜单全部展示 -->
<!-- <sidebar-item v-for="route in asyncRoutes" :key="route.path" :item="route" :base-path="route.path" /> -->
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-20 14:22:35
* @LastEditTime: 2023-03-23 15:17:24
-->
<template>
<div class="app-wrapper jgWrapper">
......@@ -12,10 +12,10 @@
</div>
</template>
<script>
import { AppMain, Navbar, Sidebar, TagsView } from './components'
import ResizeMixin from './mixin/ResizeHandler'
import { mapState } from 'vuex'
export default {
import { AppMain, Navbar, Sidebar, TagsView } from './components'
import ResizeMixin from './mixin/ResizeHandler'
import { mapState } from 'vuex'
export default {
name: 'Layout',
components: {
AppMain,
......@@ -24,7 +24,6 @@
TagsView
},
created () {
console.log("hhh");
this.$store.dispatch("products/setData", "BDCJGPT");
},
mixins: [ResizeMixin],
......@@ -35,15 +34,15 @@
fixedHeader: state => state.settings.fixedHeader
})
}
}
}
</script>
<style lang="scss">
@import "~@/styles/jgSidebar.scss";
@import "~@/styles/jgSidebar.scss";
</style>
<style lang="scss" scoped>
@import "~@/styles/mixin.scss";
@import "~@/styles/mixin.scss";
.app-wrapper {
.app-wrapper {
@include clearfix;
position: relative;
height: 100%;
......@@ -58,9 +57,9 @@
position: fixed;
top: 0;
}
}
}
.appMain {
.appMain {
// min-width: 1280px;
height: calc(100vh - 101px) !important;
box-sizing: border-box;
......@@ -68,5 +67,5 @@
.app-main {
height: 100%;
}
}
}
</style>
......
......@@ -6,15 +6,13 @@
<h4>不动产登记上报系统</h4>
</div>
<div class="right-menu">
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="hover" @command="handleCommand">
<div class="avatar-wrapper">
<span style="padding-right:10px">{{ name }}</span>
<img :src="avatar + '?imageView2/1/w/80/h/80'" class="user-avatar" />
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="hover">
<div class="user">
{{ userName }}
<span @click="onCancel">
<i class="el-icon-switch-button"></i>
</span>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="a">个人中心</el-dropdown-item>
<el-dropdown-item command="b">退出</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
......@@ -23,17 +21,15 @@
<script>
import { mapGetters } from 'vuex'
import Breadcrumb from './Breadcrumb'
import defaultSettings from '@/settings'
import { logout } from "@/api/login.js";
export default {
components: {
Breadcrumb
},
computed: {
...mapGetters(['sidebar', 'avatar', 'name'])
},
data () {
return {
title: defaultSettings.title
...mapGetters(["sidebar", "dicData", "userInfo"]),
userName () {
return this.userInfo ? this.userInfo.name : ""
}
},
methods: {
......@@ -44,11 +40,22 @@ export default {
themeChange (val) {
this.$store.dispatch('app/updateTheme', val)
},
handleCommand (command) {
if (command == 'a') {
} else {
}
onCancel () {
logout()
.then((res) => {
sessionStorage.removeItem("token");
this.$store.dispatch("user/resetState");
this.$store.dispatch("permission/resetRoutes");
this.$router.replace({
path: "/sb",
query: {
redirect: this.$route.fullPath,
},
});
})
.catch((error) => {
// console.dir(error);
})
}
}
}
......@@ -79,45 +86,6 @@ export default {
}
}
.NoticeBar {
position: absolute;
bottom: 0;
}
.el-dropdown-menu {
padding: 0 !important;
border: 1px solid #ebeef5;
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.12);
border-radius: 4px 0 0 4px 4px;
.el-dropdown-menu__item {
text-align: center;
margin-top: 0 !important;
font-size: 14px;
font-weight: 400;
color: #4a4a4a;
width: 140px;
height: 36px;
line-height: 36px;
}
.el-dropdown-menu__item:nth-child(6) {
border-top: 1px solid #ebeef5;
}
.popper__arrow {
top: -11px !important;
left: 110px !important;
transform: rotate(0deg) scale(2);
}
.el-dropdown-menu__item:not(.is-disabled):hover,
.el-dropdown-menu__item:focus {
background: #f6f7f9;
color: #4a4a4a;
}
}
.navbar {
height: $headerHeight;
overflow: hidden;
......@@ -133,117 +101,12 @@ export default {
width: 300px;
}
.backdrop {
flex: 1;
width: 60%;
background-size: 100% 100%;
height: $headerHeight;
display: flex;
align-items: center;
}
.hamburger-container {
line-height: 43px;
height: 100%;
float: left;
cursor: pointer;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
.breadcrumb-container {
float: left;
}
.right-menu {
float: right;
height: 100%;
line-height: 50px;
display: flex;
align-items: center;
.function {
margin: 0 15px;
cursor: pointer;
}
.shutdown {
font-size: 20px;
margin-left: 15px;
cursor: pointer;
}
.organization-item {
margin-right: 40px;
margin-top: -40px !important;
}
.item {
margin-right: 40px;
margin-top: -20px;
line-height: 18.4px;
cursor: pointer;
position: relative;
.item-box {
position: absolute;
top: -5px;
left: 3px;
width: 100%;
min-width: 25px;
height: 25px;
cursor: pointer;
z-index: 100;
}
}
&:focus {
outline: none;
}
.right-menu-item {
display: inline-block;
height: 100%;
font-size: 18px;
color: #fff;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer;
transition: background 0.3s;
display: flex;
align-items: center;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
}
.avatar-wrapper {
position: relative;
display: flex;
height: 40px;
align-items: center;
.user-avatar {
cursor: pointer;
width: 35px;
height: 35px;
border-radius: 50%;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -15px;
top: 17px;
font-size: 12px;
}
}
}
}
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-06 16:18:21
* @LastEditTime: 2023-03-23 16:17:42
-->
<template>
<div>
......@@ -19,22 +19,19 @@
</template>
<script>
import { mapGetters } from 'vuex'
import Logo from './Logo'
import defaultSettings from '@/settings'
import SidebarItem from './SidebarItem'
import variables from '@/styles/variables.scss'
import { asyncRoutes } from '@/router'
export default {
import { mapGetters } from 'vuex'
import Logo from './Logo'
import defaultSettings from '@/settings'
import SidebarItem from './SidebarItem'
import variables from '@/styles/variables.scss'
import { asyncRoutes } from '@/router'
export default {
components: { SidebarItem, Logo },
data () {
return {
title: defaultSettings.title
}
},
created () {
console.log(this.permission_routes);
},
computed: {
...mapGetters(['permission_routes', 'sidebar']),
activeMenu () {
......@@ -53,7 +50,7 @@
}
},
mounted () {
}
console.log(this.permission_routes, 'permission_routespermission_routes');
}
}
</script>
......
<template>
<div id="tags-view-container" class="tags-view-container">
<scroll-pane ref="scrollPane" class="tags-view-wrapper" @scroll="handleScroll">
<router-link v-for="tag in visitedViews" ref="tag" :key="tag.path" :class="isActive(tag)?'active':''"
<router-link v-for="tag in visitedViews" ref="tag" :key="tag.path" :class="isActive(tag) ? 'active' : ''"
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }" tag="span" class="tags-view-item"
@click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''"
@contextmenu.prevent.native="openMenu(tag,$event)">
@click.middle.native="!isAffix(tag) ? closeSelectedTag(tag) : ''" @contextmenu.prevent.native="openMenu(tag, $event)">
{{ tag.title }}
<span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
</router-link>
</scroll-pane>
<ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
<ul v-show="visible" :style="{ left: left + 'px', top: top + 'px' }" class="contextmenu">
<li @click="refreshSelectedTag(selectedTag)">Refresh</li>
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">Close</li>
<li @click="closeOthersTags">Close Others</li>
......@@ -200,6 +199,7 @@ export default {
padding-top: 3px;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
margin-bottom: 5px;
.tags-view-wrapper {
.tags-view-item {
display: inline-block;
......
......@@ -83,9 +83,4 @@ export default {
width: 100%;
transition: width 0.28s;
}
.el-dropdown-menu--small {
padding: 0;
width: 5px;
}
</style>
......
......@@ -2,7 +2,7 @@
* @Author: yangwei
* @Date: 2023-01-16 09:10:12
* @LastEditors: Please set LastEditors
* @LastEditTime: 2023-03-21 15:00:04
* @LastEditTime: 2023-03-23 15:15:02
* @FilePath: \bdcjg-web\src\main.js
* @Description:
*
......
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-23 14:47:38
*/
let mixin = {
methods: {
}
}
export default mixin
\ No newline at end of file
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-21 13:52:58
* @LastEditTime: 2023-03-23 16:37:20
*/
import Vue from 'vue'
import router from "./router";
import store from "./store";
import { getMenuInfo } from "@/api/user";
......@@ -14,7 +15,6 @@ import Cookies from "js-cookie";
NProgress.configure({ showSpinner: false });
router.beforeEach(async (to, from, next) => {
getTheme()
NProgress.start();
window.document.documentElement.setAttribute("data-theme", 'blue');
document.title = getPageTitle(to.meta.title);
......@@ -23,17 +23,15 @@ router.beforeEach(async (to, from, next) => {
let hasAddRoute = store.state.permission.addRoutes;
if (to.path == "/sb" || to.path == "/jg") {
localStorage.removeItem("token");
sessionStorage.setItem("psth", to.path)
next();
} else {
let code = sessionStorage.getItem("psth") == "/sb" ? "BDCSBPT" : "BDCJGPT"
let code = Vue.prototype.BASE_API.THEME == "sb" ? "BDCSBPT" : "BDCJGPT"
//判断token是否存在
const hasToken = localStorage.getItem("token");
if (hasToken) {
//请求用户信息
if (!hasUser) {
store.dispatch("user/getUserInfo");
// import("@/styles/public.scss");
}
if (hasAddRoute) {
next();
......@@ -52,19 +50,20 @@ router.beforeEach(async (to, from, next) => {
if (!hasAddDict) {
await store.dispatch("dict/generateDic");
}
if (routeTo && routeTo !== "/") {
if (routeTo && routeTo !== "/" && routeTo !== "/sb" && routeTo !== "/jg") {
next({ ...to, replace: true });
} else {
next("/home");
next();
}
}
} else if (sessionStorage.getItem("psth")) {
next(sessionStorage.getItem("psth"));
} else {
next("/jg");
if (code == 'BDCSBPT') {
next('/sb');
} else {
next('/jg');
}
}
}
NProgress.done();
});
router.afterEach((to) => {
......
......@@ -29,15 +29,24 @@ export const constantRoutes = [
name: "loginsb",
component: () => import("@/views/loginsb/index.vue"),
},
// 监管首页
{
path: '/',
redirect: to => {
if (Vue.prototype.BASE_API.THEME == 'jg') {
return { path: '/jg' }
} else {
return { path: '/sb' }
}
},
},
// 监管首页
{
path: '/home',
component: Layout,
redirect: '/jg',
meta: { title: '首页' },
children: [
{
path: 'home',
path: '',
component: () => import('@/views/home/index'),
name: 'home',
meta: { title: '工作台', icon: 'workbench', affix: true }
......
const state = {
visitedViews: [{
'fullPath': "/home",
'meta': {
affix: true
},
'name': "Dashboard",
'path': "/home",
'title': "工作台"
}]
visitedViews: []
}
const mutations = {
ADD_VISITED_VIEW: (state, view) => {
if (state.visitedViews.some(v => v.path === view.path)) return
......
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-23 15:26:37
*/
var Layout;
let ApiUrl = localStorage.getItem('ApiUrl')
......@@ -19,7 +24,6 @@ export default function filterAsyncRouter (routers) {
item.component = Layout
} else {
item.component = loadView(item.uri)
console.log(item.component, 'item.componentitem.component');
}
item.meta = {
title: item.name,
......
......@@ -2,7 +2,7 @@
<div class="bg">
<div class="login-logo"></div>
<div class="login-inner-bg login">
<h2>{{ productName }}</h2>
<h2>{{ BASE_API.TITLE }}</h2>
<div class="user_style">
<h3>欢迎登录</h3>
<el-form :model="user" :rules="rules" ref="user" id="loginform" class="demo-ruleForm">
......@@ -21,12 +21,11 @@
</div>
</div>
</template>
<script>
import { getMenuInfo } from "@/api/user";
import { loginIn } from "@/api/login.js";
import { api, getAction } from "@/api/manageApi";
export default {
name: "Login",
name: "jgLogin",
data () {
return {
user: {
......@@ -34,41 +33,11 @@ export default {
password: "",
checkStatus: false,
},
productName: "",
rules: {
account: [{ required: true, message: "请填写帐号", trigger: "blur" }],
password: [{ required: true, message: "请填写密码", trigger: "blur" }],
},
};
},
created () {
const params = {};
const queryOptions = {
conditionGroup: {
conditions: [
{
property: "code",
value: "BDCJGPT",
operator: "EQ",
},
],
queryRelation: "AND",
},
};
params.queryOptions = JSON.stringify(queryOptions);
//根据子系统code获取子系统详细信息
getAction(api.subsystem, params).then((res) => {
if (res.status === 1) {
this.productName = res.content[0].name;
this.$store.dispatch("products/setData", res.content[0].code);
sessionStorage.setItem("products", res.content[0].code)
} else {
this.$message.error({ message: res.message, showClose: true });
}
});
},
mounted () {
// this.checkUserName();
}
},
methods: {
//记住用户名
......@@ -87,30 +56,20 @@ export default {
}
},
login (user) {
var self = this;
this.$refs[user].validate((valid) => {
var self = this
this.$refs[user].validate(async (valid) => {
if (valid) {
loginIn(self.user.account, self.user.password)
.then((res) => {
if (res.status === 1) {
//存储token
let res = await loginIn(self.user.account, self.user.password)
if (res.status == 1) {
localStorage.setItem("token", `Bearer ${res.content}`);
//登录成功后需判断有无重定向,没有重定向则跳转首页
console.log(this.$route.query.redirect);
this.$router.replace(this.$route.query.redirect || "/home");
} else {
//错误处理
}
}
})
.catch((error) => {
// console.dir(error);
});
}
});
},
},
components: {},
};
}
}
</script>
<style scoped lang="scss">
.username,
......
......@@ -2,7 +2,7 @@
<div class="bg">
<div class="title">
<img src="../../image/bdclogo.png" alt="">
<h2>{{ productName }}</h2>
<h2>{{ BASE_API.TITLE }}</h2>
</div>
<div class="login-inner-bg login">
<div class="user_style">
......@@ -12,19 +12,21 @@
<el-input class="username" v-model="user.account" placeholder="请输入用户名"></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input type="password" class="password" @keyup.native="login('user')" v-model="user.password"
placeholder="请输入密码" show-password></el-input>
<el-input type="password" class="password" v-model="user.password" placeholder="请输入密码"
show-password></el-input>
</el-form-item>
<el-form-item prop="yz">
<!-- <el-form-item prop="yz">
<div class="flex-container">
<div class="flex-input">
<el-input class="yz" @keyup.native="login('user')" v-model="user.yz" placeholder="请输入验证码"></el-input>
</div>
<div class="flex-line"></div>
<div class="flex-img"><canvas id="s-canvas" ref="s-canvas"></canvas></div>
<div class="flex-renovate"><font id="renovate" @click="verification">换一批</font></div>
<div class="flex-renovate">
<font id="renovate" @click="verification">换一批</font>
</div>
</el-form-item>
</div>
</el-form-item> -->
<el-form-item class="login-btn">
<el-button type="primary" style="width: 100%" @click="login('user')">登录</el-button>
</el-form-item>
......@@ -35,10 +37,10 @@
</template>
<script>
import { loginIn } from "@/api/login.js";
import { api, getAction } from "@/api/manageApi";
export default {
name: "Login",
import { getMenuInfo } from "@/api/user";
import { loginIn } from "@/api/login.js";
export default {
name: "sbLogin",
data () {
return {
user: {
......@@ -54,66 +56,35 @@
},
};
},
created () {
this.verification();
const params = {};
const queryOptions = {
conditionGroup: {
conditions: [
{
property: "code",
value: "BDCSBPT",
operator: "EQ",
},
],
queryRelation: "AND",
},
};
params.queryOptions = JSON.stringify(queryOptions);
//根据子系统code获取子系统详细信息
getAction(api.subsystem, params).then((res) => {
if (res.status === 1) {
this.productName = res.content[0].name;
this.$store.dispatch("products/setData", res.content[0].code);
sessionStorage.setItem("products", res.content[0].code)
} else {
this.$message.error({ message: res.message, showClose: true });
}
});
},
mounted () {
// this.checkUserName();
},
methods: {
verification() {
verification () {
let str = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ', code = '', i = 0;
for( ; i++ < 4 ; ) code += str[ Math.floor( Math.random() * ( str.length - 0 ) + 0 ) ];
setTimeout( () => {
for (; i++ < 4;) code += str[Math.floor(Math.random() * (str.length - 0) + 0)];
setTimeout(() => {
let canvas = document.getElementById("s-canvas"), ctx = canvas.getContext("2d");
canvas.width = 80;
canvas.height = 28;
ctx.fillStyle = '#ffffff';
ctx.fillRect( 0, 0, 80, 28 );
for ( i = 0; i < code.length; i++ ) { this.drawText( ctx, code[i], i ); }
}, 0 );
ctx.fillRect(0, 0, 80, 28);
for (i = 0; i < code.length; i++) { this.drawText(ctx, code[i], i); }
}, 0);
},
drawText(ctx, txt, i) {
drawText (ctx, txt, i) {
ctx.fillStyle = this.randomColor(50, 160);
ctx.font = "18px SimHei";
let x = (i + 1) * (80 / (4 + 1)), y = this.randomNum( 18, 28 - 5 );
let x = (i + 1) * (80 / (4 + 1)), y = this.randomNum(18, 28 - 5);
ctx.translate(x, y);
ctx.fillText(txt, 0, 0);
ctx.rotate((-0 * Math.PI) / 180);
ctx.translate(-x, -y);
},
randomColor(min, max) {
randomColor (min, max) {
let r = this.randomNum(min, max);
let g = this.randomNum(min, max);
let b = this.randomNum(min, max);
return "rgb(" + r + "," + g + "," + b + ")";
},
randomNum(min, max) {
randomNum (min, max) {
return Math.floor(Math.random() * (max - min) + min);
},
//记住用户名
......@@ -132,39 +103,38 @@
}
},
login (user) {
var self = this;
this.$refs[user].validate((valid) => {
var self = this
this.$refs[user].validate(async (valid) => {
if (valid) {
loginIn(self.user.account, self.user.password)
.then((res) => {
if (res.status === 1) {
this.$store.dispatch('business/setInitRules', "layout1")
//存储token
let res = await loginIn(self.user.account, self.user.password)
if (res.status == 1) {
let code = this.BASE_API.THEME == "sb" ? "BDCSBPT" : "BDCJGPT"
localStorage.setItem("token", `Bearer ${res.content}`);
this.$store.dispatch("products/setData", res.content[0].code);
sessionStorage.setItem("products", res.content[0].code)
const { result: getMenuData } = (await getMenuInfo(code)) || [];
let path1 = JSON.parse(getMenuData[0].metadata)?.path + '/' + JSON.parse(getMenuData[0].children[0].metadata)?.path
//登录成功后需判断有无重定向,没有重定向则跳转首页
this.$router.replace(this.$route.query.redirect || "/");
} else {
console.log(res);
this.$message.error({ message: res.message })
const accessRoutes = await this.$store.dispatch(
"permission/generateRoutes",
getMenuData
);
this.$router.addRoutes([
...accessRoutes,
{ path: "*", redirect: "/404", hidden: true },
]);
this.$router.replace(this.$route.query.redirect || path1);
}
}
})
.catch((error) => {
// console.dir(error);
});
}
});
},
},
components: {},
};
}
}
</script>
<style scoped lang="scss">
.username,
.password,
.yz {
.username,
.password,
.yz {
position: relative;
&:before {
content: "";
display: block;
......@@ -179,57 +149,60 @@
/deep/ .el-input__inner {
color: #000 !important;
text-indent: 24px;
// border: 1px solid rgba(11, 161, 248, 0.4);
// background-color: rgba(6, 135, 205, 0.3) !important;
}
}
}
.flex-container {
.flex-container {
position: relative;
display: -webkit-flex;
display: flex;
}
}
.flex-input {
.flex-input {
width: 100%;
}
.flex-line {
}
.flex-line {
position: absolute;
width: 1px;
height: 64%;
margin: 5px;
right: 36%;
background-color: #CCCCCC;
}
.flex-img {
}
.flex-img {
position: absolute;
margin: 2px;
right: 16%;
}
.flex-renovate {
}
.flex-renovate {
position: absolute;
margin: 1px;
right: 3%;
}
#renovate {
}
#renovate {
color: #3F8FEA;
font-size: 16px;
font-weight: 700;
cursor: pointer;
}
}
.username::before {
.username::before {
background-image: url(../../image/userlogo.png);
}
}
.password::before {
.password::before {
background-image: url(../../image/passlogo.png);
}
.yz::before {
}
.yz::before {
background-image: url(../../image/yzlogo.png);
}
}
.bg {
.bg {
width: 100%;
height: 100%;
min-width: 1440px;
......@@ -238,13 +211,15 @@
background-size: 100% 100%;
overflow: hidden;
position: relative;
}
.title {
}
.title {
width: 24%;
height: 6%;
top: 20%;
right: 38%;
position: absolute;
img {
width: 60px;
height: 60px;
......@@ -252,6 +227,7 @@
left: 2%;
position: absolute;
}
h2 {
top: 25%;
left: 22%;
......@@ -263,8 +239,9 @@
color: #ffffff;
text-shadow: 0px 4px 4px #002c95;
}
}
.login-inner-bg {
}
.login-inner-bg {
background: white;
width: 24.6%;
height: 47%;
......@@ -276,9 +253,9 @@
background-size: 100% 100%;
box-sizing: border-box;
padding: 56px;
}
}
.login {
.login {
.user_style {
h3 {
font-weight: normal;
......@@ -307,9 +284,9 @@
cursor: pointer;
background-color: #2d8cf0;
}
}
}
.login #loginform {
.login #loginform {
.el-form-item {
margin-bottom: 24px !important;
}
......@@ -333,10 +310,10 @@
.el-checkbox__label {
color: #fff;
}
}
}
.inputUser .ivu-input {
.inputUser .ivu-input {
padding: 6px 24px !important;
border: 1px solid #9f9f9f !important;
}
}
</style>
......