pengwei
2025-03-12 18fcb8ad28f583e3e1b99b23e4f7d9e1833dcd83
ÏîÄ¿´úÂë/client/src/views/system/UserInfo.vue
@@ -42,7 +42,9 @@
        <el-row :gutter="2" style="height: 2.2rem">
          <el-col :span="3">
            <el-form-item label="登录账号:">
              <span style="font-size: 1rem; font-weight: bold">dsfuis</span>
              <span style="font-size: 1rem; font-weight: bold">{{
                userInfo.userName
              }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="3"
@@ -101,7 +103,7 @@
              </template>
              <el-input
                size="small"
                v-model="form.name"
                v-model="form.userName"
                placeholder="请输入"
                style="width: 18.375rem"
              />
@@ -122,7 +124,7 @@
                >
              </template>
              <el-input
                v-model="form.name"
                v-model="form.phoneNo"
                size="small"
                placeholder="请输入"
                style="width: 18.375rem"
@@ -150,6 +152,7 @@
            action="#"
            list-type="picture-card"
            :auto-upload="false"
            :limit="3"
          >
            <el-icon><Plus /></el-icon>
@@ -208,10 +211,10 @@
      <template #title>
        <div style="font-size: 1.25rem; font-weight: bold">密码修改</div>
      </template>
      <el-form :model="form">
      <el-form :model="Passwordform" ref="PasswordformRef" :rules="rules">
        <el-form-item>
          <el-input
            v-model="form.name"
            v-model="Passwordform.oldPwd"
            autocomplete="off"
            placeholder="请输入原密码"
            style="width: 21.25rem; height: 2.8125rem; font-size: 1rem"
@@ -219,7 +222,7 @@
        </el-form-item>
        <el-form-item>
          <el-input
            v-model="form.name"
            v-model="Passwordform.newPwd"
            autocomplete="off"
            placeholder="请输入新密码"
            style="width: 21.25rem; height: 2.8125rem; font-size: 1rem"
@@ -227,7 +230,7 @@
        </el-form-item>
        <el-form-item>
          <el-input
            v-model="form.name"
            v-model="newPwd"
            autocomplete="off"
            placeholder="确认密码"
            style="width: 21.25rem; height: 2.8125rem; font-size: 1rem"
@@ -240,7 +243,7 @@
          style="display: flex; justify-content: center"
        >
          <el-button
            @click="dialogVisible = false"
            @click="clickPassword(PasswordformRef)"
            type="primary"
            style="
              width: 21.25rem;
@@ -257,27 +260,54 @@
</template>
<script setup>
import { ref, reactive } from "vue";
import { GetUserInfo, UpdatePassword, UpdateUser } from "@/api/user";
import { ElMessage } from "element-plus";
const formInline = reactive({
  user: "",
  region: "",
  date: "",
});
const form = reactive({
  name: "",
  region: "",
  date1: "",
  date2: "",
  delivery: false,
  type: [],
  resource: "",
  desc: "",
});
const form = ref({});
const newPwd = ref("");
const onSubmit = () => {
  // UpdateUser().then((res) => {});
  console.log(form.value);
  console.log("submit!");
};
const rules = reactive({
  oldPwd: [{ required: true, message: "请输入旧密码", trigger: "blur" }],
  newPwd: [{ required: true, message: "请输入新密码", trigger: "blur" }],
});
const PasswordformRef = ref();
const Passwordform = ref({
  oldPwd: "",
  newPwd: "",
});
const clickPassword = async (formEl) => {
  if (!formEl) return;
  await formEl.validate((valid, fields) => {
    if (valid) {
      UpdatePassword(Passwordform.value).then((res) => {
        ElMessage({
          message: "修改成功",
          type: "success",
        });
        console.log(res);
      });
    } else {
      console.log("error submit!", fields);
    }
  });
};
const dialogVisible = ref(false);
const userInfo = ref({});
GetUserInfo({}).then((res) => {
  userInfo.value = res.data;
  form.value = res.data;
  console.log(res);
});
</script>
<style lang="scss" scoped>
.personal {