lsc 5 mesiacov pred
rodič
commit
5c1b16e3ef
1 zmenil súbory, kde vykonal 45 pridanie a 11 odobranie
  1. 45 11
      src/components/pages/sz/teacher.vue

+ 45 - 11
src/components/pages/sz/teacher.vue

@@ -363,21 +363,55 @@ export default {
   methods: {
     getUser() {
       
-      let params = {
-        userid: this.userid
-      };
-      // console.log(111,params);
+      // let params = {
+      //   userid: this.userid
+      // };
+      // // console.log(111,params);
+      // this.ajax
+      //   .get(this.$store.state.api + "selectUser", params)
+      //   .then(res => {
+      //     // console.log(res);
+      //     this.userSuffix = res.data[0][0].accountNumber.split("@")[1];
+      //     // console.log(this.userSuffix);
+      //   })
+      //   .catch(err => {
+      //     console.error(err);
+      //   });
+
+        let params = [
+        {
+          functionName: "select_Suffix", // 调用存储过程的名称
+          org: this.org, //组织id
+          oid: this.oid, //学校id
+        },
+      ];
+
+      // 发起请求
       this.ajax
-        .get(this.$store.state.api + "selectUser", params)
-        .then(res => {
-          // console.log(res);
-          this.userSuffix = res.data[0][0].accountNumber.split("@")[1];
-          // console.log(this.userSuffix);
+        .post(this.$store.state.api + "onlinePost", params)
+        .then((res) => {
+          console.log('getSuffix',res)
+          let data = res.data[0]
+          let orgData = res.data[1]
+
+          if(data.length > 0){
+            let ap = data[0].username
+            this.userSuffix =  this.getEmailWithAt(ap)[0]
+          } else if (orgData.length > 0) {
+            let ap = orgData[0].username
+            this.userSuffix =  this.getEmailWithAt(ap)[0]
+          }
+        
         })
-        .catch(err => {
-          console.error(err);
+        .catch((err) => {
+          console.error("请求失败,错误信息:", err);
         });
     },
+    getEmailWithAt(email) {
+      const regex = /@[^@]+$/;  // 匹配最后一个 @ 及其后的内容
+      const match = email.match(regex);
+      return match ? match : '';
+    },
     // 确定修改信息
     conModify() {
       if (!this.modifyDiaData.dName) {