-
+
@@ -24,7 +24,7 @@
{{$t('login.logIn')}}
- {{$t('login.username')}} : admin
+ {{$t('login.username')}} : visitor
{{$t('login.password')}} : 123456
@@ -36,7 +36,6 @@
import { isvalidUsername } from '@/utils/validate'
import LangSelect from '@/components/LangSelect'
import SocialSign from './socialsignin'
-import { login } from '@/api/system'
export default {
components: { LangSelect, SocialSign },
@@ -44,21 +43,21 @@ export default {
data() {
const validateUsername = (rule, value, callback) => {
if (!isvalidUsername(value)) {
- callback(new Error('Please enter the correct user name'))
+ callback(new Error('请输入用户名'))
} else {
callback()
}
}
const validatePassword = (rule, value, callback) => {
if (value.length < 6) {
- callback(new Error('The password can not be less than 6 digits'))
+ callback(new Error('密码不能少于6位'))
} else {
callback()
}
}
return {
loginForm: {
- username: 'admin',
+ username: 'visitor',
password: '123456'
},
loginRules: {
@@ -82,16 +81,11 @@ export default {
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true
- login({
- loginName: this.loginForm.username,
- loginPassword: this.loginForm.password
- }).then(() => {
- this.$store.dispatch('LoginByUsername', this.loginForm).then(() => {
- this.loading = false
- this.$router.push({ path: '/' })
- }).catch(() => {
- this.loading = false
- })
+ this.$store.dispatch('LoginByUsername', this.loginForm).then(() => {
+ this.loading = false
+ this.$router.push({ path: '/' })
+ }).catch(() => {
+ this.loading = false
})
} else {
console.log('error submit!!')
diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/UserController.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/UserController.java
index f18a6033..6097d59c 100644
--- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/UserController.java
+++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/UserController.java
@@ -28,7 +28,9 @@ import fun.asgc.neutrino.core.db.page.PageQuery;
import fun.asgc.neutrino.core.web.annotation.GetMapping;
import fun.asgc.neutrino.core.web.annotation.RequestMapping;
import fun.asgc.neutrino.core.web.annotation.RestController;
+import fun.asgc.neutrino.proxy.server.controller.req.UserInfoReq;
import fun.asgc.neutrino.proxy.server.controller.req.UserListReq;
+import fun.asgc.neutrino.proxy.server.controller.res.UserInfoRes;
import fun.asgc.neutrino.proxy.server.controller.res.UserListRes;
import fun.asgc.neutrino.proxy.server.service.UserService;
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
@@ -59,4 +61,9 @@ public class UserController {
return userService.list(req);
}
+
+ @GetMapping("info")
+ public UserInfoRes info() {
+ return userService.info();
+ }
}
diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/req/UserInfoReq.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/req/UserInfoReq.java
new file mode 100644
index 00000000..a5390a17
--- /dev/null
+++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/req/UserInfoReq.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2022 aoshiguchen
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package fun.asgc.neutrino.proxy.server.controller.req;
+
+/**
+ * 用户信息请求
+ * @author: wen.y
+ * @date: 2022/8/27
+ */
+public class UserInfoReq {
+}
diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/res/UserInfoRes.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/res/UserInfoRes.java
new file mode 100644
index 00000000..83dd1a26
--- /dev/null
+++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/res/UserInfoRes.java
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2022 aoshiguchen
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package fun.asgc.neutrino.proxy.server.controller.res;
+
+import fun.asgc.neutrino.core.db.annotation.Id;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 用户信息响应
+ * @author: wen.y
+ * @date: 2022/8/27
+ */
+@Accessors(chain = true)
+@Data
+public class UserInfoRes {
+ private Integer id;
+ /**
+ * 用户名
+ */
+ private String name;
+ /**
+ * 登录名
+ */
+ private String loginName;
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+ /**
+ * 更新时间
+ */
+ private Date updateTime;
+}
diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/UserService.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/UserService.java
index 8b9c337d..668311b7 100644
--- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/UserService.java
+++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/UserService.java
@@ -35,6 +35,7 @@ import fun.asgc.neutrino.proxy.server.controller.req.LoginReq;
import fun.asgc.neutrino.proxy.server.controller.req.UserListReq;
import fun.asgc.neutrino.proxy.server.controller.res.LicenseListRes;
import fun.asgc.neutrino.proxy.server.controller.res.LoginRes;
+import fun.asgc.neutrino.proxy.server.controller.res.UserInfoRes;
import fun.asgc.neutrino.proxy.server.controller.res.UserListRes;
import fun.asgc.neutrino.proxy.server.dal.UserLoginRecordMapper;
import fun.asgc.neutrino.proxy.server.dal.UserMapper;
@@ -136,4 +137,17 @@ public class UserService {
List list = userMapper.list();
return list;
}
+
+ public UserInfoRes info() {
+ UserDO userDO = userMapper.findById(SystemContextHolder.getUser().getId());
+ if (null == userDO) {
+ return null;
+ }
+ return new UserInfoRes()
+ .setId(userDO.getId())
+ .setName(userDO.getName())
+ .setLoginName(userDO.getLoginName())
+ .setCreateTime(userDO.getCreateTime())
+ .setUpdateTime(userDO.getUpdateTime());
+ }
}