Bläddra i källkod

Merge branch 'beta' of https://git.cocorobo.cn/CocoRoboLabs/pbl-teacher-table into beta

SanHQin 2 dagar sedan
förälder
incheckning
db6764bf36
1 ändrade filer med 38 tillägg och 1 borttagningar
  1. 38 1
      src/components/pages/sz/teacher.vue

+ 38 - 1
src/components/pages/sz/teacher.vue

@@ -125,9 +125,19 @@
           <el-table-column label="操作" width="220px">
             <template slot-scope="scope">
               <div style="display: flex;">
+                <el-button class="de_button" type="primary" size="small" style="
+                      width: auto;
+                      padding: 5px !important;
+                      line-height: 15px;
+                    " @click="iniPassword(scope.row.userid)">初始化密码</el-button>
                 <el-button
-                  size="mini"
+                  class="de_button"
+                  size="small"
                   type="primary"
+                  style="
+                      width: auto;
+                      padding:0 10px !important;
+                      line-height: 15px;"
                   @click="modifyDiaBtn(scope.row)"
                   >修改</el-button
                 >
@@ -416,6 +426,33 @@ export default {
           console.error("请求失败,错误信息:", err);
         });
     },
+    iniPassword(id) {
+      this.$confirm("确定" + "初始化" + "此教师的密码吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          let params = [
+            {
+              uid: id,
+              pa: 'Coco1234',
+            },
+          ];
+          this.ajax
+            .post(this.$store.state.api + "iniPassword", params)
+            .then((res) => {
+              this.$message({
+                message: "初始化密码成功!",
+                type: "success",
+              });
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        })
+        .catch(() => { });
+    },
     getEmailWithAt(email) {
       const regex = /@[^@]+$/;  // 匹配最后一个 @ 及其后的内容
       const match = email.match(regex);