Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
hmd
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6ad1666f
authored
Jul 17, 2023
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改登录
1 parent
1a94f2e4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
25 deletions
api/module/user.js
api/request/http.js
pages/loading/loading.js
api/module/user.js
View file @
6ad1666
import
http
from
'../request/http'
// const { appId } = wx.getAccountInfoSync().miniProgram
import
{
appId
}
from
'~/utils/constants'
const
{
appId
}
=
wx
.
getAccountInfoSync
().
miniProgram
let
loginCount
=
null
,
loginCache
=
null
,
loginTimer
=
null
...
...
api/request/http.js
View file @
6ad1666
...
...
@@ -5,7 +5,6 @@ import {
pathEnum
,
domain
,
}
from
'../env/index'
let
INTERRUPT
=
false
/**接口 */
class
Request
{
get
(
params
,
returnAll
=
false
)
{
...
...
@@ -14,16 +13,22 @@ class Request {
post
(
params
,
returnAll
=
false
)
{
return
this
.
request
(
'POST'
,
params
,
returnAll
)
}
fetch
(
method
,
data
,
returnAll
=
true
){
return
this
.
post
(
{
fetch
(
method
,
data
,
returnAll
=
true
)
{
return
this
.
post
({
method
,
...
data
,
},
returnAll
);
}
wx_request
({
url
,
method
=
'GET'
,
data
=
{},
header
=
{},
dataType
=
'json'
,
responseType
=
"text"
}){
wx_request
({
url
,
method
=
'GET'
,
data
=
{},
header
=
{},
dataType
=
'json'
,
responseType
=
"text"
})
{
return
new
Promise
((
resolve
)
=>
{
wx
.
request
({
url
,
...
...
@@ -46,7 +51,9 @@ class Request {
wx
.
showNavigationBarLoading
()
let
header
=
RequestMethods
===
'POST'
?
{
'content-type'
:
'application/x-www-form-urlencoded'
}
:
{
'Cache-Control'
:
'no-cache'
}
}
:
{
'Cache-Control'
:
'no-cache'
}
header
.
merchantId
=
defaultMerchantId
let
projectName
=
this
.
getRopProject
(
params
.
method
)
if
(
!
projectName
)
projectName
=
this
.
getRopProject
(
params
.
method
)
...
...
@@ -74,21 +81,9 @@ class Request {
}
if
(
code
==
20
||
code
==
21
)
{
wx
.
hideLoading
()
const
thisPage
=
wx
.
p
.
router
.
getPageInstance
()
if
(
thisPage
&&
thisPage
.
pageRefresh
)
thisPage
.
pageRefresh
()
if
(
!
wx
.
p
.
authStatus
)
{
if
(
INTERRUPT
)
return
INTERRUPT
=
true
wx
.
showLoading
()
getApp
().
login
().
then
(()
=>
{
if
(
thisPage
.
init
&&
thisPage
.
data
.
userInfo
)
thisPage
.
init
()
if
(
thisPage
.
loginCallBack
&&
thisPage
.
data
.
userInfo
)
thisPage
.
loginCallBack
(
thisPage
.
data
.
userInfo
)
if
(
thisPage
.
onRoute
)
thisPage
.
onRoute
()
thisPage
.
onLoad
()
thisPage
.
onShow
()
INTERRUPT
=
false
})
}
return
wx
.
reLaunch
({
url
:
'/pages/loading/loading'
})
}
else
{
if
(
code
==
'0'
)
{
resolve
(
data
.
data
)
...
...
pages/loading/loading.js
View file @
6ad1666
...
...
@@ -29,6 +29,9 @@ Page({
wx
.
p
.
storage
.
set
(
'userInfo'
,
data
)
wx
.
p
.
storage
.
set
(
'sessionId'
,
data
.
sessionId
)
if
(
!
data
)
throw
message
}
else
{
wx
.
p
.
storage
.
rm
(
'userInfo'
)
wx
.
p
.
storage
.
rm
(
'sessionId'
)
}
console
.
log
(
data
,
'============='
)
//scenc获取页面参数并跳转
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment