Selaa lähdekoodia

feat: NC-46: 业绩调整增加记录表.

kevin 1 vuosi sitten
vanhempi
commit
fbe3f8940b

+ 9 - 1
backendApi/modules/v1/models/AdminForm.php

@@ -42,7 +42,7 @@ class AdminForm extends Model
             [['adminName', 'oldPassword'], 'required', 'on'=>['noLoginModifyPassword']],
             [['adminName'], 'unique', 'targetClass'=>Admin::class, 'targetAttribute'=>'ADMIN_NAME', 'on'=>['add']],
             ['surePassword', 'compare', 'compareAttribute'=>'password', 'message' => '两次密码必须一致'],
-            [['email', 'email']]
+            [['email', 'isEmail']]
         ];
     }
 
@@ -62,6 +62,14 @@ class AdminForm extends Model
         return array_merge($parentScenarios, $customScenarios);
     }
 
+    public function isEmail($attribute)
+    {
+        $pattern = "/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/";
+        if ($this->email && !preg_match($pattern, $this->email)) {
+            $this->addError($attribute, '邮箱格式错误');
+        }
+    }
+
     public function attributeLabels()
     {
         return [

+ 1 - 1
backendEle/src/views/admin/edit.vue

@@ -28,7 +28,7 @@
           </el-input>
           <el-tag type="info">一行一个IP;可指定ip段,如192.168.0.1-255</el-tag>
         </el-form-item>
-        <el-form-item label="" v-show="isAddOrEdit">
+        <el-form-item label="邮箱" v-show="isAddOrEdit">
           <el-input v-model="form.email"></el-input>
         </el-form-item>
         <el-form-item label="备注" v-show="isAddOrEdit">

+ 1 - 1
backendEle/src/views/admin/index.vue

@@ -52,7 +52,7 @@
             {{scope.row.BIND_IP}}
           </template>
         </el-table-column>
-        <el-table-column label="" width="250">
+        <el-table-column label="邮箱" width="250">
           <template slot-scope="scope">
             {{scope.row.EMAIL}}
           </template>