Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
deb17f7b
Commit
deb17f7b
authored
Sep 18, 2019
by
程默
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix request
parent
c778fc2b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
18 deletions
+28
-18
src/api/shop.js
+0
-1
src/pages/index/index.vue
+2
-3
src/pages/login/index.vue
+1
-1
src/utils/request.js
+25
-13
No files found.
src/api/shop.js
View file @
deb17f7b
...
...
@@ -2,7 +2,6 @@ import {requestPOST,requestGET} from "@/utils/request.js";
export
default
{
//登录
getShopInfo
(){
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shop/get_shop_info`
)
}
...
...
src/pages/index/index.vue
View file @
deb17f7b
<
template
>
<div
@
click=
"clickHandle"
>
加载中。。。
<web-view
:src=
"link+page+params"
@
message=
"getMessage"
></web-view>
<!--
<div
class=
"userinfo"
@
click=
"bindViewTap"
>
<img
class=
"userinfo-avatar"
v-if=
"userInfo.avatarUrl"
:src=
"userInfo.avatarUrl"
background-size=
"cover"
/>
...
...
@@ -40,8 +39,8 @@ export default {
return
{
options
:
{},
session_key
:
""
,
link
:
"http://test-m-shop.mayi888.cn"
,
//
link: "http://localhost:3000",
//
link: "http://test-m-shop.mayi888.cn",
link
:
"http://localhost:3000"
,
page
:
"/"
,
params
:
"?mixid=dev001"
,
motto
:
"Hello miniprograme"
,
...
...
src/pages/login/index.vue
View file @
deb17f7b
...
...
@@ -139,7 +139,7 @@ export default {
e
.
mp
.
detail
.
encryptedData
,
e
.
mp
.
detail
.
iv
);
this
.
unionId
=
data
.
unionId
|
""
;
this
.
unionId
=
data
.
unionId
|
|
""
;
this
.
userInfo
=
JSON
.
parse
(
e
.
target
.
rawData
);
console
.
log
(
"data"
,
data
,
this
.
unionId
);
}
...
...
src/utils/request.js
View file @
deb17f7b
let
shopMixid
=
"dev001"
;
let
sessionid
=
"eedbbdaf-844c-4fcc-8970-1fb92346441c"
;
console
.
log
(
'----------------------------'
,
process
.
env
.
sessionid
)
export
function
requestGET
(
url
,
options
)
{
let
shopMixid
=
"dev001"
;
let
sessionid
=
"eedbbdaf-844c-4fcc-8970-1fb92346441c"
;
console
.
log
(
'----------------------------'
,
process
.
env
.
sessionid
);
// wx.getStore
export
async
function
requestGET
(
url
,
options
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
request
({
url
:
url
,
...
...
@@ -9,7 +12,6 @@ export function requestGET(url, options) {
method
:
"GET"
,
header
:
{
"Shop-Mixid"
:
shopMixid
,
Authorization
:
sessionid
},
success
:
function
(
res
)
{
resolve
(
res
)
...
...
@@ -21,7 +23,7 @@ export function requestGET(url, options) {
})
}
export
function
requestPOST
(
url
,
options
)
{
export
async
function
requestPOST
(
url
,
options
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
request
({
url
:
url
,
...
...
@@ -29,7 +31,6 @@ export function requestPOST(url, options) {
method
:
"POST"
,
header
:
{
"Shop-Mixid"
:
shopMixid
,
Authorization
:
sessionid
},
success
:
function
(
res
)
{
resolve
(
res
)
...
...
@@ -41,17 +42,14 @@ export function requestPOST(url, options) {
})
}
export
async
function
requestPOST1
(
url
,
options
)
{
export
function
requestPOST1
(
url
,
options
)
{
let
header
=
getHeader
();
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
request
({
url
:
url
,
data
:
options
,
method
:
"POST"
,
header
:
{
"Content-Type"
:
"application/x-www-form-urlencoded"
,
"Shop-Mixid"
:
shopMixid
,
Authorization
:
sessionid
},
header
:
header
,
success
:
function
(
res
)
{
resolve
(
res
)
},
...
...
@@ -60,4 +58,17 @@ export async function requestPOST1(url, options) {
}
})
})
}
function
getHeader
()
{
let
sessionid
=
wx
.
getStorageSync
(
'sessionid'
);
let
header
=
{
"Content-Type"
:
"application/x-www-form-urlencoded"
,
"Shop-Mixid"
:
shopMixid
,
Authorization
:
sessionid
};
// if (!sessionid) {
// delete header.Authorization
// }
return
header
}
\ 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