7db45342 by 任超

Merge branch 'master' into dev

2 parents 45b88067 c195fd34
1 /*
2 * @Description:
3 * @Autor: renchao
4 * @LastEditTime: 2023-03-23 13:17:59
5 */
1 import request from '@/utils/request' 6 import request from '@/utils/request'
2 // let SERVER = JSON.parse(localStorage.getItem('ApiUrl')) 7 // let SERVER = JSON.parse(localStorage.getItem('ApiUrl'))
3 let SERVER = JSON.parse(localStorage.getItem('ApiUrl')) 8 let SERVER = JSON.parse(localStorage.getItem('ApiUrl'))
9 console.log(JSON.parse(localStorage.getItem('ApiUrl')));
4 // 获取用户信息 10 // 获取用户信息
5 export function getUserInfo () { 11 export function getUserInfo () {
6 return request({ 12 return request({
...@@ -9,14 +15,6 @@ export function getUserInfo () { ...@@ -9,14 +15,6 @@ export function getUserInfo () {
9 }) 15 })
10 } 16 }
11 17
12 // // 获取菜单信息
13 // export function getMenuInfo () {
14 // return request({
15 // url: SERVER.SERVERAPI + '/rest/user/getUserAuthorizationMenus',
16 // method: 'get',
17 // })
18 // }
19
20 // 获取菜单信息 18 // 获取菜单信息
21 export function getMenuInfo (data) { 19 export function getMenuInfo (data) {
22 return request({ 20 return request({
......
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
29 sidebarRight, 29 sidebarRight,
30 }, 30 },
31 computed: { 31 computed: {
32 ...mapGetters(["sidebar", "dicData", "userInfo"]), 32 ...mapGetters(["sidebar", "dicData", , "permission_routes", "userInfo"]),
33 logoName () { 33 logoName () {
34 return this.dicData['sysCode'] && this.dicData['sysCode'].filter(item => 34 return this.dicData['sysCode'] && this.dicData['sysCode'].filter(item =>
35 item.DCODE == "systemTitle" 35 item.DCODE == "systemTitle"
......
1 <!--
2 * @Description: log
3 * @Autor: renchao
4 * @LastEditTime: 2023-03-23 14:40:06
5 -->
1 <template> 6 <template>
2 <el-menu router :default-active="activeMenu" mode="horizontal"> 7 <el-menu router :default-active="activeMenu" mode="horizontal">
3 <!-- 权限菜单 --> 8 <!-- 权限菜单 -->
......
1 <!-- 1 <!--
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-03-20 14:22:35 4 * @LastEditTime: 2023-03-23 15:17:24
5 --> 5 -->
6 <template> 6 <template>
7 <div class="app-wrapper jgWrapper"> 7 <div class="app-wrapper jgWrapper">
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
12 </div> 12 </div>
13 </template> 13 </template>
14 <script> 14 <script>
15 import { AppMain, Navbar, Sidebar, TagsView } from './components' 15 import { AppMain, Navbar, Sidebar, TagsView } from './components'
16 import ResizeMixin from './mixin/ResizeHandler' 16 import ResizeMixin from './mixin/ResizeHandler'
17 import { mapState } from 'vuex' 17 import { mapState } from 'vuex'
18 export default { 18 export default {
19 name: 'Layout', 19 name: 'Layout',
20 components: { 20 components: {
21 AppMain, 21 AppMain,
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
24 TagsView 24 TagsView
25 }, 25 },
26 created () { 26 created () {
27 console.log("hhh");
28 this.$store.dispatch("products/setData", "BDCJGPT"); 27 this.$store.dispatch("products/setData", "BDCJGPT");
29 }, 28 },
30 mixins: [ResizeMixin], 29 mixins: [ResizeMixin],
...@@ -35,15 +34,15 @@ ...@@ -35,15 +34,15 @@
35 fixedHeader: state => state.settings.fixedHeader 34 fixedHeader: state => state.settings.fixedHeader
36 }) 35 })
37 } 36 }
38 } 37 }
39 </script> 38 </script>
40 <style lang="scss"> 39 <style lang="scss">
41 @import "~@/styles/jgSidebar.scss"; 40 @import "~@/styles/jgSidebar.scss";
42 </style> 41 </style>
43 <style lang="scss" scoped> 42 <style lang="scss" scoped>
44 @import "~@/styles/mixin.scss"; 43 @import "~@/styles/mixin.scss";
45 44
46 .app-wrapper { 45 .app-wrapper {
47 @include clearfix; 46 @include clearfix;
48 position: relative; 47 position: relative;
49 height: 100%; 48 height: 100%;
...@@ -58,9 +57,9 @@ ...@@ -58,9 +57,9 @@
58 position: fixed; 57 position: fixed;
59 top: 0; 58 top: 0;
60 } 59 }
61 } 60 }
62 61
63 .appMain { 62 .appMain {
64 // min-width: 1280px; 63 // min-width: 1280px;
65 height: calc(100vh - 101px) !important; 64 height: calc(100vh - 101px) !important;
66 box-sizing: border-box; 65 box-sizing: border-box;
...@@ -68,5 +67,5 @@ ...@@ -68,5 +67,5 @@
68 .app-main { 67 .app-main {
69 height: 100%; 68 height: 100%;
70 } 69 }
71 } 70 }
72 </style> 71 </style>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 * @Author: yangwei 2 * @Author: yangwei
3 * @Date: 2023-01-16 09:10:12 3 * @Date: 2023-01-16 09:10:12
4 * @LastEditors: Please set LastEditors 4 * @LastEditors: Please set LastEditors
5 * @LastEditTime: 2023-03-21 15:00:04 5 * @LastEditTime: 2023-03-23 15:15:02
6 * @FilePath: \bdcjg-web\src\main.js 6 * @FilePath: \bdcjg-web\src\main.js
7 * @Description: 7 * @Description:
8 * 8 *
......
1 /* 1 /*
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-03-21 13:52:58 4 * @LastEditTime: 2023-03-23 15:17:36
5 */ 5 */
6 import Vue from 'vue'
6 import router from "./router"; 7 import router from "./router";
7 import store from "./store"; 8 import store from "./store";
8 import { getMenuInfo } from "@/api/user"; 9 import { getMenuInfo } from "@/api/user";
...@@ -14,7 +15,6 @@ import Cookies from "js-cookie"; ...@@ -14,7 +15,6 @@ import Cookies from "js-cookie";
14 NProgress.configure({ showSpinner: false }); 15 NProgress.configure({ showSpinner: false });
15 router.beforeEach(async (to, from, next) => { 16 router.beforeEach(async (to, from, next) => {
16 getTheme() 17 getTheme()
17
18 NProgress.start(); 18 NProgress.start();
19 window.document.documentElement.setAttribute("data-theme", 'blue'); 19 window.document.documentElement.setAttribute("data-theme", 'blue');
20 document.title = getPageTitle(to.meta.title); 20 document.title = getPageTitle(to.meta.title);
...@@ -23,17 +23,12 @@ router.beforeEach(async (to, from, next) => { ...@@ -23,17 +23,12 @@ router.beforeEach(async (to, from, next) => {
23 let hasAddRoute = store.state.permission.addRoutes; 23 let hasAddRoute = store.state.permission.addRoutes;
24 if (to.path == "/sb" || to.path == "/jg") { 24 if (to.path == "/sb" || to.path == "/jg") {
25 localStorage.removeItem("token"); 25 localStorage.removeItem("token");
26 sessionStorage.setItem("psth", to.path)
27 next(); 26 next();
28 } else { 27 } else {
29 let code = sessionStorage.getItem("psth") == "/sb" ? "BDCSBPT" : "BDCJGPT" 28 let code = Vue.prototype.BASE_API.THEME == "sb" ? "BDCSBPT" : "BDCJGPT"
30 //判断token是否存在
31 const hasToken = localStorage.getItem("token");
32 if (hasToken) {
33 //请求用户信息 29 //请求用户信息
34 if (!hasUser) { 30 if (!hasUser) {
35 store.dispatch("user/getUserInfo"); 31 store.dispatch("user/getUserInfo");
36 // import("@/styles/public.scss");
37 } 32 }
38 if (hasAddRoute) { 33 if (hasAddRoute) {
39 next(); 34 next();
...@@ -46,27 +41,21 @@ router.beforeEach(async (to, from, next) => { ...@@ -46,27 +41,21 @@ router.beforeEach(async (to, from, next) => {
46 ); 41 );
47 router.addRoutes([ 42 router.addRoutes([
48 ...accessRoutes, 43 ...accessRoutes,
49 { path: "*", redirect: "/404", hidden: true }, 44 { path: "*", redirect: "/404", hidden: true }
50 ]); 45 ]);
51 const routeTo = Cookies.get("routerTo"); 46 const routeTo = Cookies.get("routerTo");
52 if (!hasAddDict) { 47 if (!hasAddDict) {
53 await store.dispatch("dict/generateDic"); 48 await store.dispatch("dict/generateDic");
54 } 49 }
55 if (routeTo && routeTo !== "/") { 50 if (routeTo && routeTo !== "/" && routeTo !== "/sb" && routeTo !== "/jg") {
56 next({ ...to, replace: true }); 51 next({ ...to, replace: true });
57 } else { 52 } else {
58 next("/home"); 53 next();
59 }
60 } 54 }
61 } else if (sessionStorage.getItem("psth")) {
62 next(sessionStorage.getItem("psth"));
63 } else {
64 next("/jg");
65 } 55 }
66 } 56 }
67 57 NProgress.done()
68 NProgress.done(); 58 })
69 });
70 router.afterEach((to) => { 59 router.afterEach((to) => {
71 // 解决刷新页面报404问题 60 // 解决刷新页面报404问题
72 Cookies.set("routerTo", to.fullPath); 61 Cookies.set("routerTo", to.fullPath);
......
...@@ -33,7 +33,7 @@ export const constantRoutes = [ ...@@ -33,7 +33,7 @@ export const constantRoutes = [
33 { 33 {
34 path: '/', 34 path: '/',
35 component: Layout, 35 component: Layout,
36 redirect: '/jg', 36 redirect: '/sb',
37 meta: { title: '首页' }, 37 meta: { title: '首页' },
38 children: [ 38 children: [
39 { 39 {
......
1 /*
2 * @Description:
3 * @Autor: renchao
4 * @LastEditTime: 2023-03-23 15:26:37
5 */
1 6
2 var Layout; 7 var Layout;
3 let ApiUrl = localStorage.getItem('ApiUrl') 8 let ApiUrl = localStorage.getItem('ApiUrl')
...@@ -19,7 +24,6 @@ export default function filterAsyncRouter (routers) { ...@@ -19,7 +24,6 @@ export default function filterAsyncRouter (routers) {
19 item.component = Layout 24 item.component = Layout
20 } else { 25 } else {
21 item.component = loadView(item.uri) 26 item.component = loadView(item.uri)
22 console.log(item.component, 'item.componentitem.component');
23 } 27 }
24 item.meta = { 28 item.meta = {
25 title: item.name, 29 title: item.name,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 <div class="bg"> 2 <div class="bg">
3 <div class="login-logo"></div> 3 <div class="login-logo"></div>
4 <div class="login-inner-bg login"> 4 <div class="login-inner-bg login">
5 <h2>{{ productName }}</h2> 5 <h2>{{ BASE_API.TITLE }}</h2>
6 <div class="user_style"> 6 <div class="user_style">
7 <h3>欢迎登录</h3> 7 <h3>欢迎登录</h3>
8 <el-form :model="user" :rules="rules" ref="user" id="loginform" class="demo-ruleForm"> 8 <el-form :model="user" :rules="rules" ref="user" id="loginform" class="demo-ruleForm">
...@@ -21,12 +21,11 @@ ...@@ -21,12 +21,11 @@
21 </div> 21 </div>
22 </div> 22 </div>
23 </template> 23 </template>
24
25 <script> 24 <script>
25 import { getMenuInfo } from "@/api/user";
26 import { loginIn } from "@/api/login.js"; 26 import { loginIn } from "@/api/login.js";
27 import { api, getAction } from "@/api/manageApi";
28 export default { 27 export default {
29 name: "Login", 28 name: "jgLogin",
30 data () { 29 data () {
31 return { 30 return {
32 user: { 31 user: {
...@@ -34,41 +33,11 @@ export default { ...@@ -34,41 +33,11 @@ export default {
34 password: "", 33 password: "",
35 checkStatus: false, 34 checkStatus: false,
36 }, 35 },
37 productName: "",
38 rules: { 36 rules: {
39 account: [{ required: true, message: "请填写帐号", trigger: "blur" }], 37 account: [{ required: true, message: "请填写帐号", trigger: "blur" }],
40 password: [{ required: true, message: "请填写密码", trigger: "blur" }], 38 password: [{ required: true, message: "请填写密码", trigger: "blur" }],
41 },
42 };
43 },
44 created () {
45 const params = {};
46 const queryOptions = {
47 conditionGroup: {
48 conditions: [
49 {
50 property: "code",
51 value: "BDCJGPT",
52 operator: "EQ",
53 },
54 ],
55 queryRelation: "AND",
56 },
57 };
58 params.queryOptions = JSON.stringify(queryOptions);
59 //根据子系统code获取子系统详细信息
60 getAction(api.subsystem, params).then((res) => {
61 if (res.status === 1) {
62 this.productName = res.content[0].name;
63 this.$store.dispatch("products/setData", res.content[0].code);
64 sessionStorage.setItem("products", res.content[0].code)
65 } else {
66 this.$message.error({ message: res.message, showClose: true });
67 } 39 }
68 }); 40 }
69 },
70 mounted () {
71 // this.checkUserName();
72 }, 41 },
73 methods: { 42 methods: {
74 //记住用户名 43 //记住用户名
...@@ -87,30 +56,20 @@ export default { ...@@ -87,30 +56,20 @@ export default {
87 } 56 }
88 }, 57 },
89 login (user) { 58 login (user) {
90 var self = this; 59 var self = this
91 this.$refs[user].validate((valid) => { 60 this.$refs[user].validate(async (valid) => {
92 if (valid) { 61 if (valid) {
93 loginIn(self.user.account, self.user.password) 62 let res = await loginIn(self.user.account, self.user.password)
94 .then((res) => { 63 if (res.status == 1) {
95 if (res.status === 1) {
96 //存储token
97 localStorage.setItem("token", `Bearer ${res.content}`); 64 localStorage.setItem("token", `Bearer ${res.content}`);
98 //登录成功后需判断有无重定向,没有重定向则跳转首页 65 //登录成功后需判断有无重定向,没有重定向则跳转首页
99 console.log(this.$route.query.redirect);
100 this.$router.replace(this.$route.query.redirect || "/home"); 66 this.$router.replace(this.$route.query.redirect || "/home");
101 } else { 67 }
102 //错误处理
103 } 68 }
104 }) 69 })
105 .catch((error) => {
106 // console.dir(error);
107 });
108 } 70 }
109 }); 71 }
110 }, 72 }
111 },
112 components: {},
113 };
114 </script> 73 </script>
115 <style scoped lang="scss"> 74 <style scoped lang="scss">
116 .username, 75 .username,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 <div class="bg"> 2 <div class="bg">
3 <div class="title"> 3 <div class="title">
4 <img src="../../image/bdclogo.png" alt=""> 4 <img src="../../image/bdclogo.png" alt="">
5 <h2>{{ productName }}</h2> 5 <h2>{{ BASE_API.TITLE }}</h2>
6 </div> 6 </div>
7 <div class="login-inner-bg login"> 7 <div class="login-inner-bg login">
8 <div class="user_style"> 8 <div class="user_style">
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
12 <el-input class="username" v-model="user.account" placeholder="请输入用户名"></el-input> 12 <el-input class="username" v-model="user.account" placeholder="请输入用户名"></el-input>
13 </el-form-item> 13 </el-form-item>
14 <el-form-item prop="password"> 14 <el-form-item prop="password">
15 <el-input type="password" class="password" @keyup.native="login('user')" v-model="user.password" 15 <el-input type="password" class="password" v-model="user.password" placeholder="请输入密码"
16 placeholder="请输入密码" show-password></el-input> 16 show-password></el-input>
17 </el-form-item> 17 </el-form-item>
18 <el-form-item prop="yz"> 18 <!-- <el-form-item prop="yz">
19 <div class="flex-container"> 19 <div class="flex-container">
20 <div class="flex-input"> 20 <div class="flex-input">
21 <el-input class="yz" @keyup.native="login('user')" v-model="user.yz" placeholder="请输入验证码"></el-input> 21 <el-input class="yz" @keyup.native="login('user')" v-model="user.yz" placeholder="请输入验证码"></el-input>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
26 <font id="renovate" @click="verification">换一批</font> 26 <font id="renovate" @click="verification">换一批</font>
27 </div> 27 </div>
28 </div> 28 </div>
29 </el-form-item> 29 </el-form-item> -->
30 <el-form-item class="login-btn"> 30 <el-form-item class="login-btn">
31 <el-button type="primary" style="width: 100%" @click="login('user')">登录</el-button> 31 <el-button type="primary" style="width: 100%" @click="login('user')">登录</el-button>
32 </el-form-item> 32 </el-form-item>
...@@ -37,10 +37,11 @@ ...@@ -37,10 +37,11 @@
37 </template> 37 </template>
38 38
39 <script> 39 <script>
40 import { getMenuInfo } from "@/api/user";
40 import { loginIn } from "@/api/login.js"; 41 import { loginIn } from "@/api/login.js";
41 import { api, getAction } from "@/api/manageApi"; 42 import { api, getAction } from "@/api/manageApi";
42 export default { 43 export default {
43 name: "Login", 44 name: "sbLogin",
44 data () { 45 data () {
45 return { 46 return {
46 user: { 47 user: {
...@@ -56,37 +57,6 @@ export default { ...@@ -56,37 +57,6 @@ export default {
56 }, 57 },
57 }; 58 };
58 }, 59 },
59 created () {
60 this.verification();
61 const params = {};
62 const queryOptions = {
63 conditionGroup: {
64 conditions: [
65 {
66 property: "code",
67 value: "BDCSBPT",
68 operator: "EQ",
69 },
70 ],
71 queryRelation: "AND",
72 },
73 };
74 params.queryOptions = JSON.stringify(queryOptions);
75 //根据子系统code获取子系统详细信息
76 getAction(api.subsystem, params).then((res) => {
77 if (res.status === 1) {
78 this.productName = res.content[0].name;
79 this.$store.dispatch("products/setData", res.content[0].code);
80
81 sessionStorage.setItem("products", res.content[0].code)
82 } else {
83 this.$message.error({ message: res.message, showClose: true });
84 }
85 });
86 },
87 mounted () {
88 // this.checkUserName();
89 },
90 methods: { 60 methods: {
91 verification () { 61 verification () {
92 let str = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ', code = '', i = 0; 62 let str = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ', code = '', i = 0;
...@@ -134,33 +104,23 @@ export default { ...@@ -134,33 +104,23 @@ export default {
134 } 104 }
135 }, 105 },
136 login (user) { 106 login (user) {
137 var self = this; 107 var self = this
138 this.$refs[user].validate((valid) => { 108 this.$refs[user].validate(async (valid) => {
139 if (valid) { 109 if (valid) {
140 loginIn(self.user.account, self.user.password) 110 let res = await loginIn(self.user.account, self.user.password)
141 .then((res) => { 111 if (res.status == 1) {
142 if (res.status === 1) { 112 let code = this.BASE_API.THEME == "sb" ? "BDCSBPT" : "BDCJGPT"
143 this.$store.dispatch('business/setInitRules', "layout1")
144 //存储token
145 localStorage.setItem("token", `Bearer ${res.content}`); 113 localStorage.setItem("token", `Bearer ${res.content}`);
146 this.$store.dispatch("products/setData", res.content[0].code); 114 const { result: getMenuData } = (await getMenuInfo(code)) || [];
147 sessionStorage.setItem("products", res.content[0].code) 115 let path1 = JSON.parse(getMenuData[0].metadata)?.path + '/' + JSON.parse(getMenuData[0].children[0].metadata)?.path
148 //登录成功后需判断有无重定向,没有重定向则跳转首页 116 //登录成功后需判断有无重定向,没有重定向则跳转首页
149 this.$router.replace(this.$route.query.redirect || "/jsbwcx/index"); 117 this.$router.replace(this.$route.query.redirect || path1);
150 } else { 118 }
151 console.log(res);
152 this.$message.error({ message: res.message })
153 } 119 }
154 }) 120 })
155 .catch((error) => {
156 // console.dir(error);
157 });
158 } 121 }
159 }); 122 }
160 }, 123 }
161 },
162 components: {},
163 };
164 </script> 124 </script>
165 <style scoped lang="scss"> 125 <style scoped lang="scss">
166 .username, 126 .username,
...@@ -182,8 +142,6 @@ export default { ...@@ -182,8 +142,6 @@ export default {
182 /deep/ .el-input__inner { 142 /deep/ .el-input__inner {
183 color: #000 !important; 143 color: #000 !important;
184 text-indent: 24px; 144 text-indent: 24px;
185 // border: 1px solid rgba(11, 161, 248, 0.4);
186 // background-color: rgba(6, 135, 205, 0.3) !important;
187 } 145 }
188 } 146 }
189 147
...@@ -350,4 +308,5 @@ export default { ...@@ -350,4 +308,5 @@ export default {
350 .inputUser .ivu-input { 308 .inputUser .ivu-input {
351 padding: 6px 24px !important; 309 padding: 6px 24px !important;
352 border: 1px solid #9f9f9f !important; 310 border: 1px solid #9f9f9f !important;
353 }</style> 311 }
312 </style>
......