1. var publicFnAxios = {
    2. post : function(url,data){
    3. return new Promise(function(resolve, reject){
    4. var that = this;
    5. data.api_version = '';
    6. Axios.post(url,data).then(function (res) {
    7. //判断是否是登录过期==》后台登录过期返回code=1100
    8. if(res.data.code==1100){
    9. sessionStorage.clear();
    10. router.replace({
    11. path: "/"
    12. })
    13. }
    14. resolve(res);
    15. }).catch(function (error) {
    16. reject(error);
    17. });
    18. })
    19. },
    20. get : function(url,data){
    21. return new Promise(function(resolve, reject){
    22. var that = this;
    23. data.api_version = '';
    24. Axios.get(url,data).then(function (res) {
    25. //判断是否是登录过期==》后台登录过期返回code=1100
    26. if(res.data.code==1100){
    27. sessionStorage.clear();
    28. router.replace({
    29. path: "/"
    30. })
    31. }
    32. resolve(res);
    33. }).catch(function (error) {
    34. reject(error);
    35. });
    36. })
    37. },
    38. }