Commit 4c60c5ab authored by ly's avatar ly

获取设备信息相关修改

parent 8179316a
...@@ -221,7 +221,7 @@ ...@@ -221,7 +221,7 @@
} }
}, },
onShow: function() { onShow: function() {
this.checkVersion()
const common = uni.getStorageSync("m-header-device") const common = uni.getStorageSync("m-header-device")
if (!common && plus.os.name=='iOS') { if (!common && plus.os.name=='iOS') {
console.log(plus.os.name,'9') console.log(plus.os.name,'9')
...@@ -230,6 +230,7 @@ ...@@ -230,6 +230,7 @@
this.loadLocation(); this.loadLocation();
this.loadUuid() this.loadUuid()
} }
this.checkVersion()
}, },
onHide: function() { onHide: function() {
......
...@@ -74,16 +74,16 @@ ...@@ -74,16 +74,16 @@
} }
}, },
onLoad() { onLoad() {
const token=uni.getStorageSync('token') const token=uni.getStorageSync('tokenFinance')
const common = uni.getStorageSync("m-header-device") const common = uni.getStorageSync("m-header-device")
this.init()
console.log('onLoad')
if(!common && plus.os.name!='iOS' && token){ if(!common && plus.os.name!='iOS' && token){
loadDevice() loadDevice()
loadNetwork() loadNetwork()
loadUuid() loadUuid()
loadLocation() loadLocation()
this.init()
}else{
this.init()
} }
}, },
...@@ -141,17 +141,15 @@ ...@@ -141,17 +141,15 @@
} }
}, },
onShow(){ onShow(){
console.log('onShow2x')
const token=uni.getStorageSync('token') this.init()
const token=uni.getStorageSync('tokenFinance')
const common = uni.getStorageSync("m-header-device") const common = uni.getStorageSync("m-header-device")
if(!common && plus.os.name!='iOS' && token){ if(!common && plus.os.name!='iOS' && token){
loadDevice() loadDevice()
loadNetwork() loadNetwork()
loadUuid() loadUuid()
loadLocation() loadLocation()
this.init()
}else{
this.init()
} }
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -17510,7 +17510,7 @@ if(false) {} ...@@ -17510,7 +17510,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); 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); exports = ___CSS_LOADER_API_IMPORT___(false);
// Module // 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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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 // Exports
module.exports = exports; module.exports = exports;
...@@ -19,14 +19,17 @@ export const convertPromise = function (FnName, params = {}) { ...@@ -19,14 +19,17 @@ export const convertPromise = function (FnName, params = {}) {
export const initHeaderInfo = function (){ export const initHeaderInfo = function (){
const versionNew=uni.getStorageSync('version') const versionNew=uni.getStorageSync('version')
console.log(versionNew,'versionNew') let deviceName
if(plus.os.name=='Android'){
deviceName='android'
}
// 根据当前时间戳生成一个随机整数 // 根据当前时间戳生成一个随机整数
var randomNum = new Date().getTime(); var randomNum = new Date().getTime();
const commons={ const commons={
"appName":"DDH", "appName":"DDH",
"appSourceId":"1", "appSourceId":"1",
"token":randomNum, "token":randomNum,
"device":plus.os.name, "device":deviceName,
"appVersion":versionNew, "appVersion":versionNew,
} }
return commons return commons
......
...@@ -6,20 +6,21 @@ const request=async(url,type,data)=>{ ...@@ -6,20 +6,21 @@ const request=async(url,type,data)=>{
const headerDevice = uni.getStorageSync('m-header-device') const headerDevice = uni.getStorageSync('m-header-device')
const versionNew=uni.getStorageSync('version') const versionNew=uni.getStorageSync('version')
const deviceInfo = uni.getStorageSync('m-device-info')
// 根据当前时间戳生成一个随机整数 // 根据当前时间戳生成一个随机整数
var randomNum = new Date().getTime(); var randomNum = new Date().getTime();
let rd let rd
console.log(deviceInfo,'networkInfo')
const tokenF=uni.getStorageSync('tokenFinance') const tokenF=uni.getStorageSync('tokenFinance')
if(tokenF=='' && plus.os.name!='iOS'){ if(!deviceInfo || tokenF=='' && plus.os.name!='iOS'){
rd=initHeaderInfo() rd=initHeaderInfo()
}else{ }else{
if (headerDevice) { if (headerDevice) {
rd = headerDevice rd = headerDevice
// console.log(headerDevice,'headerDevice')
}else{ }else{
const common = initHeaderDevice() const common = initHeaderDevice()
rd = JSON.stringify(common) rd = JSON.stringify(common)
// console.log(rd,'rd3333')
} }
} }
return new Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment