Ver código fonte

修改图片人员

callm 3 meses atrás
pai
commit
591841ef81
2 arquivos alterados com 17 adições e 1 exclusões
  1. 16 0
      src/main.js
  2. 1 1
      src/views/assembly/centerRight1.vue

+ 16 - 0
src/main.js

@@ -83,6 +83,22 @@ Vue.prototype.$http.interceptors.request.use(config => {
   return config;
 });
 
+Vue.prototype.$httpImg =  axios.create({
+  //设置20秒超时时间
+  timeout: 20000,
+  baseURL: '/mes', //这里写后端地址http://localhost:8099/uas/  https://mes.ubtob.net:8099/mes/
+  responseType: 'blob'
+});
+Vue.prototype.$httpImg.interceptors.request.use(config => {
+  //为请求头添加x-access-token 字段为服务端返回的token
+  if(sessionStorage.getItem('x-access-token')) {
+    config.headers['x-access-token'] = sessionStorage.getItem('x-access-token');
+  }
+  config.headers['username'] = encodeURIComponent(sessionStorage.getItem('username'));
+  config.headers['password'] = sessionStorage.getItem('password');
+  config.headers['sob'] = sessionStorage.getItem('sob');
+  return config;
+});
 
 Vue.prototype.isFullScreen = false;
 // response interceptor 响应拦截

+ 1 - 1
src/views/assembly/centerRight1.vue

@@ -176,6 +176,7 @@ export default {
     },
     async fetchImage(param,url) {
       try {
+        console.log(param);
         // 假设你已经有了token,并且知道图片的URL
         let response = await this.$httpImg.get("/kanban/download.action?path="+url+"&_noc=1");
         if (response.status === 200) {
@@ -232,7 +233,6 @@ $box-width: 640px;
       flex-wrap: wrap;
       >div:first-child{
         flex: 1;
-        background-color: red;
         border-radius: 5px 5px 0 0;
         >img{
           width: 100%;