分享
这次面试我也做了一些总结,确实还有很多要学的东西。相关面试题也做了整理,可以分享给大家,了解一下面试真题,想进大厂的或者想跳槽的小伙伴不妨好好利用时间来学习。学习的脚步一定不能停止!
Spring Cloud实战
Spring Boot实战
面试题整理(性能优化+微服务+并发编程+开源框架+分布式)
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
method: "POST",
data: {
name: inputName,
password: inputPassword
},
success: function(res) {
console.log(res)
if (res.statusCode != 200) {
wx.showToast({ //这里提示失败原因
title: res.data.message,
icon: 'loading',
duration: 1500
})
} else {
wx.showToast({
title: '注册成功', //这里成功
icon: 'success',
duration: 1000
});
that.setData({
isLogin: true,
}
)
}
},
fail: function(res) {
console.log(res)
wx.showToast({
title: '请求失败',
icon: 'none',
duration: 1500
})
}
});
}
},
注意点:
if (res.statusCode != 200) 这里我们判断后台返回的statusCode,只有statusCode等于200时,才说明我们注册成功,下面时注册成功后后台返回的信息
![注册成功.png](https://upload-images.jianshu.io/upload_images/6273713-63dd384862c99f2e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
四,登陆功能实现
========
登陆其实和注册都是把用户名和密码传到后台,只不过登陆时,先那用户名去数据库里查,看是否存在这个用户。
如果存在,就去比对我们传的密码和数据库里存的密码是否一样,如果一样就登陆成功,返回登陆信息。
![登陆成功.png](https://upload-images.jianshu.io/upload_images/6273713-281001cd7526f89c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
下面贴出完整代码index.js
----------------
var inputName = “”;
var inputPassword = “”;
Page({
/**
-
页面的初始数据
-
初始化两个输入值
*/
data: {
isLogin: false
},
//获取用户输入的值a
inputName: function(e) {
inputName = e.detail.value;
},
//获取用户输入的值b
inputPassword: function(e) {
inputPassword = e.detail.value;
console.log(“输入的密码:” + inputPassword);
},
// 注册
register: function() {
var that = this;
var isrightful = that.checkInput();
if (isrightful) {
wx.request({
url: 'http://localhost:8080/user/testSave',
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
method: "POST",
data: {
name: inputName,
password: inputPassword
},
success: function(res) {
console.log(res)
if (res.statusCode != 200) {
wx.showToast({ //这里提示失败原因
title: res.data.message,
icon: 'loading',
duration: 1500
})
} else {
wx.showToast({
title: '注册成功', //这里成功
icon: 'success',
duration: 1000
});
that.setData({
isLogin: true,
}
)
}
},
fail: function(res) {
console.log(res)
wx.showToast({
title: '请求失败',
icon: 'none',
duration: 1500
})
}
});
}
},
// 登陆
login: function() {
var that = this;
var isrightful = that.checkInput();
if (isrightful) {
wx.request({
url: 'http://localhost:8080/user/testLogin',
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
method: "POST",
data: {
name: inputName,
password: inputPassword
},
success: function(res) {
console.log(res)
if (res.statusCode != 200) {
wx.showToast({ //这里提示失败原因
title: res.data.message,
icon: 'loading',
duration: 1500
})
} else {
wx.showToast({
title: '登陆成功', //这里成功
icon: 'success',
duration: 1000
});
that.setData({
isLogin: true,
}
)
}
},
fail: function(res) {
console.log(res)
wx.showToast({
title: '请求失败',
icon: 'none',
duration: 1500
})
}
});
}
},
//检测输入值
checkInput: function() {
if (inputName == “” || inputName == null ||
inputName == undefined) {
this.showErrorToastUtils(‘请输入用户名’);
} else if (inputPassword == “” || inputPassword == null || inputPassword == undefined) {
this.showErrorToastUtils(‘请输入密码’);
} else if (inputPassword.length < 6) {
this.showErrorToastUtils(‘密码至少要6位’);
}
总结
对于面试还是要好好准备的,尤其是有些问题还是很容易挖坑的,例如你为什么离开现在的公司(你当然不应该抱怨现在的公司有哪些不好的地方,更多的应该表明自己想要寻找更好的发展机会,自己的一些现实因素,比如对于我而言是现在应聘的公司离自己的家更近,又或者是自己工作到达了迷茫期,想跳出迷茫期等等)
Java面试精选题、架构实战文档
整理不易,觉得有帮助的朋友可以帮忙点赞分享支持一下小编~
你的支持,我的动力;祝各位前程似锦,offer不断!
自己的家更近,又或者是自己工作到达了迷茫期,想跳出迷茫期等等)
[外链图片转存中…(img-1MQHspCA-1715123985075)]
Java面试精选题、架构实战文档
整理不易,觉得有帮助的朋友可以帮忙点赞分享支持一下小编~
你的支持,我的动力;祝各位前程似锦,offer不断!