This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { BrowserRouter as Router, Switch } from 'react-router-dom' | |
import routes from './routes' | |
import FancyRoute from './components/tools/FancyRoute' | |
const App = props => | |
<Router> | |
<Switch> | |
{routes.map((route, i) => | |
<FancyRoute key={i} {...route} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
componentWillMount() { | |
const menuTreeNode = this.renderMenu(MenuConfig) | |
this.setState({ | |
menuTreeNode | |
}) | |
} | |
renderMenu = (config) => { | |
return config.map((item) => { | |
if (item.children) { | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
td { | |
text-align:justify; | |
text-justify:distribute-all-lines;/*ie6-8*/ | |
text-align-last:justify;/* ie9*/ | |
-moz-text-align-last:justify;/*ff*/ | |
-webkit-text-align-last:justify;/*chrome 20+*/ | |
} | |
@media screen and (-webkit-min-device-pixel-ratio:0){/* chrome*/ | |
td:after { | |
content:"."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import { withRouter } from 'react-router' | |
import { Route, Redirect } from 'react-router-dom' | |
class AuthRouter extends Component { | |
render() { | |
const { component: Component, ...rest } = this.props | |
const isLogged = sessionStorage.getItem("isLogin") === "1" ? true : false; | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
做了 n 个 spa,给你一点意见: | |
1,登陆权限,一般来说这个是独立出来,不用 spa 做,就一个表单的事情,后面也容易做扩展,包括单点登录什么的; | |
2,登陆集成到 spa 里面,这个一般在请求加拦截,vuex 可以存 token,每次请求头带 token,后端校验 token 是否有效,如果修改了或者过期了,返回约定的字段标识,异步请求 axios 在返回 response 的时候优先拦截 token 校验,如果失效直接 vue-router 路由到登录页; | |
3,内部权限,子页面什么的,前端一般是打包好了文件,页面是全部的,但是有的页面需要权限控制是否能访问,这时候只能做 2 次校验,后端返回当前权限能访问的路由 or 页面,存 vuex,前端路由加 watch,每次切换跳转都要遍历一次; | |
4,接口权限,有的接口是不能提供给无权限的人使用的,比如抓包出来的;这时候后端做鉴权,返回约定的字段就行 | |
后台管理系统 | |
1. 维护页面菜单信息,名称,上下级关系,路由等; | |
2. 维护 API 信息,API 的名称,路由; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. 嵌套规则 (Nested Rules) | |
2. 父选择器 & (Referencing Parent Selectors: &) | |
3. 属性嵌套 (Nested Properties) | |
4. 变量 $ | |
5. 导入@import, | |
6. 控制指令 (Control Directives) | |
7. 混合指令 (Mixin Directives), | |
@mixin 定义(参数 $width(Arguments, 通过 $width : 1px, 设置default), 参数变量 … 声明(写在参数的最后方)) | |
@include 使用 | |
8. 函数指令 (Function Directives) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const merge = (target, source) => { | |
const keys = Object.keys(target); | |
keys.forEach(k => { | |
if (source.hasOwnProperty(k)) { | |
if (Object.prototype.toString.call(source[k]) === '[object Object]') { | |
merge(target[k], source[k]); | |
} else { | |
target[k] = source[k]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
我们在安装Python3(>=3.3)时,Python的安装包实际上在系统中安装了一个启动器py.exe,默认放置在文件夹C:\Windows\下面 | |
py -2 hello.py | |
py -3 hello.py | |
py.exe这个启动器允许你在代码中加入说明 | |
#! python2 | |
#! python3 | |
使用 | |
py hello.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.sudo rm -rf /usr/local/go | |
sudo rm -rf /usr/bin/go | |
2.wget https://dl.google.com/go/go1.10.4.linux-amd64.tar.gz | |
sudo tar -xzf go1.10.4.linux-amd64.tar.gz -C /usr/local | |
sudo ln -s /usr/local/go/bin/ /usr/bin/ | |
3.mkdir -p $HOME/go-workspace/src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. 克隆源码 | |
cd /usr/local | |
git clone https://github.com/inconshreveable/ngrok.git | |
2. 引入环境变量 | |
export GOPATH=/usr/local/ngrok/ #目录位置 | |
export NGROK_DOMAIN="ngrok.yourset.com" #你的ngrok服务二级域名 | |
3. 根据你的域名生成证书 | |
openssl genrsa -out rootCA.key 2048 |
OlderNewer