打开ideal
1.在后端项目jeecg-boot-module-system\src\main\java\org\jeecg\modules中创建test文件夹
2.在test文件夹中创建JeecgTestController Java类
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/test/jeecgTest")
@Slf4j
public class JeecgTestController {
/**
* hello world
*
* @param id
* @return
*/
@GetMapping(value = "/hello")
public Result<String> hello() {
Result<String> result = new Result<String>();
result.setResult("Hello World!");
result.setSuccess(true);
log.info("------------Hello world------");
return result;
}
}
3.在jeecg-boot-module-system\src\main\java\org\jeecg\config\ShiroConfig.java拦截器中允许访问刚才的controller,设置如下
4.运行后端项目,测试如下
5.
http://localhost:8080/jeecg-boot/swagger-ui.html#/
模仿postman发送get/post等请求
打开webstrom
1.打开前端项目
在ant-design-vue-jeecg\src\views\jeecg\tablist中建立test.vue
2.前后端项目运行在前端访问
图中test.vue中的代码是最终结果先不用管,但test.vue需要有基本的组件结构(如下)
<template>
</template>
<script>
</script>
<style>
</style>
3.登录
4.配置菜单
5.授权
6.刷新页面
7.完善webstrom建立的test.vue文件
<template>
<div>
{{ message }} hhhhh
</div>
</template>
<script>
import { getAction } from '@/api/manage'
export default {
data() {
return {
message: ''
}
},
created() {//页面渲染前加载,mutation页面渲染后加载
getAction('/test/jeecgTest/hello').then((res) => {
console.log('------------')
console.log(res)
this.message = res.result;
})
}
}
</script>
<style>
</style>
测试成功