#
luxiaotao1123
2024-02-28 4bf7bf638a38f27a913493e1588d5253565214bc
#
4个文件已修改
2个文件已添加
85 ■■■■ 已修改文件
zy-asrs-flow/config/routes.ts 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/User/Login/index.jsx 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/account/setting/components/security.jsx 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/home/index.jsx 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/UserController.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/param/ResetPwdParam.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/config/routes.ts
@@ -13,7 +13,7 @@
export default [
  {
    path: '/',
    redirect: '/system/user',
    redirect: '/home',
  },
  {
    path: '/user',
@@ -27,10 +27,10 @@
    ],
  },
  {
    path: '/welcome',
    name: 'welcome',
    path: '/home',
    name: 'home',
    icon: 'smile',
    component: './Welcome',
    component: './home',
  },
  {
    path: '*',
zy-asrs-flow/src/pages/User/Login/index.jsx
@@ -44,6 +44,7 @@
    const [form] = Form.useForm();
    const [loginType, setLoginType] = useState('account');
    const [status, setStatus] = useState(200);
    const [errDesc, setErrDesc] = useState('');
    const [rememberMe, setRememberMe] = useState(() => {
        const storedValue = localStorage.getItem('rememberMe');
        return storedValue !== null ? JSON.parse(storedValue) : true;
@@ -128,6 +129,7 @@
                return;
            }
            setStatus(r.code);
            setErrDesc(r.msg);
        } catch (error) {
            console.log(error);
            message.error(intl.formatMessage({
@@ -228,7 +230,7 @@
                )}
                {status !== 200 && loginType === 'account' && (
                    <LoginMessage
                        content={'账户或密码错误'}
                        content={errDesc}
                    />
                )}
                {loginType === 'phone' && (
zy-asrs-flow/src/pages/account/setting/components/security.jsx
@@ -7,13 +7,32 @@
import { useModel } from '@umijs/max';
import Http from '@/utils/http';
const resetPwd = async (val) => {
  const hide = message.loading('正在更新');
  try {
    const resp = await Http.doPost('api/user/update', val);
    if (resp.code === 200) {
      message.success('更新成功');
      return true;
    } else {
      message.error(resp.msg);
      return false;
    }
  } catch (error) {
    message.error('配置失败请重试!');
    return false;
  } finally {
    hide();
  }
};
const SecurityView = () => {
  const [form] = Form.useForm();
  const { initialState } = useModel('@@initialState');
  const { currentUser } = initialState || {};
  const handleFinish = (values) => {
    console.log(values);
    resetPwd({...values, userId: currentUser.id});
  }
  return (
@@ -50,6 +69,14 @@
                required: true,
                message: '请输入新密码!',
              },
              {
                validator(_, value) {
                  if (value.length >= 4 && value.length <= 16) {
                    return Promise.resolve();
                  }
                  return Promise.reject(new Error('新密码必须是4到16个字符!'));
                },
              },
            ]}
          />
          <ProFormText.Password
@@ -61,6 +88,12 @@
                required: true,
                message: '请再次输入新密码!',
              },
              {
                validator(_, value) {
                  if (form.getFieldValue('newPwd') === value) return Promise.resolve();
                  return Promise.reject(new Error('两次输入的密码不相符!'));
                }
              }
            ]}
          />
        </ProForm>
zy-asrs-flow/src/pages/home/index.jsx
New file
@@ -0,0 +1,10 @@
const Home = () => {
    return (
        <>
            <h1>Home</h1>
        </>
    )
}
export default Home;
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/UserController.java
@@ -9,6 +9,7 @@
import com.zy.asrs.wcs.common.domain.BaseParam;
import com.zy.asrs.wcs.common.domain.KeyValVo;
import com.zy.asrs.wcs.common.domain.PageParam;
import com.zy.asrs.wcs.system.controller.param.ResetPwdParam;
import com.zy.asrs.wcs.system.entity.User;
import com.zy.asrs.wcs.system.entity.UserRole;
import com.zy.asrs.wcs.system.service.UserRoleService;
@@ -186,9 +187,13 @@
    @PreAuthorize("hasAuthority('system:user:update')")
    @OperationLog("重置密码")
    @PostMapping("/user/reset/pwd")
    public R resetPwd(@RequestBody User user) {
        if (!Cools.isEmpty(user.getPassword())) {
            user.setPassword(userService.encodePassword(user.getPassword()));
    public R resetPwd(@RequestBody ResetPwdParam param) {
        User user = userService.getById(param.getId());
        if (!Cools.isEmpty(param.getOldPwd())) {
        }
        if (!Cools.isEmpty(param.getPassword())) {
            user.setPassword(userService.encodePassword(param.getPassword()));
        }
        user.setUpdateBy(getLoginUserId());
        user.setUpdateTime(new Date());
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/param/ResetPwdParam.java
New file
@@ -0,0 +1,17 @@
package com.zy.asrs.wcs.system.controller.param;
import lombok.Data;
/**
 * Created by vincent on 2/28/2024
 */
@Data
public class ResetPwdParam {
    private Long id;
    private String oldPwd;
    private String password;
}