联调登入

This commit is contained in:
Dragon
2023-07-11 18:01:38 +08:00
parent 296a640744
commit cdc8f2290c
5 changed files with 590 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ const toastMsg = (content = '操作完成', time = 2) => {
var idOrPhone = true;//判断id登入或手机号登入
var times = 0;//倒计时计时器
var isClick = true;//判断是否再次获取验证码
var token;
$(function () {
setTimeout(function () {
getInfoFromClient()
@@ -62,6 +63,29 @@ function getCode () {
}
})
}
// ticket接口
function ticket () {
showLoading()
networkRequest({
type: 'POST',
url: urlPrefix + '/oauth/ticket',
data: { issue_type: "multi", access_token: token },
success (res) {
if (res.code === 200) {
sessionStorage.setItem("uid", res.data.uid);
sessionStorage.setItem("ticket", res.data.ticket);
window.location.href = './index.html'
} else {
toastMsg(res.message)
}
hideLoading(layerIndex)
},
error (err) {
hideLoading(layerIndex)
toastMsg('網絡錯誤,請退出重進')
}
})
}
// 登入接口
function oauthToken () {
if (idOrPhone) {
@@ -79,7 +103,8 @@ function oauthToken () {
data: idOrPhone ? { "grant_type": "password", phone, password, client_id: "erban-client", "client_secret": "uyzjdhds" } : { grant_type: 'verify_code', phoneAreaCode, phone, code, client_id: "erban-client", "client_secret": "uyzjdhds" },
success (res) {
if (res.code === 200) {
token = res.data.access_token;
ticket();
} else {
toastMsg(res.message)
}