guhongwei 5 лет назад
Родитель
Сommit
4368166454
3 измененных файлов с 22 добавлено и 18 удалено
  1. 0 1
      src/layout/otheruser/otheruserForm.vue
  2. 2 4
      src/plugins/check-res.js
  3. 20 13
      src/views/otheruser/detail.vue

+ 0 - 1
src/layout/otheruser/otheruserForm.vue

@@ -36,7 +36,6 @@ export default {
   data: () => ({
     rules: {
       phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
-      passwd: [{ required: true, message: '请输入注册密码', trigger: 'blur' }],
       type: [{ required: true, message: '请选择用户类型', trigger: 'change' }],
     },
   }),

+ 2 - 4
src/plugins/check-res.js

@@ -22,16 +22,14 @@ const Plugin = {
           return _okText();
         }
         if (_okText) {
-          // Message.success(_okText);
-          Notify({ type: 'success', message: _okText });
+          Message.success(_okText);
         }
         return true;
       }
       if (_.isFunction(_errText)) {
         return _errText();
       }
-      // Message.error(_errText || errmsg);
-      Notify({ type: 'danger', message: _okText });
+      Message.error(_errText || errmsg);
       // Message({ message: _errText || errmsg, duration: 60000 });
       return false;
     };

+ 20 - 13
src/views/otheruser/detail.vue

@@ -35,7 +35,9 @@ export default {
   data: () => ({
     display: 'none',
     topTitle: '用户信息管理',
-    ruleForm: {},
+    ruleForm: {
+      passwd: '123456',
+    },
   }),
   created() {
     this.searchInfo();
@@ -54,23 +56,28 @@ export default {
       }
     },
     // 提交
-    async submitForm(form) {
-      let data = form;
+    async submitForm({ data }) {
       let res;
       if (this.id) {
         res = await this.update(data);
-        this.$message({
-          message: '信息修改成功',
-          type: 'success',
-        });
+        if (res.errcode === 0) {
+          this.$message({
+            message: '信息修改成功',
+            type: 'success',
+          });
+        }
       } else {
-        res = await this.create({ ...data, passwd: 123456 });
-        this.$message({
-          message: '信息添加成功',
-          type: 'success',
-        });
+        res = await this.create(data);
+        if (res.errcode === 0) {
+          this.$message({
+            message: '信息创建成功',
+            type: 'success',
+          });
+        }
       }
-      if (this.$checkRes(res)) this.$router.push({ path: '/otheruser/index' });
+      if (this.$checkRes(res)) this.resetForm();
+
+      console.log(res.data);
     },
     // 取消
     resetForm() {