前端去掉/index 配置

230 阅读1分钟

nginx配置修改


    ## 后端接口服务
    upstream api {
        server 10.9.48.232:9081 weight=5;
    }
    
    ## 前端
    server {
        listen       7777;
        server_name  localhost;
        ## 网关
        location ^~/api/ {
            proxy_set_header Host $host;
            proxy_set_header  X-Real-IP        $remote_addr;
            proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_set_header X-NginX-Proxy true;
            proxy_connect_timeout    600;
            proxy_read_timeout       600;
            proxy_send_timeout       600;
            ## 去前缀配置
            rewrite ^/api/(.*)$ /$1 break;
            proxy_pass http://api;
        }
        
        ## acap
        location /framework/{
            alias  /static/webroot/;
        }

        ## 前端
        location / {
            root   /static/drugstoreVue;
            index  index.html index.htm;
        }    

    }

acap 修改

drugconfig.json 参数修改

"getAllRedisCodeList":"/api/admin/system/dict/data/getAllRedisCodeList",
"getSingleCodeList":"/api/admin/system/dict/data/getSingleCodeList/{prm_aaa100}",

所有 global.js 4个文件都改 修改添加前缀

unieap.REST_PREFIX = "/api";

/*
 *  用户可配置项
 *  
 *  @summary:
 *   api请求的前缀,使用api文档时可统一定义访问前缀
 *   
 */
unieap.API_PREFIX = "api";

vue 配置 修改

config.js // 后端api config.base_api = '/api'