代码拉取完成,页面将自动刷新
同步操作将从 羲云科技/小潴微服微帮便民平台 微信小程序 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
App({
onLaunch: function () {
var that=this;
this.globalData.view=[];//浏览
this.globalData.view.push({ac:'load',time:(new Date()).getTime()});
wx.showShareMenu({withShareTicket: true,menus: ['shareAppMessage', 'shareTimeline']})
var sys_info=wx.getStorageSync('sys_info');
console.log('数据',sys_info)
if(sys_info){
var d = JSON.parse (sys_info);
for(var i in d){
that.globalData[i]=d[i];
}
console.log('读取缓存',d);
}else{
wx.getSystemInfo({
success: (res) => {console.log(res)
var data={}
if(res.system.indexOf('iOS')!=-1){that.globalData.os='IOS';data.os='IOS';}else{ that.globalData.os='AN';data.os='AN';}//系统
that.globalData.nav_top = res.statusBarHeight;
data.nav_top=res.statusBarHeight;;
if(!res.safeArea.top){res.safeArea.top=44;}
that.globalData.safe_top=res.safeArea.top;
data.safe_top=res.safeArea.top;
that.globalData.safe_bottom=res.screenHeight-res.safeArea.bottom-20;
data.safe_bottom=res.screenHeight-res.safeArea.bottom-20;
var user_session=data.os+Math.ceil((new Date).getTime()/1000);
data.user_session=user_session;
that.globalData.user_session=user_session;
try {
// wx.setStorage({key:'sys_info',data:JSON.stringify(data)})
wx.setStorageSync('sys_info', JSON.stringify(data))
} catch (e) { }
}
});
}
//地区
var area=wx.getStorageSync('area');
if(!area){area=''}
console.log('所在城市'+area)
that.globalData.area=area;
var region=wx.getStorageSync('region');
if(!region){region=[]}
console.log('区域'+region)
that.globalData.region=region;
//登录信息
var val = wx.getStorageSync('login_info');
if (val) {
var d = JSON.parse(val);
that.globalData.user_id = d.user_id;
that.globalData.session = d.session;
that.globalData.user_info = d;
}
var val = wx.getStorageSync('adm_login');//管理员登录
if (val) {
var d = JSON.parse(val);
that.globalData.adm_id = d.id;
that.globalData.adm_session = d.session;
}
var user_session=wx.getStorageSync('user_session');
if(!user_session){
user_session=Math.ceil((new Date).getTime()/1000);
try {
wx.setStorageSync('user_session', user_session)
} catch (e) { }
}
this.globalData.user_session=user_session;
},
//全局信息
globalData: {
server:"https://www.zjhn.top/project/pig/",//测试服务器
map_key:"",//腾讯地图API
web:"小潴微服",
website:"https://www.zjhn.top/project/pig/",
sign:''
},
//消息提示
msg:function(t){wx.showToast({ title: t,icon: 'none',duration: 2000 });},
err: function (t) {console.log('消息');
wx.showModal({title: '提示',content: t,})
},onError:function(res){
var app=this.globalData.app;
if(!app){return;}
console.log('应用',app)
if(app.debug!=1){return;}
wx.showModal({title: '错误提示',content:res,});
//是否提交错误
wx.request({
url: this.globalData.server+'server.php',
header:{'content-type':'application/x-www-form-urlencoded'},
method:'POST',
enableHttp2:true,
data:{
ac:'send_err',
adm:this.globalData.adm,
app_id:this.globalData.app_id,
version:this.globalData.version?this.globalData.version:'',
val:res
},success(res){
}
})
},onHide(){//应用关闭时候推送信息
//var app=this.globalData.app;
if(!this.globalData.view){return;}
//if(!app){return;}
//console.log('应用',app)
var that=this;
console.log(this.globalData.view)
wx.request({
url: this.globalData.server+'ac.php',
header:{'content-type':'application/x-www-form-urlencoded'},
method:'POST',
enableHttp2:true,
data:{
ac:'app_view',
user_id:this.globalData.user_id?this.globalData.user_id:0,
session:this.globalData.session?this.globalData.session:'',
user_session:this.globalData.user_session?this.globalData.user_session:'',
data:JSON.stringify(this.globalData.view),
area:this.globalData.area?this.globalData.area:'',
},success(res){
that.globalData.view=[];
console.log(res)
}
})
}
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。