设置镜像源
npm config set registry https://registry.npm.taobao.org
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-saas
npm 修改库地址
npm config set registry https://registry.npm.taobao.org
npm config set sass_binary_site https://npm.taobao.org/mirros/node-sass
前期配置
切换淘宝镜像源
npm config set registry https://registry.npm.taobao.org
安装node sass的镜像地址
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass
github.com/TaleLin
开源项目 收藏网址
https://www.cnblogs.com/zyw-205520/p/4771253.html
https://www.imooc.com/video/22958
## fixed: tableName bug ✅cms_ 表名不一致,导致登录失败!
cms-koa/app/api/cms/user.js
cms-koa/app/model/user.js
用户不存在,
# login table
root 123456
# user table
root root
admin admin
# koa-imooc 代码冗余 bug
throw new NotFound({ msg: '用户不存在', errorCode: 10021 });
mysql 没有密码,怎么版
root
520imooc
-- ----------------------------
-- 插入超级管理员
-- 插入root分组
-- ----------------------------
BEGIN;
INSERT INTO cms_user(id, username, nickname)
VALUES (1, 'root', 'root');
INSERT INTO cms_user_identity (id, user_id, identity_type, identifier, credential)
VALUES (1, 1, 'USERNAME_PASSWORD', 'root',
'sha1$c419e500$1$84869e5560ebf3de26b6690386484929456d6c07');
-- 123456 sha1$c419e500$1$84869e5560ebf3de26b6690386484929456d6c07
module.exports = {
db: {
database: 'lin-cms',
host: 'localhost',
dialect: 'mysql',
port: 3306,
username: 'root',
password: '123456',
logging: false,
timezone: '+08:00'
},
secret:
'\x88W\xf09\x91\x07\x98\x89\x87\x96\xa0A\xc68\xf9\xecJJU\x17\xc5V\xbe\x8b\xef\xd7\xd8\xd3\xe6\x95*4'
};
/**
* 存储tokens
* @param {string} accessToken
* @param {string} refreshToken
*/
export function saveTokens(accessToken, refreshToken) {
localStorage.setItem('access_token', `Bearer ${accessToken}`)
localStorage.setItem('refresh_token', `Bearer ${refreshToken}`)
}
/**
* 存储access_token
* @param {string} accessToken
*/
export function saveAccessToken(accessToken) {
localStorage.setItem('access_token', `Bearer ${accessToken}`)
}
/**
* 获得某个token
* @param {string} tokenKey
*/
export function getToken(tokenKey) {
return localStorage.getItem(tokenKey)
}
/**
* 移除token
*/
export function removeToken() {
localStorage.removeItem('access_token')
localStorage.removeItem('refresh_token')
}
https://codeload.github.com/TaleLin/lin-cms-koa/zip/master
https://codeload.github.com/TaleLin/lin-cms-vue/zip/master
git clone -b imooc-island
npm config set registry https://registry.npm.taobao.org
npm config set sass_binary_site https://npm.taobao.org/mirros/node-sass
npm config set registry https://registry.npm.taobao.org
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass
也可以使用cnpm, 安装cnpm命令
npm install cnpm -g --registry=https://registry.npm.taobao.org
aaaaa