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
9f412baf
Commit
9f412baf
authored
Sep 26, 2024
by
ly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initinit
parent
e7fbda84
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1814 additions
and
2130 deletions
+1814
-2130
.DS_Store
.DS_Store
+0
-0
header_20240808113138.js
.history/utils/header_20240808113138.js
+0
-80
header_20240808113154.js
.history/utils/header_20240808113154.js
+0
-80
request_20240807163740.js
.history/utils/request_20240807163740.js
+0
-80
request_20240807165234.js
.history/utils/request_20240807165234.js
+0
-80
App.vue
App.vue
+46
-49
index.vue
pages/app-update/index.vue
+4
-1
checkVersion.js
pages/app-update/js-sdk/checkVersion.js
+1
-1
index.vue
pages/index/index.vue
+2
-0
login.vue
pages/login/login.vue
+1
-5
app-service.js
unpackage/dist/dev/app-plus/app-service.js
+1746
-1746
app-view.js
unpackage/dist/dev/app-plus/app-view.js
+1
-1
deviceInfo.js
utils/deviceInfo.js
+1
-0
header.js
utils/header.js
+2
-1
request.js
utils/request.js
+10
-6
No files found.
.DS_Store
View file @
9f412baf
No preview for this file type
.history/utils/header_20240808113138.js
deleted
100644 → 0
View file @
e7fbda84
// 把方法修改成Promise函数
export
const
convertPromise
=
function
(
FnName
,
params
=
{})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
[
FnName
]({
...
params
,
success
:
function
(
res
)
{
return
resolve
(
res
)
},
fail
:
function
(
err
)
{
console
.
log
(
err
,
`处理
${
FnName
}
方法信息报错`
)
return
reject
(
err
)
},
complete
:
function
(
res
)
{
//console.log(res,`处理${FnName}方法信息完成`)
}
})
});
}
// 初始化请求头的device参数信息
export
const
initHeaderDevice
=
function
()
{
const
common
=
{
appName
:
'DDH'
,
appSourceId
:
"1"
,
token
:
"c695fa285b9dc46a"
,
// 设备令牌(device_token) 设备udid
idfa
:
""
,
// IOS设备则为:IDFA 广告标识
imei
:
""
,
//安卓设备为:imei
mac
:
""
,
// mac
wifiMac
:
""
,
// wifimac
clientIp
:
""
,
carrierOperator
:
'OperatorName'
,
//运营商
pushType
:
"1"
,
//设备push接入类型(1. 小米PUSH,2. 极光PUSH)
electricQuantity
:
""
,
//电量
totalStorage
:
""
,
//存储总空间
availableStorage
:
""
//可用存储空间
};
const
deviceInfo
=
uni
.
getStorageSync
(
'm-device-info'
)
const
networkInfo
=
uni
.
getStorageSync
(
'm-network-info'
)
// const locationInfo = uni.getStorageSync('m-location-info')
const
loadUuid
=
uni
.
getStorageSync
(
'm-load-udid'
)
let
device
=
{};
if
(
deviceInfo
)
{
device
=
Object
.
assign
(
device
,
common
,
JSON
.
parse
(
deviceInfo
))
}
if
(
networkInfo
)
{
device
=
Object
.
assign
(
device
,
common
,
JSON
.
parse
(
networkInfo
))
}
if
(
locationInfo
)
{
device
=
Object
.
assign
(
device
,
common
,
JSON
.
parse
(
locationInfo
))
}
if
(
loadUuid
){
device
=
Object
.
assign
(
device
,
common
,
JSON
.
parse
(
loadUuid
))
}
if
(
deviceInfo
&&
networkInfo
&&
loadUuid
)
{
const
headerDeviceInfo
=
{
...
JSON
.
parse
(
deviceInfo
),
...
JSON
.
parse
(
networkInfo
),
...
JSON
.
parse
(
loadUuid
),
...
common
}
// 存储所有请求的头部信息
uni
.
setStorage
({
key
:
'm-header-device'
,
data
:
JSON
.
stringify
(
headerDeviceInfo
),
success
:
function
()
{
console
.
log
(
'm-header-device存储成功4'
);
}
});
return
headerDeviceInfo
}
return
device
}
.history/utils/header_20240808113154.js
deleted
100644 → 0
View file @
e7fbda84
// 把方法修改成Promise函数
export
const
convertPromise
=
function
(
FnName
,
params
=
{})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
[
FnName
]({
...
params
,
success
:
function
(
res
)
{
return
resolve
(
res
)
},
fail
:
function
(
err
)
{
console
.
log
(
err
,
`处理
${
FnName
}
方法信息报错`
)
return
reject
(
err
)
},
complete
:
function
(
res
)
{
//console.log(res,`处理${FnName}方法信息完成`)
}
})
});
}
// 初始化请求头的device参数信息
export
const
initHeaderDevice
=
function
()
{
const
common
=
{
appName
:
'DDH'
,
appSourceId
:
"1"
,
token
:
"c695fa285b9dc46a"
,
// 设备令牌(device_token) 设备udid
idfa
:
""
,
// IOS设备则为:IDFA 广告标识
imei
:
""
,
//安卓设备为:imei
mac
:
""
,
// mac
wifiMac
:
""
,
// wifimac
clientIp
:
""
,
carrierOperator
:
'OperatorName'
,
//运营商
pushType
:
"1"
,
//设备push接入类型(1. 小米PUSH,2. 极光PUSH)
electricQuantity
:
""
,
//电量
totalStorage
:
""
,
//存储总空间
availableStorage
:
""
//可用存储空间
};
const
deviceInfo
=
uni
.
getStorageSync
(
'm-device-info'
)
const
networkInfo
=
uni
.
getStorageSync
(
'm-network-info'
)
const
locationInfo
=
uni
.
getStorageSync
(
'm-location-info'
)
const
loadUuid
=
uni
.
getStorageSync
(
'm-load-udid'
)
let
device
=
{};
if
(
deviceInfo
)
{
device
=
Object
.
assign
(
device
,
common
,
JSON
.
parse
(
deviceInfo
))
}
if
(
networkInfo
)
{
device
=
Object
.
assign
(
device
,
common
,
JSON
.
parse
(
networkInfo
))
}
if
(
locationInfo
)
{
device
=
Object
.
assign
(
device
,
common
,
JSON
.
parse
(
locationInfo
))
}
if
(
loadUuid
){
device
=
Object
.
assign
(
device
,
common
,
JSON
.
parse
(
loadUuid
))
}
if
(
deviceInfo
&&
networkInfo
&&
loadUuid
)
{
const
headerDeviceInfo
=
{
...
JSON
.
parse
(
deviceInfo
),
...
JSON
.
parse
(
networkInfo
),
...
JSON
.
parse
(
loadUuid
),
...
common
}
// 存储所有请求的头部信息
uni
.
setStorage
({
key
:
'm-header-device'
,
data
:
JSON
.
stringify
(
headerDeviceInfo
),
success
:
function
()
{
console
.
log
(
'm-header-device存储成功4'
);
}
});
return
headerDeviceInfo
}
return
device
}
.history/utils/request_20240807163740.js
deleted
100644 → 0
View file @
e7fbda84
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
deleted
100644 → 0
View file @
e7fbda84
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
App.vue
View file @
9f412baf
<
script
>
import
{
convertPromise
}
from
'./utils/header.js'
import
{
convertPromise
,
initHeaderInfo
}
from
'./utils/header.js'
import
Permission
from
'@/js_sdk/wa-permission/permission'
import
{
SelectLocation
}
from
"./utils/authPerission"
;
import
silentlyAppUpdate
from
'@/pages/app-update/js-sdk/silentlyAppUpdate'
...
...
@@ -12,23 +12,27 @@
this
.
loadNetwork
();
this
.
loadLocation
();
this
.
loadUuid
()
// const isAgree = uni.getStorageSync('m-agreement')
// console.log(isAgree,'isAgree1')
}
plus
.
screen
.
lockOrientation
(
"portrait-primary"
)
console
.
log
(
'App Launch'
)
/*** tabbar*/
this
.
switchShowTabbar
()
// 重点是以下: 一定要监听后台恢复 !一定要
// plus.globalEvent.addEventListener('newintent', (e) => {
// // this.checkArguments() // 检测启动参数
// console.log(e,'333')
// if (plus.runtime.isAgreePrivacy()) {
// console.log(e,'444')
// initHeaderInfo()
// }
// })
//app更新版本
// silentlyAppUpdate()
// if (plus.runtime.isAgreePrivacy()) {
// initHeaderInfo()
// silentlyAppUpdate()
// }
silentlyAppUpdate
()
if
(
plus
.
runtime
.
isAgreePrivacy
())
{
// setDevice()
silentlyAppUpdate
()
}
plus
.
screen
.
lockOrientation
(
"portrait-primary"
)
console
.
log
(
'App Launch'
)
},
methods
:{
//tab的信息
...
...
@@ -177,15 +181,8 @@
}
},
onShow
:
function
()
{
console
.
log
(
'App Show'
)
/*** tabbar*/
this
.
switchShowTabbar
()
// 版本更新
silentlyAppUpdate
()
if
(
plus
.
runtime
.
isAgreePrivacy
())
{
// setDevice()
silentlyAppUpdate
()
}
console
.
log
(
2
,
'App Show'
)
},
onHide
:
function
()
{
...
...
pages/app-update/index.vue
View file @
9f412baf
...
...
@@ -378,8 +378,11 @@
key
:
"m-agreement"
,
data
:
'true'
,
success
:
function
()
{
console
.
log
(
'm-agreement成功'
)
}
})
const
headerDevice
=
uni
.
getStorageSync
(
'm-header-device'
)
console
.
log
(
headerDevice
,
'headerDevice'
)
if
(
this
.
downloading
)
{
console
.
log
(
1
,
'9'
)
uni
.
showModal
({
...
...
pages/app-update/js-sdk/checkVersion.js
View file @
9f412baf
...
...
@@ -22,7 +22,7 @@ export default function checkVersion() {
if
(
res
.
success
==
true
)
{
let
response
=
res
.
result
.
data
;
console
.
log
(
response
,
'appVersion'
)
let
result
=
{};
result
.
versionCode
=
response
.
version
;
result
.
versionName
=
response
.
versionName
;
...
...
pages/index/index.vue
View file @
9f412baf
...
...
@@ -72,6 +72,7 @@
</
template
>
<
script
>
import
{
switchShowTabbar
}
from
'../../utils/deviceInfo.js'
import
silentlyAppUpdate
from
'@/pages/app-update/js-sdk/silentlyAppUpdate'
export
default
{
data
()
{
...
...
@@ -264,6 +265,7 @@
this
.
token
=
token
this
.
init
()
this
.
searchGood
()
// switchShowTabbar()
}
}
</
script
>
...
...
pages/login/login.vue
View file @
9f412baf
...
...
@@ -171,12 +171,8 @@
const
{
deviceId
}
=
userInfo
uni
.
setStorageSync
(
'deviceId'
,
deviceId
)
}
uni
.
setStorageSync
(
'mobileCall'
,
self
.
mobile
)
uni
.
setStorageSync
(
'token'
,
token
)
// self.loginNocheck()
uni
.
navigateBack
({
delta
:
1
})
self
.
loginNocheck
()
}).
catch
(
err
=>
{
console
.
log
(
err
,
'请求出错'
)
})
...
...
unpackage/dist/dev/app-plus/app-service.js
View file @
9f412baf
This source diff could not be displayed because it is too large. You can
view the blob
instead.
unpackage/dist/dev/app-plus/app-view.js
View file @
9f412baf
...
...
@@ -8974,7 +8974,7 @@ if(false) {}
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../../Applications/HBuilderX 2.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/runtime/api.js */ 10);
exports = ___CSS_LOADER_API_IMPORT___(false);
// Module
exports.push([module.i, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n\n\n
/*每个页面公共css */\n", ""]);
exports.push([module.i, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/*每个页面公共css */\n", ""]);
// Exports
module.exports = exports;
utils/deviceInfo.js
View file @
9f412baf
...
...
@@ -8,6 +8,7 @@
import
{
convertPromise
}
from
'../utils/header.js'
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
...
...
utils/header.js
View file @
9f412baf
...
...
@@ -37,7 +37,7 @@ export const initHeaderDevice = function () {
const
deviceInfo
=
uni
.
getStorageSync
(
'm-device-info'
)
const
networkInfo
=
uni
.
getStorageSync
(
'm-network-info'
)
//
const locationInfo = uni.getStorageSync('m-location-info')
const
locationInfo
=
uni
.
getStorageSync
(
'm-location-info'
)
const
loadUuid
=
uni
.
getStorageSync
(
'm-load-udid'
)
let
device
=
{};
...
...
@@ -59,6 +59,7 @@ export const initHeaderDevice = function () {
const
headerDeviceInfo
=
{
...
JSON
.
parse
(
deviceInfo
),
...
JSON
.
parse
(
networkInfo
),
// ...JSON.parse(locationInfo),
...
JSON
.
parse
(
loadUuid
),
...
common
}
...
...
utils/request.js
View file @
9f412baf
import
{
initHeaderDevice
}
from
'./header.js'
import
{
initHeaderDevice
,
initHeaderInfo
}
from
'./header.js'
import
api
from
'@/config/api.js'
const
request
=
async
(
url
,
type
,
data
)
=>
{
const
baseUrl
=
api
.
common
// 这里确保一定是可以获取得到的
const
headerDevice
=
uni
.
getStorageSync
(
'm-header-device'
)
let
rd
=
null
;
const
deviceInfo
=
uni
.
getStorageSync
(
'm-device-info'
)
let
rd
=
null
console
.
log
(
deviceInfo
,
'8888'
)
if
(
headerDevice
)
{
rd
=
headerDevice
console
.
log
(
rd
,
'rd1'
)
}
else
{
const
common
=
initHeaderDevice
()
rd
=
JSON
.
stringify
(
common
)
console
.
log
(
rd
,
'rd2'
)
}
// console.log(baseUrl,'rd
')
console
.
log
(
rd
,
'rd3
'
)
return
new
Promise
((
resolve
,
reject
)
=>
{
const
token
=
uni
.
getStorageSync
(
'token'
)
const
tokenFinance
=
uni
.
getStorageSync
(
'tokenFinance'
)
...
...
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