Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
junlebao-milk-20240619
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
junlebao-milk-20240619
Commits
357c5e93
Commit
357c5e93
authored
Jun 24, 2024
by
haiyoucuv
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
3657f94c
e9030072
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
config.ts
miniprogram/utils/config.ts
+26
-0
request.ts
miniprogram/utils/request.ts
+30
-0
No files found.
miniprogram/utils/config.ts
0 → 100644
View file @
357c5e93
// 【开发环境】
export
const
devOptions
=
{
BASE_URL
:
'https://activity.m.duibadev.com.cn/'
,
appKey
:
'jlg88lyxz7siqtmr'
,
}
// 【测试环境】
export
const
testOptions
=
{
BASE_URL
:
'https://activity.m.duibatest.com.cn/'
,
appKey
:
'3tWCs93A2ZfuvMyJkWxC7xddg6qA'
,
}
// 【预发环境】
export
const
prevOptions
=
{
BASE_URL
:
'https://activity-pre.m.duiba.com.cn/'
,
// 免登接口有预发的环境
appKey
:
'388ENcX8CGJBEdn2hyZA5zDkqpR6'
,
}
// 【线上环境】
export
const
publishOptions
=
{
BASE_URL
:
'https://activity.m.duiba.com.cn/'
,
appKey
:
'388ENcX8CGJBEdn2hyZA5zDkqpR6'
,
}
export
default
publishOptions
\ No newline at end of file
miniprogram/utils/request.ts
0 → 100644
View file @
357c5e93
import
env
from
'./config'
;
const
headersConfig
=
{
'Content-Type'
:
'application/x-www-form-urlencoded; charset=UTF-8'
,
}
export
let
request
=
(
config
:
any
)
=>
new
Promise
((
resolve
,
reject
)
=>
{
const
method
=
config
.
method
.
toUpperCase
()
||
'GET'
;
const
{
BASE_URL
}
=
env
;
wx
.
request
({
method
,
url
:
config
.
url
?
`
${
BASE_URL
}${
config
.
url
}
`
:
''
,
data
:
config
.
data
,
header
:
{
...
headersConfig
,
...
config
.
headers
},
success
(
response
)
{
if
(
+
response
.
statusCode
===
200
)
{
resolve
(
response
.
data
);
}
else
{
reject
(
new
Error
(
`请求失败 statusCode:
${
response
.
statusCode
}
`
));
}
},
fail
(
error
)
{
reject
(
new
Error
(
error
.
errMsg
));
},
})
})
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment