11wqe1 1 mese fa
parent
commit
15b83a2a9c

+ 4 - 0
src/assets/liyuan/edit.svg

@@ -0,0 +1,4 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M7 7H6C5.46957 7 4.96086 7.21071 4.58579 7.58579C4.21071 7.96086 4 8.46957 4 9V18C4 18.5304 4.21071 19.0391 4.58579 19.4142C4.96086 19.7893 5.46957 20 6 20H15C15.5304 20 16.0391 19.7893 16.4142 19.4142C16.7893 19.0391 17 18.5304 17 18V17" stroke="#BDBDBD" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M16 4.99998L19 7.99998M20.385 6.58499C20.7788 6.19114 21.0001 5.65697 21.0001 5.09998C21.0001 4.543 20.7788 4.00883 20.385 3.61498C19.9912 3.22114 19.457 2.99988 18.9 2.99988C18.343 2.99988 17.8088 3.22114 17.415 3.61498L9 12V15H12L20.385 6.58499Z" stroke="#BDBDBD" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>

+ 4 - 0
src/assets/liyuan/lpot.svg

@@ -0,0 +1,4 @@
+<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="15" cy="15" r="15" fill="#0663FE"/>
+<path d="M12.5001 7.5H17.5001L19.1667 9.16667H22.5001C22.7211 9.16667 22.9331 9.25446 23.0893 9.41074C23.2456 9.56702 23.3334 9.77899 23.3334 10V21.6667C23.3334 21.8877 23.2456 22.0996 23.0893 22.2559C22.9331 22.4122 22.7211 22.5 22.5001 22.5H7.50008C7.27907 22.5 7.06711 22.4122 6.91083 22.2559C6.75455 22.0996 6.66675 21.8877 6.66675 21.6667V10C6.66675 9.77899 6.75455 9.56702 6.91083 9.41074C7.06711 9.25446 7.27907 9.16667 7.50008 9.16667H10.8334L12.5001 7.5ZM15.0001 20.8333C16.3262 20.8333 17.5979 20.3065 18.5356 19.3689C19.4733 18.4312 20.0001 17.1594 20.0001 15.8333C20.0001 14.5073 19.4733 13.2355 18.5356 12.2978C17.5979 11.3601 16.3262 10.8333 15.0001 10.8333C13.674 10.8333 12.4022 11.3601 11.4645 12.2978C10.5269 13.2355 10.0001 14.5073 10.0001 15.8333C10.0001 17.1594 10.5269 18.4312 11.4645 19.3689C12.4022 20.3065 13.674 20.8333 15.0001 20.8333ZM15.0001 19.1667C14.116 19.1667 13.2682 18.8155 12.6431 18.1904C12.0179 17.5652 11.6667 16.7174 11.6667 15.8333C11.6667 14.9493 12.0179 14.1014 12.6431 13.4763C13.2682 12.8512 14.116 12.5 15.0001 12.5C15.8841 12.5 16.732 12.8512 17.3571 13.4763C17.9822 14.1014 18.3334 14.9493 18.3334 15.8333C18.3334 16.7174 17.9822 17.5652 17.3571 18.1904C16.732 18.8155 15.8841 19.1667 15.0001 19.1667Z" fill="black"/>
+</svg>

+ 3 - 0
src/assets/liyuan/tele.svg

@@ -0,0 +1,3 @@
+<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M5.51667 8.99167C6.71667 11.35 8.65 13.2833 11.0083 14.4833L12.8417 12.65C13.075 12.4167 13.4 12.35 13.6917 12.4417C14.625 12.75 15.625 12.9167 16.6667 12.9167C16.8877 12.9167 17.0996 13.0045 17.2559 13.1607C17.4122 13.317 17.5 13.529 17.5 13.75V16.6667C17.5 16.8877 17.4122 17.0996 17.2559 17.2559C17.0996 17.4122 16.8877 17.5 16.6667 17.5C12.9094 17.5 9.30609 16.0074 6.64932 13.3507C3.99256 10.6939 2.5 7.09057 2.5 3.33333C2.5 3.11232 2.5878 2.90036 2.74408 2.74408C2.90036 2.5878 3.11232 2.5 3.33333 2.5H6.25C6.47101 2.5 6.68298 2.5878 6.83926 2.74408C6.99554 2.90036 7.08333 3.11232 7.08333 3.33333C7.08333 4.375 7.25 5.375 7.55833 6.30833C7.65 6.6 7.58333 6.925 7.35 7.15833L5.51667 8.99167Z" fill="#969BA3"/>
+</svg>

+ 442 - 0
src/components/pages/liyuan/page/userInfoL.vue

@@ -0,0 +1,442 @@
+<template>
+  <div
+    class="pb_content"
+  >
+  <div class="leftInfo">
+    <div class="leftInfoCon">
+      <div style="position: relative;width: 80px;height: 80px;">
+        <img style="width: 100%;height: 100%;object-fit: cover;border-radius: 50%;" :src="ruleForm.headportrait" alt="">
+        <img style="position: absolute;right: 0;bottom: 0;" src="../../../../assets/liyuan/lpot.svg" alt="">
+      </div>
+      <div>{{ruleForm.name}}</div>
+      <div style="display: flex;flex-direction: column;gap: 10px;">
+        <div style="font-family: Inter;
+          font-weight: 600;
+          font-size: 16px;
+          line-height: 100%;
+          text-align: center;
+          color: #969BA3;
+        ">{{ ruleForm.type }}</div>
+        <div style="font-family: Inter;
+          font-weight: 300;
+          font-size: 16px;
+          line-height: 100%;
+          text-align: center;
+          color: #969BA3;
+          display: flex;
+          align-items: center;
+          gap: 6px;
+          "
+        ><img src="../../../../assets/liyuan/tele.svg" alt="">{{ ruleForm.phone ? ruleForm.phone :'暂无' }}
+      </div>
+      </div>
+    </div>
+  </div>
+  <div class="rightCon">
+    <div style="display: flex;justify-content: space-between;align-items: center;margin-bottom: 40px;">
+        <span style="font-family: Inter;
+        font-weight: 600;
+        font-size: 20px;
+        line-height: 100%;
+        text-align: center;
+        ">基础信息</span>
+        <img src="../../../../assets/liyuan/edit.svg" @click="editInfo" style="cursor: pointer;" alt="">
+    </div>
+
+    <el-form
+      :model="ruleForm"
+      ref="ruleForm"
+      label-width="100px"
+      label-position="left"
+    >
+      <el-form-item label="姓名" prop="name">
+        <el-input
+          v-model="ruleForm.name"
+          style="width: 300px"
+          :disabled="type"
+          placeholder="请输入姓名"
+        ></el-input>
+        
+      </el-form-item>
+
+      <el-form-item label="性别" prop="sex">
+        <el-select
+          v-model="ruleForm.sex"
+          clearable
+          :disabled="type"
+        >
+          <el-option label="男" value="男"></el-option>
+          <el-option label="女" value="女"></el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="组织" prop="org">
+        <el-select
+          v-model="ruleForm.org"
+          clearable
+          placeholder="暂无组织"
+          :disabled="type"
+        >
+          <el-option
+            v-for="item in orgJuri"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id"
+          >
+          </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="教研室" v-if="ruleForm.type == '老师'">
+        <el-select
+          v-model="ccName"
+          clearable
+          placeholder="暂无教研室"
+          :disabled="type"
+        >
+        </el-select>
+      </el-form-item>
+      
+      <el-form-item label="学校" prop="sBySchool">
+        <el-select
+          v-model="ruleForm.sBySchool"
+          clearable
+          placeholder="请选择学校"
+          :disabled="type"
+        >
+      
+          <el-option :value="ruleForm.sBySchool"> </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="职务" prop="type">
+        <el-select
+          v-model="ruleForm.type"
+          clearable
+          placeholder="请选择身份"
+          :disabled="type"
+        >
+          <el-option :value="ruleForm.type"> </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="司龄" prop="type">
+        <el-select
+          v-model="ruleForm.type"
+          clearable
+          placeholder="请选择身份"
+          :disabled="type"
+        >
+          <el-option :value="ruleForm.type"> </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="简介" prop="type">
+        <el-input
+          type="textarea"
+          resize="none"
+          rows="6"
+          placeholder="简介"
+          :disabled="type"
+        ></el-input>
+      </el-form-item>
+    </el-form>
+  </div>
+
+  </div>
+</template>
+
+<script>
+export default {
+  data() {
+    var validatePass = (rule, value, callback) => {
+      if (value == "") {
+        return;
+      }
+      var reg =
+        /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/;
+      if (!reg.test(value)) {
+        callback(new Error("请输入正确的邮箱"));
+      } else {
+        callback();
+      }
+    };
+    var validatePass1 = (rule, value, callback) => {
+      var reg = /^1\d{10}$/;
+      if (!reg.test(value)) {
+        callback(new Error("请输入正确的手机号码"));
+      } else {
+        callback();
+      }
+    };
+    return {
+      type: true,
+      ruleForm: {
+        name: "",
+        type: "",
+        sex: "男",
+        intro: "",
+        // mail: "",
+        phone: "",
+        sBySchool: "",
+        org: "",
+        headportrait: "",
+      },
+      ccName: "",
+      opassword: "",
+      password: "",
+      password1: "",
+      isLook: false,
+      eyeOff: require("../../../../assets/icon/eyeOff.png"),
+      eye: require("../../../../assets/icon/eye.png"),
+      tx: require("../../../../assets/avatar.png"),
+      userinfo: "",
+      schoolJuri: [],
+      orgJuri: [],
+      userid: this.$route.query.userid,
+      rules: {
+        pass: [{ validator: validatePass, trigger: "blur" }],
+        name: [{ required: true, message: "请输入你的名字", trigger: "blur" }],
+        mail: [
+          {
+            required: true,
+            message: "请输入你的邮箱",
+            trigger: "blur",
+          },
+        ],
+        phone: [
+          // { required: true, message: "请输入你的手机号码", trigger: "blur" },
+
+          {
+            validator: validatePass1,
+            trigger: "blur",
+          },
+        ],
+      },
+    };
+  },
+  methods: {
+    editInfo(){
+      this.type = !this.type
+    },
+    getSchool() {
+      this.isLoading = true;
+      let params = {
+        page: this.page,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectOrg", params)
+        .then((res) => {
+          this.isLoading = false;
+          this.schoolJuri = res.data[0];
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    changeEye() {
+      this.isLook = !this.isLook;
+    },
+    getOrg() {
+      this.isLoading = true;
+      this.ajax
+        .get(this.$store.state.api + "selectorg2", "")
+        .then((res) => {
+          this.isLoading = false;
+          this.orgJuri = res.data[0];
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    submitForm(formName) {
+      this.$refs[formName];
+      let params = [
+        {
+          userid: this.userid,
+          username: this.ruleForm.name,
+          type: this.ruleForm.type == "老师" ? 1 : 2,
+          oid: this.ruleForm.sBySchool,
+          phone: this.ruleForm.phone,
+          // intro: this.ruleForm.intro,
+          intro: "",
+          sex: this.ruleForm.sex == "男" ? "0" : "1",
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "updatePblMessage2", params)
+        .then((res) => {
+          this.$message({
+            message: "修改成功",
+            type: "success",
+          });
+           window.topU.postMessage({ close: "1" }, "*");
+          this.getUser();
+        })
+        .catch((err) => {
+          this.$message.error("修改失败");
+          console.error(err);
+        });
+    },
+    getUser() {
+      let params = { uid: this.userid };
+      this.ajax
+        .get(this.$store.state.api + "getUser", params)
+        .then((res) => {
+          this.userinfo = res.data[0][0];
+          // this.$cookies.set("userInfo", this.userinfo, -1);
+          this.$cookies.set("teacherInfo", res.data[0][0], -1);
+          this.$store.commit("update", ["userInfo", this.userinfo]);
+          console.log(res.data[0][0]);
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    getDetail() {
+      let params = { uid: this.userid };
+      this.ajax
+        .get(this.$store.state.api + "getUser", params)
+        .then((res) => {
+          if (res.data[0][0]) {
+            res.data[0][0].sex = res.data[0][0].sex ? "女" : "男";
+            this.ruleForm = res.data[0][0];
+            this.ruleForm.org = res.data[0][0].org
+              ? res.data[0][0].org.split(",")[0]
+              : "";
+            this.ruleForm.type =
+              res.data[0][0].type == 1
+                ? "老师"
+                : res.data[0][0].type == 2
+                ? "学生"
+                : "管理员";
+            this.getCcName(res.data[0][0].organizeid);
+            console.log(res.data[0][0]);
+          }
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    getCcName(oid) {
+      let params = { oid: oid };
+      this.ajax
+        .get(this.$store.state.api + "selectTeacherOfficeBySchool", params)
+        .then((res) => {
+          var cBox = res.data[0];
+          var str = this.ruleForm.cclassid;
+          var arr = str.split(",");
+          for (var k = 0; k < cBox.length; k++) {
+            for (var i = 0; i < arr.length; i++) {
+              if (cBox[k].id == arr[i] && cBox[k].parentid == '6') {
+                if (this.ccName == "") {
+                  this.ccName = cBox[k].name;
+                } else {
+                  this.ccName += "," + cBox[k].name;
+                }
+              }
+            }
+          }
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    updatePassword() {
+      const reg = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[A-Za-z\d]{8,16}$/;
+      if (!reg.test(this.password)) {
+        this.$message.error("密码长度为8-16位,且包含大小写字母");
+        return;
+      } else if (this.password != this.password1) {
+        this.$message.error("两次新密码不相同");
+        return;
+      }
+      let params = [
+        {
+          userid: this.userid,
+          opassword: this.opassword,
+          password: this.password,
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "updatePassword", params)
+        .then((res) => {
+          if (res.data[0] && res.data[0].success == 1) {
+            this.$message.success("修改成功");
+            this.opassword = "";
+            this.password = "";
+            this.password1 = "";
+          } else {
+            this.$message.error("修改失败,原密码不正确");
+          }
+        })
+        .catch((err) => {
+          this.$message.error("修改失败");
+          console.error(err);
+        });
+    },
+  },
+  created() {
+    this.getSchool();
+    this.getOrg();
+    this.getDetail();
+  },
+};
+</script>
+
+<style scoped>
+.pb_content{
+  display: flex;
+  gap: 20px;
+  height: 100%;
+  width: 100%;
+  background: #fff;
+  padding: 20px;
+  box-sizing: border-box;
+}
+.leftInfo{
+  width: 20%;
+}
+.leftInfoCon{
+  box-sizing: border-box;
+  display: flex;
+  justify-content: center;
+  flex-direction: column;
+  align-items: center;
+  box-shadow: 0px 4px 20px 0px #0000001A;
+  background: #fff;
+  border-radius: 12px;
+  padding-top: 40px;
+  padding-right: 50px;
+  padding-bottom: 40px;
+  padding-left: 50px;
+  gap: 19px;
+
+}
+.rightCon{
+  width: 80%;
+  box-shadow: 0px 4px 20px 0px #0000001A;
+  border-radius: 12px;
+  padding-top: 40px;
+  padding-right: 50px;
+  padding-bottom: 40px;
+  padding-left: 50px;
+  box-sizing: border-box;
+}
+
+.rightCon >>> .el-select{
+  width: 100%;
+}
+
+.rightCon >>> .el-input{
+  width: 100% !important;
+}
+.rightCon >>> .el-form-item{
+    margin-bottom: 15px !important;
+}
+.rightCon >>> .el-form-item__label{
+  color: #000 !important;
+}
+</style>