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
b054c69c
Commit
b054c69c
authored
Oct 28, 2024
by
caimeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
1c164044
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
108 additions
and
117 deletions
+108
-117
.DS_Store
pages/index/.DS_Store
+0
-0
tools.js
pages/web/tools.js
+1
-0
app-service.js
unpackage/dist/dev/app-plus/app-service.js
+7
-7
deviceInfo.js
utils/deviceInfo.js
+89
-89
header.js
utils/header.js
+4
-4
index.js
utils/index.js
+1
-0
request.js
utils/request.js
+4
-16
tools.js
utils/tools.js
+2
-1
No files found.
pages/index/.DS_Store
View file @
b054c69c
No preview for this file type
pages/web/tools.js
View file @
b054c69c
...
...
@@ -129,6 +129,7 @@ export const loadNetwork = () => {
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
getNetworkType
({
success
:
(
res
)
=>
{
console
.
log
(
res
,
'往222'
)
// 网络信息存储
uni
.
setStorage
({
key
:
"m-network-info"
,
...
...
unpackage/dist/dev/app-plus/app-service.js
View file @
b054c69c
This source diff could not be displayed because it is too large. You can
view the blob
instead.
utils/deviceInfo.js
View file @
b054c69c
...
...
@@ -10,112 +10,112 @@ import Permission from '../js_sdk/wa-permission/permission.js'
import
{
SelectLocation
}
from
"../utils/authPerission.js"
;
// import { getAppVersion } from "@/api/api.js";
// 获取common当中的设备信息
export
const
loadDevice
=
function
()
{
const
that
=
this
convertPromise
(
'getSystemInfo'
).
then
(
result
=>
{
const
deviceInfo
=
{
// token:uuidObtain, result.appName
deviceType
:
result
.
deviceType
,
appName
:
'DDH'
,
deviceId
:
result
.
deviceId
,
device
:
result
.
osName
,
deviceName
:
result
.
platform
,
appVersion
:
result
.
appWgtVersion
,
osVersion
:
result
.
osVersion
?
result
.
osVersion
:
result
.
system
,
mobileType
:
result
.
model
,
screenHeight
:
result
.
screenHeight
,
screenWidth
:
result
.
screenWidth
,
resolution
:
result
.
windowWidth
+
'*'
+
result
.
screenHeight
,
appSourceId
:
"1"
};
// 本地存储
uni
.
setStorage
({
key
:
'm-device-info'
,
data
:
JSON
.
stringify
(
deviceInfo
),
success
:
function
()
{
console
.
log
(
'm-device-info存储成功'
);
}
});
}).
catch
(
err
=>
{
//that.toast('获取设备信息失败')
uni
.
showModal
({
title
:
'"多典花"想访问您的设备信息'
,
content
:
'通过访问您的设备信息,提高您授信通过率。'
,
showCancel
:
false
,
confirmText
:
'去设置'
,
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
Permission
.
gotoAppPermissionSetting
()
}
}
});
})
export
const
loadDevice
=
function
()
{
const
that
=
this
convertPromise
(
'getSystemInfo'
).
then
(
result
=>
{
const
deviceInfo
=
{
// token:uuidObtain, result.appName
deviceType
:
result
.
deviceType
,
appName
:
'DDH'
,
deviceId
:
result
.
deviceId
,
device
:
result
.
osName
,
deviceName
:
result
.
platform
,
appVersion
:
result
.
appWgtVersion
,
osVersion
:
result
.
osVersion
?
result
.
osVersion
:
result
.
system
,
mobileType
:
result
.
model
,
screenHeight
:
result
.
screenHeight
,
screenWidth
:
result
.
screenWidth
,
resolution
:
result
.
windowWidth
+
'*'
+
result
.
screenHeight
,
appSourceId
:
"1"
};
// 本地存储
uni
.
setStorage
({
key
:
'm-device-info'
,
data
:
JSON
.
stringify
(
deviceInfo
),
success
:
function
()
{
console
.
log
(
'm-device-info存储成功'
);
}
});
}).
catch
(
err
=>
{
//that.toast('获取设备信息失败')
uni
.
showModal
({
title
:
'"多典花"想访问您的设备信息'
,
content
:
'通过访问您的设备信息,提高您授信通过率。'
,
showCancel
:
false
,
confirmText
:
'去设置'
,
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
Permission
.
gotoAppPermissionSetting
()
}
}
});
})
}
// 获取common当中的网络信息
export
const
loadNetwork
=
function
()
{
const
that
=
this
;
convertPromise
(
'getNetworkType'
).
then
(
result
=>
{
const
networkInfo
=
{
networkStatus
:
result
.
networkType
};
// 网络信息存储
uni
.
setStorage
({
key
:
'm-network-info'
,
data
:
JSON
.
stringify
(
networkInfo
),
success
:
function
()
{
console
.
log
(
'm-network-info存储成功'
);
}
});
}).
catch
(
err
=>
{
that
.
toast
(
'获取网络信息失败'
)
})
export
const
loadNetwork
=
function
()
{
const
that
=
this
;
convertPromise
(
'getNetworkType'
).
then
(
result
=>
{
const
networkInfo
=
{
networkStatus
:
result
.
networkType
};
// 网络信息存储
uni
.
setStorage
({
key
:
'm-network-info'
,
data
:
JSON
.
stringify
(
networkInfo
),
success
:
function
()
{
console
.
log
(
'm-network-info存储成功'
);
}
});
}).
catch
(
err
=>
{
that
.
toast
(
'获取网络信息失败'
)
})
}
// 获取common当中的网络信息
export
const
loadUuid
=
function
()
{
export
const
loadUuid
=
function
()
{
plus
.
device
.
getInfo
({
success
:
function
(
e
)
{
const
deviceInfo
=
{
token
:
e
.
uuid
,
};
uni
.
setStorage
({
key
:
'm-load-udid'
,
data
:
JSON
.
stringify
(
deviceInfo
),
success
:
function
()
{
console
.
log
(
'uuid存储成功'
);
}
})
},
fail
:
function
(
e
)
{
console
.
log
(
'getDeviceInfo failed: '
+
JSON
.
stringify
(
e
));
}
success
:
function
(
e
)
{
const
deviceInfo
=
{
token
:
e
.
uuid
,
};
uni
.
setStorage
({
key
:
'm-load-udid'
,
data
:
JSON
.
stringify
(
deviceInfo
),
success
:
function
()
{
console
.
log
(
'uuid存储成功'
);
}
})
},
fail
:
function
(
e
)
{
console
.
log
(
'getDeviceInfo failed: '
+
JSON
.
stringify
(
e
));
}
});
}
// 获取common当中的网络信息
export
const
loadLocation
=
function
()
{
export
const
loadLocation
=
function
()
{
const
that
=
this
;
// 苹果测试手机如果没有插入手机卡,获取定位之后会解析失败,报错
SelectLocation
(()
=>
{
convertPromise
(
'getLocation'
,
{
type
:
'wgs84'
,
geocode
:
true
geocode
:
true
}).
then
(
result
=>
{
const
locationInfo
=
{
lat
:
String
(
result
.
latitude
),
lng
:
String
(
result
.
longitude
)
};
uni
.
setStorage
({
key
:
'm-location-info'
,
data
:
JSON
.
stringify
(
locationInfo
),
success
:
function
()
{
const
locationInfo
=
{
lat
:
String
(
result
.
latitude
),
lng
:
String
(
result
.
longitude
)
};
uni
.
setStorage
({
key
:
'm-location-info'
,
data
:
JSON
.
stringify
(
locationInfo
),
success
:
function
()
{
console
.
log
(
'm-location-info存储成功'
);
}
});
}
});
}).
catch
(
err
=>
{
console
.
log
(
err
,
'错误了'
)
// that.toast('获取位置信息失败')
})
console
.
log
(
err
,
'错误了'
)
// that.toast('获取位置信息失败')
})
})
}
export
default
{
loadDevice
,
...
...
utils/header.js
View file @
b054c69c
...
...
@@ -60,6 +60,9 @@ export const initHeaderDevice = function () {
const
networkInfo
=
uni
.
getStorageSync
(
'm-network-info'
)
const
locationInfo
=
uni
.
getStorageSync
(
'm-location-info'
)
const
loadUuid
=
uni
.
getStorageSync
(
'm-load-udid'
)
console
.
log
(
networkInfo
,
loadUuid
,
'==================='
)
let
device
=
{};
if
(
deviceInfo
)
{
device
=
Object
.
assign
(
device
,
common
,
JSON
.
parse
(
deviceInfo
))
...
...
@@ -87,10 +90,7 @@ export const initHeaderDevice = function () {
// 存储所有请求的头部信息
uni
.
setStorage
({
key
:
'm-header-device'
,
data
:
JSON
.
stringify
(
headerDeviceInfo
),
success
:
function
()
{
// console.log('m-header-device存储成功4');
}
data
:
JSON
.
stringify
(
headerDeviceInfo
)
});
return
headerDeviceInfo
...
...
utils/index.js
View file @
b054c69c
...
...
@@ -113,6 +113,7 @@ export const loadNetwork = () => {
const
networkInfo
=
{
networkStatus
:
result
.
networkType
};
// 网络信息存储
uni
.
setStorage
({
key
:
'm-network-info'
,
...
...
utils/request.js
View file @
b054c69c
...
...
@@ -4,23 +4,11 @@ const request = async (url, type, data) => {
const
baseUrl
=
api
.
common
// 这里确保一定是可以获取得到的
const
headerDevice
=
uni
.
getStorageSync
(
'm-header-device'
)
const
deviceInfo
=
uni
.
getStorageSync
(
'm-device-info'
)
const
tokenF
=
uni
.
getStorageSync
(
'tokenFinance'
)
let
rd
=
null
if
(
!
deviceInfo
||
tokenF
==
''
&&
plus
.
os
.
name
!=
'iOS'
)
{
rd
=
initHeaderInfo
()
}
else
{
if
(
headerDevice
)
{
rd
=
headerDevice
}
else
{
const
common
=
initHeaderDevice
()
console
.
log
(
common
,
'日==='
)
if
(
common
)
{
rd
=
JSON
.
stringify
(
common
)
}
}
}
let
rd
=
initHeaderInfo
()
if
(
headerDevice
)
rd
=
headerDevice
else
rd
=
initHeaderDevice
()
rd
=
JSON
.
stringify
(
rd
)
return
new
Promise
((
resolve
,
reject
)
=>
{
const
token
=
uni
.
getStorageSync
(
'token'
)
...
...
utils/tools.js
View file @
b054c69c
...
...
@@ -127,10 +127,11 @@ export const loadNetwork = () => {
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
getNetworkType
({
success
:
(
res
)
=>
{
console
.
log
(
res
,
'哈哈===='
)
// 网络信息存储
uni
.
setStorage
({
key
:
"m-network-info"
,
data
:
res
.
networkType
,
data
:
JSON
.
stringify
(
res
)
,
success
:
function
()
{
console
.
log
(
"m-network-info存储成功"
);
},
...
...
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