代码拉取完成,页面将自动刷新
// app.js
var QQMapWX = require('/utils/qqmap-wx-jssdk.min.js');
App({
onLaunch: function () {
var that = this;
//1.2实例化腾讯地图API核心类
that.globalData.qqmapsdk = new QQMapWX({
key: 'PFEBZ-XQTKW-775RR-RLWA3-ID2H5-IKBQO'
});
//1.3wx.getLocation方法获取当前位置坐标。
wx.getLocation({
altitude:false,
success: function (res) {
var latitude = res.latitude;
var longitude = res.longitude;
that.globalData.location={
latitude: latitude,
longitude: longitude
}
}
});
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
this.globalData.sysinfo = wx.getSystemInfoSync()
var that = this;
var that = this;
wx.getSystemInfo({
success: function (res) {
that.globalData.statusBarHeight = res.statusBarHeight*1+46*1
that.globalData.statusBarHeight1 = res.statusBarHeight
//////console.log(res.statusBarHeight, 'statusBarHeight')
}
})
//获取用户本地是否是第一次进入新版本
var versions = wx.getStorageSync('versions');
////////console.log('versions:' + versions);
//判断是不是需要授权
if (versions == '1'){
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: function (res) {
that.globalData.userInfo = res.userInfo
////////console.log(that.globalData.userInfo)
},
fail: function () {
// wx.redirectTo({
// url: '../wurui_house/pages/login/index',
// })
}
})
}else{
//未授权, 跳转登录页面
// wx.redirectTo({
// url: '../wurui_house/pages/login/index',
// })
}
// 获取顶部栏信息
wx.getSystemInfo({
success: res => {
//导航高度
this.globalData.navHeight = res.statusBarHeight + 46;
}, fail(err) {
//console.log(err);
}
})
},
globalData: {
uid:1,
rid:1,
url_l: 'https://jielonggongju.cn/api/',
screenWidth:wx.getSystemInfoSync().screenWidth,
screenHeight:wx.getSystemInfoSync().screenHeight,
gb:0,
dizhi:1,
dz_xq:"",
gg_sz:'',
tem_id:"",
mb_img:"",
key:"",
pt_sz:"",
px_id:"",
attribute_1:"",
attribute_2:"",
wb_nr:"",
ck_id:"",
jieti_str:"",
jieti_num:"",
itemList1:"",
itemList:"",
cp_id:[],
rule_str:"",
dz_id:"",
cx_id:"",
wuliu:"",
tg_name:"",
},
wxRequest(method, url, data, callback, errFun) {
wx.request({
url: url,
method: method,
data: data,
header: {
'content-type': method == 'GET'?'application/json':'application/x-www-form-urlencoded',
'Accept': 'application/json'
},
dataType: 'json',
success: function (res) {
callback(res.data);
},
fail: function (err) {
errFun(res);
}
})
},
getModel: function () { //获取手机型号
return this.globalData.sysinfo["model"]
},
getVersion: function () { //获取微信版本号
return this.globalData.sysinfo["version"]
},
getSystem: function () { //获取操作系统版本
return this.globalData.sysinfo["system"]
},
getPlatform: function () { //获取客户端平台
return this.globalData.sysinfo["platform"]
},
getSDKVersion: function () { //获取客户端基础库版本
return this.globalData.sysinfo["SDKVersion"]
},
BLEInformation:{
platform: "",
deviceId:"",
writeCharaterId: "",
writeServiceId: "",
notifyCharaterId: "",
notifyServiceId: "",
readCharaterId: "",
readServiceId: "",
},
getLocationInfo: function (cb) {
var that = this;
if (this.globalData.locationInfo) {
cb(this.globalData.locationInfo)
} else {
wx.getLocation({
type: 'gcj02', // 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
success: function (res) {
that.globalData.locationInfo = res;
cb(that.globalData.locationInfo)
},
fail: function () {
// fail
},
complete: function () {
// complete
}
})
}
},
util: require('utils/util.js'),
})
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
})
updateManager.onUpdateReady(function () {
updateManager.applyUpdate()
})
updateManager.onUpdateFailed(function () {
// 新版本下载失败
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。