luohairen
2024-11-14 80889e7f32480ae76896f3bd042baa82a0fc9e9e
src/views/class-management/ClassStaff.vue
@@ -53,22 +53,6 @@
        label="电话"
      >
      </el-table-column>
      <el-table-column
        label="操作"
        align="center"
        width="300px"
      >
        <template slot-scope="scope">
          <el-button @click="handlerEditStudent(scope.row)" type="warning" size="small">编辑</el-button>
          <el-popconfirm
            style="margin: 0 5px"
            title="确定要删除该成员吗?"
            @confirm="remove(scope.row.id)"
          >
            <el-button slot="reference" type="danger" size="small" v-show="false">删除</el-button>
          </el-popconfirm>
        </template>
      </el-table-column>
    </el-table>
    <div
      class="block"
@@ -177,12 +161,16 @@
      }
    }
    var validatePhone = (rule, value, callback) => {
      // 手机号验证逻辑
      const phoneRegex = /^1[3-9]\d{9}$/;
      // 手机号和座机号验证逻辑
      const phoneRegex = /^1[3-9]\d{9}$/; // 手机号格式
      const landlineRegex = /^\d{3,4}-?\d{7,8}$/; // 座机号格式,可以包含区号和可选的连字符
      if (!value) {
        callback(new Error('请输入手机号'));
        callback(new Error('请输入手机号或座机号'));
      } else if (!phoneRegex.test(value)) {
        callback(new Error('手机号格式不正确'));
        if (!landlineRegex.test(value)){
          callback(new Error('手机号或座机号格式不正确'));
        }
      } else {
        callback();
      }