1 Star 0 Fork 0

liukang824/群接龙

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 4.68 KB
一键复制 编辑 原始数据 按行查看 历史
刘继峰 提交于 2021-08-13 16:56 . no commit message
// 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 () {
// 新版本下载失败
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kangshaoye/qunjielong.git
git@gitee.com:kangshaoye/qunjielong.git
kangshaoye
qunjielong
群接龙
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385