|
|
|
@ -68,19 +68,29 @@ |
|
|
|
|
<el-input type="password" v-model="regForm.password" placeholder="请输入密码"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="rePassword"> |
|
|
|
|
<el-input type="password" v-model="regForm.rePassword" placeholder="请再次输入密码" @keyup.enter.native="registerForm"></el-input> |
|
|
|
|
<el-input type="password" v-model="regForm.rePassword" placeholder="请再次输入密码"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</div> |
|
|
|
|
<div class="line"> |
|
|
|
|
<el-form-item> |
|
|
|
|
<p class="label">*验证码</p> |
|
|
|
|
<el-input v-model="regForm.validateCode" placeholder="请输入验证码" @keyup.enter.native="registerForm"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item> |
|
|
|
|
<img :src="verifyCode" style="cursor: pointer;" @click="getVerificationCode" title="看不清?换一张" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-button class="submit" type="primary" @click="registerForm">注册</el-button> |
|
|
|
|
</el-form> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import axios from 'axios'; |
|
|
|
|
export default { |
|
|
|
|
data: function() { |
|
|
|
|
return { |
|
|
|
|
verifyCode:'', |
|
|
|
|
regForm: { |
|
|
|
|
userName: '', |
|
|
|
|
workNumber: '', |
|
|
|
@ -91,7 +101,8 @@ export default { |
|
|
|
|
password: '', |
|
|
|
|
rePassword: '', |
|
|
|
|
roleId: 4, |
|
|
|
|
schoolId: 2105 |
|
|
|
|
schoolId: 2105, |
|
|
|
|
validateCode:'' |
|
|
|
|
}, |
|
|
|
|
regRules: { |
|
|
|
|
userName: [{ required: true, message: '请输入学生姓名', trigger: 'blur' }], |
|
|
|
@ -122,8 +133,27 @@ export default { |
|
|
|
|
mounted() { |
|
|
|
|
this.getProvince() |
|
|
|
|
this.getSchoolData() |
|
|
|
|
this.getVerificationCode() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
//获取图形验证码 |
|
|
|
|
getVerificationCode(){ |
|
|
|
|
// this.$get(this.api.getValidateCode) |
|
|
|
|
axios({ |
|
|
|
|
url:this.api.getValidateCode, |
|
|
|
|
methods:'get', |
|
|
|
|
headers: { |
|
|
|
|
"Content-Type": "application/json", |
|
|
|
|
"EngineCode": "j371gy1q1ioeveq2y05l4gjz3", |
|
|
|
|
"EngineSecret": "IgMlZo+KOs8FthII3KnobUoynILH5ELJVqcHNZcs1G2mwrkofR1THw==" |
|
|
|
|
}, |
|
|
|
|
responseType: 'arraybuffer', |
|
|
|
|
}) |
|
|
|
|
.then(res => { |
|
|
|
|
const bufferUrl = btoa(new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), '')); |
|
|
|
|
this.verifyCode = 'data:image/png;base64,' + bufferUrl; |
|
|
|
|
}).catch(res => {}); |
|
|
|
|
}, |
|
|
|
|
getProvince(){ |
|
|
|
|
this.$get(this.api.queryProvince).then(res => { |
|
|
|
|
this.provinceList = res.message |
|
|
|
@ -155,12 +185,14 @@ export default { |
|
|
|
|
let data = this.regForm |
|
|
|
|
data.account = data.phone |
|
|
|
|
data.uniqueIdentificationAccount = new Date().getTime() |
|
|
|
|
this.$post(`${this.api.save}?workNumber=${this.regForm.workNumber}`,data).then(res => { |
|
|
|
|
this.$post(`${this.api.save}?workNumber=${this.regForm.workNumber}&validateCode=${this.regForm.validateCode}`,data).then(res => { |
|
|
|
|
this.$message.success('注册成功') |
|
|
|
|
this.$emit('update:isReg',false) |
|
|
|
|
this.$emit('updateInfo',{username: this.regForm.phone,password: this.regForm.password}) |
|
|
|
|
this.$refs.reg.resetFields() |
|
|
|
|
}).catch(res => {}); |
|
|
|
|
}).catch(res => { |
|
|
|
|
// this.$message.error(res) |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
// this.$message.error('请输入账号和密码'); |
|
|
|
|
return false; |
|
|
|
|