Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
U
uni-pdtravel
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
panyongping
uni-pdtravel
Commits
08764e75
Commit
08764e75
authored
Feb 04, 2024
by
潘永坪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
组合票首页应急预案处理
parent
2963e95a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
11 deletions
+77
-11
request.js
common/request.js
+38
-8
distributionCombiChoose.vue
...ation/distributionCombiChoose/distributionCombiChoose.vue
+39
-3
No files found.
common/request.js
View file @
08764e75
...
...
@@ -20,14 +20,44 @@ const request = (url = '', data = {},showLoad) => {
url
:
baseUrl
+
url
+
'?token='
+
uni
.
getStorageSync
(
'token'
),
data
:
data
,
dataType
:
'json'
,
}).
then
((
response
)
=>
{
uni
.
hideLoading
()
let
[
error
,
res
]
=
response
resolve
(
res
.
data
)
}).
catch
(
error
=>
{
uni
.
hideLoading
()
let
[
err
,
res
]
=
error
reject
(
err
)
success
(
res
)
{
uni
.
hideLoading
()
if
(
res
.
statusCode
==
'200'
){
//请求成功,状态成功
resolve
(
res
.
data
)
}
else
{
//请求成功,状态不对
reject
(
res
)
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
,
duration
:
4000
})
}
},
fail
(
err
)
{
//请求超时,没有网络等
uni
.
hideLoading
()
uni
.
getNetworkType
({
//首次判断网络状态
success
:
(
res
)
=>
{
let
networkType
=
res
.
networkType
if
(
networkType
===
'none'
)
{
//none是没有网络
uni
.
showToast
({
title
:
'网络断开'
,
icon
:
'none'
,
duration
:
4000
})
}
else
{
uni
.
showToast
({
title
:
'请求超时'
,
icon
:
'none'
,
duration
:
4000
})
reject
(
err
)
}
}
})
}
})
})
}
...
...
pages/combination/distributionCombiChoose/distributionCombiChoose.vue
View file @
08764e75
...
...
@@ -175,6 +175,12 @@
</u-modal>
</scroll-view>
<image
class=
"suodaoImg"
v-if=
"showSuodaoImg"
src=
"https://lx.pangdly.com/img/cjsdFirst.50a2e63.jpg"
></image>
<!-- 系统无法访问时弹窗 -->
<u-popup
:show=
"showTip"
:round=
"20"
>
<view
style=
"padding: 300rpx 0;text-align: center;font-size: 32rpx;font-weight: bold;"
>
当前访问人数过多,请稍后重试
</view>
</u-popup>
</view>
</template>
...
...
@@ -194,6 +200,7 @@ export default {
},
data
()
{
return
{
showTip
:
false
,
//系统调不通或者崩了跳出弹窗
detailData
:
''
,
//详情数据
showSuodaoImg
:
false
,
//索道耳麦图片是否显示隐藏
companyId
:
''
,
//公司Id
...
...
@@ -332,6 +339,7 @@ export default {
//解决支付宝小程序报错问题
this
.
$refs
.
detail
.
showPop
=
false
}
let
newTimestamp
=
uni
.
getStorageSync
(
'newTimestamp'
)
||
''
let
token
=
uni
.
getStorageSync
(
'token'
)
if
(
token
)
{
uni
.
getLocation
({
...
...
@@ -340,12 +348,30 @@ export default {
let
latitude
=
res
.
latitude
//纬度
let
longitude
=
res
.
longitude
//经度
this
.
showDistance
=
true
this
.
initList
(
latitude
,
longitude
)
//判断时间戳,之前请求失败,必须大于缓存时间戳才进行请求
if
(
newTimestamp
){
if
(
Date
.
now
()
>
newTimestamp
){
this
.
initList
(
latitude
,
longitude
)
}
else
{
this
.
showTip
=
true
}
}
else
{
this
.
initList
(
latitude
,
longitude
)
}
},
fail
:
res
=>
{
let
latitude
=
''
let
longitude
=
''
this
.
initList
(
latitude
,
longitude
)
//判断时间戳,之前请求失败,必须大于缓存时间戳才进行请求
if
(
newTimestamp
){
if
(
Date
.
now
()
>
newTimestamp
){
this
.
initList
(
latitude
,
longitude
)
}
else
{
this
.
showTip
=
true
}
}
else
{
this
.
initList
(
latitude
,
longitude
)
}
}
})
}
...
...
@@ -364,6 +390,7 @@ export default {
}
this
.
scenicList
=
[]
this
.
$request
(
'/scenic/groupGood/findGroupGoodProductList'
,
data
).
then
(
res
=>
{
uni
.
removeStorageSync
(
'newTimestamp'
)
if
(
res
.
code
==
'00'
)
{
let
merchantList
=
res
.
data
.
merchantList
||
[]
merchantList
.
forEach
(
item
=>
{
...
...
@@ -413,7 +440,16 @@ export default {
icon
:
'none'
})
}
})
}).
catch
(
error
=>
{
this
.
showTip
=
true
// 获取当前时间戳
let
currentTime
=
Date
.
now
()
// 设置需要添加的分钟数
let
minutesToAdd
=
5
// 这里假设要添加5分钟
// 计算新的时间戳
let
newTimestamp
=
currentTime
+
(
minutesToAdd
*
60
*
1000
)
uni
.
setStorageSync
(
'newTimestamp'
,
newTimestamp
)
})
},
//---初始化详情
initDetail
(
merchantId
){
...
...
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