大屏项目初始化
This commit is contained in:
@@ -58,52 +58,27 @@ const pwdRules = reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
if (!isMounted.value || !pwdFormRef.value) return
|
if (!isMounted.value || !pwdFormRef.value || submitPromise) return
|
||||||
if (submitPromise) {
|
try {
|
||||||
submitPromise = null
|
submitPromise = true
|
||||||
return
|
await pwdFormRef.value.validate()
|
||||||
}
|
const reqParams = {
|
||||||
|
oldPasswd: pwdForm.oldPassword,
|
||||||
submitPromise = new Promise(async (resolve) => {
|
password: pwdForm.newPassword,
|
||||||
try {
|
userId: userStore.loginUser?.userId || ''
|
||||||
let valid = true
|
}
|
||||||
await pwdFormRef.value.validate().catch(() => {
|
const res = await updatePasswd(reqParams)
|
||||||
valid = false
|
await new Promise(res => setTimeout(res, 800))
|
||||||
ElMessage.error('表单验证失败,请检查输入内容')
|
isMounted.value && emit('success')
|
||||||
})
|
return true
|
||||||
|
} catch (error) {
|
||||||
if (!valid || !isMounted.value) {
|
console.error('修改密码接口异常:', error)
|
||||||
submitPromise = null
|
return false
|
||||||
return resolve(false)
|
} finally {
|
||||||
}
|
if (isMounted.value) {
|
||||||
|
|
||||||
let confirmResult = false
|
|
||||||
if (!confirmResult || !isMounted.value) {
|
|
||||||
submitPromise = null
|
|
||||||
return resolve(false)
|
|
||||||
}
|
|
||||||
const reqParams = {
|
|
||||||
oldPasswd :pwdForm.oldPassword,
|
|
||||||
password : pwdForm.newPassword,
|
|
||||||
userId : userStore.loginUser?.userId || '',
|
|
||||||
}
|
|
||||||
const res = await updatePasswd(reqParams);
|
|
||||||
await new Promise(res => setTimeout(res, 800))
|
|
||||||
if (isMounted.value) {
|
|
||||||
emit('success')
|
|
||||||
resolve(true)
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
if (isMounted.value) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
resolve(false)
|
|
||||||
} finally {
|
|
||||||
submitPromise = null
|
submitPromise = null
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
return submitPromise
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.mini.mybigscreen.Auth;
|
package com.mini.mybigscreen.Auth;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.mini.mybigscreen.Model.LoginRequest;
|
import com.mini.mybigscreen.Model.LoginRequest;
|
||||||
import com.mini.mybigscreen.Model.Result;
|
import com.mini.mybigscreen.Model.Result;
|
||||||
@@ -30,9 +31,9 @@ public class userController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/userLogin")
|
@PostMapping("/userLogin")
|
||||||
public Result<?> getUserInfo(@RequestBody LoginRequest loginRequest, HttpServletRequest request) {
|
public Result<?> getUserInfo(@RequestBody LoginRequest loginRequest, HttpServletRequest request) {
|
||||||
QueryWrapper<HomeUser> queryWrapper = new QueryWrapper<>();
|
LambdaQueryWrapper<HomeUser> queryWrapper = new LambdaQueryWrapper<HomeUser>()
|
||||||
queryWrapper.eq("user_name", loginRequest.getUsername())
|
.eq(HomeUser::getUserName, loginRequest.getUsername())
|
||||||
.eq("password", AesUtil.encrypt(loginRequest.getPassword()));
|
.eq(HomeUser::getPassword, AesUtil.encrypt(loginRequest.getPassword()));
|
||||||
HomeUser user = userService.getOne(queryWrapper, true);
|
HomeUser user = userService.getOne(queryWrapper, true);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
String token = KeyUtil.ObjKey(125, 0);
|
String token = KeyUtil.ObjKey(125, 0);
|
||||||
@@ -50,9 +51,9 @@ public class userController {
|
|||||||
|
|
||||||
@PostMapping("/editPasswd")
|
@PostMapping("/editPasswd")
|
||||||
public Result<?> getUserSave(String userId, String oldPasswd, String password) {
|
public Result<?> getUserSave(String userId, String oldPasswd, String password) {
|
||||||
QueryWrapper<HomeUser> query = new QueryWrapper<>();
|
LambdaQueryWrapper<HomeUser> query = new LambdaQueryWrapper<HomeUser>()
|
||||||
query.eq("user_id", userId)
|
.eq(HomeUser::getUserId, userId)
|
||||||
.eq("password", AesUtil.encrypt(oldPasswd));
|
.eq(HomeUser::getPassword, AesUtil.encrypt(password));
|
||||||
HomeUser user = userService.getOne(query, true);
|
HomeUser user = userService.getOne(query, true);
|
||||||
if (ObjectUtils.isEmpty(user)) {
|
if (ObjectUtils.isEmpty(user)) {
|
||||||
return Result.error("旧密码输入错误");
|
return Result.error("旧密码输入错误");
|
||||||
|
|||||||
Reference in New Issue
Block a user