|
|
@@ -11,41 +11,41 @@
|
|
|
<div>姓名:{{userInfo.name}}</div>
|
|
|
<div>加入时间:{{momentFromNow(userInfo.createAt)}}</div>
|
|
|
</div>
|
|
|
- <div class="sub-title">
|
|
|
- 修改资料
|
|
|
- <c-button :theme="showChangeProfile ? 'blue' : 'normal'" :left="8" text
|
|
|
- :icon="showChangeProfile ? 'unfold_less' : 'unfold_more'"
|
|
|
- @click="showChangeProfile = !showChangeProfile">
|
|
|
- {{showChangeProfile ? '收起' : '展开'}}
|
|
|
- </c-button>
|
|
|
- </div>
|
|
|
- <show-transition>
|
|
|
- <div v-if="showChangeProfile">
|
|
|
- <c-input :placeholder="'目前资料中的姓名:' + userInfo.name" class="mb-16" v-model="newName"></c-input>
|
|
|
- <c-button theme="green" block class="mb-32" @click="handleModifyName" icon="check">确认修改姓名</c-button>
|
|
|
- </div>
|
|
|
- </show-transition>
|
|
|
- <div class="sub-title">
|
|
|
- 修改密码
|
|
|
- <c-button :theme="showChangePassword ? 'blue' : 'normal'" :left="8" text
|
|
|
- :icon="showChangePassword ? 'unfold_less' : 'unfold_more'"
|
|
|
- @click="showChangePassword = !showChangePassword">
|
|
|
- {{showChangePassword ? '收起' : '展开'}}
|
|
|
- </c-button>
|
|
|
- </div>
|
|
|
- <show-transition>
|
|
|
- <div v-if="showChangePassword">
|
|
|
- <div class="verified-code-wrapper">
|
|
|
- <c-input placeholder="邮箱验证码" type="number" v-model="code"></c-input>
|
|
|
- <c-button theme="blue" :no-click-warn="typeof emailButtonContent === typeof 0"
|
|
|
- @click="handleSendEmailCode">{{ emailButtonContent }}
|
|
|
- </c-button>
|
|
|
- </div>
|
|
|
- <c-input placeholder="新密码" type="password" class="mb-16" v-model="password"></c-input>
|
|
|
- <c-input placeholder="确认新密码" type="password" class="mb-16" v-model="passwordEnsure"></c-input>
|
|
|
- <c-button block theme="orange" @click="handleModifyPassword" icon="check">确认修改密码</c-button>
|
|
|
- </div>
|
|
|
- </show-transition>
|
|
|
+ <!-- <div class="sub-title">-->
|
|
|
+ <!-- 修改资料-->
|
|
|
+ <!-- <c-button :theme="showChangeProfile ? 'blue' : 'normal'" :left="8" text-->
|
|
|
+ <!-- :icon="showChangeProfile ? 'unfold_less' : 'unfold_more'"-->
|
|
|
+ <!-- @click="showChangeProfile = !showChangeProfile">-->
|
|
|
+ <!-- {{showChangeProfile ? '收起' : '展开'}}-->
|
|
|
+ <!-- </c-button>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <show-transition>-->
|
|
|
+ <!-- <div v-if="showChangeProfile">-->
|
|
|
+ <!-- <c-input :placeholder="'目前资料中的姓名:' + userInfo.name" class="mb-16" v-model="newName"></c-input>-->
|
|
|
+ <!-- <c-button theme="green" block class="mb-32" @click="handleModifyName" icon="check">确认修改姓名</c-button>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </show-transition>-->
|
|
|
+ <!-- <div class="sub-title">-->
|
|
|
+ <!-- 修改密码-->
|
|
|
+ <!-- <c-button :theme="showChangePassword ? 'blue' : 'normal'" :left="8" text-->
|
|
|
+ <!-- :icon="showChangePassword ? 'unfold_less' : 'unfold_more'"-->
|
|
|
+ <!-- @click="showChangePassword = !showChangePassword">-->
|
|
|
+ <!-- {{showChangePassword ? '收起' : '展开'}}-->
|
|
|
+ <!-- </c-button>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <show-transition>-->
|
|
|
+ <!-- <div v-if="showChangePassword">-->
|
|
|
+ <!-- <div class="verified-code-wrapper">-->
|
|
|
+ <!-- <c-input placeholder="邮箱验证码" type="number" v-model="code"></c-input>-->
|
|
|
+ <!-- <c-button theme="blue" :no-click-warn="typeof emailButtonContent === typeof 0"-->
|
|
|
+ <!-- @click="handleSendEmailCode">{{ emailButtonContent }}-->
|
|
|
+ <!-- </c-button>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <c-input placeholder="新密码" type="password" class="mb-16" v-model="password"></c-input>-->
|
|
|
+ <!-- <c-input placeholder="确认新密码" type="password" class="mb-16" v-model="passwordEnsure"></c-input>-->
|
|
|
+ <!-- <c-button block theme="orange" @click="handleModifyPassword" icon="check">确认修改密码</c-button>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </show-transition>-->
|
|
|
</div>
|
|
|
<slide-in-different-transition>
|
|
|
<router-view/>
|
|
|
@@ -54,24 +54,25 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import CButton from '@/components/Basic/CButton'
|
|
|
-import CInput from '@/components/Basic/CInput'
|
|
|
-import { sendEmailCode } from '@/server/code'
|
|
|
-import { modifyUser, resetPasswordByEmail } from '@/server/user'
|
|
|
+// import CButton from '@/components/Basic/CButton'
|
|
|
+// import CInput from '@/components/Basic/CInput'
|
|
|
+// import { sendEmailCode } from '@/server/code'
|
|
|
+// import { modifyUser, resetPasswordByEmail } from '@/server/user'
|
|
|
import { mapState } from 'vuex'
|
|
|
import CTag from '@/components/Basic/CTag'
|
|
|
import SlideInDifferentTransition from '@/animations/SlideInDifferentTransition'
|
|
|
-import ShowTransition from '@/animations/ShowTransition'
|
|
|
+// import ShowTransition from '@/animations/ShowTransition'
|
|
|
import momentFromNow from '@/utils/moment-from-now'
|
|
|
import { userTypeNaming } from '@/enums/user-type'
|
|
|
-import { SET_USER_INFO } from '@/store/types/main-types'
|
|
|
+// import { SET_USER_INFO } from '@/store/types/main-types'
|
|
|
|
|
|
export default {
|
|
|
props: {
|
|
|
role: String,
|
|
|
roleTagTheme: String
|
|
|
},
|
|
|
- components: { CTag, CInput, CButton, SlideInDifferentTransition, ShowTransition },
|
|
|
+ // components: { CTag, CInput, CButton, SlideInDifferentTransition, ShowTransition },
|
|
|
+ components: { CTag, SlideInDifferentTransition },
|
|
|
data () {
|
|
|
return {
|
|
|
emailButtonContent: '发送验证码',
|
|
|
@@ -94,56 +95,56 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- momentFromNow,
|
|
|
- handleSendEmailCode () {
|
|
|
- this.$setInfoMessage('正在尝试发送验证码')
|
|
|
- if (this.email.match(/.+@.*(edu.cn)/)) {
|
|
|
- this.setEmailCodeCd()
|
|
|
- sendEmailCode({ email: this.email }).then(res => {
|
|
|
- this.$setSuccessMessage('邮箱验证码发送成功')
|
|
|
- }).catch(err => {
|
|
|
- this.$setErrorMessage(err.response.data.msg)
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$setErrorMessage('本邮箱不符合南京大学校邮格式')
|
|
|
- }
|
|
|
- },
|
|
|
- setEmailCodeCd () {
|
|
|
- this._emailCodeCdInterval && clearInterval(this._emailCodeCdInterval)
|
|
|
- this.emailButtonContent = 60
|
|
|
- this._emailCodeCdInterval = setInterval(() => {
|
|
|
- this.emailButtonContent--
|
|
|
- if (typeof this.emailButtonContent !== typeof 0 || this.emailButtonContent <= 0) {
|
|
|
- clearInterval(this._emailCodeCdInterval)
|
|
|
- this.emailButtonContent = '发送验证码'
|
|
|
- }
|
|
|
- }, 1000)
|
|
|
- },
|
|
|
- handleModifyPassword () {
|
|
|
- if (!this.password || this.password !== this.passwordEnsure) {
|
|
|
- this.$setInfoMessage('两次输入的密码不一致')
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- resetPasswordByEmail({ email: this.email, code: this.code, password: this.password }).then(res => {
|
|
|
- this.$setSuccessMessage('密码修改成功')
|
|
|
- }).catch(err => {
|
|
|
- this.$setErrorMessage(err.response.data.msg)
|
|
|
- })
|
|
|
- },
|
|
|
- handleModifyName () {
|
|
|
- if (!this.newName) {
|
|
|
- this.$setInfoMessage('输入的新用户名为空')
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- modifyUser({ name: this.newName, type: this.role }).then(res => {
|
|
|
- this.$setSuccessMessage('修改用户名成功')
|
|
|
- this.$store.commit(SET_USER_INFO, { userInfo: res })
|
|
|
- }).catch(err => {
|
|
|
- this.$setErrorMessage(err.response.data.msg)
|
|
|
- })
|
|
|
- }
|
|
|
+ momentFromNow
|
|
|
+ // handleSendEmailCode () {
|
|
|
+ // this.$setInfoMessage('正在尝试发送验证码')
|
|
|
+ // if (this.email.match(/.+@.*(edu.cn)/)) {
|
|
|
+ // this.setEmailCodeCd()
|
|
|
+ // sendEmailCode({ email: this.email }).then(res => {
|
|
|
+ // this.$setSuccessMessage('邮箱验证码发送成功')
|
|
|
+ // }).catch(err => {
|
|
|
+ // this.$setErrorMessage(err.response.data.msg)
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // this.$setErrorMessage('本邮箱不符合南京大学校邮格式')
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // setEmailCodeCd () {
|
|
|
+ // this._emailCodeCdInterval && clearInterval(this._emailCodeCdInterval)
|
|
|
+ // this.emailButtonContent = 60
|
|
|
+ // this._emailCodeCdInterval = setInterval(() => {
|
|
|
+ // this.emailButtonContent--
|
|
|
+ // if (typeof this.emailButtonContent !== typeof 0 || this.emailButtonContent <= 0) {
|
|
|
+ // clearInterval(this._emailCodeCdInterval)
|
|
|
+ // this.emailButtonContent = '发送验证码'
|
|
|
+ // }
|
|
|
+ // }, 1000)
|
|
|
+ // },
|
|
|
+ // handleModifyPassword () {
|
|
|
+ // if (!this.password || this.password !== this.passwordEnsure) {
|
|
|
+ // this.$setInfoMessage('两次输入的密码不一致')
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // resetPasswordByEmail({ email: this.email, code: this.code, password: this.password }).then(res => {
|
|
|
+ // this.$setSuccessMessage('密码修改成功')
|
|
|
+ // }).catch(err => {
|
|
|
+ // this.$setErrorMessage(err.response.data.msg)
|
|
|
+ // })
|
|
|
+ // },
|
|
|
+ // handleModifyName () {
|
|
|
+ // if (!this.newName) {
|
|
|
+ // this.$setInfoMessage('输入的新用户名为空')
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // modifyUser({ name: this.newName, type: this.role }).then(res => {
|
|
|
+ // this.$setSuccessMessage('修改用户名成功')
|
|
|
+ // this.$store.commit(SET_USER_INFO, { userInfo: res })
|
|
|
+ // }).catch(err => {
|
|
|
+ // this.$setErrorMessage(err.response.data.msg)
|
|
|
+ // })
|
|
|
+ // }
|
|
|
}
|
|
|
}
|
|
|
</script>
|