Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
Y
ybf
Project
Project
Details
Activity
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xulili
ybf
Commits
66d292d7
Commit
66d292d7
authored
Jan 06, 2020
by
Z
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Z: Dot: HTTP request format is done. Now can use it.
parent
15815256
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
160 additions
and
2 deletions
+160
-2
package.json
ybf_wx/package.json
+1
-2
main.js
ybf_wx/src/api/test/main.js
+19
-0
request.js
ybf_wx/src/utils/request.js
+84
-0
index.vue
ybf_wx/src/views/sideNav/discount/index.vue
+29
-0
yarn.lock
ybf_wx/yarn.lock
+27
-0
No files found.
ybf_wx/package.json
View file @
66d292d7
...
...
@@ -7,8 +7,8 @@
"build"
:
"vue-cli-service build"
,
"lint"
:
"vue-cli-service lint"
},
"dependencies"
:
{
"axios"
:
"^0.19.0"
,
"core-js"
:
"^3.4.4"
,
"js-md5"
:
"^0.7.3"
,
"vant"
:
"^2.3.3"
,
...
...
@@ -16,7 +16,6 @@
"vue-router"
:
"^3.1.3"
,
"vuex"
:
"^3.1.2"
},
"devDependencies"
:
{
"@vue/cli-plugin-babel"
:
"^4.1.0"
,
"@vue/cli-plugin-eslint"
:
"^4.1.0"
,
...
...
ybf_wx/src/api/test/main.js
0 → 100644
View file @
66d292d7
import
request
from
'@/utils/request'
export
function
ApiTestGet
()
{
return
request
({
url
:
'/admin/common/findLoginType'
,
method
:
'get'
})
}
export
function
ApiTestPost
(
inData
)
{
let
postData
=
{
appCode
:
"0611"
,
args
:
inData
}
return
request
({
url
:
'/admin/common/findLoginType'
,
method
:
'post'
,
data
:
postData
})
}
\ No newline at end of file
ybf_wx/src/utils/request.js
0 → 100644
View file @
66d292d7
import
axios
from
'axios'
import
md5
from
"js-md5"
let
BASE_API
=
"https://gd.chfatech.com/guangdian"
const
log
=
console
.
log
.
bind
(
console
)
// URL 编码与拼接
const
createSign
=
(
inPostData
,
inAppSecret
)
=>
{
let
appUser
=
inPostData
.
appUser
let
appCode
=
inPostData
.
appCode
let
ts
=
inPostData
.
ts
let
args
=
JSON
.
parse
(
JSON
.
stringify
(
inPostData
.
args
));
let
appSecret
=
inAppSecret
let
res
=
""
;
// URL 编码
for
(
let
key
in
args
)
{
res
+=
encodeURIComponent
(
key
)
+
"%3d"
+
encodeURIComponent
(
args
[
key
]).
toLowerCase
()
+
"%26"
;
}
res
=
res
.
slice
(
0
,
-
3
);
// URL 拼接
res
+=
`&appUser=
${
appUser
}
&appCode=
${
appCode
}
&
${
ts
}
${
appSecret
}
`
return
res
;
};
// Basic Info
let
basicInfo
=
{
appUser
:
"user001"
,
ver
:
"v1.0"
,
appSecret
:
"JeC0mmE2ZjZmOfdmTGImYzU5Yjg1AYU2M3F="
}
// 创建 axios 实例
const
service
=
axios
.
create
({
baseURL
:
BASE_API
,
timeout
:
20000
})
// request 拦截器
service
.
interceptors
.
request
.
use
(
res
=>
{
log
(
'--->axios: res.data:'
,
res
.
data
)
let
oldPostData
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
))
let
newPostData
=
{
appUser
:
basicInfo
.
appUser
,
appCode
:
oldPostData
.
appCode
,
ts
:
String
(
Date
.
parse
(
new
Date
())),
ver
:
basicInfo
.
ver
,
args
:
oldPostData
.
args
}
let
postData
=
{
appUser
:
newPostData
.
appUser
,
appCode
:
newPostData
.
appCode
,
ts
:
newPostData
.
ts
,
sign
:
md5
(
createSign
(
newPostData
,
basicInfo
.
appSecret
)),
ver
:
newPostData
.
ver
,
args
:
newPostData
.
args
}
res
.
data
=
postData
return
res
},
error
=>
{
Promise
.
reject
(
error
)
}
)
// response 拦截器
service
.
interceptors
.
response
.
use
(
response
=>
{
const
res
=
response
.
data
return
res
},
error
=>
{
return
Promise
.
reject
(
error
)
}
)
export
default
service
\ No newline at end of file
ybf_wx/src/views/sideNav/discount/index.vue
View file @
66d292d7
...
...
@@ -33,6 +33,9 @@
</
template
>
<
script
>
import
{
ApiTestGet
,
ApiTestPost
}
from
"@/api/test/main"
;
const
log
=
console
.
log
.
bind
(
console
);
export
default
{
name
:
"discountIndex"
,
data
()
{
...
...
@@ -74,7 +77,33 @@ export default {
dis
:
{}
};
},
created
()
{
// this.testApiGet();
this
.
testApiPost
();
},
methods
:
{
testApiGet
()
{
log
(
"--->testApi: Start:"
);
ApiTestGet
().
then
(
res
=>
{
log
(
"--->Api: Get: res ="
,
res
);
});
log
(
"--->testApi: End."
);
},
testApiPost
()
{
log
(
"--->testApi: Start:"
);
let
postData
=
{
brief
:
"停车券兑换"
,
orderNo
:
"12345678"
,
point
:
"123.321"
,
procType
:
46
,
updateType
:
"dec"
,
vipId
:
1
};
ApiTestPost
(
postData
).
then
(
res
=>
{
log
(
"--->Api: Post: res ="
,
res
);
});
log
(
"--->testApi: End."
);
},
testButtonClick
()
{},
buttonSingleMarketingClick
()
{
...
...
ybf_wx/yarn.lock
View file @
66d292d7
...
...
@@ -1503,6 +1503,14 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.0.tgz#24390e6ad61386b0a747265754d2a17219de862c"
integrity sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A==
axios@^0.19.0:
version "0.19.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.0.tgz#8e09bff3d9122e133f7b8101c8fbdd00ed3d2ab8"
integrity sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==
dependencies:
follow-redirects "1.5.10"
is-buffer "^2.0.2"
babel-eslint@^10.0.3:
version "10.0.3"
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.3.tgz#81a2c669be0f205e19462fed2482d33e4687a88a"
...
...
@@ -2671,6 +2679,13 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
dependencies:
ms "2.0.0"
debug@=3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
dependencies:
ms "2.0.0"
debug@^3.0.0, debug@^3.1.1, debug@^3.2.5:
version "3.2.6"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
...
...
@@ -3565,6 +3580,13 @@ flush-write-stream@^1.0.0:
inherits "^2.0.3"
readable-stream "^2.3.6"
follow-redirects@1.5.10:
version "1.5.10"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a"
integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==
dependencies:
debug "=3.1.0"
follow-redirects@^1.0.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.9.0.tgz#8d5bcdc65b7108fe1508649c79c12d732dcedb4f"
...
...
@@ -4382,6 +4404,11 @@ is-buffer@^1.1.5:
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==
is-buffer@^2.0.2:
version "2.0.4"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.4.tgz#3e572f23c8411a5cfd9557c849e3665e0b290623"
integrity sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==
is-callable@^1.1.4, is-callable@^1.1.5:
version "1.1.5"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.5.tgz#f7e46b596890456db74e7f6e976cb3273d06faab"
...
...
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