Merge remote-tracking branch 'origin/main'
# Conflicts: # backend/src/main/resources/application.yaml
This commit is contained in:
@@ -27,7 +27,7 @@ jetty:
|
|||||||
|
|
||||||
security:
|
security:
|
||||||
tokenName: token
|
tokenName: token
|
||||||
timeout: 3600
|
timeout: 36000
|
||||||
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
||||||
# 允许同一账号并发登录,则系统参数 SessionOnlyOne 有效,亦可踢人下线并多了弹框提示功能
|
# 允许同一账号并发登录,则系统参数 SessionOnlyOne 有效,亦可踢人下线并多了弹框提示功能
|
||||||
isConcurrent: true
|
isConcurrent: true
|
||||||
|
|||||||
+35
-1
@@ -7,6 +7,7 @@ import com.budwk.app.base.result.Result;
|
|||||||
import com.budwk.app.client.auth.models.Client_user;
|
import com.budwk.app.client.auth.models.Client_user;
|
||||||
import com.budwk.app.client.auth.service.ClientAuthService;
|
import com.budwk.app.client.auth.service.ClientAuthService;
|
||||||
import com.budwk.app.client.auth.vo.ClientLoginBody;
|
import com.budwk.app.client.auth.vo.ClientLoginBody;
|
||||||
|
import com.budwk.app.client.auth.vo.ClientRegisterBody;
|
||||||
import com.budwk.app.sys.services.SysMsgService;
|
import com.budwk.app.sys.services.SysMsgService;
|
||||||
import com.budwk.app.sys.services.SysUserService;
|
import com.budwk.app.sys.services.SysUserService;
|
||||||
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
|
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
|
||||||
@@ -59,6 +60,22 @@ public class ClientAuthController {
|
|||||||
public void login(HttpServletRequest req, HttpSession session) {
|
public void login(HttpServletRequest req, HttpSession session) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@At("/register")
|
||||||
|
@Ok("json")
|
||||||
|
@AdaptBy(type = JsonAdaptor.class)
|
||||||
|
@ApiOperation(value = "注册", nickname = "/register", httpMethod = "POST")
|
||||||
|
public Result register(ClientRegisterBody registerBody) {
|
||||||
|
try {
|
||||||
|
// String token = clientAuthService.doRegister(registerBody);
|
||||||
|
// return Result.success().addData(token);
|
||||||
|
return Result.success();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return Result.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信登录
|
* 短信登录
|
||||||
*/
|
*/
|
||||||
@@ -68,7 +85,7 @@ public class ClientAuthController {
|
|||||||
@ApiOperation(value = "短信登录", nickname = "/sms-login", httpMethod = "POST")
|
@ApiOperation(value = "短信登录", nickname = "/sms-login", httpMethod = "POST")
|
||||||
public Object doSmsLogin(ClientLoginBody loginBody, HttpServletRequest req) {
|
public Object doSmsLogin(ClientLoginBody loginBody, HttpServletRequest req) {
|
||||||
try {
|
try {
|
||||||
String token = clientAuthService.doSmsLogin(loginBody);
|
String token = clientAuthService.doLogin(loginBody);
|
||||||
return Result.success().addData(token);
|
return Result.success().addData(token);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
@@ -76,6 +93,23 @@ public class ClientAuthController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@At("/send-reg-code/?")
|
||||||
|
@Ok("json")
|
||||||
|
@ApiOperation(value = "发送注册验证码", nickname = "/send-reg-code", httpMethod = "POST")
|
||||||
|
public Result sendRegCode(String phone) {
|
||||||
|
try {
|
||||||
|
int count = dao.count(Client_user.class, Cnd.where("phone", "=", phone));
|
||||||
|
if (count > 0) {
|
||||||
|
return Result.error("手机号码已注册,请直接登录");
|
||||||
|
}
|
||||||
|
validateService.getSmsCode(phone);
|
||||||
|
return Result.success(NutMap.NEW().addv("key", RedisConstant.UCENTER_SMSCODE + phone)).addMsg("发送成功");
|
||||||
|
} catch (BaseException e) {
|
||||||
|
return Result.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送短信验证码
|
* 发送短信验证码
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -43,6 +43,21 @@ public class Client_user extends BaseModel implements Serializable {
|
|||||||
@Comment("头像")
|
@Comment("头像")
|
||||||
private String avatar;
|
private String avatar;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
@Comment("单位ID")
|
||||||
|
private String unitId;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||||
|
@Comment("密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||||
|
@Comment("盐")
|
||||||
|
private String salt;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||||
@Comment("openId")
|
@Comment("openId")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.budwk.app.client.auth.service;
|
package com.budwk.app.client.auth.service;
|
||||||
|
|
||||||
import com.budwk.app.client.auth.vo.ClientLoginBody;
|
import com.budwk.app.client.auth.vo.ClientLoginBody;
|
||||||
|
import com.budwk.app.client.auth.vo.ClientRegisterBody;
|
||||||
|
|
||||||
public interface ClientAuthService {
|
public interface ClientAuthService {
|
||||||
|
|
||||||
@@ -9,6 +10,12 @@ public interface ClientAuthService {
|
|||||||
* @param loginBody 登录信息
|
* @param loginBody 登录信息
|
||||||
* @return token
|
* @return token
|
||||||
*/
|
*/
|
||||||
String doSmsLogin(ClientLoginBody loginBody);
|
String doLogin(ClientLoginBody loginBody);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册
|
||||||
|
* @param registerBody 注册信息
|
||||||
|
* @return token
|
||||||
|
*/
|
||||||
|
String doRegister(ClientRegisterBody registerBody);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,21 @@
|
|||||||
package com.budwk.app.client.auth.service;
|
package com.budwk.app.client.auth.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.budwk.app.base.exception.BaseException;
|
import com.budwk.app.base.exception.BaseException;
|
||||||
|
import com.budwk.app.base.utils.PwdUtil;
|
||||||
import com.budwk.app.client.auth.vo.ClientLoginBody;
|
import com.budwk.app.client.auth.vo.ClientLoginBody;
|
||||||
import com.budwk.app.client.auth.models.Client_user;
|
import com.budwk.app.client.auth.models.Client_user;
|
||||||
|
import com.budwk.app.client.auth.vo.ClientRegisterBody;
|
||||||
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
|
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
|
||||||
import com.budwk.app.web.commons.auth.service.ValidateService;
|
import com.budwk.app.web.commons.auth.service.ValidateService;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Dao;
|
import org.nutz.dao.Dao;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.Strings;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@IocBean
|
@IocBean
|
||||||
public class ClientAuthServiceImpl implements ClientAuthService {
|
public class ClientAuthServiceImpl implements ClientAuthService {
|
||||||
@@ -19,22 +26,50 @@ public class ClientAuthServiceImpl implements ClientAuthService {
|
|||||||
private ValidateService validateService;
|
private ValidateService validateService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String doSmsLogin(ClientLoginBody loginBody) {
|
public String doLogin(ClientLoginBody loginBody) {
|
||||||
Client_user user = null;
|
Client_user user = null;
|
||||||
int count = dao.count(Client_user.class, Cnd.where(Client_user::getPhone, "=", loginBody.getPhone()));
|
int count = dao.count(Client_user.class, Cnd.where(Client_user::getPhone, "=", loginBody.getPhone()));
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
// 自动注册
|
throw new BaseException("手机号码不存在");
|
||||||
user = new Client_user();
|
|
||||||
user.setPhone(loginBody.getPhone());
|
|
||||||
user.setUserName("用户" + loginBody.getPhone());
|
|
||||||
dao.insert(user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
validateService.checkSMSCode(loginBody.getPhone(), loginBody.getSmsCode());
|
|
||||||
user = dao.fetch(Client_user.class, Cnd.where(Client_user::getPhone, "=", loginBody.getPhone()));
|
user = dao.fetch(Client_user.class, Cnd.where(Client_user::getPhone, "=", loginBody.getPhone()));
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new BaseException("用户登录失败");
|
throw new BaseException("用户不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StrUtil.isBlank(loginBody.getLoginMethod()) || !List.of("sms", "password").contains(loginBody.getLoginMethod())) {
|
||||||
|
throw new BaseException("登录方式不正确");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loginBody.getLoginMethod().equals("sms")) {
|
||||||
|
validateService.checkSMSCode(loginBody.getPhone(), loginBody.getSmsCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loginBody.getLoginMethod().equals("password")) {
|
||||||
|
String hashedPassword = PwdUtil.getPassword(loginBody.getPassword(), user.getSalt());
|
||||||
|
if (!Strings.sNull(hashedPassword).equalsIgnoreCase(user.getPassword())) {
|
||||||
|
throw new BaseException("密码不正确");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StpClientUtil.STP.login(user.getId());
|
||||||
|
StpClientUtil.STP.checkLogin();
|
||||||
|
return StpClientUtil.STP.getTokenValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String doRegister(ClientRegisterBody registerBody) {
|
||||||
|
int count = dao.count(Client_user.class, Cnd.where(Client_user::getPhone, "=", registerBody.getPhone()));
|
||||||
|
if (count > 0) {
|
||||||
|
throw new BaseException("手机号码已注册,请直接登录");
|
||||||
|
}
|
||||||
|
|
||||||
|
validateService.checkSMSCode(registerBody.getPhone(), registerBody.getSmsCode());
|
||||||
|
|
||||||
|
Client_user user = BeanUtil.copyProperties(registerBody, Client_user.class);
|
||||||
|
dao.insert(user);
|
||||||
StpClientUtil.STP.login(user.getId());
|
StpClientUtil.STP.login(user.getId());
|
||||||
StpClientUtil.STP.checkLogin();
|
StpClientUtil.STP.checkLogin();
|
||||||
return StpClientUtil.STP.getTokenValue();
|
return StpClientUtil.STP.getTokenValue();
|
||||||
|
|||||||
@@ -9,4 +9,8 @@ public class ClientLoginBody {
|
|||||||
|
|
||||||
private String smsCode;
|
private String smsCode;
|
||||||
|
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
private String loginMethod;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.budwk.app.client.auth.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ClientRegisterBody {
|
||||||
|
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
private String unitId;
|
||||||
|
|
||||||
|
private String smsCode;
|
||||||
|
}
|
||||||
+1
@@ -81,6 +81,7 @@ public class ClientActivityController {
|
|||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询报名人员
|
* 查询报名人员
|
||||||
* 报名人不见得参加活动
|
* 报名人不见得参加活动
|
||||||
|
|||||||
+14
@@ -117,4 +117,18 @@ public class ClientItemController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消项目报名
|
||||||
|
* @param signVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@At("/cancel-team-sign-up")
|
||||||
|
@AdaptBy(type = JsonAdaptor.class)
|
||||||
|
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||||
|
public synchronized Result cancelTeamSignUp(ClientActivitySignVO signVO) {
|
||||||
|
clientItemService.cancelTeamSignUp(signVO);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -1,9 +1,12 @@
|
|||||||
package com.budwk.app.client.module.activity.service;
|
package com.budwk.app.client.module.activity.service;
|
||||||
|
|
||||||
import com.budwk.app.base.service.BaseService;
|
import com.budwk.app.base.service.BaseService;
|
||||||
|
import com.budwk.app.client.module.activity.vo.ClientActivitySignVO;
|
||||||
import com.budwk.app.client.module.activity.vo.ClientItemSignUpVO;
|
import com.budwk.app.client.module.activity.vo.ClientItemSignUpVO;
|
||||||
import com.budwk.app.module.activity.models.ActivityItemUser;
|
import com.budwk.app.module.activity.models.ActivityItemUser;
|
||||||
|
|
||||||
public interface ClientItemService extends BaseService<ActivityItemUser> {
|
public interface ClientItemService extends BaseService<ActivityItemUser> {
|
||||||
void signUp(ClientItemSignUpVO signVO);
|
void signUp(ClientItemSignUpVO signVO);
|
||||||
|
|
||||||
|
void cancelTeamSignUp(ClientActivitySignVO signVO);
|
||||||
}
|
}
|
||||||
|
|||||||
+7
@@ -2,6 +2,7 @@ package com.budwk.app.client.module.activity.service.impl;
|
|||||||
|
|
||||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||||
import com.budwk.app.client.module.activity.service.ClientItemService;
|
import com.budwk.app.client.module.activity.service.ClientItemService;
|
||||||
|
import com.budwk.app.client.module.activity.vo.ClientActivitySignVO;
|
||||||
import com.budwk.app.client.module.activity.vo.ClientItemSignUpVO;
|
import com.budwk.app.client.module.activity.vo.ClientItemSignUpVO;
|
||||||
import com.budwk.app.module.activity.models.ActGroupUser;
|
import com.budwk.app.module.activity.models.ActGroupUser;
|
||||||
import com.budwk.app.module.activity.models.Activity;
|
import com.budwk.app.module.activity.models.Activity;
|
||||||
@@ -59,4 +60,10 @@ public class ClientItemServiceImpl extends BaseServiceImpl<ActivityItemUser> imp
|
|||||||
}
|
}
|
||||||
insert(userList);
|
insert(userList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancelTeamSignUp(ClientActivitySignVO signVO) {
|
||||||
|
clear(Cnd.where(ActivityItemUser::getActivityId, "=", signVO.getActivityId())
|
||||||
|
.and(ActivityItemUser::getItemId, "=", signVO.getItemId()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -12,6 +12,7 @@ import java.util.List;
|
|||||||
public class ClientActivitySignVO {
|
public class ClientActivitySignVO {
|
||||||
|
|
||||||
private Long activityId;
|
private Long activityId;
|
||||||
|
private Long itemId;
|
||||||
|
|
||||||
private String unitName;
|
private String unitName;
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ public class ValidateService {
|
|||||||
if (Strings.isNotBlank(codeFromRedis)) {
|
if (Strings.isNotBlank(codeFromRedis)) {
|
||||||
// throw new BaseException("请1分钟之后再试");
|
// throw new BaseException("请1分钟之后再试");
|
||||||
}
|
}
|
||||||
ThreadUtil.execute(()->{
|
ThreadUtil.execute(() -> {
|
||||||
smsSendServer.sendMsg(mobile, "验证码为:"+text);
|
smsSendServer.sendCode(mobile, "验证码为:" + text);
|
||||||
log.debug("sms code:::" + text);
|
log.debug("sms code:::" + text);
|
||||||
redisService.setex(RedisConstant.UCENTER_SMSCODE + mobile, 300, text);
|
redisService.setex(RedisConstant.UCENTER_SMSCODE + mobile, 300, text);
|
||||||
redisService.setex(RedisConstant.UCENTER_SMSCODE + mobile + ":LOCK", 60, text);
|
redisService.setex(RedisConstant.UCENTER_SMSCODE + mobile + ":LOCK", 60, text);
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
package com.budwk.app.web.commons.ext.sms;
|
package com.budwk.app.web.commons.ext.sms;
|
||||||
|
|
||||||
import com.budwk.app.base.exception.BaseException;
|
import com.budwk.app.base.exception.BaseException;
|
||||||
import com.budwk.app.base.service.BaseService;
|
import com.tencentcloudapi.common.Credential;
|
||||||
|
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
||||||
|
import com.tencentcloudapi.common.profile.ClientProfile;
|
||||||
|
import com.tencentcloudapi.common.profile.HttpProfile;
|
||||||
|
import com.tencentcloudapi.sms.v20190711.SmsClient;
|
||||||
|
import com.tencentcloudapi.sms.v20190711.models.SendSmsRequest;
|
||||||
|
import com.tencentcloudapi.sms.v20190711.models.SendSmsResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nutz.ioc.impl.PropertiesProxy;
|
import org.nutz.ioc.impl.PropertiesProxy;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
@@ -14,27 +21,124 @@ import org.nutz.log.Logs;
|
|||||||
* @author wizzer@qq.com
|
* @author wizzer@qq.com
|
||||||
*/
|
*/
|
||||||
@IocBean
|
@IocBean
|
||||||
|
@Slf4j
|
||||||
public class SmsService {
|
public class SmsService {
|
||||||
private static final Log log = Logs.get();
|
|
||||||
@Inject
|
@Inject
|
||||||
private PropertiesProxy conf;
|
private PropertiesProxy conf;
|
||||||
|
|
||||||
@Inject
|
/**
|
||||||
private BaseService baseService;
|
* 发送短信验证码
|
||||||
|
*
|
||||||
|
* @param mobile 手机号
|
||||||
|
* @param text 验证码
|
||||||
|
* @return true发送成功
|
||||||
|
* @throws BaseException
|
||||||
|
*/
|
||||||
|
public boolean sendCode(String mobile, String text) throws BaseException {
|
||||||
|
try {
|
||||||
|
if (!conf.getBoolean("sms.enabled")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Credential cred = new Credential(conf.get("sms.tencent.secret-id"), conf.get("sms.tencent.secret-key"));
|
||||||
|
|
||||||
|
HttpProfile httpProfile = new HttpProfile();
|
||||||
|
httpProfile.setEndpoint("sms.tencentcloudapi.com");
|
||||||
|
|
||||||
|
ClientProfile clientProfile = new ClientProfile();
|
||||||
|
clientProfile.setHttpProfile(httpProfile);
|
||||||
|
|
||||||
|
SmsClient client = new SmsClient(cred, "", clientProfile);
|
||||||
|
|
||||||
|
SendSmsRequest req = new SendSmsRequest();
|
||||||
|
String[] phoneNumberSet1 = {"+86" + mobile};
|
||||||
|
req.setPhoneNumberSet(phoneNumberSet1);
|
||||||
|
String[] templateParamSet1 = {text, "5"};
|
||||||
|
req.setTemplateParamSet(templateParamSet1);
|
||||||
|
req.setTemplateID(conf.get("sms.tencent.tpl.login_code"));
|
||||||
|
req.setSmsSdkAppid(conf.get("sms.tencent.appid"));
|
||||||
|
req.setSign(conf.get("sms.tencent.sign"));
|
||||||
|
SendSmsResponse resp = client.SendSms(req);
|
||||||
|
log.debug(SendSmsResponse.toJsonString(resp));
|
||||||
|
return true;
|
||||||
|
} catch (TencentCloudSDKException tencentCloudSDKException) {
|
||||||
|
throw new BaseException(tencentCloudSDKException.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送注册验证码
|
||||||
|
* @param mobile 手机号码
|
||||||
|
* @param text 验证码
|
||||||
|
* @return true发送成功
|
||||||
|
* @throws BaseException
|
||||||
|
*/
|
||||||
|
public boolean sendRegCode(String mobile,String text) throws BaseException {
|
||||||
|
try {
|
||||||
|
if (!conf.getBoolean("sms.enabled")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Credential cred = new Credential(conf.get("sms.tencent.secret-id"), conf.get("sms.tencent.secret-key"));
|
||||||
|
|
||||||
|
HttpProfile httpProfile = new HttpProfile();
|
||||||
|
httpProfile.setEndpoint("sms.tencentcloudapi.com");
|
||||||
|
|
||||||
|
ClientProfile clientProfile = new ClientProfile();
|
||||||
|
clientProfile.setHttpProfile(httpProfile);
|
||||||
|
|
||||||
|
SmsClient client = new SmsClient(cred, "", clientProfile);
|
||||||
|
|
||||||
|
SendSmsRequest req = new SendSmsRequest();
|
||||||
|
String[] phoneNumberSet1 = {"+86" + mobile};
|
||||||
|
req.setPhoneNumberSet(phoneNumberSet1);
|
||||||
|
String[] templateParamSet1 = {text, "5"};
|
||||||
|
req.setTemplateParamSet(templateParamSet1);
|
||||||
|
req.setTemplateID(conf.get("sms.tencent.tpl.reg_code"));
|
||||||
|
req.setSmsSdkAppid(conf.get("sms.tencent.appid"));
|
||||||
|
req.setSign(conf.get("sms.tencent.sign"));
|
||||||
|
SendSmsResponse resp = client.SendSms(req);
|
||||||
|
log.debug(SendSmsResponse.toJsonString(resp));
|
||||||
|
return true;
|
||||||
|
} catch (TencentCloudSDKException tencentCloudSDKException) {
|
||||||
|
throw new BaseException(tencentCloudSDKException.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送短信通知
|
* 发送短信通知
|
||||||
*
|
*
|
||||||
* @param mobile 手机号码(最多200)
|
* @param mobile 手机号码(最多200)
|
||||||
* @param text 模板参数值
|
* @param param 模板参数值
|
||||||
* @return
|
* @return
|
||||||
* @throws BaseException
|
* @throws BaseException
|
||||||
*/
|
*/
|
||||||
public boolean sendMsg(String mobile, String text) throws BaseException {
|
public boolean sendMsg(String[] mobile, String[] param) throws BaseException {
|
||||||
|
try {
|
||||||
|
if (!conf.getBoolean("sms.enabled")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Credential cred = new Credential(conf.get("sms.tencent.secret-id"), conf.get("sms.tencent.secret-key"));
|
||||||
|
|
||||||
|
HttpProfile httpProfile = new HttpProfile();
|
||||||
|
httpProfile.setEndpoint("sms.tencentcloudapi.com");
|
||||||
|
|
||||||
|
ClientProfile clientProfile = new ClientProfile();
|
||||||
|
clientProfile.setHttpProfile(httpProfile);
|
||||||
|
|
||||||
|
SmsClient client = new SmsClient(cred, "", clientProfile);
|
||||||
|
|
||||||
|
SendSmsRequest req = new SendSmsRequest();
|
||||||
|
req.setPhoneNumberSet(mobile);
|
||||||
|
req.setTemplateParamSet(param);
|
||||||
|
req.setTemplateID(conf.get("sms.tencent.tpl.msg"));
|
||||||
|
req.setSmsSdkAppid(conf.get("sms.tencent.appid"));
|
||||||
|
req.setSign(conf.get("sms.tencent.sign"));
|
||||||
|
SendSmsResponse resp = client.SendSms(req);
|
||||||
|
log.debug(SendSmsResponse.toJsonString(resp));
|
||||||
|
return true;
|
||||||
|
} catch (TencentCloudSDKException tencentCloudSDKException) {
|
||||||
|
throw new BaseException(tencentCloudSDKException.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.budwk.app.web.controllers.open;
|
||||||
|
|
||||||
|
import com.budwk.app.base.result.Result;
|
||||||
|
import com.budwk.app.sys.models.Sys_unit;
|
||||||
|
import org.nutz.dao.Cnd;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.mvc.annotation.At;
|
||||||
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@IocBean
|
||||||
|
@At("/open/common")
|
||||||
|
@Ok("json")
|
||||||
|
public class OpenCommonController {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Dao dao;
|
||||||
|
|
||||||
|
@At
|
||||||
|
public Result units() {
|
||||||
|
List<Sys_unit> units = dao.query(Sys_unit.class, Cnd.where(Sys_unit::getIsEnable, "=", 1).asc(Sys_unit::getId));
|
||||||
|
return Result.success(units);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -23,11 +23,11 @@ jetty:
|
|||||||
#结合ftp使用,或用nginx代理ftp路径
|
#结合ftp使用,或用nginx代理ftp路径
|
||||||
#staticPath: E:/project/NutzWk/upload
|
#staticPath: E:/project/NutzWk/upload
|
||||||
#开发模式静态资源
|
#开发模式静态资源
|
||||||
staticPathLocal: D:/project/hmc_gbhd/backend/src/main/resources/static
|
staticPathLocal: E:/projects/hmc_gbhd/src/main/resources/static
|
||||||
|
|
||||||
security:
|
security:
|
||||||
tokenName: token
|
tokenName: token
|
||||||
timeout: 3600
|
timeout: 86400
|
||||||
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
||||||
# 允许同一账号并发登录,则系统参数 SessionOnlyOne 有效,亦可踢人下线并多了弹框提示功能
|
# 允许同一账号并发登录,则系统参数 SessionOnlyOne 有效,亦可踢人下线并多了弹框提示功能
|
||||||
isConcurrent: true
|
isConcurrent: true
|
||||||
@@ -69,7 +69,7 @@ xsssql:
|
|||||||
beetl:
|
beetl:
|
||||||
RESOURCE:
|
RESOURCE:
|
||||||
#本地路径,开发时设置本地路径,便于调试
|
#本地路径,开发时设置本地路径,便于调试
|
||||||
rootLocal: D:/project/hmc_gbhd/backend/src/main/resources/views/
|
rootLocal: E:/projects/hmc_gbhd/src/main/resources/views/
|
||||||
root: views/
|
root: views/
|
||||||
DELIMITER_STATEMENT_START: '<!--#'
|
DELIMITER_STATEMENT_START: '<!--#'
|
||||||
DELIMITER_STATEMENT_END: '#-->'
|
DELIMITER_STATEMENT_END: '#-->'
|
||||||
@@ -141,18 +141,24 @@ quartz:
|
|||||||
connectionProvider:
|
connectionProvider:
|
||||||
class: com.budwk.app.task.conn.NutConnectionProvider
|
class: com.budwk.app.task.conn.NutConnectionProvider
|
||||||
|
|
||||||
|
swagger:
|
||||||
|
info:
|
||||||
|
title: 趣味运动会系统
|
||||||
|
description: 趣味运动会系统
|
||||||
|
|
||||||
sms:
|
sms:
|
||||||
enabled: false
|
enabled: false
|
||||||
#腾讯云短信配置
|
#腾讯云短信配置
|
||||||
tencent:
|
tencent:
|
||||||
secret-id: 1
|
secret-id: 1301383032
|
||||||
secret-key: 2
|
secret-key: AKIDMZWDepjNnxqSotiHZeU6SYOyIMAj24rO
|
||||||
appid: 1 #应用ID
|
appid: 1400934413 #应用ID
|
||||||
sign: '萌发开源' #短信签名
|
sign: '武汉地大三思科技' #短信签名
|
||||||
tpl:
|
tpl:
|
||||||
#验证码模板ID
|
#登录验证码模板ID
|
||||||
code: 1
|
login_code: 2422443
|
||||||
|
#注册验证码模板ID
|
||||||
|
reg_code: 2422440
|
||||||
#短信通知模板ID
|
#短信通知模板ID
|
||||||
msg: 2
|
msg: '?'
|
||||||
|
|
||||||
|
|||||||
@@ -31,15 +31,15 @@ const itemForm = {
|
|||||||
<el-table-column label="报名人数">
|
<el-table-column label="报名人数">
|
||||||
<template #default="{row}">
|
<template #default="{row}">
|
||||||
<el-input-number v-model="row.num" :disabled="row.isTeamApply"
|
<el-input-number v-model="row.num" :disabled="row.isTeamApply"
|
||||||
placeholder="请输入报名人数"></el-input-number>
|
placeholder="请输入报名人数" style="width: 100%"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- <el-table-column label="图片">
|
<el-table-column label="图片">
|
||||||
<template #default="{row}">
|
<template #default="{row}">
|
||||||
{{row.img}}
|
{{row.img}}
|
||||||
<image-upload v-model="row.img" :max-count="1"></image-upload>
|
<image-upload v-model="row.img" :maxCount="1"></image-upload>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>-->
|
</el-table-column>
|
||||||
<el-table-column label="操作" fixed="right" width="100px">
|
<el-table-column label="操作" fixed="right" width="100px">
|
||||||
<template #default="{$index}">
|
<template #default="{$index}">
|
||||||
<el-button type="text" class="text-danger" @click="removeRow($index)">删除</el-button>
|
<el-button type="text" class="text-danger" @click="removeRow($index)">删除</el-button>
|
||||||
|
|||||||
@@ -13,6 +13,13 @@
|
|||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/login/register",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "注册",
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/activity/list/index",
|
"path": "pages/activity/list/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
<t-dropdown-item :options="actOptions" :value="selectActId"/>
|
<t-dropdown-item :options="actOptions" :value="selectActId"/>
|
||||||
</t-dropdown-menu>
|
</t-dropdown-menu>
|
||||||
<view class="content-container">
|
<view class="content-container">
|
||||||
<view class="page-header">
|
<!-- <view class="page-header">-->
|
||||||
<text class="page-title">团队报名</text>
|
<!-- <text class="page-title">团队报名</text>-->
|
||||||
<text class="page-subtitle">点击项目报名</text>
|
<!-- <text class="page-subtitle">点击项目报名</text>-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
|
|
||||||
<!-- 项目列表 -->
|
<!-- 项目列表 -->
|
||||||
<view class="project-cards">
|
<view class="project-cards">
|
||||||
@@ -17,23 +17,25 @@
|
|||||||
:key="project.id"
|
:key="project.id"
|
||||||
class="project-card"
|
class="project-card"
|
||||||
:class="{'project-card--registered': registrationStatus.get(project.id)?.length}"
|
:class="{'project-card--registered': registrationStatus.get(project.id)?.length}"
|
||||||
@click="selectProject(project)"
|
|
||||||
>
|
>
|
||||||
<view class="project-card__content">
|
<view class="project-card__content">
|
||||||
|
<t-image :src=config.fileDomain+project.img shape="round"
|
||||||
|
class="project-card__image" fit="fill"/>
|
||||||
<view class="project-card__title">{{ project.name }}</view>
|
<view class="project-card__title">{{ project.name }}</view>
|
||||||
<view class="project-card__desc">{{ project.description }}</view>
|
|
||||||
</view>
|
<div style="display: flex;justify-content: flex-end;margin-top: 10px;">
|
||||||
<view class="project-card__status">
|
<t-button size="small" class="project-card__button" @click="openDesc(project)">项目介绍</t-button>
|
||||||
<t-tag v-if="registrationStatus.get(project.id)?.length" theme="success" variant="light-outline">
|
<t-button size="small" @click="selectProject(project)" class="project-card__button"> 活动报名 {{
|
||||||
|
registrationStatus.get(project.id)?.length ? registrationStatus.get(project.id)?.length : 0
|
||||||
|
}}人
|
||||||
|
</t-button>
|
||||||
|
</div>
|
||||||
|
<!-- <t-tag v-if="registrationStatus.get(project.id)?.length" theme="success" variant="light-outline">
|
||||||
已报名 {{ registrationStatus.get(project.id)?.length }}人
|
已报名 {{ registrationStatus.get(project.id)?.length }}人
|
||||||
</t-tag>
|
</t-tag>-->
|
||||||
<view v-else class="project-card__action">
|
|
||||||
<t-icon name="chevron-right" color="#999"/>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
<!-- <view v-if="registrationStatus.get(project.id)?.length" class="project-card__checkmark">
|
|
||||||
<t-icon name="check" color="#52c41a"/>
|
|
||||||
</view>-->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -46,6 +48,45 @@
|
|||||||
</t-empty>
|
</t-empty>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<t-popup v-model:visible="showDescPicker" placement="bottom" destroy-on-close>
|
||||||
|
<view class="member-picker">
|
||||||
|
<view class="picker-header">
|
||||||
|
<text class="picker-title">项目介绍</text>
|
||||||
|
<t-icon name="close" @click="showDescPicker = false"/>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<view class="event-item-header">
|
||||||
|
<text class="event-item-name">{{ team.name }}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="event-item-content">
|
||||||
|
<t-image :src=config.fileDomain+team.img shape="round"
|
||||||
|
class="event-item-image" fit="fill"/>
|
||||||
|
|
||||||
|
<!-- 项目信息区域 -->
|
||||||
|
<view class="event-item-info">
|
||||||
|
<view class="event-item-section">
|
||||||
|
<view class="event-item-section-title">
|
||||||
|
<t-icon name="flag" size="16px" color="var(--td-brand-color-5)"/>
|
||||||
|
<text>活动形式</text>
|
||||||
|
</view>
|
||||||
|
<view class="event-item-section-content">{{ team.form }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="event-item-section">
|
||||||
|
<view class="event-item-section-title">
|
||||||
|
<t-icon name="chart-bar" size="16px" color="var(--td-brand-color-5)"/>
|
||||||
|
<text>评分规则</text>
|
||||||
|
</view>
|
||||||
|
<view class="event-item-section-content">{{ team.rule }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</t-popup>
|
||||||
|
|
||||||
<t-popup v-model:visible="showMemberPicker" placement="bottom" destroy-on-close>
|
<t-popup v-model:visible="showMemberPicker" placement="bottom" destroy-on-close>
|
||||||
<view class="member-picker">
|
<view class="member-picker">
|
||||||
<view class="picker-header">
|
<view class="picker-header">
|
||||||
@@ -60,7 +101,7 @@
|
|||||||
此项目是团队协作需要全体成员参与
|
此项目是团队协作需要全体成员参与
|
||||||
</view>
|
</view>
|
||||||
<view v-else>
|
<view v-else>
|
||||||
此项目需【{{itemOptions.find(p => p.id === selectedItemId)?.num}}】名成员参与
|
此项目需【{{ itemOptions.find(p => p.id === selectedItemId)?.num }}】名成员参与
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@@ -81,10 +122,22 @@
|
|||||||
</view>
|
</view>
|
||||||
</t-checkbox-group>
|
</t-checkbox-group>
|
||||||
</view>
|
</view>
|
||||||
<view class="picker-footer"v-if="isSelfLeader">
|
<view class="picker-footer" v-if="isSelfLeader">
|
||||||
<t-button block theme="primary" @click="submitRegistration">
|
<t-row gutter="20">
|
||||||
|
<t-col span="12">
|
||||||
|
<t-button block theme="primary" @click="cancelRegistration"
|
||||||
|
:disabled="!selectedMemberList.filter(v => v.itemId === team.id).map(v => v.userId).length">
|
||||||
|
取消报名
|
||||||
|
</t-button>
|
||||||
|
</t-col>
|
||||||
|
<t-col span="12">
|
||||||
|
<t-button block theme="primary" style="margin-left: 5px;" @click="submitRegistration">
|
||||||
确认报名 ({{ selectedMemberIds.length }}人)
|
确认报名 ({{ selectedMemberIds.length }}人)
|
||||||
</t-button>
|
</t-button>
|
||||||
|
</t-col>
|
||||||
|
</t-row>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</t-popup>
|
</t-popup>
|
||||||
@@ -97,6 +150,7 @@ import {useRequest} from '@/utils/request';
|
|||||||
import {Dialog, Toast} from 'tdesign-mobile-vue';
|
import {Dialog, Toast} from 'tdesign-mobile-vue';
|
||||||
import {onLoad} from '@dcloudio/uni-app';
|
import {onLoad} from '@dcloudio/uni-app';
|
||||||
import {useUserStore} from "@/store";
|
import {useUserStore} from "@/store";
|
||||||
|
import {config} from "@/utils/config";
|
||||||
|
|
||||||
const request = useRequest();
|
const request = useRequest();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
@@ -106,23 +160,7 @@ const actOptions = ref([])
|
|||||||
// 选中的活动ID
|
// 选中的活动ID
|
||||||
const selectActId = ref(null);
|
const selectActId = ref(null);
|
||||||
// 项目列表数据
|
// 项目列表数据
|
||||||
const itemOptions = ref([
|
const itemOptions = ref([]);
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '篮球比赛',
|
|
||||||
description: '3v3篮球友谊赛'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: '足球比赛',
|
|
||||||
description: '5人制足球赛'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: '羽毛球比赛',
|
|
||||||
description: '双打友谊赛'
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
// 选中的项目ID
|
// 选中的项目ID
|
||||||
const selectedItemId = ref(null);
|
const selectedItemId = ref(null);
|
||||||
// 团队成员列表
|
// 团队成员列表
|
||||||
@@ -147,6 +185,14 @@ const selectedMemberIds = ref([]);
|
|||||||
// 成员选择弹窗显示状态
|
// 成员选择弹窗显示状态
|
||||||
const showMemberPicker = ref(false);
|
const showMemberPicker = ref(false);
|
||||||
|
|
||||||
|
// 描述选择弹窗显示状态
|
||||||
|
const showDescPicker = ref(false);
|
||||||
|
|
||||||
|
const openDesc = (project) => {
|
||||||
|
team.value = project
|
||||||
|
showDescPicker.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 获取活动列表
|
// 获取活动列表
|
||||||
async function listActs() {
|
async function listActs() {
|
||||||
@@ -192,7 +238,7 @@ async function listTeamUser() {
|
|||||||
const {code, data, msg} = await request.get('/client/item/list-team-user/' + selectActId.value)
|
const {code, data, msg} = await request.get('/client/item/list-team-user/' + selectActId.value)
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
teamMembers.value = data;
|
teamMembers.value = data;
|
||||||
isSelfLeader.value = data.find(t => t.userId===userStore?.userInfo.id)?.isLeader
|
isSelfLeader.value = data.find(t => t.userId === userStore?.userInfo.id)?.isLeader
|
||||||
} else {
|
} else {
|
||||||
Toast.error(msg)
|
Toast.error(msg)
|
||||||
}
|
}
|
||||||
@@ -222,10 +268,10 @@ const team = ref({})
|
|||||||
// 选择项目
|
// 选择项目
|
||||||
const selectProject = (project) => {
|
const selectProject = (project) => {
|
||||||
selectedItemId.value = project.id;
|
selectedItemId.value = project.id;
|
||||||
team.value=project
|
team.value = project
|
||||||
if (project.isTeamApply){
|
if (project.isTeamApply) {
|
||||||
selectedMemberIds.value = teamMembers.value.map(v => v.userId)
|
selectedMemberIds.value = teamMembers.value.map(v => v.userId)
|
||||||
}else{
|
} else {
|
||||||
selectedMemberIds.value = selectedMemberList.value.filter(v => v.itemId === project.id).map(v => v.userId)
|
selectedMemberIds.value = selectedMemberList.value.filter(v => v.itemId === project.id).map(v => v.userId)
|
||||||
}
|
}
|
||||||
showMemberPicker.value = true;
|
showMemberPicker.value = true;
|
||||||
@@ -245,7 +291,23 @@ const getApplyUsers = async () => {
|
|||||||
Toast.error(e.message)
|
Toast.error(e.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 取消报名
|
||||||
|
const cancelRegistration = async () => {
|
||||||
|
try {
|
||||||
|
let data = {}
|
||||||
|
data.activityId = selectActId.value
|
||||||
|
data.itemId = selectedItemId.value
|
||||||
|
const {code, msg} = await useRequest().post('/client/item/cancel-team-sign-up/' ,{...data})
|
||||||
|
if (code === 0) {
|
||||||
|
Toast.success('取消报名成功')
|
||||||
|
showMemberPicker.value = false;
|
||||||
|
await getApplyUsers();
|
||||||
|
fetchRegistrationStatus();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 提交报名 - 使用静态数据模拟
|
// 提交报名 - 使用静态数据模拟
|
||||||
const submitRegistration = async () => {
|
const submitRegistration = async () => {
|
||||||
@@ -312,6 +374,71 @@ const submitRegistration = async () => {
|
|||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.event-item-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 20rpx 24rpx;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
border-left: 8rpx solid var(--td-brand-color-5);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-item-name {
|
||||||
|
color: #333333;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
flex: 1;
|
||||||
|
margin-right: 8rpx;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-item-content {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-item-image {
|
||||||
|
height: 300rpx;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-item-info {
|
||||||
|
padding: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-item-section {
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-item-section-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
|
||||||
|
.t-icon {
|
||||||
|
margin-right: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-item-section-content {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666666;
|
||||||
|
line-height: 1.5;
|
||||||
|
word-break: break-all;
|
||||||
|
padding-left: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.project-card {
|
.project-card {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
@@ -323,6 +450,22 @@ const submitRegistration = async () => {
|
|||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
.project-card__image {
|
||||||
|
height: 150px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-card__title {
|
||||||
|
font-size: 15px !important;
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-card__button {
|
||||||
|
margin-left: 10px;
|
||||||
|
background-color: #0052D9;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
transform: scale(0.98);
|
transform: scale(0.98);
|
||||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
<div class="section-badge">{{ team.groupUsers.length }}</div>
|
<div class="section-badge">{{ team.groupUsers.length }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-grid">
|
<div class="member-grid">
|
||||||
<div class="member-grid-item" v-for="member in team.groupUsers" :key="member.id">
|
<div class="member-grid-item" v-for="member in team.groupUsers" :key="member.id" @click="openUserDetail(member)">
|
||||||
<div class="member-name">
|
<div class="member-name">
|
||||||
{{ member.userName }}
|
{{ member.userName }}
|
||||||
<t-tag theme="danger" size="small" v-if="member.isLeader">队长</t-tag>
|
<t-tag theme="danger" size="small" v-if="member.isLeader">队长</t-tag>
|
||||||
@@ -144,6 +144,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</t-dialog>
|
</t-dialog>
|
||||||
|
|
||||||
|
<t-popup v-model:visible="showUserDetailPicker" placement="bottom" destroy-on-close style="height: 50%">
|
||||||
|
<view class="member-picker">
|
||||||
|
<view class="picker-header">
|
||||||
|
<text class="picker-title">成员信息</text>
|
||||||
|
<t-icon name="close" @click="showUserDetailPicker = false"/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</t-popup>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@@ -175,11 +184,12 @@ let team = ref(null);
|
|||||||
// 申请成为队长弹框提示
|
// 申请成为队长弹框提示
|
||||||
const leaderConfirmVisible = ref(false)
|
const leaderConfirmVisible = ref(false)
|
||||||
|
|
||||||
const handleMenuOpened = () => {
|
// 用户详情弹框
|
||||||
|
const showUserDetailPicker=ref(false)
|
||||||
}
|
// 打开用户详情
|
||||||
|
const openUserDetail = (val) => {
|
||||||
const handleMenuClosed = () => {
|
showUserDetailPicker.value = true
|
||||||
|
console.log(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
const actChange = (val) => {
|
const actChange = (val) => {
|
||||||
@@ -262,6 +272,69 @@ onLoad(() => {
|
|||||||
.content-area {
|
.content-area {
|
||||||
padding: 0 16px 24px;
|
padding: 0 16px 24px;
|
||||||
}
|
}
|
||||||
|
/*用户弹框*/
|
||||||
|
.member-picker {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 16px 16px 0 0;
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
.picker-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
|
||||||
|
.picker-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-subtitle {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #ff5f5c;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding-bottom: 12px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.member-list {
|
||||||
|
max-height: 50vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding: 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.member-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 12px 0;
|
||||||
|
border-bottom: 1px solid #f5f5f5;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--disabled {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.member-status {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #52c41a;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.t-checkbox) {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-footer {
|
||||||
|
padding-top: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* 团队卡片 */
|
/* 团队卡片 */
|
||||||
.team-card {
|
.team-card {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<view class="page-container">
|
<view class="page-container">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<image class="header-bg"
|
<image class="header-bg"
|
||||||
src="https://erp-bucket.pek3b.qingstor.com/assistant/89c4b573-c54f-467a-b703-0bc44679ab08.png"
|
src="/static/img/index.png"
|
||||||
mode="aspectFill"></image>
|
mode="aspectFill"></image>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|||||||
@@ -62,16 +62,16 @@
|
|||||||
<view class="login-card">
|
<view class="login-card">
|
||||||
<view class="login-tabs">
|
<view class="login-tabs">
|
||||||
<view
|
<view
|
||||||
:class="['tab', activeMethod === 'phone' ? 'active' : '']"
|
:class="['tab', loginForm.loginMethod === 'sms' ? 'active' : '']"
|
||||||
@click="setActiveMethod('phone')"
|
@click="loginForm.loginMethod = 'sms'"
|
||||||
>
|
>
|
||||||
手机快速登录
|
验证码登录
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
:class="['tab', activeMethod === 'password' ? 'active' : '']"
|
:class="['tab', loginForm.loginMethod === 'password' ? 'active' : '']"
|
||||||
@click="setActiveMethod('password')"
|
@click="loginForm.loginMethod = 'password'"
|
||||||
>
|
>
|
||||||
账号密码登录
|
密码登录
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 验证码输入框 -->
|
<!-- 验证码输入框 -->
|
||||||
<view class="input-box">
|
<view class="input-box" v-if="loginForm.loginMethod==='sms'">
|
||||||
<t-icon name="shield-error" size="20px" class="input-icon"/>
|
<t-icon name="shield-error" size="20px" class="input-icon"/>
|
||||||
<input
|
<input
|
||||||
class="input"
|
class="input"
|
||||||
@@ -104,16 +104,28 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 密码输入框 -->
|
||||||
|
<view class="input-box" v-else>
|
||||||
|
<t-icon name="user-password" size="20px" class="input-icon"/>
|
||||||
|
<input
|
||||||
|
class="input"
|
||||||
|
type="password"
|
||||||
|
v-model="loginForm.password"
|
||||||
|
placeholder="请输入密码"
|
||||||
|
maxlength="20"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 登录按钮 -->
|
<!-- 登录按钮 -->
|
||||||
<view class="submit-btn" @click="handleLogin">
|
<view class="submit-btn" @click="handleLogin">
|
||||||
立即登录
|
立即登录
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- <!– 注册链接 –>-->
|
<!-- 注册链接 -->
|
||||||
<!-- <view class="register-link">-->
|
<view class="register-link" @click="navigateToRegister">
|
||||||
<!-- <text>没有账号?</text>-->
|
<text>没有账号?</text>
|
||||||
<!-- <text class="link">去注册</text>-->
|
<text class="link">去注册</text>
|
||||||
<!-- </view>-->
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -127,17 +139,14 @@ import {useUserStore} from "@/store";
|
|||||||
|
|
||||||
const request = useRequest()
|
const request = useRequest()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const activeMethod = ref('phone')
|
|
||||||
|
|
||||||
const loginForm = reactive({
|
const loginForm = reactive({
|
||||||
phone: '',
|
phone: '',
|
||||||
smsCode: ''
|
smsCode: '',
|
||||||
|
password: '',
|
||||||
|
loginMethod: 'sms'
|
||||||
})
|
})
|
||||||
|
|
||||||
const setActiveMethod = (method) => {
|
|
||||||
activeMethod.value = method
|
|
||||||
}
|
|
||||||
|
|
||||||
// 倒计时相关
|
// 倒计时相关
|
||||||
const countdown = ref(0)
|
const countdown = ref(0)
|
||||||
const timer = ref(null)
|
const timer = ref(null)
|
||||||
@@ -265,10 +274,14 @@ async function handleLogin() {
|
|||||||
Toast('请输入手机号码');
|
Toast('请输入手机号码');
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!loginForm.smsCode) {
|
if (!loginForm.smsCode && loginForm.loginMethod === 'sms') {
|
||||||
Toast('请输入验证码');
|
Toast('请输入验证码');
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!loginForm.password && loginForm.loginMethod === 'password') {
|
||||||
|
Toast('请输入密码');
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
userStore.smsLogin(loginForm).then(() => {
|
userStore.smsLogin(loginForm).then(() => {
|
||||||
@@ -317,6 +330,13 @@ async function handleLogin() {
|
|||||||
Toast({message: e.message, theme: 'error'})
|
Toast({message: e.message, theme: 'error'})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function navigateToRegister() {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/login/register'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
@@ -500,7 +520,7 @@ body {
|
|||||||
.register-link {
|
.register-link {
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 14px;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
|
|
||||||
.link {
|
.link {
|
||||||
|
|||||||
@@ -0,0 +1,688 @@
|
|||||||
|
<template>
|
||||||
|
<view class="register-container">
|
||||||
|
<!-- 上半部分:图片区域 -->
|
||||||
|
<view class="image-area">
|
||||||
|
<div class="tech-animation">
|
||||||
|
<svg preserveAspectRatio="xMidYMid slice" viewBox="0 0 300 100">
|
||||||
|
<pattern id="pattern-hex" x="0" y="0" width="10" height="10" patternUnits="userSpaceOnUse"
|
||||||
|
patternTransform="scale(0.8)">
|
||||||
|
<rect x="0" y="0" width="10" height="10" fill="none"/>
|
||||||
|
<path d="M0,5 L2.5,0 L7.5,0 L10,5 L7.5,10 L2.5,10 Z" stroke-width="0.5" stroke="rgba(244, 90, 90, 0.2)"
|
||||||
|
fill="rgba(244, 90, 90, 0.1)">
|
||||||
|
<animate attributeName="stroke-opacity" values="0.1;0.3;0.1" dur="3s" repeatCount="indefinite"/>
|
||||||
|
</path>
|
||||||
|
</pattern>
|
||||||
|
<rect x="0" y="0" width="100%" height="100%" fill="url(#pattern-hex)"/>
|
||||||
|
|
||||||
|
<g fill="none" stroke-width="0.5">
|
||||||
|
<path d="M20,50 Q60,20 100,50 T180,50 T260,50" stroke="rgba(244, 90, 90, 0.6)">
|
||||||
|
<animate attributeName="d"
|
||||||
|
values="M20,50 Q60,20 100,50 T180,50 T260,50;
|
||||||
|
M20,50 Q60,80 100,50 T180,50 T260,50;
|
||||||
|
M20,50 Q60,20 100,50 T180,50 T260,50"
|
||||||
|
dur="10s" repeatCount="indefinite"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path d="M20,70 Q60,40 100,70 T180,70 T260,70" stroke="rgba(244, 90, 90, 0.4)">
|
||||||
|
<animate attributeName="d"
|
||||||
|
values="M20,70 Q60,40 100,70 T180,70 T260,70;
|
||||||
|
M20,70 Q60,100 100,70 T180,70 T260,70;
|
||||||
|
M20,70 Q60,40 100,70 T180,70 T260,70"
|
||||||
|
dur="12s" repeatCount="indefinite"/>
|
||||||
|
</path>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<circle cx="50" cy="50" r="1" fill="rgba(244, 90, 90, 0.8)">
|
||||||
|
<animate attributeName="cx" values="50;250;50" dur="20s" repeatCount="indefinite"/>
|
||||||
|
<animate attributeName="cy" values="50;30;80;50" dur="16s" repeatCount="indefinite"/>
|
||||||
|
<animate attributeName="r" values="1;1.5;1" dur="5s" repeatCount="indefinite"/>
|
||||||
|
</circle>
|
||||||
|
|
||||||
|
<circle cx="150" cy="30" r="1" fill="rgba(244, 90, 90, 0.8)">
|
||||||
|
<animate attributeName="cx" values="150;100;200;150" dur="25s" repeatCount="indefinite"/>
|
||||||
|
<animate attributeName="cy" values="30;60;20;30" dur="18s" repeatCount="indefinite"/>
|
||||||
|
<animate attributeName="r" values="1;1.8;1" dur="6s" repeatCount="indefinite"/>
|
||||||
|
</circle>
|
||||||
|
|
||||||
|
<circle cx="250" cy="70" r="1" fill="rgba(244, 90, 90, 0.8)">
|
||||||
|
<animate attributeName="cx" values="250;150;250" dur="22s" repeatCount="indefinite"/>
|
||||||
|
<animate attributeName="cy" values="70;40;70" dur="15s" repeatCount="indefinite"/>
|
||||||
|
<animate attributeName="r" values="1;1.2;1" dur="4s" repeatCount="indefinite"/>
|
||||||
|
</circle>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<view class="title-content">
|
||||||
|
<text class="main-title">JOIN US</text>
|
||||||
|
<view class="sub-title-container">
|
||||||
|
<text class="sub-title">用户注册</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 下半部分:表单区域 -->
|
||||||
|
<view class="form-area">
|
||||||
|
<!-- 姓名输入框 -->
|
||||||
|
<view class="input-box">
|
||||||
|
<t-icon name="user" size="20px" class="input-icon"/>
|
||||||
|
<input
|
||||||
|
class="input"
|
||||||
|
type="text"
|
||||||
|
v-model="formData.name"
|
||||||
|
placeholder="请输入姓名"
|
||||||
|
maxlength="20"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 手机号码输入框 -->
|
||||||
|
<view class="input-box">
|
||||||
|
<t-icon name="mobile" size="20px" class="input-icon"/>
|
||||||
|
<input
|
||||||
|
class="input"
|
||||||
|
type="tel"
|
||||||
|
v-model="formData.phone"
|
||||||
|
placeholder="请输入手机号"
|
||||||
|
maxlength="11"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 单位输入框 -->
|
||||||
|
<view class="input-box" @click="showUnitPicker = true">
|
||||||
|
<t-icon name="home" size="20px" class="input-icon"/>
|
||||||
|
<view class="unit-selector" :class="{'has-value': formData.unitName}">
|
||||||
|
{{ formData.unitName || '请选择单位' }}
|
||||||
|
</view>
|
||||||
|
<t-icon name="chevron-right" size="20px" class="arrow-icon"/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 身份证输入框 -->
|
||||||
|
<view class="input-box">
|
||||||
|
<t-icon name="creditcard" size="20px" class="input-icon"/>
|
||||||
|
<input
|
||||||
|
class="input"
|
||||||
|
type="text"
|
||||||
|
v-model="formData.idCard"
|
||||||
|
placeholder="请输入身份证号码"
|
||||||
|
maxlength="18"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 验证码输入框 -->
|
||||||
|
<view class="input-box">
|
||||||
|
<t-icon name="shield-error" size="20px" class="input-icon"/>
|
||||||
|
<input
|
||||||
|
class="input"
|
||||||
|
type="number"
|
||||||
|
v-model="formData.verificationCode"
|
||||||
|
placeholder="请输入验证码"
|
||||||
|
maxlength="6"
|
||||||
|
/>
|
||||||
|
<view class="verify-code-btn" @click="sendVerificationCode" :class="{ disabled: countdown > 0 }">
|
||||||
|
{{ countdown > 0 ? `${countdown}秒` : '获取验证码' }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 注册按钮 -->
|
||||||
|
<view class="submit-btn" @click="handleRegister">
|
||||||
|
{{ registering ? '注册中...' : '立即注册' }}
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 登录链接 -->
|
||||||
|
<view class="login-link-box">
|
||||||
|
<text>已有账号?</text>
|
||||||
|
<text class="link-text" @click="goToLogin">立即登录</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 自定义单位选择弹窗 -->
|
||||||
|
<t-popup v-model="showUnitPicker" placement="bottom">
|
||||||
|
<view class="custom-picker">
|
||||||
|
<view class="custom-picker-header">
|
||||||
|
<view class="cancel-btn" @click="showUnitPicker = false">取消</view>
|
||||||
|
<view class="picker-title">选择单位</view>
|
||||||
|
<view class="confirm-btn" @click="confirmUnitSelection">确定</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 搜索框 -->
|
||||||
|
<view class="search-box">
|
||||||
|
<t-icon name="search" size="22px" class="search-icon" />
|
||||||
|
<input
|
||||||
|
class="search-input"
|
||||||
|
type="text"
|
||||||
|
v-model="searchKeyword"
|
||||||
|
placeholder="搜索单位"
|
||||||
|
@input="handleSearch"
|
||||||
|
/>
|
||||||
|
<t-icon
|
||||||
|
v-if="searchKeyword"
|
||||||
|
name="close-circle-filled"
|
||||||
|
size="22px"
|
||||||
|
class="clear-icon"
|
||||||
|
@click="clearSearch"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 单位列表 -->
|
||||||
|
<scroll-view
|
||||||
|
scroll-y
|
||||||
|
class="units-scroll-view"
|
||||||
|
scroll-with-animation
|
||||||
|
:scroll-into-view="scrollViewId"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
v-for="unit in filteredUnits"
|
||||||
|
:key="unit.id"
|
||||||
|
:id="'unit-' + unit.id"
|
||||||
|
class="unit-item"
|
||||||
|
:class="{'unit-selected': selectedUnitId === unit.id}"
|
||||||
|
@click="selectUnit(unit)"
|
||||||
|
>
|
||||||
|
<text class="unit-name">{{ unit.name }}</text>
|
||||||
|
<t-icon v-if="selectedUnitId === unit.id" name="check" size="22px" class="check-icon"/>
|
||||||
|
</view>
|
||||||
|
<view v-if="filteredUnits.length === 0" class="empty-result">
|
||||||
|
<t-icon name="info-circle" size="40rpx" class="empty-icon"/>
|
||||||
|
<text class="empty-text">未找到匹配的单位</text>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</t-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, computed, onMounted, watch, nextTick, getCurrentInstance } from 'vue';
|
||||||
|
import { Toast } from 'tdesign-mobile-vue';
|
||||||
|
import { useRequest } from "@/utils/request";
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const formData = reactive({
|
||||||
|
name: '',
|
||||||
|
phone: '',
|
||||||
|
unitId: '',
|
||||||
|
unitName: '',
|
||||||
|
idCard: '',
|
||||||
|
verificationCode: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
// 验证码倒计时
|
||||||
|
const countdown = ref(0);
|
||||||
|
const sendingCode = ref(false);
|
||||||
|
const registering = ref(false);
|
||||||
|
|
||||||
|
// 单位选择相关
|
||||||
|
const showUnitPicker = ref(false);
|
||||||
|
const unitList = ref([]);
|
||||||
|
const searchKeyword = ref('');
|
||||||
|
const selectedUnitId = ref('');
|
||||||
|
const scrollViewId = ref('');
|
||||||
|
|
||||||
|
// 筛选单位列表
|
||||||
|
const filteredUnits = computed(() => {
|
||||||
|
if (!searchKeyword.value) {
|
||||||
|
return unitList.value;
|
||||||
|
}
|
||||||
|
return unitList.value.filter(unit =>
|
||||||
|
unit.name.toLowerCase().includes(searchKeyword.value.toLowerCase())
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 表单验证
|
||||||
|
const isFormValid = computed(() => {
|
||||||
|
return formData.name &&
|
||||||
|
formData.phone &&
|
||||||
|
formData.phone.length === 11 &&
|
||||||
|
formData.unitId &&
|
||||||
|
formData.idCard &&
|
||||||
|
formData.idCard.length === 18 &&
|
||||||
|
formData.verificationCode;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 当选择器打开时,预设选中当前已选单位
|
||||||
|
watch(showUnitPicker, (newVal) => {
|
||||||
|
if (newVal && formData.unitId) {
|
||||||
|
selectedUnitId.value = formData.unitId;
|
||||||
|
// 设置scrollViewId以触发滚动
|
||||||
|
scrollViewId.value = `unit-${formData.unitId}`;
|
||||||
|
} else {
|
||||||
|
selectedUnitId.value = '';
|
||||||
|
}
|
||||||
|
// 清空搜索关键词
|
||||||
|
searchKeyword.value = '';
|
||||||
|
});
|
||||||
|
|
||||||
|
// 搜索处理
|
||||||
|
const handleSearch = () => {
|
||||||
|
// 实时搜索,不需要额外处理,由计算属性完成
|
||||||
|
};
|
||||||
|
|
||||||
|
// 清除搜索
|
||||||
|
const clearSearch = () => {
|
||||||
|
searchKeyword.value = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择单位
|
||||||
|
const selectUnit = (unit) => {
|
||||||
|
selectedUnitId.value = unit.id;
|
||||||
|
scrollViewId.value = `unit-${unit.id}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 确认选择
|
||||||
|
const confirmUnitSelection = () => {
|
||||||
|
if (!selectedUnitId.value) {
|
||||||
|
Toast({ message: '请选择单位', theme: 'warning' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectedUnit = unitList.value.find(unit => unit.id === selectedUnitId.value);
|
||||||
|
if (selectedUnit) {
|
||||||
|
formData.unitId = selectedUnit.id;
|
||||||
|
formData.unitName = selectedUnit.name;
|
||||||
|
}
|
||||||
|
showUnitPicker.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取单位列表
|
||||||
|
const getUnitList = async () => {
|
||||||
|
try {
|
||||||
|
const { code, data, msg } = await useRequest().get('/open/common/units');
|
||||||
|
if (code === 0) {
|
||||||
|
unitList.value = data || [];
|
||||||
|
} else {
|
||||||
|
Toast({ message: msg || '获取单位列表失败', theme: 'error' });
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取单位列表失败', error);
|
||||||
|
Toast({ message: '获取单位列表失败', theme: 'error' });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 发送验证码
|
||||||
|
const sendVerificationCode = async () => {
|
||||||
|
if (!formData.phone || formData.phone.length !== 11) {
|
||||||
|
Toast({ message: '请输入正确的手机号', theme: 'error' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (countdown.value > 0) return;
|
||||||
|
|
||||||
|
sendingCode.value = true;
|
||||||
|
try {
|
||||||
|
const { code, msg } = await useRequest().post('/client/auth/send-verification-code', {
|
||||||
|
phone: formData.phone,
|
||||||
|
type: 'register'
|
||||||
|
});
|
||||||
|
|
||||||
|
if (code === 0) {
|
||||||
|
Toast({ message: '验证码已发送' });
|
||||||
|
startCountdown();
|
||||||
|
} else {
|
||||||
|
Toast({ message: msg || '发送验证码失败', theme: 'error' });
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('发送验证码失败', error);
|
||||||
|
Toast({ message: '发送验证码失败', theme: 'error' });
|
||||||
|
} finally {
|
||||||
|
sendingCode.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 倒计时
|
||||||
|
const startCountdown = () => {
|
||||||
|
countdown.value = 60;
|
||||||
|
const timer = setInterval(() => {
|
||||||
|
countdown.value--;
|
||||||
|
if (countdown.value <= 0) {
|
||||||
|
clearInterval(timer);
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 注册
|
||||||
|
const handleRegister = async () => {
|
||||||
|
if (!isFormValid.value) {
|
||||||
|
Toast({ message: '请完善注册信息', theme: 'error' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
registering.value = true;
|
||||||
|
try {
|
||||||
|
const { code, msg } = await useRequest().post('/client/auth/register', {
|
||||||
|
name: formData.name,
|
||||||
|
phone: formData.phone,
|
||||||
|
unitId: formData.unitId,
|
||||||
|
idCard: formData.idCard,
|
||||||
|
verificationCode: formData.verificationCode
|
||||||
|
});
|
||||||
|
|
||||||
|
if (code === 0) {
|
||||||
|
Toast({ message: '注册成功' });
|
||||||
|
// 注册成功后跳转到登录页
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/login/index'
|
||||||
|
});
|
||||||
|
}, 1500);
|
||||||
|
} else {
|
||||||
|
Toast({ message: msg || '注册失败', theme: 'error' });
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('注册失败', error);
|
||||||
|
Toast({ message: '注册失败', theme: 'error' });
|
||||||
|
} finally {
|
||||||
|
registering.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 显示协议
|
||||||
|
const showAgreement = () => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/agreement/index'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 显示隐私政策
|
||||||
|
const showPrivacy = () => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/privacy/index'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 跳转登录页面
|
||||||
|
const goToLogin = () => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/login/index'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 页面加载时获取单位列表
|
||||||
|
onMounted(() => {
|
||||||
|
getUnitList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.register-container {
|
||||||
|
height: 100vh;
|
||||||
|
background: #f4f2f2;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-area {
|
||||||
|
padding: 0;
|
||||||
|
height: 30vh;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background: linear-gradient(135deg, #7a1818 0%, #d03e3e 50%, #f45a5a 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tech-animation {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tech-animation svg {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-image {
|
||||||
|
display: none; /* 隐藏背景图片,使用动画背景 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay {
|
||||||
|
display: none; /* 不需要叠加层 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-content {
|
||||||
|
padding: 0 30px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-title {
|
||||||
|
font-size: 36px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
color: #ffffff;
|
||||||
|
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-title-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-title {
|
||||||
|
font-size: 18px;
|
||||||
|
color: #ffffff;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-area {
|
||||||
|
flex: 1;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 30px 30px 0 0;
|
||||||
|
margin-top: -30px;
|
||||||
|
padding: 30px 30px 0;
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-box {
|
||||||
|
height: 50px;
|
||||||
|
background-color: #eceaea;
|
||||||
|
border-radius: 25px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 15px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-icon {
|
||||||
|
color: #999;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-icon-container {
|
||||||
|
display: none; /* 不使用图标容器 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.input, .unit-selector {
|
||||||
|
flex: 1;
|
||||||
|
height: 100%;
|
||||||
|
border: none;
|
||||||
|
font-size: 15px;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unit-selector {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
color: gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.has-value {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow-icon {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.verify-code-btn {
|
||||||
|
color: #f45a5a;
|
||||||
|
font-size: 14px;
|
||||||
|
white-space: nowrap;
|
||||||
|
background: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
min-width: auto;
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
color: #999;
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit-btn {
|
||||||
|
margin-top: 32px;
|
||||||
|
height: 50px;
|
||||||
|
background-color: #f45a5a;
|
||||||
|
border-radius: 25px;
|
||||||
|
color: white;
|
||||||
|
font-size: 16px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
background-color: #f45a5a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-link-box {
|
||||||
|
margin-top: 16px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-text {
|
||||||
|
color: #f45a5a;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-picker {
|
||||||
|
width: 100%;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 20rpx 20rpx 0 0;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
max-height: 80vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-picker-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 20rpx;
|
||||||
|
border-bottom: 1px solid #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cancel-btn, .confirm-btn {
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
color: #f45a5a;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.confirm-btn {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-title {
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-box {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 20rpx;
|
||||||
|
border-bottom: 1px solid #f5f5f5;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
margin: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-icon {
|
||||||
|
margin-right: 10rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 28rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear-icon {
|
||||||
|
margin-left: 10rpx;
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.units-scroll-view {
|
||||||
|
flex: 1;
|
||||||
|
height: 60vh;
|
||||||
|
padding-bottom: 30rpx;
|
||||||
|
overflow-y: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unit-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 26rpx 30rpx;
|
||||||
|
border-bottom: 1px solid #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unit-selected {
|
||||||
|
background-color: rgba(244, 90, 90, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.unit-name {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.check-icon {
|
||||||
|
position: absolute;
|
||||||
|
right: 30rpx;
|
||||||
|
color: #f45a5a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-result {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 100rpx 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-icon {
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 206 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
export const config = {
|
||||||
|
fileDomain: 'http://localhost',
|
||||||
|
}
|
||||||
@@ -124,6 +124,7 @@ async function routeInterceptor(args, whiteList) {
|
|||||||
export const getDefaultWhiteList = () => {
|
export const getDefaultWhiteList = () => {
|
||||||
return [
|
return [
|
||||||
'/pages/index/index',
|
'/pages/index/index',
|
||||||
'/pages/login/index'
|
'/pages/login/index',
|
||||||
|
'/pages/login/register'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
// https: {
|
/* https: {
|
||||||
// cert: fs.readFileSync(path.join(__dirname, 'src/ssl/localhost+2.pem')),
|
cert: fs.readFileSync(path.join(__dirname, 'src/ssl/localhost+2.pem')),
|
||||||
// key: fs.readFileSync(path.join(__dirname, 'src/ssl/localhost+2-key.pem'))
|
key: fs.readFileSync(path.join(__dirname, 'src/ssl/localhost+2-key.pem'))
|
||||||
// },
|
},*/
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://192.168.41.118:9090',
|
target: 'http://localhost:9090',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api/, '')
|
rewrite: (path) => path.replace(/^\/api/, '')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user