Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uni-app-ddh-shop
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
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
zhanhai
uni-app-ddh-shop
Commits
26b95d10
Commit
26b95d10
authored
Aug 07, 2024
by
ly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
线上环境
parent
471a1ff8
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
172 additions
and
12 deletions
+172
-12
request_20240807163740.js
.history/utils/request_20240807163740.js
+80
-0
request_20240807165234.js
.history/utils/request_20240807165234.js
+80
-0
index.vue
pages/index/index.vue
+7
-7
app-service.js
unpackage/dist/dev/app-plus/app-service.js
+2
-2
request.js
utils/request.js
+3
-3
No files found.
.history/utils/request_20240807163740.js
0 → 100644
View file @
26b95d10
import
{
initHeaderDevice
}
from
'./header.js'
const
request
=
async
(
url
,
type
,
data
)
=>
{
const
baseUrl
=
'http://112.124.25.186:8089'
//测试
// const baseUrl='https://api.taimedias.com'//线上
// 这里确保一定是可以获取得到的
const
headerDevice
=
uni
.
getStorageSync
(
'm-header-device'
)
let
rd
=
null
;
if
(
headerDevice
)
{
rd
=
headerDevice
}
else
{
const
common
=
initHeaderDevice
()
rd
=
JSON
.
stringify
(
common
)
}
// console.log(rd,'rd')
return
new
Promise
((
resolve
,
reject
)
=>
{
const
token
=
uni
.
getStorageSync
(
'token'
)
uni
.
request
({
url
:
baseUrl
+
url
,
method
:
type
,
data
:
{
...
data
},
header
:
{
Accept
:
"application/json;charset=UTF-8"
,
"Content-Type"
:
"application/json;charset=UTF-8"
,
device
:
rd
,
Authorization
:
token
,
Author
:
token
,
},
success
:
(
res
)
=>
{
const
{
data
,
statusCode
}
=
res
;
if
(
statusCode
===
200
)
{
if
(
data
.
success
==
true
)
{
return
resolve
(
data
)
}
else
{
if
(
data
.
code
==
'403'
){
console
.
log
(
res
,
'402'
);
uni
.
showToast
({
title
:
data
.
message
,
icon
:
"none"
,
duration
:
2000
})
uni
.
removeStorageSync
(
'token'
)
// this.Go('uni:/pages/login/login')
}
else
{
uni
.
showToast
({
title
:
data
.
message
,
icon
:
"none"
,
duration
:
2000
})
return
false
}
}
}
else
{
console
.
log
(
res
.
errMsg
,
'!200'
);
return
reject
({
data
,
message
:
res
.
errMsg
})
}
},
fail
:(
err
)
=>
{
console
.
log
(
err
,
954
)
return
uni
.
showToast
({
icon
:
'loading'
,
title
:
'请求失败'
})
reject
(
err
)
}
});
})
}
export
default
request
;
\ No newline at end of file
.history/utils/request_20240807165234.js
0 → 100644
View file @
26b95d10
import
{
initHeaderDevice
}
from
'./header.js'
const
request
=
async
(
url
,
type
,
data
)
=>
{
// const baseUrl='http://112.124.25.186:8089' //测试
const
baseUrl
=
'http://api.yyhock.com'
//线上
// 这里确保一定是可以获取得到的
const
headerDevice
=
uni
.
getStorageSync
(
'm-header-device'
)
let
rd
=
null
;
if
(
headerDevice
)
{
rd
=
headerDevice
}
else
{
const
common
=
initHeaderDevice
()
rd
=
JSON
.
stringify
(
common
)
}
// console.log(rd,'rd')
return
new
Promise
((
resolve
,
reject
)
=>
{
const
token
=
uni
.
getStorageSync
(
'token'
)
uni
.
request
({
url
:
baseUrl
+
url
,
method
:
type
,
data
:
{
...
data
},
header
:
{
Accept
:
"application/json;charset=UTF-8"
,
"Content-Type"
:
"application/json;charset=UTF-8"
,
device
:
rd
,
Authorization
:
token
,
Author
:
token
,
},
success
:
(
res
)
=>
{
const
{
data
,
statusCode
}
=
res
;
if
(
statusCode
===
200
)
{
if
(
data
.
success
==
true
)
{
return
resolve
(
data
)
}
else
{
if
(
data
.
code
==
'403'
){
console
.
log
(
res
,
'402'
);
uni
.
showToast
({
title
:
data
.
message
,
icon
:
"none"
,
duration
:
2000
})
uni
.
removeStorageSync
(
'token'
)
// this.Go('uni:/pages/login/login')
}
else
{
uni
.
showToast
({
title
:
data
.
message
,
icon
:
"none"
,
duration
:
2000
})
return
false
}
}
}
else
{
console
.
log
(
res
.
errMsg
,
'!200'
);
return
reject
({
data
,
message
:
res
.
errMsg
})
}
},
fail
:(
err
)
=>
{
console
.
log
(
err
,
954
)
return
uni
.
showToast
({
icon
:
'loading'
,
title
:
'请求失败'
})
reject
(
err
)
}
});
})
}
export
default
request
;
\ No newline at end of file
pages/index/index.vue
View file @
26b95d10
...
...
@@ -99,9 +99,9 @@
},
onPageScroll
(
e
)
{
// 页面滚动时设置isFixed和scrollTop
// console.log(e
,'876')
console
.
log
(
e
.
scrollTop
,
'876'
)
this
.
scrollTop
=
e
.
scrollTop
;
if
(
e
.
scrollTop
>
this
.
headerHeight
){
if
(
e
.
scrollTop
>
220
){
this
.
isFixed
=
true
;
}
else
{
this
.
isFixed
=
false
;
...
...
@@ -117,11 +117,11 @@
const
token
=
uni
.
getStorageSync
(
'token'
)
this
.
token
=
token
// 获取头部的高度
const
query
=
uni
.
createSelectorQuery
().
in
(
this
);
query
.
select
(
'.i-header'
).
boundingClientRect
(
data
=>
{
console
.
log
(
data
.
height
,
'98767'
)
this
.
headerHeight
=
data
.
height
;
}).
exec
();
//
const query = uni.createSelectorQuery().in(this);
//
query.select('.i-header').boundingClientRect(data => {
//
console.log(data.height,'98767')
//
this.headerHeight = data.height;
//
}).exec();
this
.
init
()
this
.
searchGood
()
},
...
...
unpackage/dist/dev/app-plus/app-service.js
View file @
26b95d10
This diff is collapsed.
Click to expand it.
utils/request.js
View file @
26b95d10
import
{
initHeaderDevice
}
from
'./header.js'
const
request
=
async
(
url
,
type
,
data
)
=>
{
const
baseUrl
=
'http://112.124.25.186:8089'
//测试
// const baseUrl='https://api.taimedias
.com'//线上
//
const baseUrl='http://112.124.25.186:8089' //测试
const
baseUrl
=
'https://api.yyhock
.com'
//线上
// 这里确保一定是可以获取得到的
const
headerDevice
=
uni
.
getStorageSync
(
'm-header-device'
)
let
rd
=
null
;
...
...
@@ -12,7 +12,7 @@ const request=async(url,type,data)=>{
rd
=
JSON
.
stringify
(
common
)
}
// console.log(rd
,'rd')
console
.
log
(
baseUrl
,
'rd'
)
return
new
Promise
((
resolve
,
reject
)
=>
{
const
token
=
uni
.
getStorageSync
(
'token'
)
uni
.
request
({
...
...
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