给系统设置增加演示用户禁止操作的判断(再次优化)
This commit is contained in:
@@ -426,15 +426,29 @@
|
|||||||
* 检查当前用户是否是演示用户
|
* 检查当前用户是否是演示用户
|
||||||
*/
|
*/
|
||||||
function checkIsTestUser() {
|
function checkIsTestUser() {
|
||||||
var res = false;
|
var result = false;
|
||||||
var loginName = sessionStorage.getItem("loginName");
|
var demonstrateOpen = false;
|
||||||
if (loginName == "jsh") {
|
$.ajax({
|
||||||
$.messager.alert('提示', '演示用户禁止操作!', 'warning');
|
type: "get",
|
||||||
res = true;
|
url: "/user/getDemonstrateOpen",
|
||||||
} else {
|
dataType: "json",
|
||||||
res = false;
|
async: false, //设置为同步
|
||||||
|
success: function (res) {
|
||||||
|
if (res && res.code === 200) {
|
||||||
|
demonstrateOpen = res.data.demonstrateOpen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(demonstrateOpen) {
|
||||||
|
var loginName = sessionStorage.getItem("loginName");
|
||||||
|
if (loginName == "jsh") {
|
||||||
|
$.messager.alert('提示', '演示用户禁止操作!', 'warning');
|
||||||
|
result = true;
|
||||||
|
} else {
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ public class UserController {
|
|||||||
@Value("${manage.roleId}")
|
@Value("${manage.roleId}")
|
||||||
private Integer manageRoleId;
|
private Integer manageRoleId;
|
||||||
|
|
||||||
|
@Value("${demonstrate.open}")
|
||||||
|
private boolean demonstrateOpen;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
@@ -56,6 +59,27 @@ public class UserController {
|
|||||||
private static final String HTTP = "http://";
|
private static final String HTTP = "http://";
|
||||||
private static final String CODE_OK = "200";
|
private static final String CODE_OK = "200";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启演示状态,默认关闭
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/getDemonstrateOpen")
|
||||||
|
public BaseResponseInfo getDemonstrateOpen(HttpServletRequest request) {
|
||||||
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
|
try {
|
||||||
|
Map<String, Object> data = new HashMap<String, Object>();
|
||||||
|
data.put("demonstrateOpen", demonstrateOpen);
|
||||||
|
res.code = 200;
|
||||||
|
res.data = data;
|
||||||
|
} catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
res.code = 500;
|
||||||
|
res.data = "获取失败";
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/login")
|
@PostMapping(value = "/login")
|
||||||
public BaseResponseInfo login(@RequestParam(value = "loginName", required = false) String loginName,
|
public BaseResponseInfo login(@RequestParam(value = "loginName", required = false) String loginName,
|
||||||
@RequestParam(value = "password", required = false) String password,
|
@RequestParam(value = "password", required = false) String password,
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ manage.roleId=10
|
|||||||
tenant.userNumLimit=5
|
tenant.userNumLimit=5
|
||||||
#租户允许创建的单据数
|
#租户允许创建的单据数
|
||||||
tenant.billsNumLimit=200
|
tenant.billsNumLimit=200
|
||||||
|
#演示模式-默认为false
|
||||||
|
demonstrate.open=false
|
||||||
#插件配置
|
#插件配置
|
||||||
plugin.runMode=prod
|
plugin.runMode=prod
|
||||||
plugin.pluginPath=plugins
|
plugin.pluginPath=plugins
|
||||||
|
|||||||
Reference in New Issue
Block a user