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
18e45ab1
Commit
18e45ab1
authored
Dec 02, 2024
by
caimeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
安卓被拒了,隐私协议弹框还是要用uniapp的,不能自定义
parent
6695aa53
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
98 additions
and
257 deletions
+98
-257
App.vue
App.vue
+3
-6
androidPrivacy.json
androidPrivacy.json
+1
-1
upgradePopup.vue
components/showModal/upgradePopup.vue
+19
-2
manifest.json
manifest.json
+2
-2
index.vue
pages/agreement/index.vue
+9
-8
index.vue
pages/index/index.vue
+8
-4
login.vue
pages/login/login.vue
+1
-3
index.vue
pages/my/index.vue
+21
-7
index.vue
pages/starPage/index.vue
+1
-1
index.vue
pages/web/index.vue
+0
-183
tools.js
pages/web/tools.js
+21
-32
web.vue
pages/web/web.vue
+2
-2
header.js
utils/header.js
+3
-2
request.js
utils/request.js
+7
-4
No files found.
App.vue
View file @
18e45ab1
...
...
@@ -41,9 +41,7 @@ export default {
}
})
}
// 强制竖屏
plus
.
screen
.
lockOrientation
(
"portrait-primary"
)
...
...
@@ -55,13 +53,12 @@ export default {
}
else
{
versionNumber
=
plus
.
runtime
.
version
;
}
console
.
log
(
versionNumber
,
'当前版本号'
)
// 存储所有请求的头部信息
uni
.
setStorage
({
key
:
'm-header-version'
,
data
:
versionNumber
});
})
if
(
uni
.
getStorageSync
(
'm-agreement'
))
{
const
platform
=
uni
.
getSystemInfoSync
()
if
(
uni
.
getStorageSync
(
'm-agreement'
)
&&
platform
.
osName
===
'ios'
)
{
loadNetwork
()
loadDevice
()
loadLocation
()
...
...
androidPrivacy.json
View file @
18e45ab1
{
"version"
:
"1"
,
"prompt"
:
"
non
e"
,
"prompt"
:
"
templat
e"
,
"title"
:
"服务协议和隐私政策"
,
"message"
:
" 请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/> 你可阅读<a href=
\"
https://ddh.yyhock.com/appStatic/protocol/dd-user.html
\"
>《服务协议》</a>和<a href=
\"
https://ddh.yyhock.com/appStatic/protocol/dd-private.html
\"
>《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。"
,
"buttonAccept"
:
"同意并接受"
,
...
...
components/showModal/upgradePopup.vue
View file @
18e45ab1
...
...
@@ -104,13 +104,28 @@ export default {
this
.
$emit
(
'pause'
)
},
10
)
},
// 清空一些数据
delStorageSync
()
{
// 清空一些数据
uni
.
removeStorageSync
(
'm-header-version'
)
uni
.
removeStorageSync
(
'm-agreement'
)
uni
.
removeStorageSync
(
'appStart'
)
uni
.
removeStorageSync
(
'm-header-device'
)
uni
.
removeStorageSync
(
'm-location-info'
)
uni
.
removeStorageSync
(
'm-network-info'
)
uni
.
removeStorageSync
(
'm-device-info'
)
},
// 立即升级事件
upgradeNow
()
{
this
.
removeStorageSync
();
const
that
=
this
that
.
noUpdatedDisabled
=
true
let
platform
=
uni
.
getSystemInfoSync
().
platform
const
wgtType
=
that
.
containsWGTExtension
(
that
.
appUpgeadeObj
.
downloadUrl
)
that
.
isWGT
=
wgtType
const
index
=
that
.
appUpgeadeObj
.
downloadUrl
.
indexOf
(
'apps.apple.com'
)
...
...
@@ -123,6 +138,8 @@ export default {
},
upgradeNowAndroid
()
{
this
.
removeStorageSync
();
let
that
=
this
that
.
noUpdatedDisabled
=
true
let
platform
=
uni
.
getSystemInfoSync
().
platform
...
...
manifest.json
View file @
18e45ab1
...
...
@@ -73,7 +73,7 @@
"NSLocationAlwaysUsageDescription"
:
"为保护您账户安全,便于为您提供所在区域专属产品和服务,请您开启定位权限"
,
"NSLocationAlwaysAndWhenInUseUsageDescription"
:
"为保护您账户安全,便于为您提供所在区域专属产品和服务,请您开启定位权限"
,
"NSPhotoLibraryUsageDescription"
:
"为了给您提供意见反馈服务,请允许访问您的相册信息"
,
"NSCameraUsageDescription"
:
"以便于您可以使用正常使用身份证认证、刷脸
、申请借款
等功能"
"NSCameraUsageDescription"
:
"以便于您可以使用正常使用身份证认证、刷脸等功能"
},
"idfa"
:
false
},
...
...
@@ -133,7 +133,7 @@
}
},
"splashscreen"
:
{
"useOriginalMsgbox"
:
fals
e
,
"useOriginalMsgbox"
:
tru
e
,
"androidStyle"
:
"default"
,
"iosStyle"
:
"storyboard"
,
"ios"
:
{
...
...
pages/agreement/index.vue
View file @
18e45ab1
...
...
@@ -55,9 +55,9 @@ export default {
// 拒绝授权
handleReject
()
{
plus
.
runtime
.
disagreePrivacy
();
if
(
uni
.
getSystemInfoSync
().
platform
===
'ios'
)
{
if
(
uni
.
getSystemInfoSync
().
osName
===
'ios'
)
{
plus
.
ios
.
import
(
"UIApplication"
).
sharedApplication
().
performSelector
(
"exit"
)
}
else
if
(
uni
.
getSystemInfoSync
().
platform
===
'android'
)
{
}
else
if
(
uni
.
getSystemInfoSync
().
osName
===
'android'
)
{
plus
.
runtime
.
quit
();
}
},
...
...
@@ -67,12 +67,13 @@ export default {
key
:
"m-agreement"
,
data
:
'true'
,
success
:
function
()
{
loadNetwork
()
loadDevice
()
loadLocation
()
loadUuid
()
const
platform
=
uni
.
getSystemInfoSync
()
if
(
platform
.
osName
===
'ios'
)
{
loadNetwork
()
loadDevice
()
loadLocation
()
loadUuid
()
}
uni
.
navigateBack
({
delta
:
1
})
...
...
pages/index/index.vue
View file @
18e45ab1
...
...
@@ -107,7 +107,6 @@ import { isLogin, switchShowTabbar } from '@/utils/index'
const
cacheIndexData
=
uni
.
getStorageSync
(
'dataIndex'
)
?
JSON
.
parse
(
uni
.
getStorageSync
(
'dataIndex'
))
:
null
;
const
indexGoods
=
uni
.
getStorageSync
(
'indexGoods'
)
?
JSON
.
parse
(
uni
.
getStorageSync
(
'indexGoods'
))
:
[];
console
.
log
(
cacheIndexData
,
'日'
)
export
default
{
data
()
{
...
...
@@ -218,7 +217,7 @@ export default {
uni
.
getSystemInfo
({
success
:
()
=>
{
const
query
=
uni
.
createSelectorQuery
().
in
(
this
);
query
.
select
(
"#box"
).
boundingClientRect
((
data
)
=>
{
query
.
select
(
"#box"
).
boundingClientRect
((
data
)
=>
{
_this
.
Topdistance
=
data
&&
data
.
top
}).
exec
();
...
...
@@ -242,10 +241,15 @@ export default {
if
(
!
isLogin
())
{
this
.
JumpToLogin
()
}
else
{
if
(
item
.
tager
==
'uni:/subPackage/indexfinance/index,tab'
)
{
if
(
item
.
tager
==
'uni:/subPackage/indexfinance/index,tab'
||
item
.
tager
==
'uni:/pages/indexfinance/index,tab'
)
{
this
.
Go
(
'uni:/pages/web/web'
,
'tab'
)
}
else
{
this
.
Go
(
item
.
tager
)
let
linkUrl
=
item
.
tager
;
if
(
linkUrl
.
includes
(
'pages/'
))
{
linkUrl
=
linkUrl
.
replace
(
'pages/'
,
'subPackage/'
);
console
.
log
(
linkUrl
,
'日日'
)
}
this
.
Go
(
linkUrl
)
}
}
...
...
pages/login/login.vue
View file @
18e45ab1
...
...
@@ -76,9 +76,7 @@
// 预加载
initPreloadH5
()
{
try
{
const
{
h5Url
}
=
JSON
.
parse
(
uni
.
getStorageSync
(
'APP-SETTING'
));
const
{
h5Url
}
=
JSON
.
parse
(
uni
.
getStorageSync
(
'APP-SETTING'
));
// 预加载H5
plus
.
webview
.
prefetchURL
(
h5Url
);
...
...
pages/my/index.vue
View file @
18e45ab1
...
...
@@ -61,7 +61,6 @@
</view>
<view
class=
'footer-des'
>
周一至周日 09:00-18:00
</view>
<view
class=
'footer-time'
>
(12:00-13:00休息)
</view>
<view
class=
'footer-tips'
>
理性借贷 合理消费
</view>
</view>
</view>
...
...
@@ -84,19 +83,19 @@ export default {
onShow
()
{
const
token
=
uni
.
getStorageSync
(
'token'
)
const
loanSwitch
=
uni
.
getStorageSync
(
'loanSwitch'
)
this
.
isLogin
=
token
?
true
:
false
this
.
loanSwitch
=
loanSwitch
?
true
:
false
this
.
initMine
()
// 显示隐藏tabBar
switchShowTabbar
()
this
.
initMine
()
// 埋点
this
.
buryingPoint
(
'app:my_pageView'
)
},
// 页面下拉刷新
async
onPullDownRefresh
()
{
switchShowTabbar
()
await
this
.
initMine
()
setTimeout
(()
=>
{
uni
.
stopPullDownRefresh
();
...
...
@@ -139,8 +138,16 @@ export default {
default
:
break
;
}
console
.
log
(
item
.
linkUrl
,
'跳转地址'
)
this
.
Go
(
item
.
linkUrl
)
let
linkUrl
=
item
.
linkUrl
;
// 这里代码兼容
if
(
linkUrl
.
includes
(
'pages/'
))
{
linkUrl
=
linkUrl
.
replace
(
'pages/'
,
'subPackage/'
);
console
.
log
(
linkUrl
,
'日日'
)
}
this
.
Go
(
linkUrl
)
},
goBar
(
item
)
{
...
...
@@ -196,7 +203,14 @@ export default {
break
;
}
if
(
item
.
linkUrl
)
this
.
Go
(
item
.
linkUrl
)
if
(
item
.
linkUrl
)
{
let
linkUrl
=
item
.
linkUrl
;
if
(
linkUrl
.
includes
(
'pages/'
))
{
linkUrl
=
linkUrl
.
replace
(
'pages/'
,
'subPackage/'
);
console
.
log
(
linkUrl
,
'日日'
)
}
this
.
Go
(
linkUrl
)
}
}
}
}
...
...
pages/starPage/index.vue
View file @
18e45ab1
...
...
@@ -49,7 +49,7 @@ export default {
methods
:
{
init
()
{
try
{
if
(
!
uni
.
getStorageSync
(
'm-agreement'
))
{
if
(
!
uni
.
getStorageSync
(
'm-agreement'
)
&&
uni
.
getSystemInfoSync
().
platform
===
'ios'
)
{
this
.
Go
(
'uni:/pages/agreement/index'
)
}
}
catch
(
err
)
{
...
...
pages/web/index.vue
deleted
100644 → 0
View file @
6695aa53
<
template
>
<view>
<web-view
:src=
"url"
@
message=
"handleMessage"
></web-view>
</view>
</
template
>
<
script
>
import
{
hideTabBar
,
showTabBar
,
loadLocation
,
Face_UP
,
Camera_UP
,
}
from
'./utils'
import
{
CheckContactPermission
,
SelectContact
}
from
'./authPermission'
import
storage
from
'@/utils/storage'
export
default
{
data
()
{
return
{
wv
:
null
,
url
:
null
,
canBack
:
false
,
}
},
async
onShow
()
{
if
(
!
this
.
$options
.
filters
.
isLogin
(
'auth'
))
{
this
.
$options
.
filters
.
navigateToLogin
()
}
if
(
this
.
wv
)
{
this
.
wv
.
evalJS
(
`callback({ 'action': 'OnShow' })`
)
this
.
wv
.
reload
()
}
},
onLoad
()
{
},
onBackPress
(
e
)
{
if
(
this
.
wv
&&
this
.
canBack
)
{
this
.
wv
.
back
()
return
true
}
return
false
},
onReady
()
{
const
_that
=
this
// #ifdef APP-PLUS
let
statusBarHeight
=
parseInt
(
uni
.
getSystemInfoSync
().
statusBarHeight
)
let
currentWebview
=
_that
.
$scope
.
$getAppWebview
()
//此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
setTimeout
(()
=>
{
this
.
wv
=
currentWebview
.
children
()[
0
]
this
.
wv
.
setStyle
({
top
:
statusBarHeight
,
// + plus.navigator.getStatusbarHeight() //设置web-view距离顶部的距离以及自己的高度,单位为px
bottom
:
0
,
// 如果不把bottom设置为0,可能会与pages.json定义的tabBar,产生一些问题,具体的代码效果,可以去除bottom:0,自行查看一下
})
this
.
wv
.
setPullToRefresh
(
{
support
:
true
,
height
:
'50px'
,
range
:
'200px'
,
contentdown
:
{
caption
:
'下拉刷新'
,
},
contentover
:
{
caption
:
'释放刷新'
,
},
contentrefresh
:
{
caption
:
'正在刷新...'
,
},
},
_that
.
onRefresh
)
// 物理按键返回
_that
.
wv
.
addEventListener
(
'loaded'
,
()
=>
{
_that
.
wv
.
canBack
((
e
)
=>
{
_that
.
canBack
=
e
.
canBack
})
},
false
)
},
1000
)
//如果是页面初始化调用时,需要延时一下
// #endif
},
onTabItemTap
(
e
)
{
console
.
log
(
'点击tabbar'
,
JSON
.
stringify
(
e
))
},
methods
:
{
// 刷新页面
onRefresh
()
{
this
.
wv
.
evalJS
(
`callback({ 'action': 'OnRefresh' })`
)
setTimeout
(()
=>
{
uni
.
showToast
({
title
:
'刷新成功'
,
icon
:
'none'
,
})
this
.
wv
.
endPullToRefresh
()
},
1200
)
},
async
handleMessage
(
e
)
{
console
.
log
(
'接收到网页发来的消息'
,
JSON
.
stringify
(
e
.
detail
.
data
[
0
]))
const
message
=
e
.
detail
.
data
[
0
]
switch
(
message
.
action
)
{
case
'hideTabBar'
:
// 隐藏tabbar
hideTabBar
()
break
case
'showTabBar'
:
// 显示tabbar
showTabBar
()
break
case
'GetUserIsLogin'
:
// 用户是否登陆
const
subNVue
=
uni
.
getSubNVueById
(
'loan-popup'
)
// 对应page.json的id
// 1:子窗体从顶部进入(动画效果), 2:显示原生子窗体的动画持续时间
subNVue
.
show
(
'slide-in-bottom'
,
300
,
()
=>
{
// 向子窗体传递参数
uni
.
$emit
(
'loan-from-popup'
,
{
appName
:
'多典花'
,
mobile
:
storage
.
getUserInfo
().
mobile
,
})
})
break
case
'DeviceInfo'
:
// 设备信息 m-device-info
const
res
=
await
loadLocation
()
this
.
wv
.
evalJS
(
`callback(
${
JSON
.
stringify
({
action
:
'DeviceInfo'
,
result
:
res
})}
)`
)
break
case
'GetALLContact'
:
// 全部通讯录信息 m-contact
CheckContactPermission
((
res
)
=>
{
this
.
wv
.
evalJS
(
`callback(
${
JSON
.
stringify
({
action
:
'GetALLContact'
,
result
:
res
,
})}
)`
)
})
break
case
'GetContact'
:
// 选择通讯录
CheckContactPermission
(()
=>
{
SelectContact
((
res
)
=>
{
this
.
wv
.
evalJS
(
`callback(
${
JSON
.
stringify
({
action
:
'GetContact'
,
result
:
res
,
})}
)`
)
})
})
break
case
'Face_UP'
:
/**
* 人脸验证
* token
* requestId
*/
Face_UP
(
message
.
token
,
message
.
requestId
,
(
res
)
=>
{
this
.
wv
.
evalJS
(
`callback({action: 'Face_UP', 'result':
${
res
}
})`
)
})
break
case
'Camera_UP'
:
/**
* OCR识别
* token
* type
* key
* secret
*/
Camera_UP
(
message
.
token
,
message
.
type
,
(
res
)
=>
{
this
.
wv
.
evalJS
(
`callback({action: 'Camera_UP', 'type':
${
type
}
, 'result':
${
res
}
})`
)
})
break
default
:
break
}
},
},
onHide
()
{
this
.
wv
.
evalJS
(
`callback({ 'action': 'OnHide' })`
)
// 页面销毁之前 移除监听器
uni
.
$off
(
'to-popup'
)
},
}
</
script
>
pages/web/tools.js
View file @
18e45ab1
...
...
@@ -30,7 +30,8 @@ export const navigate = (type = "navigateTo", url) => {
*/
export
const
loadDeviceInfo
=
async
(
lat
,
lng
,
address
)
=>
{
// 网络状态
const
{
networkType
=
""
}
=
await
loadNetwork
();
const
{
networkType
=
""
}
=
await
loadNetwork
();
const
{
imei
=
''
,
imsi
=
''
,
uuid
=
''
}
=
await
loadUuid
();
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
getSystemInfo
({
success
:
async
(
result
)
=>
{
...
...
@@ -58,7 +59,11 @@ export const loadDeviceInfo = async (lat, lng, address) => {
osVersion
:
osVersion
,
//操作系统版本
mobileType
:
model
,
// 手机型号
idfa
:
""
,
// IOS设备则为:IDFA
imei
:
""
,
//安卓设备为:imei
imei
:
imei
,
//安卓设备为:imei
imei
:
imsi
,
uuid
:
uuid
,
mac
:
""
,
// mac
wifiMac
:
""
,
// wifimac
clientIp
:
""
,
...
...
@@ -82,10 +87,7 @@ export const loadDeviceInfo = async (lat, lng, address) => {
uni
.
setStorage
({
key
:
"m-device-info"
,
data
:
JSON
.
stringify
(
deviceInfo
),
success
:
(
res
)
=>
{
console
.
log
(
"m-device-info存储成功"
);
},
data
:
JSON
.
stringify
(
deviceInfo
)
});
return
resolve
(
deviceInfo
);
},
...
...
@@ -103,9 +105,9 @@ export const loadDeviceInfo = async (lat, lng, address) => {
export
const
Face_UP
=
(
token
=
""
,
requestId
=
""
,
callback
)
=>
{
try
{
LFv2
.
Face_UP
({
token
,
requestId
,
},
token
,
requestId
,
},
(
res
)
=>
{
console
.
log
(
"Face_UP"
,
res
);
if
(
res
.
code
==
1
)
{
...
...
@@ -125,18 +127,14 @@ export const Face_UP = (token = "", requestId = "", callback) => {
// 获取common当中的网络信息
export
const
loadNetwork
=
()
=>
{
const
that
=
this
;
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
getNetworkType
({
success
:
(
res
)
=>
{
console
.
log
(
res
,
'往222'
)
console
.
log
(
res
,
'往222'
)
// 网络信息存储
uni
.
setStorage
({
key
:
"m-network-info"
,
data
:
JSON
.
stringify
(
res
),
success
:
function
()
{
console
.
log
(
"m-network-info存储成功"
);
},
data
:
JSON
.
stringify
(
res
)
});
resolve
(
res
);
},
...
...
@@ -153,38 +151,29 @@ export const loadNetwork = () => {
// 获取common当中的位置信息
export
const
loadLocation
=
()
=>
{
const
that
=
this
;
console
.
log
(
'调用获取定位信息的方法3'
)
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
getLocation
({
type
:
"wgs84"
,
geocode
:
true
,
success
:
async
(
res
)
=>
{
console
.
log
(
res
,
"成功==="
);
const
locationInfo
=
{
lat
:
String
(
res
.
latitude
),
lng
:
String
(
res
.
longitude
),
address
:
JSON
.
stringify
(
res
.
address
)
,
address
:
res
.
address
?
JSON
.
stringify
(
res
.
address
)
:
''
,
};
// 位置信息存储
uni
.
setStorage
({
key
:
"m-location-info"
,
data
:
JSON
.
stringify
(
locationInfo
),
success
:
function
()
{
console
.
log
(
"m-location-info存储成功"
);
},
fail
:
(
err
)
=>
{
console
.
error
(
"m-location-info存储失败"
);
},
data
:
JSON
.
stringify
(
locationInfo
)
});
// 获取设备信息
const
device
=
await
loadDeviceInfo
(
res
.
latitude
,
res
.
longitude
,
''
locationInfo
.
lat
,
locationInfo
.
lng
,
locationInfo
.
address
);
resolve
(
device
);
},
...
...
@@ -208,7 +197,7 @@ export const loadLocation = () => {
uni
.
showModal
({
title
:
'"多典花"想要访问您的位置信息'
,
content
:
"您手机系统的定位处于关闭状态,会导致您后续的授信不通过,授信需要访问您的位置信息,需要您提供权限,请开启手机的定位服务。"
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
uni
.
removeStorageSync
(
'hasRefresh'
)
uni
.
removeStorageSync
(
'showModal'
)
...
...
@@ -234,7 +223,7 @@ export const loadLocation = () => {
* 包括国际移动设备身份码、国际移动用户识别码、设备的唯一标识等信息。
* Android平台调用此方法需要申请访问设备标识(部分设备提示为拨打电话)权限,详情参考https://ask.dcloud.net.cn/article/36075。
*/
export
const
getDeviceInfo
=
()
=>
{
export
const
loadUuid
=
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
plus
.
device
.
getInfo
({
success
:
(
res
)
=>
{
...
...
pages/web/web.vue
View file @
18e45ab1
...
...
@@ -133,9 +133,9 @@ export default {
}
// 这里为借款做的刷新
// const canRefresh = uni.getStorageSync('canRefresh');
// console.log(canRefresh, '是否需要刷新-这里为
借款
做的刷新')
// console.log(canRefresh, '是否需要刷新-这里为做的刷新')
// if (canRefresh) {
// uni.removeStorageSync('canRefresh')
// if (reloadTimeOut) clearTimeout(reloadTimeOut)
...
...
utils/header.js
View file @
18e45ab1
...
...
@@ -33,7 +33,8 @@ export const initHeaderDevice = function () {
let
channel
=
plus
&&
plus
.
runtime
.
channel
&&
plus
.
runtime
.
channel
;
// 获取版本号
let
AppVersion
=
uni
.
getStorageSync
(
'm-header-version'
);
let
AppVersion
=
uni
.
getStorageSync
(
'm-header-version'
);
// AppVersion = AppVersion === '1.0.7' ? AppVersion : '1.0.7';
const
common
=
{
appName
:
'DDH'
,
appSourceId
:
modelApp
,
...
...
@@ -91,6 +92,6 @@ export const initHeaderDevice = function () {
return
headerDeviceInfo
}
return
device
return
device
}
utils/request.js
View file @
18e45ab1
...
...
@@ -3,17 +3,20 @@ import api from '@/config/api.js'
const
request
=
async
(
url
,
type
,
data
)
=>
{
const
baseUrl
=
api
.
common
// 这里确保一定是可以获取得到的
cons
t
headerDevice
=
uni
.
getStorageSync
(
'm-header-device'
)
le
t
headerDevice
=
uni
.
getStorageSync
(
'm-header-device'
)
let
rd
if
(
headerDevice
)
{
// 获取版本号
let
AppVersion
=
uni
.
getStorageSync
(
'm-header-version'
);
// AppVersion = AppVersion === '1.0.7' ? AppVersion : '1.0.7';
const
device
=
Object
.
assign
({},
JSON
.
parse
(
headerDevice
))
device
.
appVersion
=
AppVersion
rd
=
encodeURIComponent
(
headerDevice
)
}
else
{
rd
=
JSON
.
stringify
(
initHeaderDevice
())
}
return
new
Promise
((
resolve
,
reject
)
=>
{
const
token
=
uni
.
getStorageSync
(
'token'
)
const
tokenFinance
=
uni
.
getStorageSync
(
'tokenFinance'
)
...
...
@@ -40,7 +43,7 @@ const request = async (url, type, data) => {
console
.
log
(
$data
,
'接口参数'
)
if
(
res
.
data
.
result
)
console
.
log
(
res
.
data
.
result
,
'返回内容'
)
else
console
.
log
(
res
.
data
,
'返回内容'
)
// #endif
const
{
data
,
statusCode
}
=
res
;
...
...
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