|
|
@@ -7,42 +7,55 @@
|
|
|
登录信息
|
|
|
<span>1/2</span>
|
|
|
</div>
|
|
|
- <c-input placeholder="邮箱" type="email" v-model="email"></c-input>
|
|
|
+ <div class="mb-16">
|
|
|
+ <c-button @click="type = userType.student" icon="face" :theme="type === userType.student ? 'green' : 'normal'"
|
|
|
+ class="mr-8" no-bold>
|
|
|
+ 学生
|
|
|
+ </c-button>
|
|
|
+ <c-button @click="type = userType.teacher" icon="supervised_user_circle"
|
|
|
+ :theme="type === userType.teacher ? 'orange' : 'normal'" no-bold>
|
|
|
+ 教师 [ 需要管理员审核 ]
|
|
|
+ </c-button>
|
|
|
+ </div>
|
|
|
+ <c-input class="mb-8" placeholder="邮箱" type="email" v-model="email"></c-input>
|
|
|
+ <section class="tip mb-16">
|
|
|
+ <div>邮箱要求是国内教育邮箱(即以 edu.cn 结尾)</div>
|
|
|
+ </section>
|
|
|
<div class="verified-code-wrapper">
|
|
|
<c-input placeholder="邮箱验证码" type="number" v-model="emailCode"></c-input>
|
|
|
<c-button :no-click-warn="typeof this.emailButtonContent === typeof 0" theme="blue"
|
|
|
@click="handleSendEmailCode">{{ emailButtonContent }}
|
|
|
</c-button>
|
|
|
</div>
|
|
|
- <section class="tip mb-24">
|
|
|
- <div>关于邮箱的说明:</div>
|
|
|
- <div>1. 邮箱需为南京大学校邮(@nju.edu.cn | @smail.nju.edu.cn)</div>
|
|
|
- <div>2. 系统根据邮箱判定您的身份为教师还是学生</div>
|
|
|
+ <c-input class="mb-16" placeholder="密码" type="password" v-model="password"></c-input>
|
|
|
+ <c-input placeholder="确认密码" class="mb-8" type="password" v-model="passwordEnsure"></c-input>
|
|
|
+ <section class="tip" v-if="passwordWarning">
|
|
|
+ <div class="red absolute">{{passwordWarning}}</div>
|
|
|
</section>
|
|
|
- <c-input placeholder="密码" type="password" v-model="password"></c-input>
|
|
|
- <c-input placeholder="确认密码" type="password" v-model="passwordEnsure"></c-input>
|
|
|
- <section class="tip absolute password-warning" v-if="passwordWarning">
|
|
|
- <div>{{passwordWarning}}</div>
|
|
|
+ <section class="tip" v-else-if="password && passwordEnsure && !passwordWarning">
|
|
|
+ <div class="vertical-center green absolute">
|
|
|
+ <c-icon :right="4" bold theme="green" :size="14">check</c-icon>
|
|
|
+ 密码验证通过
|
|
|
+ </div>
|
|
|
</section>
|
|
|
- <section class="tip absolute password-checked" v-if="password && passwordEnsure && !passwordWarning">
|
|
|
- <div class="vertical-center"><c-icon :right="4" bold theme="green" :size="14">check</c-icon>密码验证通过</div>
|
|
|
- </section>
|
|
|
- <c-button theme="blue" block class="mb-16 mt-32" @click="step = 2">下一步</c-button>
|
|
|
+ <c-button theme="blue" block class="mt-32" @click="step = 2">下一步</c-button>
|
|
|
</section>
|
|
|
+
|
|
|
<section class="step=2" v-show="step === 2">
|
|
|
<section class="tip mb-8">
|
|
|
- <div>已填写的邮箱:{{email}}</div>
|
|
|
+ <div class="mb-8">已填写的邮箱:{{email ? email : '[ 未填写 ]'}}</div>
|
|
|
+ <div>注册身份为:{{type ? userTypeNaming[type] : '[ 未填写 ]'}}</div>
|
|
|
</section>
|
|
|
<c-button @click="step = 1" theme="orange" block class="mb-16">上一步</c-button>
|
|
|
<div class="sub-title">
|
|
|
其他信息
|
|
|
<span>2/2</span>
|
|
|
</div>
|
|
|
- <c-input placeholder="姓名" v-model="name"></c-input>
|
|
|
+ <c-input placeholder="姓名" v-model="name" class="mb-8"></c-input>
|
|
|
<section class="tip mb-16">
|
|
|
<div>请使用真实姓名,便于学生、老师之间辨认</div>
|
|
|
</section>
|
|
|
- <c-input placeholder="手机" type="number" v-model="phone"></c-input>
|
|
|
+ <c-input placeholder="手机" type="number" v-model="phone" class="mb-16"></c-input>
|
|
|
<div class="verified-code-wrapper">
|
|
|
<c-input placeholder="手机验证码" type="number" v-model="phoneCode"></c-input>
|
|
|
<c-button theme="blue" @click="handleSendPhoneCode"
|
|
|
@@ -53,7 +66,6 @@
|
|
|
<c-button theme="blue" standout block :no-click-warn="!formChecked()" @click="handleSubmit">确认注册</c-button>
|
|
|
</div>
|
|
|
</section>
|
|
|
- <background></background>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -61,16 +73,17 @@
|
|
|
<script>
|
|
|
import CInput from '@/components/Basic/CInput'
|
|
|
import CButton from '@/components/Basic/CButton'
|
|
|
-import Background from '@/components/Layouts/Background'
|
|
|
import { sendEmailCode, sendPhoneCode } from '@/server/code'
|
|
|
import { register } from '@/server/user'
|
|
|
import CIcon from '@/components/Basic/CIcon'
|
|
|
+import userType, { userTypeNaming } from '@/server/enums/user-type'
|
|
|
|
|
|
export default {
|
|
|
- components: { CIcon, CButton, CInput, Background },
|
|
|
+ components: { CIcon, CButton, CInput },
|
|
|
data () {
|
|
|
return {
|
|
|
step: 1,
|
|
|
+ type: '',
|
|
|
email: '',
|
|
|
emailCode: '',
|
|
|
emailButtonContent: '发送验证码',
|
|
|
@@ -81,7 +94,10 @@ export default {
|
|
|
name: '',
|
|
|
phone: '',
|
|
|
phoneCode: '',
|
|
|
- message: ''
|
|
|
+ message: '',
|
|
|
+
|
|
|
+ userType,
|
|
|
+ userTypeNaming
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -94,6 +110,11 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
formChecked () {
|
|
|
+ if (this.type === '') {
|
|
|
+ this.message = '未选择用户类型'
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
if (!(this.email && this.emailCode && this.password && this.passwordEnsure)) {
|
|
|
this.message = '上一页信息尚未完全填写'
|
|
|
return false
|
|
|
@@ -125,7 +146,8 @@ export default {
|
|
|
emailCode: this.emailCode,
|
|
|
phone: this.phone,
|
|
|
phoneCode: this.phoneCode,
|
|
|
- password: this.password
|
|
|
+ password: this.password,
|
|
|
+ type: this.type
|
|
|
}).then(() => {
|
|
|
this.$setSuccessMessage('注册成功')
|
|
|
this.$router.push({ name: 'login' })
|
|
|
@@ -136,7 +158,7 @@ export default {
|
|
|
},
|
|
|
handleSendEmailCode () {
|
|
|
this.$setInfoMessage('正在尝试发送验证码')
|
|
|
- if (this.email.match(/.+@(nju.edu.cn|smail.nju.edu.cn)/)) {
|
|
|
+ if (this.email.match(/.+@.*(edu.cn)/)) {
|
|
|
this.setEmailCodeCd()
|
|
|
sendEmailCode({ email: this.email }).then(res => {
|
|
|
this.$setSuccessMessage('邮箱验证码发送成功')
|
|
|
@@ -204,6 +226,7 @@ export default {
|
|
|
|
|
|
.title {
|
|
|
color: #6a7a8a;
|
|
|
+
|
|
|
span {
|
|
|
font-family: 'Courier New', 'Courier', monospace;
|
|
|
font-size: 1.15em;
|
|
|
@@ -213,6 +236,7 @@ export default {
|
|
|
top: 2px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.sub-title {
|
|
|
span {
|
|
|
float: right;
|
|
|
@@ -225,11 +249,6 @@ export default {
|
|
|
.tip {
|
|
|
color: #7a8a9a;
|
|
|
font-size: 12px;
|
|
|
- margin-top: -12px;
|
|
|
-}
|
|
|
-
|
|
|
-.c-input {
|
|
|
- margin-bottom: 16px;
|
|
|
}
|
|
|
|
|
|
.button-area {
|
|
|
@@ -261,14 +280,4 @@ export default {
|
|
|
.absolute {
|
|
|
position: absolute;
|
|
|
}
|
|
|
-
|
|
|
-.password-warning {
|
|
|
- color: $theme-orange;
|
|
|
- font-family: 'iconfont', sans-serif;
|
|
|
-}
|
|
|
-
|
|
|
-.password-checked {
|
|
|
- color: $theme-green;
|
|
|
- font-family: 'iconfont', sans-serif;
|
|
|
-}
|
|
|
</style>
|