fix:long类型修复
This commit is contained in:
@@ -65,4 +65,15 @@ export function logout() {
|
||||
timeout: 20000
|
||||
})
|
||||
}
|
||||
|
||||
// 获取短信验证码
|
||||
export function getCodePhone(phone) {
|
||||
return request({
|
||||
url: '/account/captcha-phone',
|
||||
headers: {
|
||||
isToken: false
|
||||
},
|
||||
method: 'post',
|
||||
timeout: 20000,
|
||||
data:{phone}
|
||||
})
|
||||
}
|
||||
@@ -16,9 +16,15 @@
|
||||
<span>手机短信验证码</span>
|
||||
<input type="text" class="input-item" v-model="registerForm.code">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="password form-item">
|
||||
<span>密码</span>
|
||||
<input type="password" class="input-item" v-model="registerForm.password">
|
||||
</div>
|
||||
<div class="password form-item">
|
||||
<span>确认密码</span>
|
||||
<input type="password" class="input-item" v-model="passwordConfirm">
|
||||
</div>
|
||||
<RouterLink to="/login" > 已有账号,前往登录</RouterLink>
|
||||
<button class="login-btn" @click="register">注册</button>
|
||||
@@ -41,30 +47,48 @@
|
||||
<script setup>
|
||||
import { reactive ,ref} from 'vue';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
import {getCodePhone} from '@/apis/accountApi'
|
||||
import useUserStore from '@/stores/user.js'
|
||||
import useConfigStore from "@/stores/config";
|
||||
const configStore= useConfigStore();
|
||||
const userStore = useUserStore();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const passwordConfirm=ref('');
|
||||
const registerForm = reactive({
|
||||
userName: "",
|
||||
password: "",
|
||||
uuid: "",
|
||||
code: ""
|
||||
code: "",
|
||||
phone:""
|
||||
})
|
||||
|
||||
const isSendCaptcha=ref(false)
|
||||
|
||||
|
||||
//验证码
|
||||
const captcha=async()=>{
|
||||
isSendCaptcha.value=true;
|
||||
isSendCaptcha.value=true;
|
||||
const response= await getCodePhone(registerForm.phone);
|
||||
ElMessage({
|
||||
message: `已向${registerForm.phone}发送验证码,请注意查收`,
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
const register = async () => {
|
||||
|
||||
if(registerForm.password!=passwordConfirm.value)
|
||||
{
|
||||
ElMessage.error('两次密码输入不一致')
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const response = await userStore.register(registerForm).catch((e) => {
|
||||
registerForm.userName = "";
|
||||
registerForm.password = "";
|
||||
registerForm.password="";
|
||||
passwordConfirm.value="";
|
||||
});
|
||||
|
||||
//成功
|
||||
|
||||
@@ -7,9 +7,13 @@ using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Yi.Framework.Data.Json
|
||||
{
|
||||
/// <summary>
|
||||
/// 长整形转字符串
|
||||
/// </summary>
|
||||
public class LongToStringConverter : JsonConverter<long>
|
||||
{
|
||||
public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
@@ -26,6 +30,7 @@ namespace Yi.Framework.Data.Json
|
||||
{
|
||||
return number;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return reader.GetInt64();
|
||||
@@ -37,3 +42,4 @@ namespace Yi.Framework.Data.Json
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Yi.RBAC.Application.Identity
|
||||
private void ValidationPhoneCaptcha(RegisterDto input)
|
||||
{
|
||||
var value = _cacheManager.Get<string>($"Yi:Phone:{input.Phone}");
|
||||
if (value is not null && value.Equals($"{input.Code}:{input.Uuid}"))
|
||||
if (value is not null && value.Equals($"{input.Code}"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
code = "8888";
|
||||
}
|
||||
_cacheManager.Set($"Yi:Phone:{input.Phone}", $"{code}:{uuid}", new TimeSpan(0, 10, 0));
|
||||
_cacheManager.Set($"Yi:Phone:{input.Phone}", $"{code}", new TimeSpan(0, 10, 0));
|
||||
|
||||
|
||||
return new { Uuid = uuid };
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</summary>
|
||||
<param name="str_handset"></param>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.PostCaptchatPhone(Yi.RBAC.Application.Contracts.Identity.Dtos.Account.PhoneCaptchaImageDto)">
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.PostCaptchaPhone(Yi.RBAC.Application.Contracts.Identity.Dtos.Account.PhoneCaptchaImageDto)">
|
||||
<summary>
|
||||
注册 手机验证码
|
||||
</summary>
|
||||
|
||||
Reference in New Issue
Block a user