Merge remote-tracking branch 'origin/dev' into dev
New file |
| | |
| | | import axios from './request' |
| | | |
| | | // 获取系统配 |
| | | export const getSysConfig = () => { |
| | | return axios({ |
| | | url: '/api/sys-config', |
| | | method: 'GET' |
| | | }) |
| | | } |
| | | |
| | | // 修改系统配置表 |
| | | export const editSysConfig = (params) => { |
| | | return axios({ |
| | | url: '/api/sys-config/', |
| | | method: 'PUT', |
| | | data: params |
| | | }) |
| | | } |
| | |
| | | selectByUserName: query => post('/api/admin/user/selectByUserName', query), |
| | | studentList: () => get('/api/admin/user/student/list'), |
| | | getClassesCurrentUserList: (param) => get('/api/admin/user/classes/students', param), |
| | | updatePassword: (data) => post('/api/admin/user/update/password', data) |
| | | } |
| | |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | path: '/config', |
| | | component: Layout, |
| | | children: [ |
| | | { |
| | | path: '/setting', |
| | | name: 'SysSetting', |
| | | meta: { |
| | | title: '系统配置', |
| | | icon: 'answer', |
| | | affix: true |
| | | }, |
| | | component: () => import('@/views/sys/SysSetting') |
| | | }, |
| | | ] |
| | | }, |
| | | |
| | | // { |
| | | // path: '/message', |
| | | // component: Layout, |
| | |
| | | <template> |
| | | <div class="login-container"> |
| | | <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left"> |
| | | <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" |
| | | label-position="left"> |
| | | |
| | | <div class="title-container"> |
| | | <h3 class="title">江西语音视频培训系统</h3> |
| | |
| | | |
| | | <el-checkbox v-model="loginForm.remember" style="margin-bottom: 20px;margin-left: 5px;">记住密码</el-checkbox> |
| | | |
| | | <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">登录</el-button> |
| | | <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" |
| | | @click.native.prevent="handleLogin">登录 |
| | | </el-button> |
| | | |
| | | </el-form> |
| | | |
| | | <el-dialog |
| | | title="修改密码" |
| | | :visible.sync="forceUpdateShow" |
| | | :close-on-click-modal="false" |
| | | :close-on-press-escape="false" |
| | | width="400px" |
| | | :show-close="false" |
| | | > |
| | | <el-form :model="updatePasswordForm"> |
| | | <el-form-item label="新密码"> |
| | | <el-input v-model="updatePasswordForm.newPassword" placeholder="应包含大小写、数字" show-password></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="确认密码"> |
| | | <el-input v-model="updatePasswordForm.confirmPassword" placeholder="确认密码" show-password></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="forceUpdateShow = false">关 闭</el-button> |
| | | <el-button type="primary" @click="updatePassword">修 改</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | </div> |
| | | </template> |
| | |
| | | <script> |
| | | import { mapMutations } from 'vuex' |
| | | import loginApi from '@/api/login' |
| | | import UserApi from '@/api/user' |
| | | |
| | | export default { |
| | | name: 'Login', |
| | |
| | | } |
| | | } |
| | | return { |
| | | forceUpdateShow: false, |
| | | updatePasswordForm: { |
| | | userId: null, |
| | | newPassword: '', |
| | | confirmPassword: '' |
| | | }, |
| | | loginForm: { |
| | | userName: '', |
| | | password: '', |
| | |
| | | // window.removeEventListener('storage', this.afterQRScan) |
| | | }, |
| | | methods: { |
| | | updatePassword () { |
| | | if (this.updatePasswordForm.newPassword !== this.updatePasswordForm.confirmPassword) { |
| | | this.$message.error("两次输入的密码不一致") |
| | | return |
| | | } |
| | | UserApi.updatePassword(this.updatePasswordForm).then(res => { |
| | | if (res.code === 1) { |
| | | this.$message.success('密码修改成功。请重新登录') |
| | | this.loginForm.password = '' |
| | | this.forceUpdateShow = false |
| | | } |
| | | }) |
| | | }, |
| | | checkCapslock ({ shiftKey, key } = {}) { |
| | | if (key && key.length === 1) { |
| | | // eslint-disable-next-line no-mixed-operators |
| | |
| | | this.$refs.loginForm.validate(valid => { |
| | | if (valid) { |
| | | this.loading = true |
| | | loginApi.login(this.loginForm).then(function (result) { |
| | | loginApi.login(this.loginForm).then(result => { |
| | | // 如果code为205,则强制修改密码 |
| | | if (result && result.code === 205) { |
| | | this.updatePasswordForm.userId = result.data |
| | | this.forceUpdateShow = true |
| | | this.loading = false |
| | | return |
| | | } |
| | | if (result && result.code === 1) { |
| | | _this.setUserName(_this.loginForm.userName) |
| | | _this.$router.push({ path: '/dashboard' }) |
New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="form" status-icon :rules="rules" ref="form" label-width="150px"> |
| | | <el-form-item label="密码过期时间(天)" prop="passwordExpireTime"> |
| | | <el-input v-model="form.passwordExpireTime" type="number" autocomplete="off" placeholder="比如:30天密码过期"></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="edit()">保存</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getSysConfig, editSysConfig } from '@/api/sysConfig' |
| | | |
| | | export default { |
| | | name: 'SysSetting', |
| | | data () { |
| | | return { |
| | | form: { |
| | | id: null, |
| | | passwordExpireTime: null |
| | | }, |
| | | rules: { |
| | | passwordExpireTime: [ |
| | | { required: true, message: '请输入密码过期时间', trigger: 'blur' } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | mounted () { |
| | | this.getConfig() |
| | | }, |
| | | methods: { |
| | | getConfig () { |
| | | getSysConfig().then(res => { |
| | | this.form = res.data.data |
| | | }) |
| | | }, |
| | | edit () { |
| | | this.$refs['form'].validate((valid) => { |
| | | if (valid) { |
| | | editSysConfig(this.form).then(res => { |
| | | this.$message.success('修改成功') |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | <div class="app-container"> |
| | | |
| | | <el-form :model="form" ref="form" label-width="100px" v-loading="formLoading" :rules="rules"> |
| | | <el-form-item label="用户名:" prop="userName" required> |
| | | <el-input v-model="form.userName"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="密码:" required> |
| | | <el-input v-model="form.password"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="真实姓名:" prop="realName" required> |
| | | <el-input v-model="form.realName"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="手机:" prop="phone" required> |
| | | <el-input v-model="form.phone"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="登录账号:" prop="userName" required> |
| | | <el-input v-model="form.userName" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="登录密码:" prop="password" required> |
| | | <el-input v-model="form.password" show-password autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="年龄:"> |
| | | <el-input v-model="form.age"></el-input> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="出生日期:"> |
| | | <el-date-picker v-model="form.birthDay" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" /> |
| | | </el-form-item> |
| | | <el-form-item label="手机:"> |
| | | <el-input v-model="form.phone"></el-input> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="年级:" prop="userLevel" required>--> |
| | | <!-- <el-select v-model="form.userLevel" placeholder="年级">--> |
| | |
| | | |
| | | export default { |
| | | data () { |
| | | var validatePassword = (rule, value, callback) => { |
| | | if (value === '') { |
| | | callback(new Error('请输入密码')) |
| | | } else if (!/[A-Z]/.test(value)) { |
| | | callback(new Error('密码必须包含至少一个大写字母')) |
| | | } else if (!/[a-z]/.test(value)) { |
| | | callback(new Error('密码必须包含至少一个小写字母')) |
| | | } else if (!/[0-9]/.test(value)) { |
| | | callback(new Error('密码必须包含至少一个数字')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | var validatePhone = (rule, value, callback) => { |
| | | // 手机号验证逻辑 |
| | | const phoneRegex = /^1[3-9]\d{9}$/; |
| | | if (!value) { |
| | | callback(new Error('请输入手机号')); |
| | | } else if (!phoneRegex.test(value)) { |
| | | callback(new Error('手机号格式不正确')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | } |
| | | return { |
| | | form: { |
| | | id: null, |
| | |
| | | ], |
| | | realName: [ |
| | | { required: true, message: '请输入真实姓名', trigger: 'blur' } |
| | | ], |
| | | password: [ |
| | | { validator: validatePassword, trigger: 'blur' } |
| | | ], |
| | | phone: [ |
| | | { validator: validatePhone, trigger: 'blur' } |
| | | ] |
| | | } |
| | | } |