|
- // pages/index/index.js
- const Http = require("../../utils/HttpBasics");
- const config = require("../../config/config.js");
- let app = getApp();
- Page({
-
- /**
- * 跳转到其他小程序
- * 接受唯一参数 appId
- * */
- goPlaza(event) {
- let appid = event.currentTarget.dataset.appid
- wx.navigateToMiniProgram({
- appId: appid,
- success(res) {
- // 打开成功
- }
- })
- },
-
- /**
- * banner
- */
- getBannerlist: function () {
- // Http.setToken(app.globalData.token);
- let that = this;
- Http.get({
- url: config.api.bannerlist,
- data: {
- pageNum: 1,
- pageSize: 7
- }
-
- }).then(res => {
- // that.getmemberId(app.globalData.token);
- // that.checkUserCarStatus();
- that.setData({
- list: res.data.list
- });
- })
- .catch(err => {
- // that.getmemberId(app.globalData.token);
- // that.checkUserCarStatus();
- });
- },
-
- /**
- * 页面的初始数据
- */
- data: {
- list: [],
- subMalls: [],
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- if (app.globalData.token) {
- this.getBannerlist()
- this.gitSquareLis()
- } else {
- app.tokenCallback = token => {
- this.getBannerlist()
- this.gitSquareLis()
- }
- }
-
-
- },
-
- /*
- 获取集团下面的广场
- */
- gitSquareLis(){
-
- const tempData = wx.getStorageSync("subMalls");
- console.log(wx.getStorageSync("subMalls"))
- this.setData({
- subMalls: tempData
- })
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- //测试发送请求
- // this.getInfo();
-
- },
- //获取用户信息
- getInfo() {
- Http.post({
- url: config.api.login,
- data: {
-
- }
- }).then(res => {
- console.log(res)
- })
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
- }
- })
|