Commit 8179316a authored by ly's avatar ly

获取设备信息

parent a6afa57e
This diff is collapsed.
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
}, },
// 地址控件改变控件 // 地址控件改变控件
columnchange(d) { columnchange(d) {
this.updateSelectIndex(d.detail.column, d.detail.value) // 更新选择索引 this.updateSelectIndex(d.detail.column, d.detail.value) // 更新选择索引
.updateSourceDate() // 更新源数据 .updateSourceDate() // 更新源数据
.updateAddressDate() // 更新结果数据 .updateAddressDate() // 更新结果数据
...@@ -100,7 +100,8 @@ ...@@ -100,7 +100,8 @@
/** /**
* 点击确定 * 点击确定
* */ * */
bindPickerChange(e) { bindPickerChange(e) {
console.log(e.target.value,'change')
this.$emit('change', { this.$emit('change', {
index: selectCode, index: selectCode,
data: selectVal data: selectVal
......
...@@ -14,7 +14,7 @@ const BASE = { ...@@ -14,7 +14,7 @@ const BASE = {
baseUrl: "https://dell-buyer-l.meimeiyouxin.com", baseUrl: "https://dell-buyer-l.meimeiyouxin.com",
}, },
prod: { prod: {
baseUrl: "https://dell-buyer.meimeiyouxin.com", baseUrl: "https://api.yyhock.com",
} }
} }
let env = process.env.VUE_APP_BASE_NODE_ENV let env = process.env.VUE_APP_BASE_NODE_ENV
......
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
// }else{ // }else{
// self.getOss(tempFilePaths,type) // self.getOss(tempFilePaths,type)
// } // }
uni.setStorageSync('authVals','1')
self.getOss(tempFilePaths,type) self.getOss(tempFilePaths,type)
}, },
fail: (err) => { fail: (err) => {
......
...@@ -607,6 +607,7 @@ ...@@ -607,6 +607,7 @@
this.showmarriage=true this.showmarriage=true
}, },
changeLive(data) { changeLive(data) {
console.log(data,'现居城市')
this.liveCity = data.data.join('') this.liveCity = data.data.join('')
this.liveCode=data.index.join(',') this.liveCode=data.index.join(',')
}, },
...@@ -622,9 +623,10 @@ ...@@ -622,9 +623,10 @@
this.cityAddress=e.detail.value this.cityAddress=e.detail.value
}, },
changeWork(data) { changeWork(data) {
console.log(data,'工作城市')
this.workCity = data.data.join('') this.workCity = data.data.join('')
this.workCode=data.index.join(',') this.workCode=data.index.join(',')
// console.log(data)
}, },
workChange(e){ workChange(e){
this.workAddress=e.target.value this.workAddress=e.target.value
......
...@@ -50,7 +50,8 @@ ...@@ -50,7 +50,8 @@
</template> </template>
<script> <script>
import moment from "moment"; import moment from "moment";
import {loadDevice,loadNetwork,loadUuid,loadLocation} from '../../utils/deviceInfo.js'
export default { export default {
data() { data() {
return { return {
...@@ -59,8 +60,19 @@ ...@@ -59,8 +60,19 @@
billList:[], billList:[],
} }
}, },
onLoad() { onLoad() {
this.init() const token=uni.getStorageSync('token')
const common = uni.getStorageSync("m-header-device")
if(!common && plus.os.name!='iOS' && token){
loadDevice()
loadNetwork()
loadUuid()
loadLocation()
this.init()
}else{
this.init()
}
}, },
methods: { methods: {
init(){ init(){
...@@ -105,7 +117,18 @@ ...@@ -105,7 +117,18 @@
}, },
onShow() { onShow() {
this.init() const token=uni.getStorageSync('token')
const common = uni.getStorageSync("m-header-device")
if(!common && plus.os.name!='iOS' && token){
loadDevice()
loadNetwork()
loadUuid()
loadLocation()
this.init()
}else{
this.init()
}
} }
} }
</script> </script>
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
</template> </template>
<script> <script>
import {loadDevice,loadNetwork,loadUuid,loadLocation} from '../../utils/deviceInfo.js'
export default { export default {
data() { data() {
return { return {
...@@ -121,15 +122,22 @@ ...@@ -121,15 +122,22 @@
}, },
onLoad() { onLoad() {
const token=uni.getStorageSync('token') const token=uni.getStorageSync('token')
const common = uni.getStorageSync("m-header-device")
this.token=token this.token=token
// 获取头部的高度 if(!common && plus.os.name!='iOS' && token){
// const query = uni.createSelectorQuery().in(this); loadDevice()
// query.select('.i-header').boundingClientRect(data => { loadNetwork()
// console.log(data.height,'98767') loadUuid()
// this.headerHeight = data.height; loadLocation()
// }).exec(); this.init()
this.init() this.searchGood()
this.searchGood()
}else{
this.init()
this.searchGood()
}
}, },
methods:{ methods:{
init(){ init(){
...@@ -234,9 +242,8 @@ ...@@ -234,9 +242,8 @@
"size":pageSize, "size":pageSize,
"sort":sort "sort":sort
} }
console.log(params,'查询商品')
self.$request('/pawn/category/getGoodsPage','POST',params).then(res => { self.$request('/pawn/category/getGoodsPage','POST',params).then(res => {
console.log(res,'查询商品')
const {current,total,size,records }=res.result const {current,total,size,records }=res.result
const hasNextPage=total-self.pageSize*self.pageNum>0?true:false //是否有下一页 const hasNextPage=total-self.pageSize*self.pageNum>0?true:false //是否有下一页
if(self.loadFlag){ if(self.loadFlag){
...@@ -274,9 +281,22 @@ ...@@ -274,9 +281,22 @@
}, },
onShow() { onShow() {
const token=uni.getStorageSync('token') const token=uni.getStorageSync('token')
const common = uni.getStorageSync("m-header-device")
this.token=token this.token=token
this.init() if(!common && plus.os.name!='iOS' && token){
this.searchGood() loadDevice()
loadNetwork()
loadUuid()
loadLocation()
this.init()
this.searchGood()
}else{
this.init()
this.searchGood()
}
} }
} }
</script> </script>
......
...@@ -56,7 +56,8 @@ ...@@ -56,7 +56,8 @@
<script> <script>
//1、使用插件 //1、使用插件
import moduleCard from '../../components/moduleCard/index.vue' import moduleCard from '../../components/moduleCard/index.vue'
import {loadDevice,loadNetwork,loadUuid,loadLocation} from '../../utils/deviceInfo.js'
export default { export default {
//2、使用插件 //2、使用插件
components:{ components:{
...@@ -73,25 +74,24 @@ ...@@ -73,25 +74,24 @@
} }
}, },
onLoad() { onLoad() {
const token=uni.getStorageSync('token')
this.init() const common = uni.getStorageSync("m-header-device")
if(!common && plus.os.name!='iOS' && token){
loadDevice()
loadNetwork()
loadUuid()
loadLocation()
this.init()
}else{
this.init()
}
}, },
onPullDownRefresh(){ onPullDownRefresh(){
console.log('shuaixin') console.log('shuaixin')
this.init() this.init()
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}, },
// onReady() {
// const isAgree = uni.getStorageSync('m-agreement')
// if (!isAgree) {
// console.log(isAgree,'isAgree')
// uni.navigateTo({
// url: '/pages/agreement/index'
// })
// }
// },
methods: { methods: {
refushMy(){ refushMy(){
console.log('emit2') console.log('emit2')
...@@ -141,8 +141,19 @@ ...@@ -141,8 +141,19 @@
} }
}, },
onShow(){ onShow(){
this.init()
// this.initMy() const token=uni.getStorageSync('token')
const common = uni.getStorageSync("m-header-device")
if(!common && plus.os.name!='iOS' && token){
loadDevice()
loadNetwork()
loadUuid()
loadLocation()
this.init()
}else{
this.init()
}
} }
} }
</script> </script>
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
</template> </template>
<script> <script>
import {loadDevice,loadNetwork,loadUuid,loadLocation} from '../../utils/deviceInfo.js'
export default { export default {
data() { data() {
return { return {
...@@ -69,15 +70,22 @@ ...@@ -69,15 +70,22 @@
}, },
onLoad(){ onLoad(){
const token=uni.getStorageSync('token') const token=uni.getStorageSync('token')
console.log(token,'token') const common = uni.getStorageSync("m-header-device")
if(token==''){ if(!common && plus.os.name!='iOS' && token){
this.userTel='' loadDevice()
this.Go('uni:/pages/login/login') loadNetwork()
return false loadUuid()
loadLocation()
this.initMy()
this.initTels()
}else{ }else{
if(token==''){
this.userTel=''
this.Go('uni:/pages/login/login')
return false
}
this.initMy() this.initMy()
this.initTels() this.initTels()
} }
}, },
...@@ -158,12 +166,20 @@ ...@@ -158,12 +166,20 @@
}, },
onShow(){ onShow(){
const token=uni.getStorageSync('token') const token=uni.getStorageSync('token')
console.log(token,'token') const common = uni.getStorageSync("m-header-device")
if(token==''){ if(!common && plus.os.name!='iOS' && token){
this.userTel='' loadDevice()
this.Go('uni:/pages/login/login') loadNetwork()
return false loadUuid()
loadLocation()
this.initMy()
this.initTels()
}else{ }else{
if(token==''){
this.userTel=''
this.Go('uni:/pages/login/login')
return false
}
this.initMy() this.initMy()
this.initTels() this.initTels()
} }
......
.single-pages{ .single-pages{
width: 100%; width: 100%;
height: 100vh; height: 100vh;
min-height: 1634rpx; min-height: 100vh;
background: #F7FAFF; background: #F7FAFF;
.single-header{ .single-header{
padding:15rpx 0 15rpx 30rpx; padding:15rpx 0 15rpx 30rpx;
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
line-height: 33rpx; line-height: 33rpx;
} }
.single-boxs{ .single-boxs{
margin-bottom:220rpx; padding-bottom:90rpx;
.single-main{ .single-main{
margin: 0 30rpx; margin: 0 30rpx;
height: 120rpx; height: 120rpx;
......
This diff is collapsed.
This diff is collapsed.
/*
* URL分为3中类型
* 1. 以uni://开头的地址是uni-app原生的页面
* 2. 以http或者https开头的地址是H5
* 3. 跳转到其它APP的地址
* */
import { convertPromise } from '../utils/header.js'
import Permission from '../js_sdk/wa-permission/permission.js'
import { SelectLocation } from "../utils/authPerission.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()
}
}
});
})
}
// 获取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('获取网络信息失败')
})
}
// 获取common当中的网络信息
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));
}
});
}
// 获取common当中的网络信息
export const loadLocation=function() {
const that = this;
// 苹果测试手机如果没有插入手机卡,获取定位之后会解析失败,报错
SelectLocation(() => {
convertPromise('getLocation', {
type: 'wgs84',
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() {
console.log('m-location-info存储成功');
}
});
}).catch(err => {
console.log(err, '错误了')
// that.toast('获取位置信息失败')
})
})
}
export default {
loadDevice,
loadNetwork,
loadUuid,
loadLocation
}
...@@ -33,24 +33,6 @@ export const initHeaderInfo = function (){ ...@@ -33,24 +33,6 @@ export const initHeaderInfo = function (){
} }
// 初始化请求头的device参数信息 // 初始化请求头的device参数信息
export const initHeaderDevice = function () { export const initHeaderDevice = function () {
const common = {
appName: 'DDH',
appSourceId: "1",
token: "c695fa285b9dc46a", // 设备令牌(device_token) 设备udid
device:'',//设备是安卓还是ios
appVersion:'',//版本号
idfa: "", // IOS设备则为:IDFA 广告标识
imei: "", //安卓设备为:imei
mac: "", // mac
wifiMac: "", // wifimac
clientIp: "",
carrierOperator: 'OperatorName', //运营商
pushType: "1", //设备push接入类型(1. 小米PUSH,2. 极光PUSH)
electricQuantity: "", //电量
totalStorage: "", //存储总空间
availableStorage: "" //可用存储空间
};
console.log(common,'common')
const deviceInfo = uni.getStorageSync('m-device-info') const deviceInfo = uni.getStorageSync('m-device-info')
const networkInfo = uni.getStorageSync('m-network-info') const networkInfo = uni.getStorageSync('m-network-info')
const locationInfo = uni.getStorageSync('m-location-info') const locationInfo = uni.getStorageSync('m-location-info')
...@@ -58,27 +40,26 @@ export const initHeaderDevice = function () { ...@@ -58,27 +40,26 @@ export const initHeaderDevice = function () {
let device = {}; let device = {};
if (deviceInfo) { if (deviceInfo) {
device = Object.assign(device, common, JSON.parse(deviceInfo)) device = Object.assign(device, JSON.parse(deviceInfo))
} }
if (networkInfo) { if (networkInfo) {
device = Object.assign(device, common, JSON.parse(networkInfo)) device = Object.assign(device, JSON.parse(networkInfo))
} }
if (locationInfo) { if (locationInfo) {
device = Object.assign(device, common, JSON.parse(locationInfo)) device = Object.assign(device, JSON.parse(locationInfo))
} }
if(loadUuid){ if(loadUuid){
device = Object.assign(device, common, JSON.parse(loadUuid)) device = Object.assign(device, JSON.parse(loadUuid))
} }
if (deviceInfo && networkInfo && loadUuid) { if (deviceInfo && networkInfo && locationInfo && loadUuid) {
const headerDeviceInfo = { let headerDeviceInfo = {
...JSON.parse(deviceInfo), ...JSON.parse(deviceInfo),
...JSON.parse(networkInfo), ...JSON.parse(networkInfo),
...JSON.parse(locationInfo),
...JSON.parse(loadUuid), ...JSON.parse(loadUuid),
...common
} }
// 存储所有请求的头部信息 // 存储所有请求的头部信息
uni.setStorage({ uni.setStorage({
key: 'm-header-device', key: 'm-header-device',
......
import {initHeaderDevice} from './header.js' import {initHeaderDevice,initHeaderInfo} from './header.js'
import api from '../config/api.js' import api from '../config/api.js'
const request=async(url,type,data)=>{ const request=async(url,type,data)=>{
// const baseUrl='http://portal.cloudsmake.cn' //测试
// const baseUrl='https://api.yyhock.com'//线上
const baseUrl=api.baseUrl const baseUrl=api.baseUrl
// 这里确保一定是可以获取得到的 // 这里确保一定是可以获取得到的
console.log(baseUrl,'rd3333')
const headerDevice = uni.getStorageSync('m-header-device') const headerDevice = uni.getStorageSync('m-header-device')
let rd = null; const versionNew=uni.getStorageSync('version')
if (headerDevice) { // 根据当前时间戳生成一个随机整数
rd = headerDevice var randomNum = new Date().getTime();
} else { let rd
const common = initHeaderDevice() const tokenF=uni.getStorageSync('tokenFinance')
if(tokenF=='' && plus.os.name!='iOS'){
rd = JSON.stringify(common) rd=initHeaderInfo()
}else{
if (headerDevice) {
rd = headerDevice
}else{
const common = initHeaderDevice()
rd = JSON.stringify(common)
// console.log(rd,'rd3333')
}
} }
return new Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{
const token=uni.getStorageSync('token') const token=uni.getStorageSync('token')
const tokenFinance=uni.getStorageSync('tokenFinance') const tokenFinance=uni.getStorageSync('tokenFinance')
console.log(token,'token')
console.log(tokenFinance,'tokenFinance')
uni.request({ uni.request({
url: baseUrl+url, url: baseUrl+url,
method:type, method:type,
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
* 3. 跳转到其它APP的地址 * 3. 跳转到其它APP的地址
* */ * */
export const Jump = function (url, type='navigate') { export const Jump = function (url, type='navigate') {
console.log(url,type,'路径1') console.log(url,type,'路径1')
if (!url) return; if (!url) return;
...@@ -58,6 +57,8 @@ export const Jump = function (url, type='navigate') { ...@@ -58,6 +57,8 @@ export const Jump = function (url, type='navigate') {
} }
export default { export default {
Jump Jump,
} }
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