feat: 支持注册带入昵称

This commit is contained in:
橙子
2024-10-02 23:25:29 +08:00
parent d4e8ce9c89
commit 94ee0fb058
13 changed files with 75 additions and 23 deletions

View File

@@ -8,12 +8,12 @@
/// <summary>
/// 账号
/// </summary>
public string UserName { get; set; } = string.Empty;
public string UserName { get; set; }
/// <summary>
/// 密码
/// </summary>
public string Password { get; set; } = string.Empty;
public string Password { get; set; }
/// <summary>
/// 唯一标识码
@@ -29,5 +29,11 @@
/// 验证码
/// </summary>
public string? Code { get; set; }
/// <summary>
/// 昵称
/// </summary>
public string? Nick{ get; set; }
}
}

View File

@@ -245,7 +245,7 @@ namespace Yi.Framework.Rbac.Application.Services
}
//注册领域逻辑
await _accountManager.RegisterAsync(input.UserName, input.Password, input.Phone);
await _accountManager.RegisterAsync(input.UserName, input.Password, input.Phone,input.Nick);
}

View File

@@ -19,12 +19,12 @@ namespace Yi.Framework.Rbac.Domain.Entities
{
}
public UserAggregateRoot(string userName, string password, long phone, string nick = "萌新")
public UserAggregateRoot(string userName, string password, long phone, string? nick = null)
{
UserName = userName;
EncryPassword.Password = password;
Phone = phone;
Nick = nick+"-"+userName;
Nick =string.IsNullOrWhiteSpace(nick)?"萌新-"+userName:nick.Trim();
BuildPassword();
}

View File

@@ -271,9 +271,9 @@ namespace Yi.Framework.Rbac.Domain.Managers
/// <param name="password"></param>
/// <param name="phone"></param>
/// <returns></returns>
public async Task RegisterAsync(string userName, string password, long phone)
public async Task RegisterAsync(string userName, string password, long phone,string? nick)
{
var user = new UserAggregateRoot(userName, password, phone);
var user = new UserAggregateRoot(userName, password, phone,nick);
await _userManager.CreateAsync(user);
await _userManager.SetDefautRoleAsync(user.Id);

View File

@@ -14,7 +14,7 @@ namespace Yi.Framework.Rbac.Domain.Managers
string CreateRefreshToken(Guid userId);
Task<string> GetTokenByUserIdAsync(Guid userId,Action<UserRoleMenuDto>? getUserInfo=null);
Task LoginValidationAsync(string userName, string password, Action<UserAggregateRoot>? userAction = null);
Task RegisterAsync(string userName, string password, long phone);
Task RegisterAsync(string userName, string password, long phone,string? nick);
Task<bool> RestPasswordAsync(Guid userId, string password);
Task UpdatePasswordAsync(Guid userId, string newPassword, string oldPassword);
}

View File

@@ -142,8 +142,8 @@ align-items: flex-end;
{
margin-left: 20px;
border: 0.8px solid #000;
width: 100px;
height: 30px;
width: 150px;
height: 40px;
text-align: center;
}
.div-bottom

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@@ -154,7 +154,12 @@ const noticeForNoReadCount = computed(() => {
})
//加载初始化离线消息
onMounted(async () => {
await fetchNoticeData();
//登录了才去判断消息通知
if (isLogin.value)
{
await fetchNoticeData();
}
})
const fetchNoticeData = async () => {
const { data } = await getNoticeList({ maxResultCount: 20 });

View File

@@ -37,10 +37,13 @@ watch(
break;
}
try {
//state 0 代表使用第三方登录
if (type.value === "0") {
const { data } = await authOtherLogin({ code: val }, scheme.value);
authData.value = data;
} else if (type.value === "1") {
}
//state 0 代表进行第三方绑定
else if (type.value === "1") {
const { data } = await authOtherBind({ code: val }, scheme.value);
authData.value = data;
}

View File

@@ -62,6 +62,7 @@
<el-form-item label="封面:" v-if="radio == 'discuss'">
<el-image
v-if="dialogImageUrl"
:src="getUrl"
style="width: 178px; height: 178px"
class="avatar"

View File

@@ -1,4 +1,3 @@
<template>
404
</template>

View File

@@ -3,8 +3,8 @@
<el-row :gutter="20" class="top-div">
<el-col :span="17">
<div class="chat-hub">
<p @click="onClickToChatHub">点击前往-最新上线<span>聊天室 </span>现已支持<span>Ai助手</span>希望能帮助大家
</p>
<!-- <p @click="onClickToChatHub">点击前往-最新上线<span>聊天室 </span>现已支持<span>Ai助手</span>希望能帮助大家</p>-->
<p @click="onClickToWeChat">点击关注-最新上线<span>.Net官方微信公众号 </span>分享有<span>深度</span>.Net知识希望能帮助大家</p>
</div>
<div class="scrollbar">
<ScrollbarInfo/>
@@ -188,6 +188,25 @@
</el-row>
</el-col>
</el-row>
<el-dialog
v-model="wechatDialogVisible"
title="意社区官方微信公众号"
width="800"
>
<div style="display: flex;justify-content: center;">
<img style="width: 585px; height: 186px" src="@/assets/wechat/share.png" alt=""/>
</div>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="wechatDialogVisible = false">
已关注
</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
@@ -402,6 +421,7 @@ const onClickAccessLog = async () => {
}
const wechatDialogVisible=ref(false)
//切换统计开关
const onClickWeekSwitch = async () => {
if (weekQuery.accessLogType === "HomeClick") {
@@ -413,6 +433,11 @@ const onClickWeekSwitch = async () => {
const {data: weekData} = await getWeek(weekQuery);
weekList.value = weekData;
}
//打开微信公众号弹窗
const onClickToWeChat=()=>{
wechatDialogVisible.value=true;
};
</script>
<style scoped lang="scss">
.home-box {

View File

@@ -73,15 +73,25 @@
:rules="registerRules"
>
<div class="input-content">
<div class="input">
<p>用户名</p>
<div style="display: flex;justify-content: space-between;margin: 0">
<div class="input" style="width: 55%;margin: 0">
<p>*登录账号</p>
<el-form-item prop="userName">
<input type="text" v-model.trim="registerForm.userName">
</el-form-item>
</div>
<div class="input">
<p>电话</p>
<div class="input" style="width: 35%;margin: 0">
<p>昵称</p>
<el-form-item prop="userName">
<input type="text" v-model.trim="registerForm.nick">
</el-form-item>
</div>
</div>
<div class="input" style="margin-top: 0">
<p>*电话</p>
<el-form-item prop="phone">
<div class="phone-code">
<input class="phone-code-input" type="text" v-model.trim="registerForm.phone">
@@ -90,19 +100,19 @@
</el-form-item>
</div>
<div class="input">
<p>短信验证码</p>
<p>*短信验证码</p>
<el-form-item prop="code" >
<input :disabled="!isDisabledCode" type="text" v-model.trim="registerForm.code">
</el-form-item>
</div>
<div class="input">
<p>密码</p>
<p>*密码</p>
<el-form-item prop="password">
<input :disabled="!isDisabledCode" type="password" v-model.trim="registerForm.password">
</el-form-item>
</div>
<div class="input">
<p>确认密码</p>
<p>*确认密码</p>
<el-form-item>
<input :disabled="!isDisabledCode" type="password" v-model.trim="passwordConfirm">
</el-form-item>
@@ -186,8 +196,12 @@ const registerForm = reactive({
password: "",
uuid: "",
code: "",
nick:""
});
const registerRules = reactive({
nick: [
{ min: 2, message: "昵称需大于两位", trigger: "blur" },
],
userName: [
{ required: true, message: "请输入用户名", trigger: "blur" },
{ min: 2, message: "用户名需大于两位", trigger: "blur" },
@@ -297,7 +311,6 @@ window.addEventListener("message", async (e) => {
console.log(authData, "传到登录页的值");
if (authData) {
await loginSuccess({ data: JSON.parse(authData) });
window.close();
}
});
</script>