分类 PHP 下的文章

vue用的是history模式,导致刷新404,解决方法:

1.服务器是Apache,在代码文件目录里的.htaccess输入(网站那里的伪静态配置看情况):
 <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      RewriteRule ^index\.html$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ ./index.html [L]
</IfModule>
2.服务器是nginx,网站那里的配置文件里(不是伪静态配置)加入(加在root下就行,大概第七行左右):
location / {
       try_files $uri $uri/ /index.html;
    }

只需要在wk.js里把这个uploadExcel里的onUploadSuccess修改下就行了

'onUploadSuccess': function(file, data, response) {
                if(data.code == 200){
                    wk.success('导入成功!',excel_url);
                }else{
                    layer.msg(data.msg,{icon:2,time:2000,shade:0.1},function(index){
                        location.reload()
                    });
                }
            },
返回
return json(['code'=>0,'msg'=> '无此分类']);
or
return json(['code'=>200]);