..
This commit is contained in:
@@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信登录
|
* 短信登录
|
||||||
*/
|
*/
|
||||||
@@ -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,11 @@ 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
|
@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 {
|
||||||
|
|
||||||
@@ -11,4 +12,10 @@ public interface ClientAuthService {
|
|||||||
*/
|
*/
|
||||||
String doSmsLogin(ClientLoginBody loginBody);
|
String doSmsLogin(ClientLoginBody loginBody);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册
|
||||||
|
* @param registerBody 注册信息
|
||||||
|
* @return token
|
||||||
|
*/
|
||||||
|
String doRegister(ClientRegisterBody registerBody);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.budwk.app.client.auth.service;
|
package com.budwk.app.client.auth.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.budwk.app.base.exception.BaseException;
|
import com.budwk.app.base.exception.BaseException;
|
||||||
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;
|
||||||
@@ -23,11 +25,12 @@ public class ClientAuthServiceImpl implements ClientAuthService {
|
|||||||
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) {
|
||||||
// 自动注册
|
// // 自动注册
|
||||||
user = new Client_user();
|
// user = new Client_user();
|
||||||
user.setPhone(loginBody.getPhone());
|
// user.setPhone(loginBody.getPhone());
|
||||||
user.setUserName("用户" + loginBody.getPhone());
|
// user.setUserName("用户" + loginBody.getPhone());
|
||||||
dao.insert(user);
|
// dao.insert(user);
|
||||||
|
throw new BaseException("手机号码不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
validateService.checkSMSCode(loginBody.getPhone(), loginBody.getSmsCode());
|
validateService.checkSMSCode(loginBody.getPhone(), loginBody.getSmsCode());
|
||||||
@@ -39,4 +42,20 @@ public class ClientAuthServiceImpl implements ClientAuthService {
|
|||||||
StpClientUtil.STP.checkLogin();
|
StpClientUtil.STP.checkLogin();
|
||||||
return StpClientUtil.STP.getTokenValue();
|
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.checkLogin();
|
||||||
|
return StpClientUtil.STP.getTokenValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -27,7 +27,7 @@ jetty:
|
|||||||
|
|
||||||
security:
|
security:
|
||||||
tokenName: token
|
tokenName: token
|
||||||
timeout: 3600
|
timeout: 86400
|
||||||
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
||||||
# 允许同一账号并发登录,则系统参数 SessionOnlyOne 有效,亦可踢人下线并多了弹框提示功能
|
# 允许同一账号并发登录,则系统参数 SessionOnlyOne 有效,亦可踢人下线并多了弹框提示功能
|
||||||
isConcurrent: true
|
isConcurrent: true
|
||||||
@@ -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: '?'
|
||||||
|
|
||||||
|
|||||||
@@ -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": {
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|
||||||
|
|||||||
@@ -109,11 +109,11 @@
|
|||||||
立即登录
|
立即登录
|
||||||
</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>
|
||||||
@@ -317,6 +317,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 +507,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,664 @@
|
|||||||
|
<template>
|
||||||
|
<view class="register-container">
|
||||||
|
<view class="title-area">
|
||||||
|
<image class="bg-image" src="/static/login-bg.jpg" mode="aspectFill"></image>
|
||||||
|
<view class="overlay"></view>
|
||||||
|
<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-wrapper">
|
||||||
|
<!-- 注册表单区域 -->
|
||||||
|
<view class="form-container">
|
||||||
|
<view class="form-title">填写信息</view>
|
||||||
|
|
||||||
|
<!-- 姓名输入框 -->
|
||||||
|
<view class="input-box">
|
||||||
|
<view class="input-icon-container">
|
||||||
|
<t-icon name="user" size="22px" class="input-icon"/>
|
||||||
|
</view>
|
||||||
|
<input
|
||||||
|
class="input"
|
||||||
|
type="text"
|
||||||
|
v-model="formData.name"
|
||||||
|
placeholder="请输入姓名"
|
||||||
|
maxlength="20"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 手机号码输入框 -->
|
||||||
|
<view class="input-box">
|
||||||
|
<view class="input-icon-container">
|
||||||
|
<t-icon name="mobile" size="22px" class="input-icon"/>
|
||||||
|
</view>
|
||||||
|
<input
|
||||||
|
class="input"
|
||||||
|
type="tel"
|
||||||
|
v-model="formData.phone"
|
||||||
|
placeholder="请输入手机号"
|
||||||
|
maxlength="11"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 单位输入框 -->
|
||||||
|
<view class="input-box" @click="showUnitPicker = true">
|
||||||
|
<view class="input-icon-container">
|
||||||
|
<t-icon name="home" size="22px" class="input-icon"/>
|
||||||
|
</view>
|
||||||
|
<view class="input placeholder" :class="{'has-value': formData.unitName}">
|
||||||
|
{{ formData.unitName || '请选择单位' }}
|
||||||
|
</view>
|
||||||
|
<t-icon name="chevron-right" size="20px" class="arrow-icon"/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 身份证输入框 -->
|
||||||
|
<view class="input-box">
|
||||||
|
<view class="input-icon-container">
|
||||||
|
<t-icon name="id-card" size="22px" class="input-icon"/>
|
||||||
|
</view>
|
||||||
|
<input
|
||||||
|
class="input"
|
||||||
|
type="text"
|
||||||
|
v-model="formData.idCard"
|
||||||
|
placeholder="请输入身份证号码"
|
||||||
|
maxlength="18"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 验证码输入框 -->
|
||||||
|
<view class="input-box">
|
||||||
|
<view class="input-icon-container">
|
||||||
|
<t-icon name="shield-check" size="22px" class="input-icon"/>
|
||||||
|
</view>
|
||||||
|
<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" :class="{ disabled: !isFormValid }" @click="handleRegister">
|
||||||
|
{{ registering ? '注册中...' : '立即注册' }}
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 登录链接 -->
|
||||||
|
<view class="login-link-box">
|
||||||
|
<text>已有账号?</text>
|
||||||
|
<text class="link-text" @click="goToLogin">立即登录</text>
|
||||||
|
</view>
|
||||||
|
</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 {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-area {
|
||||||
|
position: relative;
|
||||||
|
height: 380rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-image {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
background: linear-gradient(to bottom, rgba(244, 90, 90, 0.8), rgba(244, 90, 90, 0.5));
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-content {
|
||||||
|
position: relative;
|
||||||
|
z-index: 3;
|
||||||
|
padding: 80rpx 40rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-title {
|
||||||
|
font-size: 68rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #fff;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
letter-spacing: 2rpx;
|
||||||
|
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-title-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-title {
|
||||||
|
font-size: 38rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 500;
|
||||||
|
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-wrapper {
|
||||||
|
position: relative;
|
||||||
|
background-color: #ffffff;
|
||||||
|
padding: 0 40rpx;
|
||||||
|
margin-top: -60rpx;
|
||||||
|
z-index: 10;
|
||||||
|
border-radius: 50rpx 50rpx 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-container {
|
||||||
|
padding: 60rpx 0 50rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-box {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 20rpx 0;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
position: relative;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
transition: border-color 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-box:focus-within {
|
||||||
|
border-bottom-color: #f45a5a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-icon-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 70rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(244, 90, 90, 0.1);
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-icon {
|
||||||
|
color: #f45a5a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow-icon {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 28rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.placeholder {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.has-value {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.verify-code-btn {
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
background-color: #f45a5a;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 26rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
text-align: center;
|
||||||
|
min-width: 180rpx;
|
||||||
|
margin-left: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disabled {
|
||||||
|
background-color: #f8a8a8;
|
||||||
|
color: #fff;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit-btn {
|
||||||
|
background: linear-gradient(135deg, #f45a5a, #f78484);
|
||||||
|
height: 90rpx;
|
||||||
|
border-radius: 45rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 32rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin: 50rpx 0 30rpx;
|
||||||
|
transition: transform 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit-btn:active {
|
||||||
|
transform: scale(0.98);
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit-btn.disabled {
|
||||||
|
opacity: 0.7;
|
||||||
|
background: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-link-box {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
margin: 20rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-text {
|
||||||
|
color: #f45a5a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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 |
@@ -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'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export default defineConfig({
|
|||||||
// },
|
// },
|
||||||
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