1. admin-web 接入新的登陆接入

This commit is contained in:
YunaiV 2020-04-26 19:52:14 +08:00
parent eb86ae7cbc
commit 18180b3a01
12 changed files with 45 additions and 9 deletions

View File

@ -19,7 +19,7 @@ function basePathBuilder(proxys, basePath) {
} }
export default function(NODE_ENV, basePath) { export default function(NODE_ENV, basePath) {
NODE_ENV = 'prod'; // NODE_ENV = 'prod';
let proxys = NODE_ENV === 'development' || NODE_ENV === 'undefined' ? proxyDev : proxyProd; let proxys = NODE_ENV === 'development' || NODE_ENV === 'undefined' ? proxyDev : proxyProd;
if (basePath) { if (basePath) {
proxys = basePathBuilder(proxys, basePath); proxys = basePathBuilder(proxys, basePath);

View File

@ -1,7 +1,7 @@
// 开发环境的代理配置 // 开发环境的代理配置
module.exports = { module.exports = {
'/admin-api/': { '/system-api/': {
target: 'http://127.0.0.1:18083/', target: 'http://127.0.0.1:18083/',
// target: 'http://180.167.213.26:18083/', // target: 'http://180.167.213.26:18083/',
changeOrigin: true, changeOrigin: true,

View File

@ -1,7 +1,7 @@
// production 配置文件 // production 配置文件
module.exports = { module.exports = {
'/admin-api/': { '/system-api/': {
target: 'http://api.shop.iocoder.cn', target: 'http://api.shop.iocoder.cn',
changeOrigin: true, changeOrigin: true,
pathRewrite: {}, pathRewrite: {},

View File

@ -1,6 +1,7 @@
import { routerRedux } from 'dva/router'; import { routerRedux } from 'dva/router';
import { stringify } from 'qs'; import { stringify } from 'qs';
import { fakeAccountLogin, getFakeCaptcha } from '@/services/api'; import { getFakeCaptcha } from '@/services/api';
import { usernameAuthenticate } from '@/services/system';
import { setAuthority } from '@/utils/authority'; import { setAuthority } from '@/utils/authority';
import { getPageQuery } from '@/utils/utils'; import { getPageQuery } from '@/utils/utils';
import { reloadAuthorized } from '@/utils/Authorized'; import { reloadAuthorized } from '@/utils/Authorized';
@ -15,7 +16,7 @@ export default {
effects: { effects: {
*login({ payload }, { call, put }) { *login({ payload }, { call, put }) {
const response = yield call(fakeAccountLogin, payload); const response = yield call(usernameAuthenticate, payload);
yield put({ yield put({
type: 'changeLoginStatus', type: 'changeLoginStatus',
payload: response, payload: response,
@ -23,6 +24,8 @@ export default {
yield put(routerRedux.replace('/')); yield put(routerRedux.replace('/'));
debugger;
// Login successfully // Login successfully
if (response.code === 0) { if (response.code === 0) {

View File

@ -0,0 +1,10 @@
import { stringify } from '@/utils/request.qs';
import request from '@/utils/request';
export async function usernameAuthenticate(params) {
return request(`/system-api/admins/oauth2/username-authenticate?${stringify(params)}`, {
method: 'POST',
body: {},
});
}

View File

@ -138,7 +138,7 @@ export default function request(url, option) {
// 将登陆的 accessToken 放到 header // 将登陆的 accessToken 放到 header
const loginToken = getLoginToken(); const loginToken = getLoginToken();
if (loginToken && loginToken.accessToken if (loginToken && loginToken.accessToken
&& url.indexOf('/passport/login') === -1) { // TODO 芋艿临时这么加可能不是很优雅 && url.indexOf('/system-api/admins/oauth2/username-authenticate') === -1) { // TODO 芋艿临时这么加可能不是很优雅
const headers = { const headers = {
...newOptions.headers, ...newOptions.headers,
Authorization: `Bearer ${loginToken.accessToken}`, Authorization: `Bearer ${loginToken.accessToken}`,

View File

@ -16,8 +16,8 @@
<modules> <modules>
<module>system-application</module> <module>system-application</module>
<!-- <module>system-sdk</module>--> <!-- <module>system-sdk</module>-->
<!-- <module>system-service-api</module>--> <module>system-service-api</module>
<!-- <module>system-service-impl</module>--> <module>system-service-impl</module>
<module>system-rpc-api</module> <module>system-rpc-api</module>
<module>system-rpc</module> <module>system-rpc</module>
<module>system-rest</module> <module>system-rest</module>

View File

@ -27,5 +27,11 @@ public class RoleDO extends DeletableDO {
* 角色编码 * 角色编码
*/ */
private String code; private String code;
/**
* 角色类型
*
* TODO 需要补充
*/
private Integer type;
} }

View File

@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
//@RestController //@RestController
@RequestMapping("admins/file") @RequestMapping("admins/file")
@Api(tags = "文件模块") @Api(tags = "文件模块")
// TODO FROM 芋艿 to 小范挪下
public class AdminsFileController { public class AdminsFileController {
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());

View File

@ -0,0 +1,15 @@
package cn.iocoder.mall.system.rest.controller.admin;
import cn.iocoder.common.framework.constant.MallConstants;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(MallConstants.ROOT_PATH_ADMIN + "/admin")
@Api(tags = "管理员 - 管理员 API")
public class AdminsOAdminController {
}

View File

@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
@RestController @RestController
@RequestMapping("admins/sms/sign") @RequestMapping("admins/sms/sign")
@Api("短信服务(签名)") @Api("短信服务(签名)")
// TODO FROM 芋艿 to 小范挪下
public class AdminsSmsSignController { public class AdminsSmsSignController {
@Autowired @Autowired

View File

@ -3,7 +3,6 @@ package cn.iocoder.mall.system.rest.controller.admin;
import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.system.biz.bo.smsTemplate.ListSmsTemplateBO; import cn.iocoder.mall.system.biz.bo.smsTemplate.ListSmsTemplateBO;
import cn.iocoder.mall.system.biz.dto.smsTemplate.ListSmsTemplateDTO;
import cn.iocoder.mall.system.biz.service.sms.SmsService; import cn.iocoder.mall.system.biz.service.sms.SmsService;
import cn.iocoder.mall.system.rest.convert.sms.AdminsSmsConvert; import cn.iocoder.mall.system.rest.convert.sms.AdminsSmsConvert;
import cn.iocoder.mall.system.rest.request.smsTemplate.AddSmsTemplateRequest; import cn.iocoder.mall.system.rest.request.smsTemplate.AddSmsTemplateRequest;
@ -23,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
@RestController @RestController
@RequestMapping("admins/sms/template") @RequestMapping("admins/sms/template")
@Api("短信服务(短信模板)") @Api("短信服务(短信模板)")
// TODO FROM 芋艿 to 小范挪下
public class AdminsSmsTemplateController { public class AdminsSmsTemplateController {
@Autowired @Autowired