|
@@ -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>
|