Watch 7 Star 11 Fork 8

一枚码农 / len-blog-uiApache-2.0

Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
vue 博客 ui 后端 lenosp spread retract

http://blog.lenosp.cn

Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

len-blog

lenos 博客 vue ui 采用 vue iview ui

Build 项目

lenosp 博客模块
1、采用 vue iview 后端数据储存采用lenosp 前后分离 模块分为 App展示单页 和Admin 管理单页 admin管理页功能简单

管理单页权限采用jwt token 权限验证:
路由拦截(admin.js)
router.beforeEach((to, from, next) => {
  iView.LoadingBar.start();
  if (to.path === '/login') {
    next();
  } else {
    let auth = localStorage.getItem('auth');
    if (!auth) {
      next('/login')
    } else {
      next();
    }
  }

});
axios 对请求过滤
axios.interceptors.request.use(function (config) {
  config.headers.Authorization = localStorage.getItem('auth');
  return config;
}, function (error) {
  return Promise.reject(error);
});
axios.interceptors.response.use(
  response => {
    return response;
  },
  error => {
    if (error.response) {
      if (error.response.status === 401) {
        router.push('/login');
      }
    }
    return Promise.reject(error.response.data)
  });

启动

后端支撑
  启动lenosp 开源地址:https://gitee.com/bweird/lenosp
  启动lenosp
ui启动
修改 /config/index.js 映射端口配置
proxyTable: {
      '/api': {
        target: 'http://localhost:8089',
        changeOrigin: true,
        pathRewrite: {
          '^/api' : ''
      }
    }
  },
  
npm install
npm run dev

Comments ( 0 )

You need to Sign in for post a comment

Help Search

Gitee_you_jiang_zheng_wen Zheng_wen_close