| | |
| | | updatePassword: (data) => post('/api/common/user/update/password', data), |
| | | uploadImg: (data) => post('/api/admin/upload/img', data), |
| | | resetUserPassword: (id) => post('/api/admin/user/reset/password/' + id), |
| | | editPassword:(data) => post('/api/admin/user/edit/password', data), |
| | | } |
New file |
| | |
| | | <template> |
| | | <el-form> |
| | | <el-form-item label="请输入新密码"> |
| | | <el-input v-model="form.newPassword" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="submit">更新</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </template> |
| | | |
| | | <script> |
| | | import userApi from '@/api/user' |
| | | export default { |
| | | props: ['userInfo'], |
| | | data () { |
| | | return { |
| | | form: { |
| | | id: undefined, |
| | | newPassword: '' |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | submit () { |
| | | this.form.id = this.userInfo.id |
| | | let _this = this |
| | | userApi.editPassword(this.form).then(re => { |
| | | if (re.code === 1) { |
| | | _this.$message.success(re.message) |
| | | } else { |
| | | _this.$message.error(re.message) |
| | | } |
| | | }) |
| | | this.resetForm() |
| | | }, |
| | | resetForm () { |
| | | this.form = { |
| | | id: undefined, |
| | | newPassword: '' |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | <el-tab-pane label="账号" name="account"> |
| | | <account :user-info="userInfo" /> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="修改密码" name="editPassword"> |
| | | <editPassword :user-info="userInfo" /> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </el-card> |
| | | </el-col> |
| | |
| | | import UserCard from './components/UserCard' |
| | | import Timeline from './components/Timeline' |
| | | import Account from './components/Account' |
| | | import EditPassword from './components/EditPassword' |
| | | import userApi from '@/api/user' |
| | | |
| | | export default { |
| | |
| | | } |
| | | } |
| | | }, |
| | | components: { UserCard, Timeline, Account }, |
| | | components: { UserCard, Timeline, Account, EditPassword }, |
| | | created () { |
| | | let _this = this |
| | | userApi.getCurrentUser().then(re => { |