This commit is contained in:
zhuchunyun 2024-08-29 18:27:08 +08:00
parent e378b3b63b
commit 6e747c941a
15 changed files with 260 additions and 96 deletions

View File

@ -2,6 +2,8 @@ package com.ruoyi.cms.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.HitRegistrationTeachInfo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -9,7 +11,6 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.domain.HitRegistrationTeachInfo;
import com.ruoyi.cms.service.IHitRegistrationTeachInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

View File

@ -1,8 +1,10 @@
package com.ruoyi.cms.service;
import java.util.List;
import com.ruoyi.common.core.domain.HitRegistrationTeachInfo;
import com.ruoyi.common.core.domain.model.RegisterBody;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* 教师信息Service接口
@ -62,4 +64,5 @@ public interface IHitRegistrationTeachInfoService
List<HitRegistrationTeachInfo> getTeacherInfo(String schoolName, String division);
void register(RegisterBody user) throws Exception;
}

View File

@ -11,8 +11,6 @@ import com.ruoyi.cms.mapper.HitTeamMembersMapper;
import com.ruoyi.cms.mapper.HitTeamsMapper;
import com.ruoyi.cms.service.IHitCompetitionStudentInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.cms.service.IHitRegistrationTeachInfoService;
import com.ruoyi.cms.service.IHitTeamsService;
import com.ruoyi.common.core.domain.HitRegistrationTeachInfo;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;

View File

@ -7,7 +7,6 @@ import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.ruoyi.cms.domain.*;
import com.ruoyi.cms.mapper.*;
import com.ruoyi.cms.service.ICmsContentService;
@ -15,7 +14,6 @@ import com.ruoyi.cms.service.IHitCompetitionStudentInfoService;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.HitRegistrationTeachInfo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cms.service.IHitRegInfoService;

View File

@ -1,16 +1,31 @@
package com.ruoyi.cms.service.impl;
import java.util.Collections;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.HitRegistrationTeachInfo;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.RegisterBody;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.user.CaptchaException;
import com.ruoyi.common.exception.user.CaptchaExpireException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.framework.web.service.SysRegisterService;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cms.mapper.HitRegistrationTeachInfoMapper;
import com.ruoyi.common.core.domain.HitRegistrationTeachInfo;
import com.ruoyi.cms.service.IHitRegistrationTeachInfoService;
import org.springframework.transaction.annotation.Transactional;
/**
* 教师信息Service业务层处理
@ -22,6 +37,14 @@ import com.ruoyi.cms.service.IHitRegistrationTeachInfoService;
public class HitRegistrationTeachInfoServiceImpl implements IHitRegistrationTeachInfoService {
@Autowired
private HitRegistrationTeachInfoMapper hitRegistrationTeachInfoMapper;
@Autowired
private SysRegisterService registerService;
@Autowired
private ISysConfigService configService;
@Autowired
private ISysUserService userService;
@Autowired
private RedisCache redisCache;
/**
* 查询教师信息
@ -104,6 +127,83 @@ public class HitRegistrationTeachInfoServiceImpl implements IHitRegistrationTeac
queryWrapper.eq(HitRegistrationTeachInfo::getDivision, division);
return hitRegistrationTeachInfoMapper.selectList(queryWrapper);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void register(RegisterBody user) throws Exception {
String msg = "", username = user.getUsername(), password = user.getPassword();
SysUser sysUser = new SysUser();
sysUser.setUserName(username);
// 验证码开关
boolean captchaEnabled = configService.selectCaptchaEnabled();
if (captchaEnabled) {
validateCaptcha(username, user.getCode(), user.getUuid());
}
if (StringUtils.isEmpty(username)) {
msg = "用户名不能为空";
} else if (StringUtils.isEmpty(password)) {
msg = "用户密码不能为空";
} else if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
msg = "账户长度必须在2到20个字符之间";
} else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
msg = "密码长度必须在5到20个字符之间";
} else if (!userService.checkUserNameUnique(sysUser)) {
msg = "保存用户'" + username + "'失败,注册账号已存在";
} else {
sysUser.setNickName(user.getNickName());
sysUser.setPassword(SecurityUtils.encryptPassword(password));
sysUser.setUserType(user.getUserType());
boolean regFlag = userService.registerUser(sysUser);
if (!regFlag) {
msg = "注册失败,请联系系统管理人员";
} else {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.REGISTER, MessageUtils.message("user.register.success")));
}
}
if(StringUtils.isNotEmpty(msg)){
throw new Exception(msg);
}
if (user.getUserType().equals("02")){
HitRegistrationTeachInfo teachInfo = user.getHitRegistrationTeachInfo();
teachInfo.setRelatedAccounts(user.getUsername());
teachInfo.setStatus("1");
teachInfo.setType(user.getUserType());
teachInfo.setTeacherName(user.getNickName());
this.insertHitRegistrationTeachInfo(teachInfo);
}else if (user.getUserType().equals("03")){
HitRegistrationTeachInfo teachInfo = user.getHitRegistrationTeachInfo();
teachInfo.setRelatedAccounts(user.getUsername());
teachInfo.setStatus("0");
teachInfo.setType(user.getUserType());
teachInfo.setTeacherName(user.getNickName());
this.insertHitRegistrationTeachInfo(teachInfo);
}
}
/**
* 校验验证码
*
* @param username 用户名
* @param code 验证码
* @param uuid 唯一标识
* @return 结果
*/
public void validateCaptcha(String username, String code, String uuid) {
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
String captcha = redisCache.getCacheObject(verifyKey);
redisCache.deleteObject(verifyKey);
if (captcha == null) {
throw new CaptchaExpireException();
}
if (!code.equalsIgnoreCase(captcha)) {
throw new CaptchaException();
}
}
}

View File

@ -1,9 +1,7 @@
package com.ruoyi.cms.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.cms.domain.HitCompetitionStudentInfo;
import com.ruoyi.cms.domain.HitTeamMembers;
import com.ruoyi.cms.domain.HitTeams;
import com.ruoyi.cms.domain.Preliminary;
@ -11,7 +9,6 @@ import com.ruoyi.cms.mapper.HitRegistrationTeachInfoMapper;
import com.ruoyi.cms.mapper.HitTeamMembersMapper;
import com.ruoyi.cms.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.HitRegistrationTeachInfo;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,8 +1,19 @@
package com.ruoyi.web.controller.system;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.ruoyi.cms.service.IHitRegistrationTeachInfoService;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.HitRegistrationTeachInfo;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.user.CaptchaException;
import com.ruoyi.common.exception.user.CaptchaExpireException;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -22,29 +33,25 @@ import com.ruoyi.system.service.ISysConfigService;
@RestController
public class SysRegisterController extends BaseController
{
@Autowired
private SysRegisterService registerService;
@Autowired
private ISysConfigService configService;
@Autowired
private IHitRegistrationTeachInfoService hitRegistrationTeachInfoService;
@PostMapping("/register")
public AjaxResult register(@RequestBody RegisterBody user)
{
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
{
return error("当前系统没有开启注册功能!");
}
String msg = registerService.register(user);
if (user.getUserType().equals("02")){
HitRegistrationTeachInfo teachInfo = user.getHitRegistrationTeachInfo();
teachInfo.setRelatedAccounts(user.getUsername());
hitRegistrationTeachInfoService.insertHitRegistrationTeachInfo(teachInfo);
String msg="";
try {
hitRegistrationTeachInfoService.register(user);
}catch (Exception e){
msg = e.getMessage();
}
return StringUtils.isEmpty(msg) ? success() : error(msg);
}
}

View File

@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.cms.mapper.HitRegistrationTeachInfoMapper">
<resultMap type="HitRegistrationTeachInfo" id="HitRegistrationTeachInfoResult">
<resultMap type="com.ruoyi.common.core.domain.HitRegistrationTeachInfo" id="HitRegistrationTeachInfoResult">
<result property="id" column="id" />
<result property="hitRegId" column="hit_reg_id" />
<result property="teacherName" column="teacher_name" />
@ -19,16 +19,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="type" column="type" />
<result property="status" column="status" />
<result property="relatedAccounts" column="related_accounts" />
<result property="schoolName" column="school_name" />
<result property="division" column="division" />
</resultMap>
<sql id="selectHitRegistrationTeachInfoVo">
select id, hit_reg_id, teacher_name, teacher_job, teacher_number, teacher_email, teacher_school, remark, del_flag, create_time, create_by, update_time, update_by, type from hit_registration_teach_info
select id, hit_reg_id, teacher_name, teacher_job, teacher_number, teacher_email, teacher_school, remark, del_flag, create_time, create_by, update_time, update_by, type,status from hit_registration_teach_info
</sql>
<select id="selectHitRegistrationTeachInfoList" parameterType="HitRegistrationTeachInfo" resultMap="HitRegistrationTeachInfoResult">
<select id="selectHitRegistrationTeachInfoList" parameterType="com.ruoyi.common.core.domain.HitRegistrationTeachInfo" resultMap="HitRegistrationTeachInfoResult">
<include refid="selectHitRegistrationTeachInfoVo"/>
<where>
<if test="hitRegId != null "> and hit_reg_id = #{hitRegId}</if>
@ -38,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="teacherEmail != null and teacherEmail != ''"> and teacher_email = #{teacherEmail}</if>
<if test="teacherSchool != null and teacherSchool != ''"> and teacher_school = #{teacherSchool}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
@ -46,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<insert id="insertHitRegistrationTeachInfo" parameterType="HitRegistrationTeachInfo">
<insert id="insertHitRegistrationTeachInfo" parameterType="com.ruoyi.common.core.domain.HitRegistrationTeachInfo">
insert into hit_registration_teach_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
@ -63,10 +65,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="type != null">type,</if>
<if test="status != null">status,</if>
<if test="schoolName != null and schoolName !='' ">school_name,</if>
<if test="division != null and division !='' ">division,</if>
<if test="relatedAccounts != null and relatedAccounts !='' ">related_accounts,</if>
<if test="SampleAddress != null and SampleAddress !='' ">sample_address,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -82,15 +85,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="type != null">#{type},</if>
<if test="type != null">type,</if>
<if test="status != null">#{status},</if>
<if test="schoolName != null and schoolName !='' ">#{schoolName},</if>
<if test="division != null and division !='' ">#{division},</if>
<if test="relatedAccounts != null and relatedAccounts !='' ">#{relatedAccounts},</if>
<if test="SampleAddress != null and SampleAddress !='' ">#{SampleAddress},</if>
</trim>
</insert>
<update id="updateHitRegistrationTeachInfo" parameterType="HitRegistrationTeachInfo">
<update id="updateHitRegistrationTeachInfo" parameterType="com.ruoyi.common.core.domain.HitRegistrationTeachInfo">
update hit_registration_teach_info
<trim prefix="SET" suffixOverrides=",">
<if test="hitRegId != null">hit_reg_id = #{hitRegId},</if>
@ -105,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="type != null">type = #{type},</if>
<if test="status != null">status = #{status},</if>
</trim>
where id = #{id}
</update>

View File

@ -93,7 +93,7 @@ public class Constants
/**
* 验证码有效期分钟
*/
public static final Integer CAPTCHA_EXPIRATION = 2;
public static final Integer CAPTCHA_EXPIRATION = 5;
/**
* 令牌

View File

@ -2,9 +2,10 @@ package com.ruoyi.common.core.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
/**
* 教师信息对象 hit_registration_teach_info
@ -66,6 +67,8 @@ public class HitRegistrationTeachInfo extends BaseEntity
/** 盲样邮寄地址 */
@Excel(name = "盲样邮寄地址")
private String SampleAddress;
//审核状态0待审核1审核通过2审核拒绝
private String status;
public String getSampleAddress() {
return SampleAddress;
@ -206,4 +209,12 @@ public class HitRegistrationTeachInfo extends BaseEntity
.append("sampleAddress",getSampleAddress())
.toString();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}

View File

@ -11,6 +11,7 @@ public class LoginBody
* 用户名
*/
private String username;
private String nickName;
/**
* 用户密码
@ -66,4 +67,12 @@ public class LoginBody
{
this.uuid = uuid;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
}

View File

@ -116,7 +116,7 @@ public class SecurityConfig
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
.antMatchers("/api/**", "/ueditor/**","/system/dict/data/type/sys_user_sex","/system/dict/data/type/imitation_type"
,"/system/dict/data/type/school_name").permitAll()
,"/system/dict/data/type/school_name","/system/dict/data/type/com_region").permitAll()
.antMatchers("/system/hit_stu_info/*").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated();

View File

@ -65,7 +65,7 @@ public class SysRegisterService {
} else if (!userService.checkUserNameUnique(sysUser)) {
msg = "保存用户'" + username + "'失败,注册账号已存在";
} else {
sysUser.setNickName(username);
sysUser.setNickName(registerBody.getNickName());
sysUser.setPassword(SecurityUtils.encryptPassword(password));
sysUser.setUserType(registerBody.getUserType());
boolean regFlag = userService.registerUser(sysUser);

View File

@ -1,5 +1,5 @@
<template>
<div class="tab-boxs">
<!-- left -->
<div class="d-s" @click="toHome">
@ -54,7 +54,7 @@
<el-input placeholder="密码" v-model="loginForm.password" type="password"></el-input>
</el-form-item>
<el-form-item prop="code">
<el-input v-model="loginForm.code"
<el-input v-model="loginForm.code"
auto-complete="off"
placeholder="验证码"
style="width: 63%"
@ -73,47 +73,63 @@
<el-button type="primary" @click="submitLogin"> </el-button>
</span>
</el-dialog>
<el-dialog title="注册" :visible.sync="registerDialog" width="30%" :modal="false">
<div>
<el-dialog title="注册" :close-on-click-modal="false" :visible.sync="registerDialog" width="30%" :modal="false">
<div>
<el-form :model="registerForm" :rules="registerRules" ref="registerForm">
<el-form-item label="老师注册">
<el-switch v-model="value"></el-switch>
</el-form-item>
<el-form-item prop="userType">
<el-radio-group v-model="registerForm.userType">
<el-radio label="01">学生</el-radio>
<el-radio label="02">指导老师</el-radio>
<el-radio label="03">领队老师</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="nickName" >
<el-input placeholder="姓名" v-model="registerForm.nickName" type="text"></el-input>
</el-form-item>
<el-form-item prop="username">
<el-input placeholder="学号" v-model="registerForm.username" type="text"></el-input>
<el-input placeholder="学号(登录账号)" v-model="registerForm.username" type="text"></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input placeholder="密码" v-model="registerForm.password" type="password"></el-input>
</el-form-item>
<el-form-item prop="confirmPassword">
<el-input placeholder="确认密码" v-model="registerForm.confirmPassword" type="password"></el-input>
</el-form-item>
<el-form-item prop="teacherName" v-if="value">
<el-input placeholder="姓名" v-model="registerForm.hitRegistrationTeachInfo.teacherName" type="text"></el-input>
</el-form-item>
<el-form-item prop="teacherJob" v-if="value">
<el-form-item prop="hitRegistrationTeachInfo.teacherEmail" v-if="registerForm.userType=='03'||registerForm.userType=='02'">
<el-input placeholder="邮箱" v-model="registerForm.hitRegistrationTeachInfo.teacherEmail" type="text"></el-input>
</el-form-item>
<el-form-item prop="hitRegistrationTeachInfo.teacherNumber" v-if="registerForm.userType=='03'||registerForm.userType=='02'">
<el-input placeholder="手机号" v-model="registerForm.hitRegistrationTeachInfo.teacherNumber" type="text"></el-input>
</el-form-item>
<el-form-item prop="hitRegistrationTeachInfo.division" v-if="registerForm.userType=='03'||registerForm.userType=='02'">
<el-select v-model="registerForm.hitRegistrationTeachInfo.division" filterable allow-create default-first-option
placeholder="请选择赛区">
<el-option v-for="item in dict.type.com_region" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="hitRegistrationTeachInfo.schoolName" v-if="registerForm.userType=='03'||registerForm.userType=='02'">
<el-select v-model="registerForm.hitRegistrationTeachInfo.schoolName" filterable allow-create default-first-option
placeholder="请选择学校名称">
<el-option v-for="item in dict.type.school_name" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="hitRegistrationTeachInfo.teacherSchool" v-if="registerForm.userType=='03'||registerForm.userType=='02'">
<el-input placeholder="所在系及专业" v-model="registerForm.hitRegistrationTeachInfo.teacherSchool" type="text"></el-input>
</el-form-item>
<el-form-item prop="hitRegistrationTeachInfo.teacherJob" v-if="registerForm.userType=='03'||registerForm.userType=='02'">
<el-input placeholder="职务" v-model="registerForm.hitRegistrationTeachInfo.teacherJob" type="text"></el-input>
</el-form-item>
<el-form-item prop="teacherEmail" v-if="value">
<el-input placeholder="邮箱" v-model="registerForm.hitRegistrationTeachInfo.teacherEmail" type="text"></el-input>
</el-form-item>
<el-form-item prop="teacherNumber" v-if="value">
<el-input placeholder="手机号" v-model="registerForm.hitRegistrationTeachInfo.teacherNumber" type="text"></el-input>
</el-form-item>
<el-form-item prop="teacherSchool" v-if="value">
<el-input placeholder="所在系及专业" v-model="registerForm.hitRegistrationTeachInfo.teacherSchool" type="text"></el-input>
</el-form-item>
<el-form-item prop="SchoolName" v-if="value">
<el-input placeholder="所在学校" v-model="registerForm.hitRegistrationTeachInfo.schoolName" type="text"></el-input>
</el-form-item>
<el-form-item prop="division" v-if="value">
<el-input placeholder="所属赛区" v-model="registerForm.hitRegistrationTeachInfo.division" type="text"></el-input>
</el-form-item>
<el-form-item prop="SampleAddress" v-if="value">
<el-input placeholder="盲样邮寄地址" v-model="registerForm.hitRegistrationTeachInfo.SampleAddress"></el-input>
</el-form-item>
<el-form-item prop="code" >
<el-input v-model="registerForm.code"
<el-input v-model="registerForm.code"
auto-complete="off"
placeholder="验证码"
style="width: 63%"
@ -133,7 +149,7 @@
</span>
</el-dialog>
</div>
</template>
<script>
import { getHomeUserInfo ,getTeacherAndStudentInfo} from "@/api/system/user";
@ -143,7 +159,9 @@ import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
export default {
dicts: ["sys_user_sex", "school_name","com_region"],
data() {
const equalToPassword = (rule, value, callback) => {
if (this.registerForm.password !== value) {
callback(new Error("两次输入的密码不一致"));
@ -192,7 +210,7 @@ export default {
code: '',
confirmPassword: '',
uuid: '',
userType:'',
userType:'01',
hitRegistrationTeachInfo:{
teacherName: '',
teacherJob: '',
@ -202,7 +220,7 @@ export default {
schoolName: '',
division: '',
SampleAddress: '',
}
},
registerRules: {
@ -210,6 +228,10 @@ export default {
{ required: true, trigger: "blur", message: "请输入您的账号" },
{ message: '学号不能为空', trigger: 'blur' }
],
nickName: [
{ required: true, trigger: "blur", message: "请输入您的姓名" },
{ message: '姓名不能为空', trigger: 'blur' }
],
password: [
{ required: true, trigger: "blur", message: "请输入您的密码" },
{ min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" },
@ -219,7 +241,25 @@ export default {
{ required: true, trigger: "blur", message: "请再次输入您的密码" },
{ required: true, validator: equalToPassword, trigger: "blur" }
],
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
code: [{ required: true, trigger: "change", message: "请输入验证码" }],
'hitRegistrationTeachInfo.teacherEmail': [
{ required: true, trigger: "blur", message: "请输入您的邮箱" },
],
'hitRegistrationTeachInfo.teacherNumber': [
{ required: true, trigger: "blur", message: "请输入您的手机号" },
],
'hitRegistrationTeachInfo.division': [
{ required: true, trigger: "blur", message: "请选择赛区" },
],
'hitRegistrationTeachInfo.schoolName': [
{ required: true, trigger: "blur", message: "请选择学校名称" },
],
'hitRegistrationTeachInfo.teacherSchool': [
{ required: true, trigger: "blur", message: "请输入所在系及专业" },
],
'hitRegistrationTeachInfo.teacherJob': [
{ required: true, trigger: "blur", message: "请输入您的职务" },
],
}
}
},
@ -248,14 +288,14 @@ export default {
//
window.removeEventListener('beforeunload', this.handleBeforeUnload);
},
methods:{
//
loadUserInfo() {
getHomeUserInfo().then(response => {
this.currentUser = response.data.userName;
console.log('当前用户名:', this.currentUser);
console.log('当前用户名:', this.currentUser);
if (this.userInfo.avatar && this.userInfo.avatar != '') {
this.userInfo.avatar = process.env.VUE_APP_BASE_API + this.userInfo.avatar;
}
@ -302,7 +342,7 @@ export default {
this.$router.push("/virtually").catch(()=>{});
this.loadUserInfo();
localStorage.setItem('isLoggedIn', 'true'); // localStorage
console.log('当前用户名:', this.currentUser);
console.log('当前用户名:', this.currentUser);
}).catch(() => {
this.loading = false;
if (this.captchaEnabled) {
@ -318,13 +358,9 @@ export default {
this.$refs.registerForm.validate(valid => {
if (valid) {
this.loading = true;
if (this.value) {
this.registerForm.userType = '02';
}else {
this.registerForm.userType = '01';
}
register(this.registerForm).then(res => {
const username = this.registerForm.username;
this.registerDialog = false
this.$alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", '系统提示', {
dangerouslyUseHTMLString: true,
type: 'success'
@ -481,8 +517,8 @@ export default {
.login-code-img {
height: 38px;
}
.el-dialog__title {
text-align: center;
.el-dialog__title {
text-align: center;
}
</style>

View File

@ -135,7 +135,7 @@
<el-button type="primary" @click="RefuseToFormTeam">拒绝组队</el-button>
<el-button type="primary" @click="AgreeToFormTeam">确认组队</el-button>
</div>
<div>
<div class="step-box" v-if="active == 2 && teammateInfo.isAgreeWith ==1" >
<div class="step-box-title" >
@ -149,7 +149,7 @@
</div>
</div>
</div>
<!-- main -->
<div v-show="currentActive == 0 || currentActive == 1 || currentActive == 5" v-html="pageContext"></div>
@ -207,7 +207,7 @@ export default {
SwiperSlide,
"page-util": PageUtil
},
dicts: ["sys_user_sex", "school_name"],
dicts: ["sys_user_sex", "school_name","com_region"],
name: 'HelloWorld',
data() {
@ -249,7 +249,7 @@ export default {
teamMateId: "",
isAgreeWith:"",
},
teammateList: [], //
teacherList: [], //
rules: {
@ -312,7 +312,7 @@ export default {
//
loadUserInfo() {
getHomeUserInfo().then(response => {
this.signUpForm.studentId = response.data.userName;
this.preliminaryForm.division = response.data.division;
this.preliminaryForm.schoolName = response.data.schoolName;
@ -323,19 +323,19 @@ export default {
fetchRegistrationInformation() {
getStudentInfoByStuId(this.signUpForm.studentId)
.then(response => {
this.updateSignUpForm(response.data);
if (response.data.id != null) {
this.fetchTeamMateInfo();
this.fetchTeacherInfo();
}
console.log('报名信息:', this.signUpForm);
})
},
updateSignUpForm(data) {
this.preliminaryForm.division = data.division;
this.preliminaryForm.schoolName = data.schoolName;
this.active = 1;
@ -347,7 +347,7 @@ export default {
if (this.preliminaryForm.division!= null) {
this.fetchTeamMateInfoByUserId();
}
},
//
fetchTeamMateInfo() {
@ -379,7 +379,7 @@ export default {
this.active= 2;
}
for (let i = 0; i < this.teacherList.length; i++) {
if (this.teacherList[i].hitRegId !=null) {
this.active = 3;
}