Merge branch 'master' into dev
Showing
10 changed files
with
133 additions
and
220 deletions
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 | <!-- | 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,61 +12,60 @@ | ... | @@ -12,61 +12,60 @@ |
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, |
22 | Navbar, | 22 | Navbar, |
23 | Sidebar, | 23 | Sidebar, |
24 | TagsView | 24 | TagsView |
25 | }, | 25 | }, |
26 | created () { | 26 | created () { |
27 | console.log("hhh"); | 27 | this.$store.dispatch("products/setData", "BDCJGPT"); |
28 | this.$store.dispatch("products/setData", "BDCJGPT"); | 28 | }, |
29 | }, | 29 | mixins: [ResizeMixin], |
30 | mixins: [ResizeMixin], | 30 | computed: { |
31 | computed: { | 31 | ...mapState({ |
32 | ...mapState({ | 32 | sidebar: state => state.app.sidebar, |
33 | sidebar: state => state.app.sidebar, | 33 | needTagsView: state => state.settings.tagsView, |
34 | needTagsView: state => state.settings.tagsView, | 34 | fixedHeader: state => state.settings.fixedHeader |
35 | fixedHeader: state => state.settings.fixedHeader | 35 | }) |
36 | }) | ||
37 | } | ||
38 | } | 36 | } |
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%; |
50 | width: 100%; | 49 | width: 100%; |
51 | min-width: 1280px; | 50 | min-width: 1280px; |
52 | background: url("~@/image/bg.png") no-repeat; | 51 | background: url("~@/image/bg.png") no-repeat; |
53 | background-size: 100% 100%; | 52 | background-size: 100% 100%; |
54 | padding: 12px; | 53 | padding: 12px; |
55 | box-sizing: border-box; | 54 | box-sizing: border-box; |
56 | 55 | ||
57 | &.mobile.openSidebar { | 56 | &.mobile.openSidebar { |
58 | position: fixed; | 57 | position: fixed; |
59 | top: 0; | 58 | top: 0; |
60 | } | ||
61 | } | 59 | } |
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; |
67 | 66 | ||
68 | .app-main { | 67 | .app-main { |
69 | height: 100%; | 68 | height: 100%; |
70 | } | ||
71 | } | 69 | } |
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,50 +23,39 @@ router.beforeEach(async (to, from, next) => { | ... | @@ -23,50 +23,39 @@ 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是否存在 | 29 | //请求用户信息 |
31 | const hasToken = localStorage.getItem("token"); | 30 | if (!hasUser) { |
32 | if (hasToken) { | 31 | store.dispatch("user/getUserInfo"); |
33 | //请求用户信息 | 32 | } |
34 | if (!hasUser) { | 33 | if (hasAddRoute) { |
35 | store.dispatch("user/getUserInfo"); | 34 | next(); |
36 | // import("@/styles/public.scss"); | 35 | } else { |
36 | //请求菜单 | ||
37 | const { result: getMenuData } = (await getMenuInfo(code)) || []; | ||
38 | const accessRoutes = await store.dispatch( | ||
39 | "permission/generateRoutes", | ||
40 | getMenuData | ||
41 | ); | ||
42 | router.addRoutes([ | ||
43 | ...accessRoutes, | ||
44 | { path: "*", redirect: "/404", hidden: true } | ||
45 | ]); | ||
46 | const routeTo = Cookies.get("routerTo"); | ||
47 | if (!hasAddDict) { | ||
48 | await store.dispatch("dict/generateDic"); | ||
37 | } | 49 | } |
38 | if (hasAddRoute) { | 50 | if (routeTo && routeTo !== "/" && routeTo !== "/sb" && routeTo !== "/jg") { |
39 | next(); | 51 | next({ ...to, replace: true }); |
40 | } else { | 52 | } else { |
41 | //请求菜单 | 53 | next(); |
42 | const { result: getMenuData } = (await getMenuInfo(code)) || []; | ||
43 | const accessRoutes = await store.dispatch( | ||
44 | "permission/generateRoutes", | ||
45 | getMenuData | ||
46 | ); | ||
47 | router.addRoutes([ | ||
48 | ...accessRoutes, | ||
49 | { path: "*", redirect: "/404", hidden: true }, | ||
50 | ]); | ||
51 | const routeTo = Cookies.get("routerTo"); | ||
52 | if (!hasAddDict) { | ||
53 | await store.dispatch("dict/generateDic"); | ||
54 | } | ||
55 | if (routeTo && routeTo !== "/") { | ||
56 | next({ ...to, replace: true }); | ||
57 | } else { | ||
58 | next("/home"); | ||
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) { | 64 | localStorage.setItem("token", `Bearer ${res.content}`); |
96 | //存储token | 65 | //登录成功后需判断有无重定向,没有重定向则跳转首页 |
97 | localStorage.setItem("token", `Bearer ${res.content}`); | 66 | this.$router.replace(this.$route.query.redirect || "/home"); |
98 | //登录成功后需判断有无重定向,没有重定向则跳转首页 | 67 | } |
99 | console.log(this.$route.query.redirect); | ||
100 | this.$router.replace(this.$route.query.redirect || "/home"); | ||
101 | } else { | ||
102 | //错误处理 | ||
103 | } | ||
104 | }) | ||
105 | .catch((error) => { | ||
106 | // console.dir(error); | ||
107 | }); | ||
108 | } | 68 | } |
109 | }); | 69 | }) |
110 | }, | 70 | } |
111 | }, | 71 | } |
112 | components: {}, | 72 | } |
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") | 113 | localStorage.setItem("token", `Bearer ${res.content}`); |
144 | //存储token | 114 | const { result: getMenuData } = (await getMenuInfo(code)) || []; |
145 | localStorage.setItem("token", `Bearer ${res.content}`); | 115 | let path1 = JSON.parse(getMenuData[0].metadata)?.path + '/' + JSON.parse(getMenuData[0].children[0].metadata)?.path |
146 | this.$store.dispatch("products/setData", res.content[0].code); | 116 | //登录成功后需判断有无重定向,没有重定向则跳转首页 |
147 | sessionStorage.setItem("products", res.content[0].code) | 117 | this.$router.replace(this.$route.query.redirect || path1); |
148 | //登录成功后需判断有无重定向,没有重定向则跳转首页 | 118 | } |
149 | this.$router.replace(this.$route.query.redirect || "/jsbwcx/index"); | ||
150 | } else { | ||
151 | console.log(res); | ||
152 | this.$message.error({ message: res.message }) | ||
153 | } | ||
154 | }) | ||
155 | .catch((error) => { | ||
156 | // console.dir(error); | ||
157 | }); | ||
158 | } | 119 | } |
159 | }); | 120 | }) |
160 | }, | 121 | } |
161 | }, | 122 | } |
162 | components: {}, | 123 | } |
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> | ... | ... |
-
Please register or sign in to post a comment