|
@@ -110,21 +110,28 @@ const upyunInstance = axios.create({});
|
|
|
upyunInstance.defaults.headers.common = {};
|
|
|
// upyunInstance.defaults.headers.common["Authorization"] = UPYUN_HEADER_AUTH;
|
|
|
|
|
|
+let __upyunAuth = null;
|
|
|
upyunInstance.interceptors.request.use(
|
|
|
config => {
|
|
|
- return qmInstance
|
|
|
- .get("/api/ecs_oe_student_face/upyun")
|
|
|
- .then(res => {
|
|
|
- config.baseURL = res.data.bucketUrl;
|
|
|
- const authorization =
|
|
|
- "Basic " +
|
|
|
- btoa(atob(res.data.upyunOperator) + ":" + atob(res.data.upyunCred));
|
|
|
- config.headers.common["Authorization"] = authorization;
|
|
|
- return config;
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- console.log(err);
|
|
|
- });
|
|
|
+ if (__upyunAuth) {
|
|
|
+ config.headers.common["Authorization"] = __upyunAuth;
|
|
|
+ return config;
|
|
|
+ } else {
|
|
|
+ return qmInstance
|
|
|
+ .get("/api/ecs_oe_student_face/upyun")
|
|
|
+ .then(res => {
|
|
|
+ config.baseURL = res.data.bucketUrl;
|
|
|
+ const authorization =
|
|
|
+ "Basic " +
|
|
|
+ btoa(atob(res.data.upyunOperator) + ":" + atob(res.data.upyunCred));
|
|
|
+ __upyunAuth = authorization;
|
|
|
+ config.headers.common["Authorization"] = __upyunAuth;
|
|
|
+ return config;
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
error => {
|
|
|
Message.error({
|