fix:long类型修复

This commit is contained in:
陈淳
2023-03-30 13:42:57 +08:00
parent 6b2ef71296
commit ba220e9d55
5 changed files with 50 additions and 9 deletions

View File

@@ -65,4 +65,15 @@ export function logout() {
timeout: 20000 timeout: 20000
}) })
} }
// 获取短信验证码
export function getCodePhone(phone) {
return request({
url: '/account/captcha-phone',
headers: {
isToken: false
},
method: 'post',
timeout: 20000,
data:{phone}
})
}

View File

@@ -16,9 +16,15 @@
<span>手机短信验证码</span> <span>手机短信验证码</span>
<input type="text" class="input-item" v-model="registerForm.code"> <input type="text" class="input-item" v-model="registerForm.code">
</div> </div>
<div class="password form-item"> <div class="password form-item">
<span>密码</span> <span>密码</span>
<input type="password" class="input-item" v-model="registerForm.password"> <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> </div>
<RouterLink to="/login" > 已有账号前往登录</RouterLink> <RouterLink to="/login" > 已有账号前往登录</RouterLink>
<button class="login-btn" @click="register">注册</button> <button class="login-btn" @click="register">注册</button>
@@ -41,30 +47,48 @@
<script setup> <script setup>
import { reactive ,ref} from 'vue'; import { reactive ,ref} from 'vue';
import { useRouter, useRoute } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
import {getCodePhone} from '@/apis/accountApi'
import useUserStore from '@/stores/user.js' import useUserStore from '@/stores/user.js'
import useConfigStore from "@/stores/config"; import useConfigStore from "@/stores/config";
const configStore= useConfigStore(); const configStore= useConfigStore();
const userStore = useUserStore(); const userStore = useUserStore();
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const passwordConfirm=ref('');
const registerForm = reactive({ const registerForm = reactive({
userName: "", userName: "",
password: "", password: "",
uuid: "", uuid: "",
code: "" code: "",
phone:""
}) })
const isSendCaptcha=ref(false) const isSendCaptcha=ref(false)
//验证码 //验证码
const captcha=async()=>{ const captcha=async()=>{
isSendCaptcha.value=true; isSendCaptcha.value=true;
const response= await getCodePhone(registerForm.phone);
ElMessage({
message: `已向${registerForm.phone}发送验证码,请注意查收`,
type: 'success',
})
} }
const register = async () => { const register = async () => {
if(registerForm.password!=passwordConfirm.value)
{
ElMessage.error('两次密码输入不一致')
return;
}
const response = await userStore.register(registerForm).catch((e) => { const response = await userStore.register(registerForm).catch((e) => {
registerForm.userName = ""; registerForm.password="";
registerForm.password = ""; passwordConfirm.value="";
}); });
//成功 //成功

View File

@@ -7,9 +7,13 @@ using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using System.Threading.Tasks; using System.Threading.Tasks;
using SqlSugar;
namespace Yi.Framework.Data.Json namespace Yi.Framework.Data.Json
{ {
/// <summary>
/// 长整形转字符串
/// </summary>
public class LongToStringConverter : JsonConverter<long> public class LongToStringConverter : JsonConverter<long>
{ {
public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
@@ -26,6 +30,7 @@ namespace Yi.Framework.Data.Json
{ {
return number; return number;
} }
return 0;
} }
return reader.GetInt64(); return reader.GetInt64();
@@ -37,3 +42,4 @@ namespace Yi.Framework.Data.Json
} }
} }
} }

View File

@@ -102,7 +102,7 @@ namespace Yi.RBAC.Application.Identity
private void ValidationPhoneCaptcha(RegisterDto input) private void ValidationPhoneCaptcha(RegisterDto input)
{ {
var value = _cacheManager.Get<string>($"Yi:Phone:{input.Phone}"); 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; return;
} }
@@ -212,7 +212,7 @@ namespace Yi.RBAC.Application.Identity
{ {
code = "8888"; 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 }; return new { Uuid = uuid };

View File

@@ -33,7 +33,7 @@
</summary> </summary>
<param name="str_handset"></param> <param name="str_handset"></param>
</member> </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>
注册 手机验证码 注册 手机验证码
</summary> </summary>