中心页面分为4个文件,详情说明如下:
1、user.js 接口数据交互
var app = getApp();
Page({
data: {
uInfo: '',
dataNum: 0
},
onLoad: function (options) {
app.pageConfig(this);
app.util.footer(this);
var userInfo = wx.getStorageSync('userInfo');
if (userInfo.openid) {
this.setData({
userInfo: userInfo.wxInfo,
openid: userInfo.openid
})
this.getUserInfo(userInfo.openid)
}
// console.log(userInfo)
},
onShow: function () {
},
getInfo:function(){
var openid = this.data.openid;
if(openid == undefined){
wx.showToast({
title: '请先登录',
icon: 'loading',
duration: 1500
})
}else{
wx.navigateTo({
url: 'shopList?op=' + this.data.openid
})
}
},
//关闭登录框
close_login: function () {
var that = this;
that.onLo