1
This commit is contained in:
parent
a776179199
commit
6b8b60a1da
10
.idea/UniappTool.xml
generated
Normal file
10
.idea/UniappTool.xml
generated
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="cn.fjdmy.uniapp.UniappProjectDataService">
|
||||||
|
<option name="generalBasePath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="manifestPath" value="$PROJECT_DIR$/manifest.json" />
|
||||||
|
<option name="pagesPath" value="$PROJECT_DIR$/pages.json" />
|
||||||
|
<option name="scanNum" value="1" />
|
||||||
|
<option name="type" value="store" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -59,28 +59,40 @@ const changeType = () => {
|
|||||||
type.value=type.value==0?1:0;
|
type.value=type.value==0?1:0;
|
||||||
}
|
}
|
||||||
const submitDoLogin = () => {
|
const submitDoLogin = () => {
|
||||||
|
// 用户通过手机号登录
|
||||||
userPhoneLogin({'mobile':mobile.value,'captcha':code.value}).then(res => {
|
userPhoneLogin({'mobile':mobile.value,'captcha':code.value}).then(res => {
|
||||||
|
// 如果返回状态码为200,说明登录成功
|
||||||
if(res.code==200){
|
if(res.code==200){
|
||||||
message.success(res.msg);
|
// 显示登录成功的信息
|
||||||
|
message.success(res.msg);
|
||||||
|
// 将用户信息存入sessionStorage
|
||||||
sessionStorage.setItem('user', JSON.stringify(res.data.userinfo));
|
sessionStorage.setItem('user', JSON.stringify(res.data.userinfo));
|
||||||
|
// 跳转到首页
|
||||||
router.push('/');
|
router.push('/');
|
||||||
}else{
|
}else{
|
||||||
|
// 如果返回状态码不为200,说明登录失败
|
||||||
message.error(res.msg)
|
message.error(res.msg)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
const getMsg = () => {
|
const getMsg = () => {
|
||||||
console.log(mobile.value);
|
|
||||||
if (mobile.value.length != 11) {
|
console.log(mobile.value);
|
||||||
message.error( '手机号输入错误!')
|
//检查手机号格式
|
||||||
return;
|
if (mobile.value.length != 11) {
|
||||||
}
|
message.error( '手机号输入错误!')
|
||||||
if (!canGetCode.value) {
|
return;
|
||||||
//发送验证码
|
}
|
||||||
getPhoneCode();
|
//检查是否可以获取验证码
|
||||||
} else {
|
if (!canGetCode.value) {
|
||||||
message.error( '请在' + codeTips.value + '秒后重试')
|
//发送验证码
|
||||||
}
|
getPhoneCode();
|
||||||
|
} else {
|
||||||
|
message.error( '请在' + codeTips.value + '秒后重试')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
const getPhoneCode = () => {
|
const getPhoneCode = () => {
|
||||||
canGetCode.value = true;
|
canGetCode.value = true;
|
||||||
|
@ -50,27 +50,39 @@ const userInfo = ref();
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
var item = sessionStorage.getItem('user');
|
var item = sessionStorage.getItem('user');
|
||||||
var jsonArray = JSON.parse(item);
|
var jsonArray = JSON.parse(item);
|
||||||
|
// 隐藏用户手机号,只显示前3位和后7位
|
||||||
const hiddenPhoneNumber = jsonArray.mobile.substring(0, 3) + "****" + jsonArray.mobile.substring(7);
|
const hiddenPhoneNumber = jsonArray.mobile.substring(0, 3) + "****" + jsonArray.mobile.substring(7);
|
||||||
|
// 更新用户手机号
|
||||||
jsonArray.mobile = hiddenPhoneNumber;
|
jsonArray.mobile = hiddenPhoneNumber;
|
||||||
|
// 将用户信息赋值给userInfo
|
||||||
userInfo.value = jsonArray;
|
userInfo.value = jsonArray;
|
||||||
})
|
// 更新用户信息的mobile属性
|
||||||
</script>
|
jsonArray.mobile = hiddenPhoneNumber;
|
||||||
<style scoped>
|
// 将更新
|
||||||
.right_title {
|
// 用户通过手机号登录
|
||||||
font-size: 20px;
|
userPhoneLogin({'mobile':mobile.value,'captcha':code.value}).then(res => {
|
||||||
font-weight: 400;
|
// 如果返回状态码为200,说明登录成功
|
||||||
color: #000000;
|
if(res.code==200){
|
||||||
letter-spacing: 4px;
|
// 显示登录成功的信息
|
||||||
}
|
message.success(res.msg);
|
||||||
|
// 将用户信息存入sessionStorage
|
||||||
.left_text {
|
sessionStorage.setItem('user', JSON.stringify(res.data.userinfo));
|
||||||
cursor: pointer;
|
// 跳转到首页
|
||||||
font-size: 18px;
|
router.push('/');
|
||||||
color: #000000;
|
}else{
|
||||||
letter-spacing: 3px;
|
// 如果返回状态码不为200,说明登录失败
|
||||||
}
|
message.error(res.msg)
|
||||||
|
}
|
||||||
.left_text_init {
|
});
|
||||||
|
ngify(res.data.userinfo));
|
||||||
|
// 跳转到首页
|
||||||
|
router.push('/');
|
||||||
|
}else{
|
||||||
|
// 如果返回状态码不为200,说明登录失败
|
||||||
|
message.error(res.msg)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
_text_init {
|
||||||
color: #0051B1;
|
color: #0051B1;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user