!5 修复登出账号、修改密码等操作会清除uuid的bug 感谢大佬ray 提出的pr
Merge pull request !5 from master
This commit is contained in:
		
						commit
						1fa264b0bf
					
				@ -5,7 +5,6 @@
 | 
				
			|||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
import {v4 as uuidv4} from 'uuid';
 | 
					 | 
				
			||||||
import {getCategoryTree} from '@/api/goods.js'
 | 
					import {getCategoryTree} from '@/api/goods.js'
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
  updated() {
 | 
					  updated() {
 | 
				
			||||||
@ -17,13 +16,7 @@ export default {
 | 
				
			|||||||
      })
 | 
					      })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  mounted() {
 | 
					
 | 
				
			||||||
    let uuid = this.getStore('uuid');
 | 
					 | 
				
			||||||
    if (!uuid) {
 | 
					 | 
				
			||||||
      uuid = uuidv4();
 | 
					 | 
				
			||||||
      this.setStore('uuid', uuid);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -4,6 +4,7 @@ import { router } from "../router/index";
 | 
				
			|||||||
import { Message } from "view-design";
 | 
					import { Message } from "view-design";
 | 
				
			||||||
import Cookies from "js-cookie";
 | 
					import Cookies from "js-cookie";
 | 
				
			||||||
import { handleRefreshToken } from "../api/index";
 | 
					import { handleRefreshToken } from "../api/index";
 | 
				
			||||||
 | 
					import {v4 as uuidv4} from 'uuid';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 统一请求路径前缀
 | 
					// 统一请求路径前缀
 | 
				
			||||||
export const commonUrl =
 | 
					export const commonUrl =
 | 
				
			||||||
@ -29,7 +30,11 @@ service.interceptors.request.use(
 | 
				
			|||||||
        ...config.params
 | 
					        ...config.params
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const uuid = getStore("uuid");
 | 
					    let uuid = getStore("uuid");
 | 
				
			||||||
 | 
					    if (!uuid) {
 | 
				
			||||||
 | 
					      uuid = uuidv4();
 | 
				
			||||||
 | 
					      setStore('uuid', uuid);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    config.headers["uuid"] = uuid;
 | 
					    config.headers["uuid"] = uuid;
 | 
				
			||||||
    return config;
 | 
					    return config;
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user