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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
24 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'
import
http
from
'../request/http'
// const { appId } = wx.getAccountInfoSync().miniProgram
const
{
appId
}
=
wx
.
getAccountInfoSync
().
miniProgram
import
{
appId
}
from
'~/utils/constants'
let
loginCount
=
null
,
let
loginCount
=
null
,
loginCache
=
null
,
loginCache
=
null
,
loginTimer
=
null
loginTimer
=
null
...
...
api/request/http.js
View file @
6ad1666
...
@@ -5,7 +5,6 @@ import {
...
@@ -5,7 +5,6 @@ import {
pathEnum
,
pathEnum
,
domain
,
domain
,
}
from
'../env/index'
}
from
'../env/index'
let
INTERRUPT
=
false
/**接口 */
/**接口 */
class
Request
{
class
Request
{
get
(
params
,
returnAll
=
false
)
{
get
(
params
,
returnAll
=
false
)
{
...
@@ -14,16 +13,22 @@ class Request {
...
@@ -14,16 +13,22 @@ class Request {
post
(
params
,
returnAll
=
false
)
{
post
(
params
,
returnAll
=
false
)
{
return
this
.
request
(
'POST'
,
params
,
returnAll
)
return
this
.
request
(
'POST'
,
params
,
returnAll
)
}
}
fetch
(
method
,
data
,
returnAll
=
true
){
fetch
(
method
,
data
,
returnAll
=
true
)
{
return
this
.
post
(
return
this
.
post
({
{
method
,
method
,
...
data
,
...
data
,
},
},
returnAll
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
)
=>
{
return
new
Promise
((
resolve
)
=>
{
wx
.
request
({
wx
.
request
({
url
,
url
,
...
@@ -46,7 +51,9 @@ class Request {
...
@@ -46,7 +51,9 @@ class Request {
wx
.
showNavigationBarLoading
()
wx
.
showNavigationBarLoading
()
let
header
=
RequestMethods
===
'POST'
?
{
let
header
=
RequestMethods
===
'POST'
?
{
'content-type'
:
'application/x-www-form-urlencoded'
'content-type'
:
'application/x-www-form-urlencoded'
}
:
{
'Cache-Control'
:
'no-cache'
}
}
:
{
'Cache-Control'
:
'no-cache'
}
header
.
merchantId
=
defaultMerchantId
header
.
merchantId
=
defaultMerchantId
let
projectName
=
this
.
getRopProject
(
params
.
method
)
let
projectName
=
this
.
getRopProject
(
params
.
method
)
if
(
!
projectName
)
projectName
=
this
.
getRopProject
(
params
.
method
)
if
(
!
projectName
)
projectName
=
this
.
getRopProject
(
params
.
method
)
...
@@ -74,21 +81,9 @@ class Request {
...
@@ -74,21 +81,9 @@ class Request {
}
}
if
(
code
==
20
||
code
==
21
)
{
if
(
code
==
20
||
code
==
21
)
{
wx
.
hideLoading
()
wx
.
hideLoading
()
const
thisPage
=
wx
.
p
.
router
.
getPageInstance
()
return
wx
.
reLaunch
({
if
(
thisPage
&&
thisPage
.
pageRefresh
)
thisPage
.
pageRefresh
()
url
:
'/pages/loading/loading'
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
})
})
}
}
else
{
}
else
{
if
(
code
==
'0'
)
{
if
(
code
==
'0'
)
{
resolve
(
data
.
data
)
resolve
(
data
.
data
)
...
...
pages/loading/loading.js
View file @
6ad1666
...
@@ -29,6 +29,9 @@ Page({
...
@@ -29,6 +29,9 @@ Page({
wx
.
p
.
storage
.
set
(
'userInfo'
,
data
)
wx
.
p
.
storage
.
set
(
'userInfo'
,
data
)
wx
.
p
.
storage
.
set
(
'sessionId'
,
data
.
sessionId
)
wx
.
p
.
storage
.
set
(
'sessionId'
,
data
.
sessionId
)
if
(
!
data
)
throw
message
if
(
!
data
)
throw
message
}
else
{
wx
.
p
.
storage
.
rm
(
'userInfo'
)
wx
.
p
.
storage
.
rm
(
'sessionId'
)
}
}
console
.
log
(
data
,
'============='
)
console
.
log
(
data
,
'============='
)
//scenc获取页面参数并跳转
//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