123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- <template>
- <div>
- <div v-if="!changePsd">
- <div class="accountmanage-tittle">
- <p>账号管理</p>
- </div>
- <div class="accountmanage-content">
- <div class="changeheader flex justify-center">
- <span><img src="http://user-file.17pdf.com/avatars/2020/11/16/0577b907be980556bdafa23fb0be0732-jpg.jpg"></span>
- <div class="headers">
- </div>
- </div>
- <div class="row-name">
- <span>昵称</span>
- <input v-model="username" @blur="handlerChangeUserName">
- <!-- <p class="err-prompt">用户名已经存在</p> -->
- </div>
- <div class="changepwd" @click="changepwdModal()">
- 修改密码
- </div>
- </div>
- </div>
- <div v-else>
- <div class="accountmanage-tittle">
- <p>修改密码</p>
- </div>
- <div class="login_content changepwd-content">
- <input v-model="form.password" class="login_input_password" type="password" placeholder="原始密码">
- <br/>
- <input v-model="form.newPassword" class="login_input_password new" type="password" placeholder="新密码(6-16个字符,区分大小写)">
- <br/>
- <input v-model="form.newPasswordConfirm" class="login_input_password confirm" type="password" placeholder="确认新密码">
- <br/>
- <div class="error-mess error-mess-signup" >
- <span id="error-message error-tip">{{errMsg}}</span>
- </div>
- <button class="logging" @click="vailidate">确认</button>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- changePsd: false,
- username: this.$store.state.userInfo?.name,
- form: {
- password:'',
- newPassword: '',
- newPasswordConfirm:''
- },
- errMsg:''
- }
- },
- methods: {
- // 点击注册前置校验
- vailidate() {
- if(this.form.newPassword !== this.form.newPasswordConfirm) {
- this.errMsg = '密码不一致'
- }else if(this.form.newPassword.length < 6) {
- this.errMsg = '密码位数不能少于6位'
- }else if(this.form.newPassword.length> 16){
- this.errMsg = '密码位数不能大于16位'
- }else {
- this.errMsg = ''
- this.handlerResetPsw()
- }
- },
- handlerResetPsw() {
- this.$axios.post('members/modifyPassword', this.form).then((res)=> {
- if(res.code === 200) {
- this.$emit('close')
- }
- })
- },
- changepwdModal() {
- this.changePsd = true
- },
- handlerChangeUserName() {
- this.$axios.get(`/members/modifyNickname?name=${this.username}`).then((res)=> {
- if(res.code === 200) {
- this.getUserInfo()
- }
- })
- },
- getUserInfo() {
- this.$axios.get('members/getMemberInfo').then((res)=> {
- if(res.code === 200) {
- this.$store.commit('setUser',res.result.memberInfo)
- }
- })
- },
- resetInterfaceStatus() {
- this.changePsd = false
- this.form.password = ''
- this.form.newPassword = ''
- this.form.newPasswordConfirm = ''
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .accountmanage-tittle {
- color: rgb(255, 79, 79);
- text-align: center;
- margin: 0;
- p {
- font-size: 20px;
- line-height: 64px;
- }
- }
- .accountmanage-content {
- .changeheader {
- text-align: center;
- margin: 0 24px;
- span img {
- width: 64px;
- border-radius: 35px;
- }
- .headers {
- margin-top: 8px;
- padding-bottom: 24px;
- border-bottom: 1px solid rgb(240, 240, 240);
- img {
- width: 36px;
- border-radius: 35px;
- margin: 8px 2px 0px 2px;
- }
- }
- }
- .row-name {
- border-top: 1px solid rgb(240, 240, 240);
- margin: 0 24px;
- height: 64px;
- line-height: 64px;
- position: relative;
- margin-top: 25px;
- span {
- color: rgb(153, 153, 153);
- font-size: 14px;
- float: left;
- width: 10%;
- }
- input {
- width: 88%;
- float: right;
- height: 30px;
- line-height: 30px;
- text-align: right;
- border: 0px;
- margin-top: 12px;
- border: none;
- outline: medium;
- &:focus {
- text-align: right;
- border: 1px;
- }
- }
- p {
- position: absolute;
- right: 0px;
- bottom: 0px;
- height: 20px;
- width: 100%;
- color: rgb(255, 79, 79);
- font-size: 14px;
- line-height: 20px;
- text-align: right;
- display: none;
- }
- }
- .changepwd {
- color: rgb(51, 51, 51);
- height: 64px;
- font-size: 14px;
- cursor:pointer;
- margin: 0 24px;
- line-height: 64px;
- border-top: 1px solid rgb(240, 240, 240);
- background: url(http://cn-file.17pdf.com/website/account/ic_cebian_normal.png) right 50% no-repeat;
- }
- }
- // .changepwd-content {
- // margin: 20px 0px;
- // }
- .login_content {
- text-align: center;
- font-size: 14px;
- .error-mess {
- position: relative;
- font-size: 14px;
- display: none;
- span{
- display: inline-block;
- background: #808080;
- color: rgb(255, 255, 255);
- padding: 5px 15px;
- border-radius: 4px;
- }
- }
- .error-mess-signup {
- position: initial;
- clear: both;
- margin-top: 15px;
- }
- .login_input_password {
- height: 60px;
- width: 360px;
- border-width: 0 0 1px 0;
- border-color: rgb(238, 238, 238);
- padding-left: 42px;
- padding-top: 16px;
- line-height: 44px;
- outline:none;
- background: url(http://cn-file.17pdf.com/website/account/ic_login_inputpassword.png) no-repeat 0px 28px;
- &.new {
- background: url(http://cn-file.17pdf.com/website/account/ic_lock_new.png) no-repeat 0px 28px;
- }
- &.confirm {
- background: url(http://cn-file.17pdf.com/website/account/ic_lock_sure.png) no-repeat 0px 28px;
- }
- }
- .login_input_password:-webkit-autofill {
- box-shadow: 0 0 0px 1000px white inset;
- }
- .logging {
- width: 360px;
- height: 48px;
- font-size: 16px;
- color: rgb(255, 255, 255);
- border: none;
- background-color: rgb(255, 79, 79);
- margin-bottom: 40px;
- border-radius: 4px;
- outline:none;
- }
- }
- </style>
|