|
|
@@ -5,20 +5,46 @@
|
|
|
个人信息设置
|
|
|
<c-tag theme="green">学生</c-tag>
|
|
|
</h1>
|
|
|
- <div class="sub-title">修改姓名</div>
|
|
|
- <c-input :placeholder="'目前资料中的姓名:' + userInfo.name" class="mb-16" v-model="newName"></c-input>
|
|
|
- <c-button theme="orange" block class="mb-32" @click="handleModifyName">确认修改姓名</c-button>
|
|
|
- <div class="sub-title">修改密码</div>
|
|
|
- <div class="verified-code-wrapper">
|
|
|
- <c-input placeholder="邮箱验证码" type="number" v-model="code"></c-input>
|
|
|
- <c-button theme="blue" :no-click-warn="typeof this.emailButtonContent === typeof 0"
|
|
|
- @click="handleSendEmailCode">{{ emailButtonContent }}
|
|
|
+ <div class="info">
|
|
|
+ <div>邮箱:{{userInfo.email}}</div>
|
|
|
+ <div>手机:{{userInfo.phone}}</div>
|
|
|
+ <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>
|
|
|
- <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 theme="orange" block class="mb-32" @click="handleModifyPassword">确认修改密码</c-button>
|
|
|
- <c-button theme="red" block @click="handleLogout">登出</c-button>
|
|
|
+ <show-transition>
|
|
|
+ <div v-if="showChangePassword">
|
|
|
+ <div class="verified-code-wrapper">
|
|
|
+ <c-input placeholder="邮箱验证码" type="number" v-model="this.code"></c-input>
|
|
|
+ <c-button theme="blue" :no-click-warn="typeof this.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/>
|
|
|
@@ -34,16 +60,20 @@ import { logout, 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 momentFromNow from '@/utils/moment-from-now'
|
|
|
|
|
|
export default {
|
|
|
- components: { CTag, CInput, CButton, SlideInDifferentTransition },
|
|
|
+ components: { CTag, CInput, CButton, SlideInDifferentTransition, ShowTransition },
|
|
|
data () {
|
|
|
return {
|
|
|
emailButtonContent: '发送验证码',
|
|
|
newName: '',
|
|
|
code: '',
|
|
|
password: '',
|
|
|
- passwordEnsure: ''
|
|
|
+ passwordEnsure: '',
|
|
|
+ showChangeProfile: false,
|
|
|
+ showChangePassword: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -55,6 +85,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ momentFromNow,
|
|
|
handleSendEmailCode () {
|
|
|
this.$setInfoMessage('正在尝试发送验证码')
|
|
|
if (this.email.match(/.+@(nju.edu.cn|smail.nju.edu.cn)/)) {
|
|
|
@@ -114,6 +145,12 @@ export default {
|
|
|
@import "~@/style/theme.scss";
|
|
|
@import "~@/views/shared/tab-common";
|
|
|
|
|
|
+.sub-title {
|
|
|
+ font-size: 20px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+
|
|
|
.verified-code-wrapper {
|
|
|
margin-bottom: 16px;
|
|
|
display: flex;
|
|
|
@@ -129,5 +166,12 @@ export default {
|
|
|
margin-left: 12px;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+.info {
|
|
|
+ font-size: 14px;
|
|
|
+ padding: 4px 12px;
|
|
|
+ background-color: #f4f4f4;
|
|
|
+ color: #7a8a9a;
|
|
|
+ line-height: 2;
|
|
|
+ margin-bottom: 16px;
|
|
|
+}
|
|
|
</style>
|