lrf402788946 3 vuotta sitten
vanhempi
commit
72ef8142e8
1 muutettua tiedostoa jossa 93 lisäystä ja 93 poistoa
  1. 93 93
      src/views/info/index.vue

+ 93 - 93
src/views/info/index.vue

@@ -1,93 +1,93 @@
-<template>
-  <div id="index">
-    <el-card style="margin:10px;">
-      <template #header>
-        <el-row>
-          <el-col style="font-size:24px" :span="24">完善学校人员资料</el-col>
-        </el-row>
-      </template>
-      <el-row type="flex" justify="center">
-        <el-col style="font-size:24px" :span="10">
-          <data-form style="padding:20px;" :data="info" :fields="fields" :rules="rules" @save="handleSave" :isNew="true">
-            <template #custom="{ item, form }">
-              <template v-if="item.model == 'mobile'">
-                <el-input v-model="form.mobile" placeholder="请输入手机号"></el-input>
-                <el-link type="danger" :underline="false">此手机号为新的登录用户名,设置后,请不要再使用学校代码进行登录</el-link>
-              </template>
-            </template>
-          </data-form>
-        </el-col>
-      </el-row>
-    </el-card>
-  </div>
-</template>
-
-<script>
-import dataForm from '@frame/components/form';
-import { mapState, createNamespacedHelpers } from 'vuex';
-import _ from 'lodash';
-const { mapActions } = createNamespacedHelpers('login');
-
-export default {
-  metaInfo: { title: '填写资料' },
-  name: 'index',
-  props: {},
-  components: { dataForm },
-  data: () => ({
-    info: {},
-    fields: [
-      { label: '学校负责人', required: true, model: 'name' },
-      { label: '手机号', required: true, model: 'mobile', options: { minLength: 11, maxlength: 11 }, custom: true },
-      { label: '密码', required: true, model: 'passwd', type: 'password' },
-    ],
-    rules: {
-      name: [{ required: true, message: '请输入负责人姓名2' }],
-      mobile: [
-        { required: true, message: '请输入手机号' },
-        { min: 11, max: 11, message: '请输入11位手机号码', trigger: 'blur' },
-      ],
-      passwd: [
-        { required: true, message: '请输入密码' },
-        { min: 6, message: '密码最少6位', trigger: 'blur' },
-      ],
-    },
-  }),
-  created() {},
-  methods: {
-    ...mapActions(['login', 'update']),
-    async handleSave({ data }) {
-      const info = JSON.parse(JSON.stringify(data));
-      let res = await this.update({ id: this.user.id, ...info });
-      if (this.$checkRes(res)) {
-        res = await this.login({ user: info, router: this.$router, needReturn: true, needNotice: false });
-        if (res.errcode !== 0) this.$message.warning(res.errmsg);
-        else {
-          this.$router.push({ path: '/' });
-          Notification({
-            title: '学校用户信息',
-            message: `修改成功`,
-            type: 'success',
-            duration: 2000,
-          });
-        }
-      }
-    },
-  },
-  computed: {
-    ...mapState(['user']),
-    mainTitle() {
-      let meta = this.$route.meta;
-      let main = meta.title || '';
-      let sub = meta.sub || '';
-      return `${main}${sub}`;
-    },
-    keyWord() {
-      let meta = this.$route.meta;
-      let main = meta.title || '';
-      return main;
-    },
-  },
-};
-</script>
-
-<style lang="less" scoped></style>
+<template>
+  <div id="index">
+    <el-card style="margin:10px;">
+      <template #header>
+        <el-row>
+          <el-col style="font-size:24px" :span="24">完善学校人员资料</el-col>
+        </el-row>
+      </template>
+      <el-row type="flex" justify="center">
+        <el-col style="font-size:24px" :span="10">
+          <data-form style="padding:20px;" :data="info" :fields="fields" :rules="rules" @save="handleSave" :isNew="true">
+            <template #custom="{ item, form }">
+              <template v-if="item.model == 'mobile'">
+                <el-input v-model="form.mobile" placeholder="请输入手机号"></el-input>
+                <el-link type="danger" :underline="false">此手机号为新的登录用户名,设置后,请不要再使用学校代码进行登录</el-link>
+              </template>
+            </template>
+          </data-form>
+        </el-col>
+      </el-row>
+    </el-card>
+  </div>
+</template>
+
+<script>
+import dataForm from '@frame/components/form';
+import { mapState, createNamespacedHelpers } from 'vuex';
+import _ from 'lodash';
+const { mapActions } = createNamespacedHelpers('login');
+
+export default {
+  metaInfo: { title: '填写资料' },
+  name: 'index',
+  props: {},
+  components: { dataForm },
+  data: () => ({
+    info: {},
+    fields: [
+      { label: '学校负责人', required: true, model: 'name' },
+      { label: '手机号', required: true, model: 'mobile', options: { minLength: 11, maxlength: 11 }, custom: true },
+      { label: '密码', required: true, model: 'passwd', type: 'password' },
+    ],
+    rules: {
+      name: [{ required: true, message: '请输入负责人姓名' }],
+      mobile: [
+        { required: true, message: '请输入手机号' },
+        { min: 11, max: 11, message: '请输入11位手机号码', trigger: 'blur' },
+      ],
+      passwd: [
+        { required: true, message: '请输入密码' },
+        { min: 6, message: '密码最少6位', trigger: 'blur' },
+      ],
+    },
+  }),
+  created() {},
+  methods: {
+    ...mapActions(['login', 'update']),
+    async handleSave({ data }) {
+      const info = JSON.parse(JSON.stringify(data));
+      let res = await this.update({ id: this.user.id, ...info, status: '1' });
+      if (this.$checkRes(res)) {
+        res = await this.login({ user: { ...info, type: '2' }, router: this.$router, needReturn: true, needNotice: false });
+        if (res.errcode !== 0) this.$message.warning(res.errmsg);
+        else {
+          this.$router.push({ path: '/' });
+          Notification({
+            title: '学校用户信息',
+            message: `修改成功`,
+            type: 'success',
+            duration: 2000,
+          });
+        }
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    mainTitle() {
+      let meta = this.$route.meta;
+      let main = meta.title || '';
+      let sub = meta.sub || '';
+      return `${main}${sub}`;
+    },
+    keyWord() {
+      let meta = this.$route.meta;
+      let main = meta.title || '';
+      return main;
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>