| | |
| | | import { encrypt } from '@/utils/jsencrypt' |
| | | |
| | | // 登录方法 |
| | | export function login(username, password, code, uuid,type, mobile) { |
| | | export function login(username, password, code, uuid,type, mobile,hospId) { |
| | | password = encrypt(password); |
| | | const data = { |
| | | username, |
| | |
| | | uuid, |
| | | type, |
| | | mobile, |
| | | hospId |
| | | } |
| | | return request({ |
| | | url: '/login', |
| | | headers: { |
| | | isToken: false |
| | | isToken: false, |
| | | hospId:hospId |
| | | }, |
| | | method: 'post', |
| | | data: data |
| | |
| | | return request({ |
| | | url: '/cus/login', |
| | | headers: { |
| | | isToken: false |
| | | isToken: false, |
| | | }, |
| | | method: 'post', |
| | | params: data |
| | |
| | | // 在免登录白名单,直接进入 |
| | | next() |
| | | } else { |
| | | next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 |
| | | // next(`/login?redirect=${to.fullPath}&hospId=${to.meta.routerType}`) // 否则全部重定向到登录页 |
| | | next({ |
| | | path:"/login", |
| | | query:{ |
| | | redirect:to.fullPath, |
| | | hospId:"xamjyy" |
| | | } |
| | | }) |
| | | NProgress.done() |
| | | } |
| | | } |
| | |
| | | children: [ |
| | | { |
| | | path: '/redirect/:path(.*)', |
| | | component: () => import('@/views/redirect') |
| | | component: () => import('@/views/redirect'), |
| | | }, |
| | | { |
| | | path: '/emer', |
| | |
| | | path: 'index', |
| | | component: () => import('@/views/index'), |
| | | name: 'Index', |
| | | meta: { title: '首页', icon: 'dashboard', affix: true } |
| | | meta: { title: '首页', icon: 'dashboard', affix: true ,} |
| | | // routerType:"xamjyy", |
| | | } |
| | | ] |
| | | }, |
| | |
| | | name: '', |
| | | avatar: '', |
| | | roles: [], |
| | | permissions: [] |
| | | permissions: [], |
| | | // routeId: null |
| | | }, |
| | | |
| | | mutations: { |
| | |
| | | }, |
| | | SET_PERMISSIONS: (state, permissions) => { |
| | | state.permissions = permissions |
| | | } |
| | | }, |
| | | // SET_ROUTE_ID(state, id) { |
| | | // state.routeId = id; |
| | | // } |
| | | }, |
| | | |
| | | actions: { |
| | |
| | | const uuid = userInfo.uuid |
| | | const type = userInfo.type |
| | | const mobile = userInfo.mobile |
| | | const hospId = userInfo.hospId |
| | | return new Promise((resolve, reject) => { |
| | | if(userInfo.username.length === 12){ |
| | | getlogin(username, password, code, uuid,type,mobile).then(res => { |
| | | getlogin(username, password, code, uuid,type,mobile,hospId).then(res => { |
| | | setToken(res.token) |
| | | commit('SET_TOKEN', res.token); |
| | | resolve(res) |
| | |
| | | reject(error) |
| | | }) |
| | | }else{ |
| | | login(username, password, code, uuid,type,mobile).then(res => { |
| | | login(username, password, code, uuid,type,mobile,hospId).then(res => { |
| | | setToken(res.token) |
| | | commit('SET_TOKEN', res.token) |
| | | // commit('SET_ROUTE_ID', hospId) |
| | | resolve(res) |
| | | }).catch(error => { |
| | | reject(error) |
| | |
| | | commit('SET_TOKEN', '') |
| | | commit('SET_ROLES', []) |
| | | commit('SET_PERMISSIONS', []) |
| | | // commit('SET_ROUTE_ID', []) |
| | | removeToken() |
| | | resolve() |
| | | }).catch(error => { |
| | |
| | | import { tansParams, blobValidate } from "@/utils/ruoyi"; |
| | | import cache from '@/plugins/cache' |
| | | import { saveAs } from 'file-saver' |
| | | import Cookies from "js-cookie" |
| | | |
| | | |
| | | let downloadLoadingInstance; |
| | | // 是否显示重新登录 |
| | | export let isRelogin = { show: false }; |
| | | |
| | | axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' |
| | | |
| | | // 创建axios实例 |
| | | const service = axios.create({ |
| | | // axios中请求配置有baseURL选项,表示请求URL公共部分 |
| | |
| | | const isRepeatSubmit = (config.headers || {}).repeatSubmit === false |
| | | if (getToken() && !isToken) { |
| | | config.headers['Authorization'] = 'Bearer ' + getToken() |
| | | console.log(store) |
| | | config.headers['hospId'] = Cookies.get("hospId"); |
| | | } |
| | | if (config.method === 'get' && config.params) { |
| | | let url = config.url + '?' + tansParams(config.params); |
| | |
| | | username: "", |
| | | password: "", |
| | | mobile: false, |
| | | hospId:"", |
| | | // username:"13800138008", |
| | | // password:"888888", |
| | | rememberMe: false, |
| | |
| | | created() { |
| | | this.getstate(); |
| | | this.getCookie(); |
| | | this.loadAll(); |
| | | }, |
| | | methods: { |
| | | getstate() { |
| | |
| | | }) |
| | | |
| | | }, |
| | | loadAll(){ |
| | | this.loginForm.hospId = this.$route.query.hospId |
| | | Cookies.set("hospId", this.loginForm.hospId); |
| | | }, |
| | | |
| | | hide() { |
| | | // this.loginForm.username = "10001"; |