杜函宇 1 year ago
commit be231b287f

@ -0,0 +1,7 @@
// 召回
import login from "./myAPI/login.js";
export default {
login
};

@ -0,0 +1,29 @@
import request from "@/utils/request";
// 本地
// let api = "API"
// 线上
let api = location.origin
export default {
frimLogin() {
return request({
baseURL: process.env.VUE_APP_USER_LOGIN,
url: "/pharmaceuticals/login",
headers: {
"Content-Type": "application/json",
isToken: true,
repeatSubmit: false,
},
method: "POST",
timeout: 60000,
data: {
pdma: "MTExMTEx",
urne: "2112042170015",
},
});
},
};

@ -39,6 +39,8 @@ import VueMeta from 'vue-meta'
import DictData from '@/components/DictData'
//计算rem基准
import '@/utils/rem.js'
// 引用api
import API from '@/api/index.js'
// 全局方法挂载
@ -51,6 +53,7 @@ Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
Vue.prototype.$api = API
// 全局组件挂载
Vue.component('DictTag', DictTag)
@ -66,6 +69,15 @@ Vue.use(plugins)
Vue.use(VueMeta)
DictData.install()
// 临时获取token
let token = async()=>{
let Authentication = await API.login.frimLogin();
localStorage.setItem(
"MSSM-LIAONING__TOKEN",
Authentication.data.result.userToken
);
}
token()
/**
* If you don't want to use mock-server
* you want to use MockJs for mock api

@ -3,7 +3,7 @@ import store from './store'
import { Message } from 'element-ui'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import { getToken } from '@/utils/auth'
import { setToken } from '@/utils/auth'
import { isRelogin } from '@/utils/request'
NProgress.configure({ showSpinner: false })
@ -11,6 +11,7 @@ NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/register']
router.beforeEach((to, from, next) => {
setToken()
NProgress.start()
next()
})

@ -1,6 +1,6 @@
import Cookies from 'js-cookie'
const TokenKey = 'Admin-Token'
const TokenKey = 'MSSM-LIAONING__TOKEN'
export function getToken() {
return Cookies.get(TokenKey)

@ -27,9 +27,7 @@ service.interceptors.request.use(config => {
// 是否需要防止数据重复提交
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
if (getToken() && !isToken) {
// config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
config.headers['Authorization'] = 'UT:e0273df4-d5e3-4dd7-87c6-286e94ccde1d' // 让每个请求携带自定义token 请根据实际情况自行修改
config.headers['Authentication'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
// get请求映射params参数
if (config.method === 'get' && config.params) {

Loading…
Cancel
Save