|
@@ -0,0 +1,97 @@
|
|
|
+<template>
|
|
|
+ <div id="index">
|
|
|
+ <detail-frame :title="mainTitle">
|
|
|
+ <data-form :data="form" :fields="fields" :rules="rules" @save="handleSave">
|
|
|
+ <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>
|
|
|
+ </detail-frame>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import detailFrame from '@frame/layout/admin/detail-frame';
|
|
|
+import dataForm from '@frame/components/form';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions } = createNamespacedHelpers('login');
|
|
|
+export default {
|
|
|
+ metaInfo: { title: '信息维护' },
|
|
|
+ name: 'index',
|
|
|
+ props: {},
|
|
|
+ components: {
|
|
|
+ detailFrame,
|
|
|
+ dataForm,
|
|
|
+ },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ form: {},
|
|
|
+ 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() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapActions(['login', 'update']),
|
|
|
+ async search() {
|
|
|
+ if (this.user) {
|
|
|
+ this.$set(this, `form`, this.user);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 保存
|
|
|
+ async handleSave({ data }) {
|
|
|
+ const info = 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,
|
|
|
+ });
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ 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>
|